:root {
  --ink: #1a1611;
  --paper: #f7f1e3;
  --paper-2: #efe6d0;
  --cream: #fbf6ea;
  --rust: #9a3a12;
  --rust-2: #7a2c0c;
  --teal: #0e5a52;
  --gold: #c9962b;
  --dim: #5a5146;
  --line: #d3cabc;
  --grid: #ece2cc;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--paper);
  font-family: "Inter Tight", sans-serif;
  color: var(--ink);
  display: flex;
  font-size: 15px;
  line-height: 1.5;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }
textarea { resize: vertical; font-family: inherit; }
a { color: var(--rust); text-decoration: none; }

/* ================ SIDEBAR ================ */
.sidebar {
  width: 280px; min-width: 280px;
  background: var(--ink);
  color: var(--cream);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; padding-bottom: 22px; border-bottom: 1px solid rgba(251,246,234,0.12); }
.brand-mark {
  width: 44px; height: 44px;
  background: var(--rust);
  color: var(--cream);
  display: flex; align-items: center; justify-content: center;
  font-family: "Fraunces"; font-size: 22px; font-weight: 700;
  font-style: italic;
  letter-spacing: -0.04em;
}
.brand-name { line-height: 1.15; font-size: 14px; }
.brand-name strong { font-family: "Fraunces"; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.brand-name em { font-family: "Fraunces"; font-style: italic; color: var(--gold); font-size: 12px; }

.biz-switcher { margin-bottom: 22px; }
.side-label { font-family: "JetBrains Mono"; font-size: 10px; text-transform: uppercase; letter-spacing: 0.2em; color: rgba(251,246,234,0.55); margin-bottom: 6px; display: block; }
#businessSelect {
  width: 100%; padding: 10px 12px; background: rgba(251,246,234,0.06);
  border: 1px solid rgba(251,246,234,0.15); color: var(--cream);
  font-family: "Fraunces"; font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
  border-radius: 2px;
}
#businessSelect option { background: var(--ink); color: var(--cream); }

.lanes { display: flex; flex-direction: column; gap: 2px; margin-bottom: auto; }
.lane-link {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 12px 12px;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  color: var(--cream);
}
.lane-link:hover { background: rgba(251,246,234,0.05); }
.lane-link.active {
  background: rgba(154,58,18,0.18);
  border-left-color: var(--rust);
}
.lane-link .num {
  font-family: "JetBrains Mono"; font-size: 11px; font-weight: 700;
  color: var(--gold); letter-spacing: 0.08em;
  padding-top: 2px; min-width: 22px;
}
.lane-link .lane-text { font-size: 14px; line-height: 1.3; }
.lane-link strong { font-family: "Fraunces"; font-weight: 700; font-size: 16px; display: block; letter-spacing: -0.01em; }
.lane-link em { font-style: italic; color: rgba(251,246,234,0.55); font-size: 12px; font-family: "Fraunces"; font-weight: 400; }

.side-footer { padding-top: 18px; border-top: 1px solid rgba(251,246,234,0.12); }
.session-pill {
  font-family: "JetBrains Mono"; font-size: 10px;
  padding: 6px 10px; background: rgba(201,150,43,0.12); color: var(--gold);
  border: 1px solid rgba(201,150,43,0.25);
  letter-spacing: 0.05em; margin-bottom: 12px;
  text-transform: uppercase;
}
.session-pill.has-session { background: rgba(14,90,82,0.2); color: #5fc8b9; border-color: rgba(14,90,82,0.4); }
.sig { font-family: "JetBrains Mono"; font-size: 10px; color: rgba(251,246,234,0.4); letter-spacing: 0.1em; line-height: 1.6; }

/* ================ STAGE ================ */
.stage {
  flex: 1; padding: 40px 56px 80px;
  max-width: 1280px;
  overflow-x: hidden;
}
.lane.hidden { display: none; }

.lane-head { margin-bottom: 36px; padding-bottom: 22px; border-bottom: 1.5px solid var(--ink); }
.kicker {
  font-family: "JetBrains Mono"; font-size: 11px; color: var(--rust);
  letter-spacing: 0.25em; text-transform: uppercase; font-weight: 700;
  margin-bottom: 14px;
  display: inline-flex; align-items: center; gap: 10px;
}
.kicker::before { content: ""; width: 32px; height: 1.5px; background: var(--rust); }
.lane-head h1 {
  font-family: "Fraunces"; font-weight: 400; font-size: 44px;
  letter-spacing: -0.03em; line-height: 1.05;
  max-width: 880px;
}
.lane-head h1 em { font-style: italic; color: var(--rust); font-weight: 400; }
.lede {
  margin-top: 14px; font-size: 16px; color: var(--dim);
  max-width: 720px; line-height: 1.55;
}

/* ================ FORM PRIMITIVES ================ */
label {
  display: block;
  font-family: "JetBrains Mono"; font-size: 11px;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--dim);
  margin-top: 16px; margin-bottom: 6px;
  font-weight: 500;
}
input[type="text"], input[type="number"], select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 2px;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--rust);
  box-shadow: 0 0 0 2px rgba(154,58,18,0.12);
}

