:root {
  --bg: #f6f3ee;
  --surface: #fffdf8;
  --surface-alt: #ebe6dc;
  --ink: #202326;
  --muted: #66706a;
  --line: #d8d1c4;
  --green: #126b57;
  --green-soft: #e3f2ec;
  --amber: #b57b16;
  --amber-soft: #fff2d1;
  --red: #b94332;
  --red-soft: #fae3df;
  --blue: #365f8f;
  --blue-soft: #e1ebf6;
  --radius: 8px;
  --shadow: 0 12px 28px rgba(42, 34, 22, 0.08);
  --font: "Be Vietnam Pro", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(32, 35, 38, 0.035) 1px, transparent 1px) 0 0 / 120px 120px,
    linear-gradient(180deg, #f9f6ef 0%, var(--bg) 48%, #eee8dc 100%);
  font-family: var(--font);
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.2rem;
  border-right: 1px solid var(--line);
  background: #1f2a27;
  color: #f9f5ec;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #d8b36b;
  color: #1f2a27;
  font-weight: 800;
}

.brand-block h1,
.topbar h2,
.panel h3,
.selected-idea span {
  margin: 0;
  letter-spacing: 0;
}

.brand-block h1 {
  font-size: 1.02rem;
  line-height: 1.25;
}

.eyebrow {
  margin: 0 0 0.18rem;
  color: #9e7b31;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: #d8b36b;
}

.side-nav {
  display: grid;
  gap: 0.35rem;
  margin: 1.25rem 0;
}

.side-nav a {
  padding: 0.68rem 0.75rem;
  border-radius: var(--radius);
  color: rgba(249, 245, 236, 0.86);
  font-weight: 700;
}

