:root {
  --wb-sidebar: 248px;
  --wb-topbar: 64px;
  --wb-line: #D9E0E6;
  --wb-soft: #F4F6F7;
  --wb-paper: #FBFBFA;
  --wb-success: #18735F;
  --wb-warn: #986B22;
  --wb-danger: #A44747;
}

.workbench-page { background: var(--wb-soft); overflow-x: hidden; }
.workbench-page > [data-nav] { display: none; }
.wb-shell { min-height: 100vh; display: grid; grid-template-columns: var(--wb-sidebar) minmax(0, 1fr); }

.wb-sidebar {
  position: sticky; top: 0; z-index: 20; height: 100vh; display: flex; flex-direction: column;
  color: #fff; background: var(--navy); border-right: 1px solid rgba(255,255,255,.08);
}
.wb-product-mark { height: 78px; display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid rgba(255,255,255,.1); }
.wb-product-mark > span { width: 29px; height: 29px; border: 2px solid var(--teal-glow); border-top-width: 7px; border-bottom-width: 7px; transform: skewY(-12deg); }
.wb-product-mark div { display: flex; flex-direction: column; }
.wb-product-mark strong { font-size: 15px; letter-spacing: -.01em; }
.wb-product-mark small { color: var(--on-navy-2); font-size: 10px; letter-spacing: .03em; }
.wb-nav-label { padding: 22px 20px 8px; color: var(--on-navy-3); font-size: 9px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.wb-module-nav { display: grid; padding: 0 10px; gap: 3px; }
.wb-module-nav button {
  position: relative; min-height: 58px; display: grid; grid-template-columns: 37px 1fr; gap: 9px; align-items: center;
  padding: 8px 10px; color: var(--on-navy-2); background: transparent; border: 0; border-radius: 4px;
  font: inherit; text-align: left; cursor: pointer; transition-property: color, background-color; transition-duration: .15s;
}
.wb-module-nav button:hover { color: #fff; background: rgba(255,255,255,.055); }
.wb-module-nav button.active { color: #fff; background: rgba(95,183,164,.13); }
.wb-module-nav button.active::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 2px; background: var(--teal-glow); }
.wb-module-nav button > span { color: var(--teal-glow); font-size: 9px; font-weight: 700; letter-spacing: .08em; }
.wb-module-nav button div { display: flex; flex-direction: column; }
.wb-module-nav button strong { font-size: 13px; line-height: 1.25; }
.wb-module-nav button small { color: var(--on-navy-3); font-size: 9.5px; line-height: 1.3; }
.wb-sidebar-foot { margin-top: auto; padding: 18px 20px 22px; border-top: 1px solid rgba(255,255,255,.1); }
.wb-sidebar-foot strong { color: var(--teal-glow); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.wb-sidebar-foot p { margin: 8px 0 12px; color: var(--on-navy-2); font-size: 10.5px; line-height: 1.45; }
.wb-sidebar-foot a { color: #fff; font-size: 11px; font-weight: 700; }

.wb-main { min-width: 0; }
.wb-topbar {
  position: sticky; top: 0; z-index: 15; height: var(--wb-topbar); display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--wb-line); backdrop-filter: blur(12px);
}
.wb-topbar > div:first-of-type { display: grid; grid-template-columns: 10px auto; column-gap: 9px; align-items: center; }
.wb-state-dot { grid-row: 1 / 3; width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px rgba(26,107,90,.1); }
.wb-topbar strong { color: var(--navy); font-size: 12px; line-height: 1.2; }
.wb-topbar small { color: var(--muted); font-size: 9.5px; line-height: 1.2; }
.wb-top-actions { display: flex; gap: 7px; }
.wb-action {
  min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0 14px;
  color: var(--navy); background: #fff; border: 1px solid var(--border-2); border-radius: 3px;
  font: 700 12px/1 var(--font); cursor: pointer;
  transition-property: transform, color, background-color, border-color, box-shadow; transition-duration: .15s; transition-timing-function: var(--ease);
}
.wb-action:hover { color: var(--teal); border-color: var(--teal); }
.wb-action:active { transform: translateY(1px) scale(.98); }
.wb-action.primary { color: #fff; background: var(--teal); border-color: var(--teal); }
.wb-action.primary:hover { background: var(--teal-700); }
.wb-action:focus-visible, .wb-module-nav button:focus-visible, .wb-mobile-toggle:focus-visible { outline: 3px solid rgba(26,107,90,.25); outline-offset: 2px; }
.wb-mobile-toggle { display: none; }

.wb-notice { padding: 10px 26px; color: var(--ink-2); background: #F4EFE4; border-bottom: 1px solid #E2D6BE; font-size: 11px; line-height: 1.45; }
.wb-notice strong { color: #6C4D18; }
.wb-panel { display: none; padding: 34px 30px 56px; }
.wb-panel.active { display: block; }
.wb-panel-head { max-width: 1420px; display: flex; justify-content: space-between; gap: 40px; margin: 0 auto 26px; }
.wb-panel-head h1 { margin-top: 7px; color: var(--navy); font-size: clamp(30px, 3vw, 44px); line-height: 1.04; letter-spacing: -.032em; }
.wb-panel-head p { max-width: 730px; margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.wb-step { color: var(--teal); font-size: 9px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.wb-panel-status { min-width: 190px; align-self: flex-end; padding: 12px 14px; border-left: 2px solid var(--teal); background: #fff; }
.wb-panel-status span { display: block; color: var(--muted-2); font-size: 8.5px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.wb-panel-status strong { display: block; margin-top: 3px; color: var(--navy); font-size: 12px; }

.wb-workspace-grid, .competitive-layout { max-width: 1420px; display: grid; grid-template-columns: minmax(280px, .72fr) minmax(620px, 1.7fr); gap: 16px; margin: 0 auto; align-items: start; }
.wb-input-panel, .wb-output-panel { min-width: 0; background: #fff; border: 1px solid var(--wb-line); }
.wb-input-panel { padding: 22px; }
.wb-output-panel { overflow: hidden; }
.wb-section-title { display: flex; align-items: center; gap: 10px; }
.wb-section-title.spaced { margin-top: 28px; }
.wb-section-title > span { width: 24px; height: 24px; display: grid; place-items: center; color: var(--teal); background: var(--teal-soft); border-radius: 2px; font-size: 8px; font-weight: 700; }
.wb-section-title h2 { color: var(--navy); font-size: 14px; }
.wb-field { display: grid; gap: 6px; margin-top: 16px; }
.wb-field > span, .wb-range > div span { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .035em; }
.wb-field input, .wb-field select, .wb-field textarea {
  width: 100%; min-height: 42px; padding: 9px 10px; color: var(--navy); background: #fff;
  border: 1px solid var(--border-2); border-radius: 3px; font: 600 13px/1.35 var(--font); outline: none;
  transition-property: border-color, box-shadow; transition-duration: .15s;
}
.wb-field textarea { resize: vertical; }
.wb-field input:focus, .wb-field select:focus, .wb-field textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(26,107,90,.1); }
.wb-money { display: grid; grid-template-columns: 34px 1fr; }
.wb-money > span { display: grid; place-items: center; color: var(--muted); background: var(--wb-soft); border: 1px solid var(--border-2); border-right: 0; border-radius: 3px 0 0 3px; font-size: 12px; font-weight: 700; }
.wb-money input { border-radius: 0 3px 3px 0; }
.wb-range { display: grid; gap: 7px; margin-top: 17px; }
.wb-range > div { display: flex; justify-content: space-between; gap: 15px; }
.wb-range output { color: var(--navy); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wb-range input { width: 100%; accent-color: var(--teal); }
.wb-range.compact { margin-top: 13px; }
.wb-field-note { margin: 9px 0 0; color: var(--muted); font-size: 10px; }
.wb-field-note.warning { color: var(--wb-danger); font-weight: 700; }

.wb-output-top { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 12px 18px; color: #fff; background: var(--navy); }
.wb-output-top > div:first-child { display: flex; flex-direction: column; }
.wb-output-top span { color: var(--on-navy-2); font-size: 8.5px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.wb-output-top strong { margin-top: 3px; font-size: 13px; }
.wb-source-chip { padding: 4px 7px; color: var(--teal-glow); border: 1px solid rgba(95,183,164,.42); border-radius: 2px; font-size: 7.5px !important; white-space: nowrap; }
.wb-source-chip.warning { color: #F1D39B; border-color: rgba(241,211,155,.42); }

.audience-kpis, .media-kpis { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--wb-line); }
.audience-kpis > div, .media-kpis > div { min-width: 0; padding: 17px 18px; border-left: 1px solid var(--wb-line); }
.audience-kpis > div:first-child, .media-kpis > div:first-child { border-left: 0; }
.audience-kpis span, .media-kpis span { display: block; color: var(--muted); font-size: 8.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.audience-kpis strong, .media-kpis strong { display: block; margin-top: 5px; color: var(--navy); font-size: 20px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.audience-tier-table { padding: 18px; }
.att-head, .att-row { display: grid; grid-template-columns: 1.3fr .5fr .5fr 1.3fr; gap: 12px; align-items: center; }
.att-head { padding: 0 12px 8px; color: var(--muted-2); font-size: 8px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.att-row { min-height: 58px; padding: 10px 12px; border-top: 1px solid var(--wb-line); color: var(--ink-2); font-size: 11.5px; }
.att-row.priority { background: var(--teal-soft); border-color: #CEDFD9; }
.att-row b { color: var(--teal); font-size: 9px; margin-right: 6px; text-transform: uppercase; }
.att-row strong { color: var(--navy); font-size: 13px; font-variant-numeric: tabular-nums; }
.wb-rationale { padding: 20px; background: var(--wb-paper); border-top: 1px solid var(--wb-line); }
.wb-rationale > p { margin: 14px 0 0; color: var(--ink-2); font-size: 13px; line-height: 1.55; }
.wb-caveat { display: grid; grid-template-columns: 150px 1fr; gap: 14px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--wb-line); }
.wb-caveat strong { color: var(--navy); font-size: 10px; }
.wb-caveat span { color: var(--muted); font-size: 10.5px; line-height: 1.45; }
.wb-output-actions, .record-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--wb-line); background: #fff; }

.competitive-layout { grid-template-columns: minmax(340px, .9fr) minmax(560px, 1.45fr); }
.competitor-entry { padding: 18px 0; border-top: 1px solid var(--wb-line); }
.competitor-entry:first-child { margin-top: 14px; }
.signal-matrix { padding: 20px; }
.signal-row { display: grid; grid-template-columns: 1fr 1.2fr 1.2fr .6fr; gap: 16px; align-items: center; min-height: 66px; border-bottom: 1px solid var(--wb-line); }
.signal-row.header { min-height: 32px; color: var(--muted-2); font-size: 8px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.signal-row strong { color: var(--navy); font-size: 13px; }
.signal-meter { height: 7px; overflow: hidden; background: var(--wb-soft); }
.signal-meter span { display: block; height: 100%; background: var(--teal); }
.signal-score { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }

.channel-controls { margin-top: 14px; border-top: 1px solid var(--wb-line); }
.channel-control { display: grid; grid-template-columns: 26px 1fr 60px; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--wb-line); }
.channel-control input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--teal); }
.channel-control label { display: flex; flex-direction: column; color: var(--navy); font-size: 11px; font-weight: 700; }
.channel-control label small { color: var(--muted); font-size: 8.5px; font-weight: 400; }
.channel-control .cpm-wrap { display: grid; grid-template-columns: 15px 1fr; align-items: center; color: var(--muted); font-size: 9px; }
.channel-control input[type="number"] { width: 100%; height: 30px; border: 1px solid var(--border-2); border-radius: 2px; color: var(--navy); font: 700 10px var(--font); }
.media-plan-table { padding: 16px 18px; overflow-x: auto; }
.mpt-row { min-width: 680px; display: grid; grid-template-columns: 1.3fr .8fr .8fr .9fr .8fr .7fr; gap: 12px; align-items: center; min-height: 54px; border-bottom: 1px solid var(--wb-line); color: var(--ink-2); font-size: 10.5px; }
.mpt-row.header { min-height: 30px; color: var(--muted-2); font-size: 7.8px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.mpt-row strong { color: var(--navy); font-size: 11.5px; }
.allocation-bar { display: grid; grid-template-columns: 1fr 32px; gap: 7px; align-items: center; }
.allocation-bar > span:first-child { height: 6px; background: var(--wb-soft); }
.allocation-bar i { display: block; height: 100%; background: var(--teal); }
.allocation-bar b { color: var(--navy); font-size: 9px; font-variant-numeric: tabular-nums; }
.rf-interpretation { padding: 18px 20px; border-top: 1px solid var(--wb-line); background: var(--wb-paper); }
.rf-interpretation > p { margin: 12px 0 0; color: var(--ink-2); font-size: 12.5px; line-height: 1.5; }
.assumption-formula { display: flex; justify-content: space-between; gap: 18px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--wb-line); }
.assumption-formula span { color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.assumption-formula code { color: var(--navy); font: 10px/1.4 var(--font); text-align: right; }

.break-even-block { display: grid; grid-template-columns: 180px 1fr; gap: 28px; align-items: center; padding: 24px; border-bottom: 1px solid var(--wb-line); }
.break-even-block > div { display: flex; flex-direction: column; }
.break-even-block span { color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.break-even-block strong { margin-top: 4px; color: var(--navy); font-size: 36px; line-height: 1; font-variant-numeric: tabular-nums; }
.break-even-block small { color: var(--teal); font-size: 10px; font-weight: 700; }
.break-even-block p { margin: 0; color: var(--ink-2); font-size: 13px; line-height: 1.55; }
.investment-scenarios { display: grid; grid-template-columns: repeat(3, 1fr); padding: 18px; gap: 10px; }
.investment-scenarios article { padding: 16px; border: 1px solid var(--wb-line); }
.investment-scenarios article.base { border-color: var(--teal); box-shadow: inset 0 3px 0 var(--teal); }
.investment-scenarios article > span { color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.investment-scenarios article > strong { display: block; margin: 8px 0 13px; color: var(--navy); font-size: 23px; font-variant-numeric: tabular-nums; }
.investment-scenarios article div { display: flex; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid var(--wb-line); color: var(--muted); font-size: 9.5px; }
.investment-scenarios article div + div { margin-top: 7px; }
.investment-scenarios b { color: var(--navy); font-variant-numeric: tabular-nums; }
.investment-scenarios b.negative { color: var(--wb-danger); }
.investment-scenarios b.positive { color: var(--wb-success); }

.record-layout { max-width: 1420px; display: grid; grid-template-columns: minmax(300px, .72fr) minmax(620px, 1.5fr); gap: 16px; margin: 0 auto; align-items: start; }
.decision-document { padding: 34px 38px; background: #fff; border: 1px solid var(--wb-line); box-shadow: 0 8px 28px rgba(11,26,46,.07); }
.dd-head { display: grid; grid-template-columns: 1fr 150px; gap: 30px; padding-bottom: 23px; border-bottom: 2px solid var(--navy); }
.dd-head span, .dd-meta span, .dd-section-id { display: block; color: var(--teal); font-size: 8px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.dd-head h2 { margin-top: 8px; color: var(--navy); font-size: 28px; line-height: 1.1; }
.dd-head > div:last-child { padding-left: 16px; border-left: 1px solid var(--wb-line); }
.dd-head > div:last-child strong { display: block; margin-top: 8px; color: var(--navy); font-size: 12px; }
.dd-meta { display: grid; grid-template-columns: 1.2fr .7fr 1fr; gap: 16px; padding: 15px 0; border-bottom: 1px solid var(--wb-line); }
.dd-meta strong { display: block; margin-top: 4px; color: var(--navy); font-size: 10px; }
.decision-document section { padding: 20px 0; border-bottom: 1px solid var(--wb-line); }
.decision-document section p { margin: 10px 0 0; color: var(--ink-2); font-size: 12.5px; line-height: 1.55; }
.dd-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 11px; }
.dd-facts div { padding: 10px; background: var(--wb-soft); }
.dd-facts span { display: block; color: var(--muted); font-size: 8px; text-transform: uppercase; }
.dd-facts strong { display: block; margin-top: 3px; color: var(--navy); font-size: 11px; }
.dd-warning { margin-top: 20px; padding: 13px 15px; color: var(--ink-2); background: #F4EFE4; border-left: 3px solid #B48636; font-size: 10.5px; line-height: 1.45; }
.dd-warning strong { color: #6C4D18; }
.dd-foot { margin-top: 22px; color: var(--muted-2); font-size: 8px; letter-spacing: .08em; text-transform: uppercase; text-align: right; }
.record-actions { max-width: 1420px; margin: 16px auto 0; border: 1px solid var(--wb-line); }

@media (max-width: 1180px) {
  :root { --wb-sidebar: 216px; }
  .wb-workspace-grid, .competitive-layout, .record-layout { grid-template-columns: 1fr; }
  .wb-input-panel { display: grid; grid-template-columns: repeat(2, 1fr); column-gap: 18px; }
  .wb-input-panel > .wb-section-title, .wb-input-panel > .wb-field-note, .competitor-inputs { grid-column: 1 / -1; }
  .competitor-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .competitor-entry { min-width: 0; }
}

@media (max-width: 840px) {
  .wb-shell { display: block; }
  .wb-sidebar { position: fixed; left: 0; top: 0; width: 260px; transform: translateX(-102%); box-shadow: 16px 0 40px rgba(11,26,46,.2); transition: transform .18s var(--ease); }
  .workbench-page.wb-nav-open .wb-sidebar { transform: translateX(0); }
  .workbench-page.wb-nav-open::after { content: ""; position: fixed; z-index: 19; inset: 0; background: rgba(11,26,46,.36); }
  .wb-mobile-toggle { width: 42px; height: 42px; display: grid; place-content: center; gap: 4px; padding: 0; background: #fff; border: 1px solid var(--border-2); border-radius: 3px; }
  .wb-mobile-toggle span { width: 17px; height: 2px; background: var(--navy); }
  .wb-topbar { padding: 0 14px; }
  .wb-topbar > div:first-of-type { margin-right: auto; margin-left: 10px; }
  .wb-top-actions .wb-action:not(.primary) { display: none; }
  .wb-panel { padding: 28px 18px 46px; }
  .wb-panel-head { align-items: flex-start; flex-direction: column; gap: 16px; }
  .wb-panel-status { align-self: flex-start; }
  .competitor-inputs { grid-template-columns: 1fr; }
  .audience-kpis, .media-kpis { grid-template-columns: repeat(2, 1fr); }
  .audience-kpis > div:nth-child(3), .media-kpis > div:nth-child(3) { border-left: 0; border-top: 1px solid var(--wb-line); }
  .audience-kpis > div:nth-child(4), .media-kpis > div:nth-child(4) { border-top: 1px solid var(--wb-line); }
  .investment-scenarios { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .wb-topbar > div:first-of-type { display: none; }
  .wb-notice { padding: 10px 16px; }
  .wb-input-panel { display: block; padding: 18px; }
  .att-head { display: none; }
  .att-row { grid-template-columns: 1fr 70px; gap: 6px 12px; }
  .att-row > span:nth-child(3), .att-row > span:nth-child(4) { color: var(--muted); font-size: 9px; }
  .wb-caveat { grid-template-columns: 1fr; gap: 6px; }
  .signal-row { grid-template-columns: 1fr .9fr .5fr; }
  .signal-row > :nth-child(3) { display: none; }
  .break-even-block { grid-template-columns: 1fr; gap: 14px; }
  .dd-head, .dd-meta { grid-template-columns: 1fr; }
  .dd-head > div:last-child { padding: 12px 0 0; border-left: 0; border-top: 1px solid var(--wb-line); }
  .decision-document { padding: 24px 20px; }
  .dd-facts { grid-template-columns: 1fr; }
  .record-actions { flex-wrap: wrap; }
}

@media print {
  .wb-sidebar, .wb-topbar, .wb-notice, .wb-panel:not([data-panel="record"]), .wb-panel-head, .record-controls, .record-actions { display: none !important; }
  .wb-shell, .wb-main, .wb-panel[data-panel="record"], .record-layout { display: block !important; padding: 0; background: #fff; }
  .decision-document { border: 0; box-shadow: none; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .wb-sidebar { transition-duration: .01ms; }
}