button.primary, button.ghost {
  padding: 11px 22px; border-radius: 2px;
  font-family: "JetBrains Mono"; font-size: 12px; font-weight: 700;
  letter-spacing: 0.15em; text-transform: uppercase;
  transition: all 0.15s;
}
button.primary {
  background: var(--ink); color: var(--cream); border: 1px solid var(--ink);
}
button.primary:hover { background: var(--rust); border-color: var(--rust); }
button.ghost {
  background: transparent; color: var(--ink); border: 1px solid var(--ink);
}
button.ghost:hover { background: var(--ink); color: var(--cream); }
button.small { padding: 7px 14px; font-size: 11px; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ================ LANE 01 · ONBOARD ================ */
.lane-body {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px;
}

.form-card {
  background: var(--cream); padding: 28px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--rust);
}

.form-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}

.derived-panel {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
  margin-top: 22px; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line);
  padding: 14px 0;
}
.derived-cell { padding: 0 14px; border-right: 1px dashed var(--line); }
.derived-cell:first-child { padding-left: 0; }
.derived-cell:last-child { border-right: none; }
.derived-label { font-family: "JetBrains Mono"; font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--dim); margin-bottom: 4px; }
.derived-value { font-family: "Fraunces"; font-size: 22px; font-weight: 700; color: var(--rust); letter-spacing: -0.02em; }

.form-card .primary { margin-top: 22px; width: 100%; }

.sessions-panel { background: white; padding: 22px; border: 1px solid var(--line); }
.sessions-panel h3 { font-family: "Fraunces"; font-weight: 700; font-size: 20px; letter-spacing: -0.02em; margin-bottom: 14px; }
.sessions-list { display: flex; flex-direction: column; gap: 8px; }
.session-item {
  padding: 12px 14px; border: 1px solid var(--line); background: var(--cream);
  cursor: pointer; transition: all 0.15s;
}
.session-item:hover { border-color: var(--rust); }
.session-item.active { border-left: 3px solid var(--rust); background: #fdf0e5; }
.session-item .q { font-family: "JetBrains Mono"; font-size: 11px; color: var(--rust); font-weight: 700; letter-spacing: 0.1em; }
.session-item .g { font-family: "Fraunces"; font-size: 15px; margin-top: 3px; line-height: 1.3; }
.session-item .meta { font-family: "JetBrains Mono"; font-size: 10px; color: var(--dim); margin-top: 5px; letter-spacing: 0.05em; }
.sessions-list .empty { color: var(--dim); font-style: italic; padding: 16px 0; font-family: "Fraunces"; font-size: 14px; }

/* ================ LANE 02 · LISTEN ================ */
.listen-week {
  display: flex; align-items: center; gap: 14px; margin-bottom: 24px;
  padding: 14px 18px; background: var(--cream); border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
}
.listen-week label { margin: 0; }
.listen-week input { width: 80px; }
.listen-week .save-status { font-family: "JetBrains Mono"; font-size: 11px; color: var(--teal); letter-spacing: 0.1em; margin-left: auto; }

.listen-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}

.listen-station {
  background: white; padding: 24px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--rust);
}
.station-head {
  display: flex; align-items: baseline; gap: 10px;
  border-bottom: 1px dashed var(--line); padding-bottom: 10px; margin-bottom: 12px;
}
.t-num {
  font-family: "JetBrains Mono"; font-size: 10px; font-weight: 700;
  color: var(--rust); letter-spacing: 0.15em;
  background: rgba(154,58,18,0.08); padding: 3px 6px;
}
.station-head h3 {
  font-family: "Fraunces"; font-weight: 700; font-size: 22px; letter-spacing: -0.02em;
  flex: 1; line-height: 1;
}
.station-head h3 em { font-style: italic; color: var(--rust); font-weight: 400; }
.tool-link {
  font-family: "JetBrains Mono"; font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--teal); font-weight: 700;
}
.station-question {
  font-family: "Fraunces"; font-style: italic; font-size: 14px; color: var(--dim);
  margin-bottom: 6px; line-height: 1.35;
  border-left: 2px solid var(--line); padding-left: 10px;
}