.side-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.guardrail-box {
  padding: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.guardrail-box ul {
  margin: 0.6rem 0 0;
  padding-left: 1.05rem;
  color: rgba(249, 245, 236, 0.84);
  font-size: 0.9rem;
}

.workspace {
  width: min(1420px, 100%);
  padding: 1.2rem;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.topbar h2 {
  font-size: clamp(1.35rem, 2vw, 2.15rem);
  line-height: 1.2;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
  max-width: 540px;
}

.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.28rem 0.55rem;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.status-ok {
  border-color: #b9d9ce;
  background: var(--green-soft);
  color: var(--green);
}

.status-warn {
  border-color: #efdcae;
  background: var(--amber-soft);
  color: #7b520c;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #253430;
  color: #fffdf8;
  box-shadow: var(--shadow);
}

.auth-copy h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.auth-copy p:last-child,
.auth-message {
  margin: 0.38rem 0 0;
  color: rgba(255, 253, 248, 0.76);
  font-size: 0.88rem;
}

.auth-form {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 0.8fr);
  gap: 0.5rem;
}

.auth-form input {
  min-height: 40px;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.auth-form input::placeholder {
  color: rgba(255, 255, 255, 0.62);
}

.auth-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.auth-message {
  grid-column: 1 / -1;
  min-height: 20px;
}

.auth-message.ok {
  color: #bdebd8;
}

.auth-message.warn {
  color: #ffe0a8;
}

.secondary-muted {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.hidden {
  display: none !important;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.pipeline article,
.panel,
.idea-card,
.schedule-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pipeline article {
  padding: 0.9rem;
}

.pipeline span {
  color: var(--amber);
  font-size: 0.74rem;
  font-weight: 800;
}

.pipeline strong {
  display: block;
  margin-top: 0.12rem;
}

.pipeline p,
.selected-idea p,
.hint,
.risk-list,
.schedule-item p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.content-grid-wide {
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
}

.panel {
  padding: 1rem;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}

.panel h3 {
  font-size: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.field {
  display: grid;
  gap: 0.36rem;
  margin-bottom: 0.78rem;
}

.field span,
.checklist h4 {
  color: #3d433f;
  font-size: 0.82rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfc7b9;
  border-radius: var(--radius);
  background: #fffefa;
  color: var(--ink);
  padding: 0.7rem 0.74rem;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(18, 107, 87, 0.12);
}

.primary-action,
.secondary-action,
.variant-button,
.icon-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 800;
}

.primary-action {
  width: 100%;
  background: var(--green);
  color: #fff;
  padding: 0.72rem 0.9rem;
}

.secondary-action {
  background: #293633;
  color: #fff;
  padding: 0.64rem 0.8rem;
}

.secondary-action:hover,
.primary-action:hover {
  filter: brightness(1.04);
}

.icon-button {
  width: 40px;
  background: var(--surface-alt);
  color: var(--ink);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.metrics-grid article {
  min-height: 90px;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7f1e6;
}

.metrics-grid span {
  display: block;
  color: var(--green);
  font-size: 1.55rem;
  font-weight: 800;
}

.metrics-grid p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.quality-meter {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.meter-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  color: #3d433f;
  font-size: 0.85rem;
  font-weight: 800;
}

.meter-track {
  height: 10px;
  margin: 0.7rem 0;
  border-radius: 999px;
  background: #e6ded0;
  overflow: hidden;
}

.meter-track div {
  width: 0%;
  height: 100%;
  background: var(--green);
  transition: width 0.2s ease;
}

#risk-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.ideas-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.idea-card {
  display: grid;
  gap: 0.55rem;
  min-height: 194px;
  padding: 0.85rem;
  text-align: left;
}

.idea-card:hover,
.idea-card.active {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(18, 107, 87, 0.1);
}

.idea-card h4 {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.35;
}

.idea-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: auto;
}

.tag {
  min-height: 24px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.72rem;
}

.tag.warning {
  background: var(--amber-soft);
  color: #7b520c;
}

.button-group {
  display: flex;
  gap: 0.35rem;
}

.variant-button {
  min-width: 74px;
  border-color: var(--line);
  background: #fffefa;
  color: var(--muted);
}

.variant-button.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.selected-idea {
  min-height: 88px;
  margin-bottom: 0.8rem;
  padding: 0.8rem;
  border: 1px dashed #c5bba9;
  border-radius: var(--radius);
  background: #fbf7ee;
}

.selected-idea span {
  display: block;
  font-weight: 800;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.draft-textarea {
  min-height: 470px;
  line-height: 1.58;
}

.review-result {
  display: grid;
  gap: 0.65rem;
}

.empty-state {
  margin: 0;
  padding: 0.8rem;
  border: 1px dashed #c5bba9;
  border-radius: var(--radius);
  color: var(--muted);
  background: #fbf7ee;
}

.risk-card {
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbf7ee;
}

.risk-card.ok {
  border-color: #b9d9ce;
  background: var(--green-soft);
}

.risk-card.warn {
  border-color: #efdcae;
  background: var(--amber-soft);
}

.risk-card.danger {
  border-color: #edb9b0;
  background: var(--red-soft);
}

.risk-card strong {
  display: block;
  margin-bottom: 0.2rem;
}

.risk-card p,
.risk-card li {
  color: #4d554f;
  font-size: 0.86rem;
}

.risk-card ul {
  margin: 0.45rem 0 0;
  padding-left: 1.05rem;
}

.checklist {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.checklist h4 {
  margin: 0 0 0.7rem;
}

.checklist label {
  display: flex;
  align-items: flex-start;
  gap: 0.48rem;
  margin-bottom: 0.58rem;
  color: #48514b;
  font-size: 0.88rem;
}

.checklist input {
  width: 18px;
  margin-top: 0.12rem;
}

.schedule-form {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(260px, 1fr) minmax(160px, 0.6fr) 180px;
  gap: 0.75rem;
  align-items: end;
}

.schedule-form .field {
  margin-bottom: 0;
}

.schedule-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.schedule-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  padding: 0.85rem;
}

.schedule-item h4 {
  margin: 0;
  font-size: 0.95rem;
}

.schedule-item time {
  display: block;
  margin-top: 0.25rem;
  color: var(--amber);
  font-size: 0.82rem;
  font-weight: 800;
}

.delete-button {
  min-width: 42px;
  height: 36px;
  border: 1px solid #edb9b0;
  border-radius: var(--radius);
  background: var(--red-soft);
  color: var(--red);
  font-weight: 900;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .side-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .guardrail-box {
    display: none;
  }

  .pipeline,
  .ideas-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .workspace,
  .sidebar {
    padding: 0.9rem;
  }

  .topbar,
  .panel-heading {
    flex-direction: column;
  }

  .auth-panel,
  .auth-form {
    grid-template-columns: 1fr;
  }

  .status-strip {
    justify-content: flex-start;
  }

  .content-grid,
  .content-grid-wide,
  .form-grid,
  .schedule-form {
    grid-template-columns: 1fr;
  }

  .side-nav,
  .pipeline,
  .ideas-list,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .draft-textarea {
    min-height: 380px;
  }

  .schedule-item {
    grid-template-columns: 1fr;
  }
}
