:root {
  color-scheme: light;
  --background: #f5f5f7;
  --surface: #fff;
  --text: #202124;
  --muted: #555963;
  --line: #dedfe4;
  --border: #e7e7eb;
  --accent: #15352b;
  --accent-soft: #e8f0ed;
  --focus: #005fcc;
  --radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--background); color: var(--text); line-height: 1.45; }
button, select { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.frame { width: min(1240px, calc(100% - 64px)); margin-inline: auto; }
.skip { position: absolute; top: -60px; left: 12px; z-index: 2; padding: 9px 13px; background: var(--surface); color: var(--accent); }
.skip:focus { top: 12px; }

.masthead { background: var(--surface); border-bottom: 1px solid var(--border); }
.mastinner, .brand { display: flex; align-items: center; gap: 10px; }
.mastinner { justify-content: space-between; height: 58px; }
.brand { font-weight: 720; letter-spacing: -.02em; }
.brand img { object-fit: contain; }
.location { font-size: .88rem; color: var(--muted); }

.hero { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 24px 0 16px; }
.hero h1 { margin: 0; font-size: clamp(2rem, 4.8vw, 3.25rem); line-height: 1.03; letter-spacing: -.055em; }
.intro { margin: 7px 0 0; color: var(--muted); }
.view-link {
  background: var(--accent); color: #fff; border-radius: 999px; padding: 8px 15px;
  font-weight: 650; font-size: .9rem; text-decoration: none; white-space: nowrap;
}
.view-link:hover { background: #244c40; }

.overview, .figures { display: grid; gap: 10px; }
.overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.overview > div, .figure, .panel {
  min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.overview > div { padding: 12px 16px; }
.overview span, .overview small, .figure span { display: block; color: var(--muted); font-size: .86rem; }
.overview strong, .figure strong { display: block; font-variant-numeric: tabular-nums; letter-spacing: -.032em; }
.overview strong { font-size: clamp(1.12rem, 2.3vw, 1.45rem); margin: 3px 0 2px; }
.overview progress {
  display: block; width: 100%; height: 5px; margin-top: 7px; border: none; border-radius: 8px;
  overflow: hidden; background: #e6e8eb; accent-color: var(--accent);
}
.overview progress::-webkit-progress-bar { background: #e6e8eb; }
.overview progress::-webkit-progress-value { background: var(--accent); }

.tabs { display: flex; gap: 18px; margin: 12px 0 18px; border-bottom: 1px solid var(--line); overflow: auto; }
.tabs button {
  background: transparent; border: 0; border-bottom: 3px solid transparent; padding: 9px 2px 10px;
  white-space: nowrap; font-weight: 650; font-size: .93rem; color: var(--muted);
}
.tabs button:hover { color: var(--accent); }
.tabs button[aria-current] { border-bottom-color: var(--accent); color: var(--accent); }
.tabs button:focus-visible { outline-offset: -3px; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin: 0 0 10px; }
h2, h3, p { margin: 0; }
h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); letter-spacing: -.045em; line-height: 1.15; }
h3 { font-size: 1.16rem; line-height: 1.2; letter-spacing: -.023em; }
.section-head p, .panel > p { margin-top: 4px; font-size: .91rem; color: var(--muted); }
.timeline { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; margin-bottom: 18px; }
.milestone {
  display: flex; flex-direction: column; align-items: start; gap: 2px; min-width: 0;
  padding: 9px 11px; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  text-align: left; border-radius: 10px;
}
.milestone:hover { border-color: #889d92; }
.milestone[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.milestone span, .milestone p { font-size: .82rem; color: var(--muted); }
.milestone strong { font-size: .94rem; font-weight: 700; }

.tasks { margin-bottom: 20px; }
#tasks-title { scroll-margin-top: 16px; }
.filter-count { color: var(--muted); font-size: .86rem; white-space: nowrap; }
.status-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
[data-tone="pending"] { --signal: #5a6270; --signal-bg: #eef0f3; --signal-line: #bcc2cb; }
[data-tone="active"] { --signal: #795000; --signal-bg: #fff1cd; --signal-line: #ddbb64; }
[data-tone="blocked"] { --signal: #a32631; --signal-bg: #fcebed; --signal-line: #e6aab0; }
[data-tone="done"] { --signal: #206244; --signal-bg: #e8f4ec; --signal-line: #a1c9af; }
.status-filter {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  min-height: 44px; padding: 7px 11px; border: 1px solid transparent; border-radius: 10px;
  background: var(--signal-bg); color: var(--signal); text-align: left; font-size: .87rem; font-weight: 600;
}
.status-filter:hover { border-color: var(--signal-line); }
.status-filter[aria-pressed="true"] { border-color: var(--signal); background: var(--signal-bg); }
.status-filter .label, .status, .gate-option > strong { display: inline-flex; align-items: center; gap: 7px; }
.status-filter strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.status-filter .label::before, .status::before, .gate-option > strong::before {
  display: inline-block; content: ""; flex: 0 0 9px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--signal, #68707a);
}
.status {
  padding: 3px 8px; width: max-content; max-width: 100%; border-radius: 999px;
  background: var(--signal-bg, #eef0f3); color: var(--signal, #555963);
  font-size: .8rem; font-weight: 650; white-space: nowrap;
}
.controls { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; margin-bottom: 9px; }
.controls label { display: grid; gap: 3px; min-width: 0; color: var(--muted); font-size: .82rem; font-weight: 650; }
.controls select { background: var(--surface); border: 1px solid #c5c7ce; border-radius: 8px; padding: 6px 8px; min-width: 122px; color: var(--text); }
.controls button { background: transparent; border: 0; color: var(--accent); padding: 7px 6px; text-decoration: underline; font-size: .85rem; }

.table-scroll { overflow: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
table { width: 100%; min-width: 710px; border-collapse: collapse; text-align: left; font-size: .89rem; }
th, td { padding: 10px 13px; vertical-align: top; border-bottom: 1px solid var(--border); }
th { font-size: .82rem; font-weight: 690; color: var(--muted); background: #fafafc; }
tr:last-child td { border-bottom: 0; }
.tasks td:first-child { width: 34%; }
.tasks td:nth-child(2) { width: 19%; }
.tasks td:nth-child(3) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tasks tr[data-tone="blocked"] > td:first-child { box-shadow: inset 3px 0 #bc3c48; }
.task-detail { min-width: 0; }
.task-detail summary { display: flex; align-items: baseline; gap: 8px; font-weight: 680; list-style: none; width: fit-content; }
.task-detail summary::-webkit-details-marker { display: none; }
.task-detail summary::before {
  display: inline-block; content: ""; flex: 0 0 6px; width: 6px; height: 6px; margin: 0 3px 1px 2px;
  border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg);
}
.task-detail[open] summary::before { transform: rotate(45deg); }
.task-detail summary:hover { color: var(--accent); text-decoration: underline; }
.task-detail p { margin: 6px 0 0 19px; color: var(--muted); }
.metric-status { display: block; color: var(--muted); font-size: .83rem; }
.empty { color: var(--muted); text-align: center; padding-block: 22px; }

.gate {
  display: grid; grid-template-columns: 1.1fr 1fr 1fr 1fr; border: 1px solid var(--border);
  background: var(--surface); border-radius: var(--radius);
}
.gate > div { padding: 11px 13px; }
.gate > div + div { border-left: 1px solid var(--border); }
.gate-date { display: block; margin-bottom: 3px; font-size: .79rem; font-weight: 700; color: var(--muted); }
.gate p { margin-top: 4px; font-size: .86rem; color: var(--muted); }
.gate .status { margin-top: 6px; }
.gate-option > strong { font-size: .95rem; }

.scenario { margin: 0 0 11px; padding: 0; border: 0; }
.scenario legend { margin-bottom: 4px; font-size: .82rem; font-weight: 700; color: var(--muted); }
.scenario > div { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; background: #e6e6eb; border-radius: 9px; }
.scenario button { min-width: 75px; background: transparent; border: 0; border-radius: 6px; padding: 6px 10px; font-size: .88rem; }
.scenario button[aria-pressed="true"] { background: var(--surface); color: var(--accent); font-weight: 700; box-shadow: 0 1px 2px #0002; }
.figures { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 10px; }
.figure { padding: 10px 13px; }
.figure strong { font-size: clamp(1.25rem, 3vw, 1.95rem); color: var(--accent); }
.panels { display: grid; grid-template-columns: 1.2fr 1fr; gap: 10px; margin-bottom: 18px; }
.panel { padding: 14px; }
.funnel { margin-top: 9px; }
.funnel-row { display: grid; grid-template-columns: minmax(92px, 120px) minmax(50px, 1fr) minmax(70px, max-content); align-items: center; gap: 8px; margin-top: 7px; font-size: .88rem; }
.funnel-row strong { text-align: right; font-size: .8rem; }
.track { height: 7px; background: #e7e9ed; border-radius: 9px; }
.track i { display: block; height: 100%; background: #4e7567; border-radius: inherit; }
.economics p { margin-top: 8px; }
footer { border-top: 1px solid var(--line); padding: 14px 0 20px; margin-top: 28px !important; color: var(--muted); font-size: .84rem; }

@media (max-width: 1000px) {
  .timeline { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gate { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gate > div:nth-child(3) { border-left: 0; }
  .gate > div:nth-child(n + 3) { border-top: 1px solid var(--border); }
}
@media (max-width: 660px) {
  .frame { width: calc(100% - 28px); }
  .mastinner { height: 49px; }
  .hero { align-items: start; padding-top: 17px; }
  .hero .view-link { margin-top: 2px; }
  .tabs { gap: 13px; }
  .overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview > div:first-child { grid-column: 1 / -1; }
  .overview > div { padding: 8px 11px; }
  .status-filters, .timeline, .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panels { grid-template-columns: 1fr; }
  .task-scroll, .studio-scroll { background: none; border: 0; overflow: visible; }
  .tasks table, .tasks tbody, .studio-scroll table, .studio-scroll tbody { display: block; min-width: 0; }
  .tasks thead, .studio-scroll thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .tasks tr, .studio-scroll tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; padding: 3px 0; }
  .tasks td:first-child, .tasks td:nth-child(2) { width: auto; }
  .tasks td, .studio-scroll td { display: block; border: 0; padding: 5px 9px; }
  .tasks td:first-child, .tasks td:nth-child(4), .studio-scroll td:first-child, td.empty { grid-column: 1 / -1; }
  td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; margin-bottom: 2px; color: var(--muted); font-size: .77rem; font-weight: 650; }
  .controls select { min-width: 107px; max-width: 49vw; }
}
@media (max-width: 380px) {
  .hero { flex-direction: column; gap: 8px; }
  .gate { grid-template-columns: 1fr; }
  .gate > div + div { border: 0; border-top: 1px solid var(--border); }
}

.state-editor {
  display: inline-flex;
  align-items: center;
  position: relative;
  background: var(--signal-bg);
  color: var(--signal);
  border-radius: 8px;
}
.state-editor::before {
  content: "";
  position: absolute;
  left: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--signal);
  pointer-events: none;
}
.state-editor select {
  min-height: 32px;
  padding: 3px 5px 3px 21px;
  border: 1px solid var(--signal-line);
  border-radius: inherit;
  background: transparent;
  font-size: .8rem;
  font-weight: 650;
  color: var(--signal);
  cursor: pointer;
}
.state-editor select:disabled { opacity: .65; cursor: progress; }
.save-message { margin: 0 0 8px; color: var(--accent); font-size: .85rem; }
.save-message:empty { display: none; }
.save-message[data-error="true"] { color: #a32631; }

.reporting { margin: 20px 0; }
.primary-action {
  border: 0;
  background: var(--accent);
  color: #fff;
  border-radius: 9px;
  min-height: 36px;
  padding: 7px 13px;
  font-size: .85rem;
  font-weight: 650;
  white-space: nowrap;
}
.primary-action:hover { background: #244c40; }
.primary-action:disabled { opacity: .6; cursor: progress; }
.subtle-action {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 7px 10px;
  font-size: .86rem;
  font-weight: 650;
}
.subtle-action:hover { text-decoration: underline; }
.results-form { margin-bottom: 12px; }
.form-fields {
  display: grid;
  grid-template-columns: repeat(5,minmax(0,1fr));
  gap: 8px 12px;
}
.form-fields label {
  display: grid;
  min-width: 0;
  gap: 4px;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 650;
}
.form-fields input, .form-fields select {
  width: 100%;
  min-height: 36px;
  padding: 5px 8px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid #c5c7ce;
  border-radius: 7px;
  font: inherit;
}
.campaign-field { grid-column: span 3; }
.form-actions { display: flex; gap: 8px; margin-top: 13px; }
.report-charts { align-items: stretch; }
.weekly-chart { position: relative; margin-top: 12px; padding-left: 40px; }
.chart-plot {
  position: relative;
  display: grid;
  grid-template-columns: repeat(9,minmax(0,1fr));
  gap: 5px;
  height: 116px;
  border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(to top, transparent 0, transparent calc(25% - 1px), var(--border) calc(25% - 1px), var(--border) 25%);
}
.chart-tick {
  position: absolute;
  right: calc(100% + 6px);
  font-size: .7rem;
  color: var(--muted);
  white-space: nowrap;
  transform: translateY(45%);
}
.chart-goal {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 1;
  border-top: 1px dashed #5a8d78;
  pointer-events: none;
}
.chart-column {
  display: flex;
  position: relative;
  align-items: end;
  justify-content: center;
  gap: 3px;
}
.chart-bar {
  width: min(36%, 20px);
  height: var(--height);
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  background: #247355;
}
.chart-bar[data-series="cpl"] { background: #9aafcb; }
.chart-bar[data-series="cac"] { background: #416691; }
.chart-labels {
  display: grid;
  grid-template-columns: repeat(9,minmax(0,1fr));
  gap: 5px;
  margin-top: 4px;
  color: var(--muted);
  font-size: .73rem;
  text-align: center;
}
.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: .85rem;
  color: var(--muted);
}
.chart-legend { display: flex; gap: 10px; margin-top: 7px; color: var(--muted); font-size: .8rem; }
.chart-legend span::before {
  display: inline-block;
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 3px;
  background: #416691;
}
.chart-legend [data-series="cpl"]::before { background: #9aafcb; }
.campaign-log h3 { margin-bottom: 8px; }
@media (max-width: 660px) {
  .form-fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .campaign-field { grid-column: 1 / -1; }
}

.phase-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 7px;
  font-weight: 650;
}
.phase-status::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #89909b;
}
.milestone[data-stage="done"] { background: #f0f7f3; border-color: #c1dac9; }
.milestone[data-stage="current"] {
  border-color: #83ad94;
  background: #e0f1e8;
}
.milestone[data-stage="current"] .phase-status,
.milestone[data-stage="done"] .phase-status { color: #206244; }
.milestone[data-stage="current"] .phase-status::before {
  background: #267752;
  box-shadow: 0 0 0 3px #c5e2d1;
}
.milestone[data-stage="done"] .phase-status::before {
  content: "✓";
  width: 13px;
  height: 13px;
  flex-basis: 13px;
  display: grid;
  place-items: center;
  font-size: 9px;
  line-height: 1;
  color: white;
  background: #267752;
}
@media (prefers-reduced-motion: no-preference) {
  .milestone[data-stage="current"] .phase-status::before { animation: stage-ring 1.7s ease-out 3; }
  @keyframes stage-ring {
    0%, 100% { box-shadow: 0 0 0 3px #c5e2d1; }
    55% { box-shadow: 0 0 0 6px #e8f4ec; }
  }
}

.form-note { margin-top: 8px; font-size: .79rem; color: var(--muted); }
.indicator-mode { width: fit-content; margin: 0 0 7px; padding: 3px 8px; color: var(--muted); background: #eeeff2; border-radius: 7px; font-size: .82rem; font-weight: 650; }
.indicator-mode[data-mode="preview"] { color: #795000; background: #fff1cd; }
.indicator-mode[data-mode="recorded"] { color: #206244; background: #e8f4ec; }
.figures { grid-template-columns: repeat(6,minmax(0,1fr)); }
.chart-trend { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.trend-line { fill: none; stroke: #247355; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.chart-point { position: absolute; width: 7px; height: 7px; transform: translate(-50%,50%); border-radius: 50%; background: #247355; }
.source-mix { display: grid; grid-template-columns: minmax(85px,106px) 1fr; align-items: center; gap: 12px 18px; min-height: 119px; }
.mix-ring { display: grid; place-items: center; aspect-ratio: 1; border-radius: 50%; background: #eff0f3; }
.mix-ring[data-has-values="true"] { background: conic-gradient(#496ba6 0 var(--share),#6ba389 var(--share) 100%); }
.mix-ring strong { display: grid; place-items: center; width: 73%; height: 73%; border-radius: 50%; background: var(--surface); font-size: clamp(.82rem,1.4vw,1rem); }
.mix-labels { display: grid; grid-template-columns: minmax(0,1fr) max-content; gap: 8px; margin: 0; font-size: .85rem; }
.mix-labels dt { display: flex; align-items: center; gap: 6px; }
.mix-labels dt::before { content: ""; flex: 0 0 8px; height: 8px; border-radius: 3px; background: #496ba6; }
.mix-labels dt[data-source="organic"]::before { background: #6ba389; }
.mix-labels dd { margin: 0; color: var(--muted); }
.mix-head label { color: var(--muted); font-size: .84rem; }
.mix-head select { border: 1px solid #c5c7ce; border-radius: 7px; padding: 4px; background: var(--surface); }
.economics { margin-bottom: 14px; }
@media (max-width: 960px) { .figures { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media (max-width: 520px) { .figures { grid-template-columns: repeat(2,minmax(0,1fr)); } .mix-labels { grid-template-columns: 1fr; gap: 3px; } }
.draft-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-top: 12px; }
.draft-metrics > div { padding: 6px 10px; border-radius: 8px; background: #f1f3f4; }
.draft-metrics span { display: block; color: var(--muted); font-size: .76rem; }
.draft-metrics strong { font-size: .9rem; color: var(--accent); }