/* KW Table */
.kw-table-wrap { margin-top: 10px; max-height: 280px; overflow-y: auto; }
.kw-table { width: 100%; border-collapse: collapse; }
.kw-table th {
  font-family: "JetBrains Mono"; font-size: 9px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--dim); font-weight: 500; text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line);
}
.kw-table th:nth-child(2), .kw-table th:nth-child(3) { text-align: right; }
.kw-table td { padding: 3px; }
.kw-table td input, .kw-table td select {
  width: 100%; padding: 4px 6px; font-size: 12px; border: 1px solid transparent; background: var(--cream);
}
.kw-table td input:focus, .kw-table td select:focus { border-color: var(--line); background: white; }
.kw-table td button {
  background: transparent; border: none; color: var(--dim); cursor: pointer;
  font-size: 14px; padding: 2px 6px;
}
.kw-table td button:hover { color: var(--rust); }

/* Ad Tally */
.ad-tally { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.competitor-block {
  border: 1px solid var(--line); background: var(--cream); padding: 12px;
}
.competitor-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.competitor-head input { flex: 1; font-family: "Fraunces"; font-weight: 700; font-size: 15px; }
.competitor-head .remove { background: transparent; border: none; color: var(--dim); cursor: pointer; font-size: 16px; }
.ad-row {
  display: grid; grid-template-columns: 1.2fr 1.2fr 1.2fr 0.9fr 0.6fr 28px;
  gap: 4px; padding: 3px 0;
}
.ad-row input, .ad-row select {
  padding: 4px 6px; font-size: 11px; border: 1px solid transparent; background: white;
}
.ad-row input:focus, .ad-row select:focus { border-color: var(--line); }
.ad-row .row-head { font-family: "JetBrains Mono"; font-size: 9px; text-transform: uppercase; color: var(--dim); letter-spacing: 0.08em; padding: 0 6px; }
.ad-row button { background: transparent; border: none; color: var(--dim); cursor: pointer; }

/* ================ LANE 03 · WHITESPACE ================ */
.ws-add {
  display: flex; gap: 12px; margin-bottom: 24px;
  padding: 16px; background: var(--cream); border: 1px solid var(--line);
}
.ws-add input { flex: 1; }

.ws-split {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px;
}

.ws-list { display: flex; flex-direction: column; gap: 12px; }
.angle-card {
  background: white; border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  padding: 16px 18px;
  transition: all 0.15s;
}
.angle-card.winner { border-left-color: var(--gold); background: #fff9e8; border: 2px solid var(--gold); border-left-width: 4px;}
.angle-card.hot { border-left-color: var(--rust); }
.angle-card.ok { border-left-color: var(--teal); }
.angle-card.cold { border-left-color: var(--dim); opacity: 0.75; }

.angle-text { font-family: "Fraunces"; font-size: 17px; font-weight: 700; margin-bottom: 10px; letter-spacing: -0.015em; line-height: 1.3;}
.angle-scores { display: flex; align-items: center; gap: 18px; margin-bottom: 8px; }
.score-group { display: flex; align-items: center; gap: 6px; }
.score-group label { margin: 0; font-size: 10px; }
.score-group select { width: 68px; padding: 4px 6px; font-size: 13px; }
.angle-result {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
}
.angle-result .score-big {
  font-family: "Fraunces"; font-weight: 800; font-size: 26px; letter-spacing: -0.03em;
  color: var(--rust); line-height: 1;
}
.angle-actions { display: flex; gap: 8px; margin-top: 4px; }
.angle-actions button {
  background: transparent; border: 1px solid var(--line); padding: 5px 10px;
  font-family: "JetBrains Mono"; font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; cursor: pointer; color: var(--ink);
}
.angle-actions button:hover { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.angle-actions button.win { border-color: var(--gold); color: var(--gold); }
.angle-actions button.win:hover { background: var(--gold); color: white; }
.angle-actions button.rm:hover { background: var(--rust); border-color: var(--rust); }

/* Matrix */
.ws-matrix { background: var(--cream); padding: 20px; border: 1px solid var(--line); height: fit-content; position: sticky; top: 20px; }
.ws-matrix h4 { font-family: "Fraunces"; font-weight: 700; font-size: 18px; margin-bottom: 14px; letter-spacing: -0.02em; }
.matrix-wrap { position: relative; padding-left: 34px; padding-bottom: 26px; }
.matrix-ylabel {
  position: absolute; left: 0; top: 50%; transform: rotate(-90deg) translateX(50%); transform-origin: left top;
  font-family: "JetBrains Mono"; font-size: 10px; text-transform: uppercase; letter-spacing: 0.15em;
  color: var(--dim); white-space: nowrap;
}
.matrix-xlabel {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  font-family: "JetBrains Mono"; font-size: 10px; text-transform: uppercase; letter-spacing: 0.15em;
  color: var(--dim);
}
.matrix-grid {
  position: relative; width: 100%; aspect-ratio: 1;
  background:
    linear-gradient(to right, var(--grid) 1px, transparent 1px) 0 0 / 20% 20%,
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px) 0 0 / 20% 20%;
  background-color: white;
  border: 1.5px solid var(--ink);
}
.matrix-dot {
  position: absolute;
  width: 34px; height: 34px;
  transform: translate(-50%, 50%);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: "Fraunces"; font-size: 13px; font-weight: 800;
  color: white;
  cursor: default;
  transition: transform 0.15s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.matrix-dot:hover { transform: translate(-50%, 50%) scale(1.15); z-index: 5; }
.matrix-dot.winner { background: var(--gold); box-shadow: 0 0 0 3px white, 0 0 0 5px var(--gold); }
.matrix-dot.hot { background: var(--rust); }
.matrix-dot.ok { background: var(--teal); }
.matrix-dot.cold { background: var(--dim); }
.matrix-tooltip {
  position: absolute; background: var(--ink); color: var(--cream);
  padding: 6px 10px; font-size: 12px; font-family: "Inter Tight";
  border-radius: 2px; pointer-events: none; opacity: 0; transition: opacity 0.15s;
  max-width: 200px; z-index: 10;
}
.matrix-dot:hover + .matrix-tooltip { opacity: 1; }

.matrix-legend {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px;
  padding-top: 14px; border-top: 1px dashed var(--line);
}
.chip {
  font-family: "JetBrains Mono"; font-size: 9px; letter-spacing: 0.1em;
  padding: 4px 8px; border-radius: 2px; text-transform: uppercase; font-weight: 700;
}
.chip-win { background: var(--gold); color: white; }
.chip-hot { background: var(--rust); color: white; }
.chip-ok { background: var(--teal); color: white; }
.chip-cold { background: var(--dim); color: white; }

.empty-angles { padding: 30px; text-align: center; color: var(--dim); font-family: "Fraunces"; font-style: italic; border: 1px dashed var(--line); background: var(--cream); }

/* ================ LANE 04 · CAMPAIGN ================ */
.brief-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  background: var(--cream); padding: 28px; border: 1px solid var(--line); border-top: 3px solid var(--rust);
}
.brief-field.full { grid-column: span 2; }
.brief-field label {
  display: flex; align-items: center; gap: 8px;
  margin-top: 0; margin-bottom: 6px;
}
.brief-field .fnum {
  font-family: "Fraunces"; font-style: italic; font-size: 13px; color: var(--rust);
  font-weight: 700; letter-spacing: 0; text-transform: none;
}
.brief-actions { grid-column: span 2; display: flex; gap: 12px; margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--line); }

@media print {
  body { background: white; }
  .sidebar, .lane-head .kicker, .lede, .brief-actions { display: none; }
  .lane:not(#lane-campaign) { display: none; }
  .stage { padding: 0; max-width: 100%; }
  .brief-grid { border: 1px solid #333; border-top: 3px solid #333; padding: 20px; }
  @page { size: A4; margin: 15mm; }
}

/* ================ LANE 05 · DASHBOARD ================ */
.dash-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.dash-card {
  background: white; border: 1px solid var(--line); padding: 20px;
  border-top: 3px solid var(--teal);
}
.dash-card.big { grid-column: span 2; border-top-color: var(--rust); }
.dash-card.wide { grid-column: span 4; border-top-color: var(--gold); }
.dash-label { font-family: "JetBrains Mono"; font-size: 10px; color: var(--dim); letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 8px; }
.dash-big { font-family: "Fraunces"; font-size: 36px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; margin-bottom: 6px; }
.dash-big em { font-style: italic; color: var(--rust); }
.dash-sub { font-size: 12px; color: var(--dim); font-style: italic; }
.adapt-list { list-style: none; margin-top: 6px; }
.adapt-list li { padding: 8px 0 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; line-height: 1.45; }
.adapt-list li:last-child { border-bottom: none; }
.adapt-list strong { color: var(--rust); }
.adapt-list em { color: var(--dim); font-style: italic; font-family: "JetBrains Mono"; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }

/* ================ RESPONSIVE ================ */
@media (max-width: 900px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; min-width: 0; height: auto; position: static; }
  .stage { padding: 24px; }
  .lane-head h1 { font-size: 32px; }
  .lane-body, .ws-split, .listen-grid, .brief-grid { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-card.big, .dash-card.wide { grid-column: span 1; }
}
