:root {
  color-scheme: light;
  --navy: #0F2B49;
  --navy-2: #173a60;
  --teal: #028880;
  --teal-ink: #016a63;
  --lime: #DDE466;
  --sand: #E3DCD2;
  --paper: #F4F0EA;
  --surface: #FCFBF8;
  --ink: #0F2B49;
  --muted: #55657a;
  --line: #d8cfc2;
  --line-soft: #e8e1d7;
  --red: #A93A27;
  --red-bg: #f6e1dc;
  --amber: #8a5a07;
  --amber-bg: #f7ead0;
  --green: #22704a;
  --green-bg: #dcefe3;
  --google: #0F2B49;
  --meta: #028880;
  --radius-lg: 14px;
  --radius-sm: 8px;
  --font: "Roboto Flex", Roboto, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  font-variation-settings: "opsz" 14;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal-ink); }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
button, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.demo-banner {
  background: var(--lime);
  color: var(--navy);
  font-size: 13.5px;
  padding: 7px 20px;
  text-align: center;
}

/* Shell */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: calc(100vh - 34px); background: linear-gradient(to right, var(--navy) 236px, transparent 236px); }
.chart { max-width: 1100px; }
.rail {
  background: var(--navy);
  color: var(--sand);
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: calc(100vh - 34px);
}
.brand { display: flex; gap: 10px; align-items: center; color: #fff; text-decoration: none; padding: 0 8px 26px; font-size: 20px; font-weight: 650; font-variation-settings: "wdth" 112, "opsz" 32; }
.brand small { display: block; font-size: 12px; font-weight: 400; color: var(--sand); opacity: .8; font-variation-settings: "wdth" 100; }
.brand-mark { width: 34px; height: 34px; color: #fff; flex: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  color: var(--sand);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 3px solid transparent;
}
.nav a:hover { background: var(--navy-2); color: #fff; }
.nav a[aria-current="page"] { background: var(--navy-2); color: #fff; border-left-color: var(--lime); font-weight: 600; }
.count { background: var(--lime); color: var(--navy); font-size: 12px; font-weight: 700; min-width: 22px; text-align: center; border-radius: 99px; padding: 1px 7px; }
.count:empty, .count[data-zero] { display: none; }
.rail-foot { margin-top: auto; display: flex; gap: 10px; align-items: center; font-size: 13.5px; padding: 0 8px; line-height: 1.3; }
.rail-foot small { opacity: .7; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }

.main { padding: 26px clamp(16px, 3vw, 40px) 60px; min-width: 0; }
.main:focus { outline: none; }
.topbar { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.topbar h1 { font-size: 30px; font-weight: 700; font-variation-settings: "wdth" 110, "opsz" 40; }
.topbar-tools { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.period { color: var(--muted); font-size: 14px; }
.select select {
  appearance: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%230F2B49' stroke-width='1.8'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 36px 8px 12px;
  min-width: 220px;
}
.view[hidden] { display: none; }
.intro { max-width: 72ch; color: var(--muted); margin: 0 0 20px; font-size: 15.5px; }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 20px; min-width: 0; }
.panel-head { margin-bottom: 16px; }
.panel-head h2 { font-size: 17px; font-weight: 650; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.sub { font-size: 15px; margin: 22px 0 10px; }

/* KPIs: plain figures, no decoration */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 22px; border-top: 2px solid var(--navy); }
.kpi { padding: 14px 18px 4px 0; }
.kpi + .kpi { padding-left: 18px; border-left: 1px solid var(--line); }
.kpi dl { margin: 0; }
.kpi dt { color: var(--muted); font-size: 13.5px; }
.kpi dd { margin: 2px 0 0; font-size: 34px; font-weight: 650; font-variation-settings: "wdth" 80, "opsz" 48; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .delta { display: block; font-size: 13px; font-weight: 500; font-variation-settings: "wdth" 100; color: var(--muted); margin-top: 4px; }
.delta.up-bad, .delta.down-bad { color: var(--red); }
.delta.good { color: var(--green); }

/* Pacing: the signature element */
.pacing { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.pace-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; }
.pace-name { font-weight: 600; }
.pace-name small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.pace-figs { font-variant-numeric: tabular-nums; font-size: 13.5px; color: var(--muted); }
.pace-figs b { color: var(--ink); font-weight: 650; }
.track { grid-column: 1 / -1; position: relative; height: 14px; background: var(--line-soft); border-radius: 3px; }
.track .fill { position: absolute; inset: 0 auto 0 0; background: var(--navy); border-radius: 3px; }
.track .fill.over { background: var(--red); }
.track .fill.under { background: #8c99a8; }
.track .today { position: absolute; top: -5px; bottom: -5px; width: 3px; background: var(--lime); box-shadow: 0 0 0 1px var(--navy); border-radius: 2px; }
.pace-state { grid-column: 1 / -1; font-size: 13px; }
.pace-state.over { color: var(--red); }
.pace-state.under { color: var(--amber); }
.pace-state.ok { color: var(--green); }

/* Alerts */
.alerts { list-style: none; margin: 0; padding: 0; }
.alerts li { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.alerts li:first-child { border-top: 0; padding-top: 0; }
.alerts .sev { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; }
.sev.high { background: var(--red); }
.sev.med { background: #d29a2c; }
.sev.low { background: var(--teal); }
.alerts strong { display: block; font-weight: 600; }
.alerts span { color: var(--muted); font-size: 13.5px; }
.alerts a { font-size: 13.5px; }

/* Chart */
.chart svg { width: 100%; height: auto; display: block; }
.chart text { font: 12px var(--font); fill: var(--muted); }
.legend { display: flex; gap: 8px 16px; align-items: center; font-size: 13px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: -10px; }
.key-google { background: var(--google); }
.key-meta { background: var(--meta); }

/* Tables */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin-bottom: 16px; }
.hint { margin: 0; color: var(--muted); font-size: 13.5px; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.segmented button { border: 0; background: transparent; padding: 8px 14px; cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); }
.panel .table-wrap { border: 0; border-radius: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 13px; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table.compact td, .table.compact th { padding: 9px 10px; }
.camp-name { font-weight: 550; word-break: break-word; min-width: 220px; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; font-weight: 600; white-space: nowrap; }
.tag.google { background: #e3e8ef; color: var(--navy); }
.tag.meta { background: #d5eeec; color: var(--teal-ink); }
.tag.live { background: var(--green-bg); color: var(--green); }
.tag.paused { background: #e8e5e0; color: #5b5750; }
.tag.limited { background: var(--amber-bg); color: var(--amber); }
.tag.rejected { background: var(--red-bg); color: var(--red); }
.tag.housing { background: #e6e0f0; color: #4a3a78; }
.ai-note { color: var(--muted); font-size: 13px; min-width: 200px; }
.ai-note.flag { color: var(--ink); }
.ai-note.flag::before { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--lime); border: 1px solid var(--navy); border-radius: 2px; margin-right: 6px; }

/* Approvals: lime means "AI proposed, waiting for a human" */
.proposals { display: grid; gap: 18px; max-width: 980px; }
.proposal { background: var(--surface); border: 1px solid var(--line-soft); border-left: 6px solid var(--lime); border-radius: var(--radius-sm) var(--radius-lg) var(--radius-lg) var(--radius-sm); padding: 20px 22px; }
.proposal.blocked { border-left-color: var(--red); }
.proposal.done { border-left-color: var(--line); opacity: .75; }
.proposal-head { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: space-between; align-items: baseline; }
.proposal h2 { font-size: 18px; font-weight: 650; max-width: 60ch; }
.proposal .meta { color: var(--muted); font-size: 13.5px; }
.proposal p { margin: 10px 0; max-width: 72ch; }
.why { margin: 12px 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 14px; }
.why li::before { content: "Evidence: "; color: var(--muted); }
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.diff div { border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; }
.diff .before { background: var(--red-bg); }
.diff .after { background: var(--green-bg); }
.diff b { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.checks { list-style: none; margin: 12px 0 16px; padding: 12px 0 0; border-top: 1px dashed var(--line); display: grid; gap: 6px; font-size: 13.5px; }
.checks li { display: grid; grid-template-columns: 22px 1fr; }
.checks .pass::before { content: "✓"; color: var(--green); font-weight: 800; }
.checks .fail::before { content: "✕"; color: var(--red); font-weight: 800; }
.checks .fail { color: var(--red); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.status-line { font-weight: 600; font-size: 14px; }

.btn { border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); padding: 9px 16px; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--navy); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-ink); border-color: var(--teal-ink); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Brief */
.grid-brief { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }
textarea { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; background: #fff; resize: vertical; margin-bottom: 14px; line-height: 1.55; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty h2 { color: var(--ink); font-size: 17px; margin-bottom: 6px; }
.empty p { max-width: 42ch; margin: 0 auto; }
.draft h2 { font-size: 18px; }
.draft h3 { font-size: 15px; margin: 18px 0 8px; }
.draft p { margin: 6px 0; }
.draft ul { margin: 6px 0; padding-left: 18px; }
.draft li { margin: 4px 0; }
.split { display: flex; height: 26px; border-radius: 4px; overflow: hidden; margin: 8px 0; font-size: 12.5px; font-weight: 600; color: #fff; }
.split span { display: flex; align-items: center; padding: 0 10px; white-space: nowrap; }
.callout { background: #ece6f4; border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; margin: 12px 0; }
.callout b { color: #4a3a78; }
.thinking { color: var(--muted); padding: 40px 0; text-align: center; }

/* Guardrails */
.rules { list-style: none; margin: 0; padding: 0; }
.rules li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; padding: 13px 0; border-top: 1px solid var(--line-soft); }
.rules li:first-child { border-top: 0; padding-top: 0; }
.rules strong { font-weight: 600; }
.rules p { grid-column: 1; margin: 0; color: var(--muted); font-size: 13.5px; }
.rules .kind { font-size: 12px; font-weight: 600; justify-self: end; }
.kind.block { color: var(--red); }
.kind.warn { color: var(--amber); }
.kind.monitor { color: var(--teal-ink); }
.switch { grid-row: 1 / span 2; grid-column: 2; align-self: center; position: relative; width: 42px; height: 24px; border-radius: 99px; background: #b9b2a7; border: 0; cursor: pointer; padding: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s ease; }
.switch[aria-checked="true"] { background: var(--teal); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }
.switch[data-locked] { cursor: not-allowed; }
.rule-side { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.rule-side .switch { grid-row: auto; grid-column: auto; }
.audit { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.audit li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-top: 1px solid var(--line-soft); }
.audit time { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Connections */
.connections { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.conn { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.conn-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.conn h2 { font-size: 17px; }
.conn p { margin: 0; color: var(--muted); font-size: 14px; }
.steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.steps li { display: grid; grid-template-columns: 20px 1fr; }
.steps .done::before { content: "✓"; color: var(--green); font-weight: 800; }
.steps .wait::before { content: "○"; color: var(--amber); font-weight: 800; }
.steps .todo::before { content: "·"; color: var(--muted); font-weight: 800; }
.conn .scope { font-size: 12.5px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 10px; margin-top: auto; }

/* Toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 18px; border-radius: var(--radius-sm); font-size: 14px; box-shadow: 0 8px 24px rgba(15, 43, 73, .25); z-index: 10; max-width: calc(100% - 32px); }

/* Responsive */
@media (max-width: 1080px) {
  .grid-2, .grid-brief { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .rail { position: static; height: auto; padding: 14px 16px 0; }
  .brand { padding: 0 0 12px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 10px; scrollbar-width: none; }
  .nav a { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; border-radius: 6px 6px 0 0; gap: 6px; }
  .nav a[aria-current="page"] { border-bottom-color: var(--lime); }
  .rail-foot { display: none; }
  .main { padding: 18px 16px 50px; }
  .topbar h1 { font-size: 24px; }
  .select select { min-width: 0; width: 100%; }
  .topbar-tools, .select { width: 100%; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { padding-left: 0; border-left: 0; }
  .kpi dd { font-size: 28px; }
  .diff { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
