/* DOPR Campaign Tracker design system. See DESIGN.md for the reasoning.
   Brand: navy + yellow on a cool canvas, Poppins. One bold element per screen:
   the delivery track. Everything else is quiet: hairlines, not boxes. */

:root {
  --navy: #102D53;
  --navy-2: #153B6B;
  --navy-3: #1D4A82;
  --yellow: #F5B900;
  --yellow-soft: #FFF4CC;
  --yellow-ink: #6E5100;
  --ink: #182433;
  --ink-2: #4B5A70;
  --ink-3: #5F6F86;
  --canvas: #F4F7FC;
  --surface: #FFFFFF;
  --surface-2: #F8FAFD;
  --line: #E1E7F0;
  --line-2: #CBD5E3;
  --green: #168765;
  --green-soft: #E3F3EC;
  --amber: #9A5B00;
  --amber-soft: #FFF3D6;
  --red: #B4362A;
  --red-soft: #FBE8E5;
  --blue: #2563A8;
  --blue-soft: #E6EEF8;

  --r-control: 6px;
  --r-sheet: 10px;
  --r-hero: 14px;
  --float: 0 12px 32px rgba(16, 45, 83, .16), 0 2px 6px rgba(16, 45, 83, .08);
  --sidebar: 232px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  font-family: Poppins, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--canvas); min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--navy-3); text-underline-offset: 2px; }
a:hover { color: var(--navy); }
img, svg { max-width: 100%; }
h1, h2, h3 { margin: 0; color: var(--ink); letter-spacing: -0.01em; }
h1 { font-size: 26px; line-height: 1.2; font-weight: 600; }
h2 { font-size: 16px; line-height: 1.3; font-weight: 600; }
h3 { font-size: 14px; line-height: 1.35; font-weight: 600; }
p { margin: 0 0 8px; }
code { font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 4px; word-break: break-all; }
:focus-visible { outline: 2px solid var(--yellow); 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; }
a.sr-only:focus { position: fixed; top: 8px; left: 8px; width: auto; height: auto; clip: auto; z-index: 100; background: var(--yellow); color: var(--navy); padding: 8px 14px; border-radius: var(--r-control); font-weight: 600; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
.inline { display: inline; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--navy); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 12px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 22px; color: #fff; text-decoration: none; }
.brand img { width: 38px; height: 38px; flex: none; object-fit: contain; }
.brand-name { font-weight: 700; letter-spacing: .08em; font-size: 14px; line-height: 1.1; color: #fff; }
.brand-sub { font-size: 11px; color: var(--yellow); font-weight: 500; letter-spacing: .02em; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-label { font-size: 12px; color: rgba(255,255,255,.5); padding: 18px 10px 6px; font-weight: 500; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-control); color: rgba(255,255,255,.78); text-decoration: none; font-size: 13.5px; font-weight: 500; position: relative; }
.nav a svg { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a[aria-current="page"] { background: rgba(255,255,255,.09); color: #fff; }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--yellow); }
.nav .count { margin-left: auto; background: var(--yellow); color: var(--navy); font-size: 11px; font-weight: 700; border-radius: 9px; padding: 0 7px; line-height: 18px; min-width: 18px; text-align: center; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.1); }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--yellow); color: var(--navy); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.me-name { font-size: 13px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { font-size: 12px; color: rgba(255,255,255,.6); }
.sidebar-foot .links { display: flex; gap: 14px; padding: 6px 8px 0; }
.sidebar-foot .links a, .sidebar-foot .links button { color: rgba(255,255,255,.72); font: 500 12.5px/1.4 inherit; font-family: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none; }
.sidebar-foot .links a:hover, .sidebar-foot .links button:hover { color: #fff; text-decoration: underline; }
.topbar { display: none; }
.main { padding: 28px 36px 64px; min-width: 0; max-width: 1280px; width: 100%; }

.demo-banner { display: block; font-size: 12.5px; color: var(--yellow-ink); background: var(--yellow-soft); border-radius: var(--r-control); padding: 6px 12px; margin-bottom: 20px; width: fit-content; max-width: 100%; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; }
.eyebrow { font-size: 13px; color: var(--ink-3); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.eyebrow a { color: var(--ink-3); text-decoration: none; }
.eyebrow a:hover { color: var(--ink); text-decoration: underline; }
.subtitle { color: var(--ink-2); margin-top: 6px; max-width: 68ch; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- sections: content on the canvas, separated by hairlines ---------- */
.section { margin-top: 32px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.section-head p { color: var(--ink-3); font-size: 13px; margin: 2px 0 0; }
.section-head .actions { display: flex; gap: 8px; align-items: center; }

/* Sheets hold tables and forms. Nothing else gets a box. */
.card, .sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sheet); padding: 20px; min-width: 0; }
.card.flush, .sheet.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head p { color: var(--ink-3); font-size: 13px; margin: 2px 0 0; }
.card.flush > .card-head { padding: 16px 20px 0; }
.stack { display: grid; gap: 24px; align-content: start; }
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); }

/* Stats read as one strip with dividers, not a grid of boxes. */
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric { padding: 14px 20px 14px 0; min-width: 0; }
.grid-4 .metric + .metric { padding-left: 20px; border-left: 1px solid var(--line); }
.metric-label { font-size: 12.5px; color: var(--ink-3); }
.metric-value { font-size: 22px; font-weight: 600; margin-top: 2px; line-height: 1.2; letter-spacing: -0.01em; }
.metric-note { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

/* ---------- delivery track: the signature element ---------- */
.track { background: var(--navy-2); color: #fff; border-radius: var(--r-hero); padding: 24px 28px 22px; position: relative; }
.track a { color: #fff; }
.track-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 32px; flex-wrap: wrap; }
.track-title { min-width: 0; }
.track-brand { font-size: 13px; color: var(--yellow); font-weight: 500; }
.track-name { font-size: 20px; font-weight: 600; color: #fff; margin-top: 2px; }
.track-meta { font-size: 12.5px; color: rgba(255,255,255,.7); margin-top: 4px; display: flex; gap: 6px 16px; flex-wrap: wrap; align-items: center; }
.track-figure { text-align: right; }
.track-figure strong { display: block; font-size: 40px; line-height: 1; font-weight: 600; letter-spacing: -0.02em; }
.track-figure span { font-size: 13px; color: rgba(255,255,255,.72); }
.track-rail { position: relative; height: 12px; margin: 30px 0 34px; background: rgba(255,255,255,.12); border-radius: 3px; }
.track-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--yellow); border-radius: 3px; transition: width .6s var(--ease); }
.track-proj { position: absolute; top: 0; bottom: 0; border: 1.5px dashed rgba(245,185,0,.75); border-left: 0; border-radius: 0 3px 3px 0; }
.track-tick { position: absolute; top: -5px; bottom: -5px; width: 1px; background: rgba(255,255,255,.3); }
.track-tick span { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); font-size: 11px; color: rgba(255,255,255,.55); white-space: nowrap; }
.track-tick.passed { background: rgba(16,45,83,.45); }
.track-tick.passed span { color: rgba(255,255,255,.85); }
.track-flag { position: absolute; right: -1px; top: -10px; bottom: -10px; width: 2px; background: #fff; }
.track-flag span { position: absolute; bottom: calc(100% + 4px); right: 0; font-size: 11.5px; color: #fff; white-space: nowrap; font-weight: 500; }
.track-facts { display: flex; gap: 12px 36px; flex-wrap: wrap; font-size: 13px; color: rgba(255,255,255,.72); }
.track-facts b { display: block; color: #fff; font-size: 15px; font-weight: 600; }
.track-verdict { margin-left: auto; align-self: flex-end; display: inline-flex; gap: 8px; align-items: center; font-size: 13px; color: #fff; }
.track-verdict .dot { width: 8px; height: 8px; border-radius: 50%; background: #5BD6A5; }
.track-verdict.behind .dot { background: var(--yellow); }
.track-verdict.final .dot { background: rgba(255,255,255,.6); }
.track.closed .track-fill { background: rgba(245,185,0,.85); }

/* Compact track for lists */
.mini-track { position: relative; height: 6px; background: var(--line); border-radius: 3px; min-width: 120px; }
.mini-track i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--yellow); border-radius: 3px; }
.mini-track b { position: absolute; top: 0; bottom: 0; border: 1px dashed var(--amber); border-left: 0; border-radius: 0 3px 3px 0; }
.pace { font-size: 12.5px; display: inline-flex; gap: 6px; align-items: center; }
.pace::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.pace.behind { color: var(--amber); }
.pace.behind::before { background: var(--amber); }
.pace.final::before { background: var(--ink-3); }

/* ---------- needs list ---------- */
.needs { list-style: none; margin: 0; padding: 0; }
.needs li { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.needs li::before { content: ""; align-self: stretch; border-radius: 2px; background: var(--ink-3); }
.needs li.tone-amber::before { background: var(--yellow); }
.needs li.tone-red::before { background: var(--red); }
.needs li.tone-blue::before { background: var(--navy-3); }
.needs .need-title { font-weight: 600; }
.needs .need-detail { font-size: 13px; color: var(--ink-2); }
.all-clear { padding: 18px 0; color: var(--ink-2); display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); }
.all-clear svg { width: 18px; height: 18px; stroke: var(--green); fill: none; stroke-width: 2; }

/* ---------- campaign rows ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { border-bottom: 1px solid var(--line); }
.row-link { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(140px, 1fr) auto; gap: 8px 24px; align-items: center; padding: 14px 8px; margin: 0 -8px; color: inherit; text-decoration: none; border-radius: var(--r-control); }
.row-link:hover { background: rgba(16,45,83,.03); color: inherit; }
.row-link .row-title { font-weight: 600; }
.row-link .row-sub { font-size: 12.5px; color: var(--ink-3); }
.row-link .row-figure { text-align: right; font-weight: 600; }
.row-link .row-figure span { display: block; font-weight: 400; font-size: 12.5px; color: var(--ink-3); }

/* ---------- accounts table: account groups with their links as rows ---------- */
.accounts-table tbody.acct + tbody.acct { border-top: 1px solid var(--line-2); }
.accounts-table .acct-head td { background: var(--surface-2); padding-top: 14px; padding-bottom: 14px; }
.accounts-table .acct-head .primary { font-size: 14.5px; }
.accounts-table .acct-link td { padding-top: 9px; padding-bottom: 9px; }
.accounts-table .acct-link td:first-child { padding-left: 36px; position: relative; }
.accounts-table .acct-link td:first-child::before { content: ""; position: absolute; left: 22px; top: 0; bottom: 0; width: 1px; background: var(--line-2); }
.accounts-table .acct-link .url { max-width: 340px; }
.accounts-table .acct-link.is-rejected .url { color: var(--ink-3); text-decoration: line-through; }
.accounts-table .acct-link.is-rejected td.num { color: var(--ink-3); }
.accounts-table tfoot td { border-top: 1px solid var(--line-2); padding-top: 12px; padding-bottom: 12px; }
.accounts-table .share-col { width: 180px; }
.share { display: flex; align-items: center; gap: 10px; }
.share .mini-track { flex: 1; min-width: 80px; }
.share span { font-size: 12.5px; color: var(--ink-3); width: 36px; text-align: right; }
.acct-toggle { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: inherit; }
.acct-toggle .chev { width: 7px; height: 7px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(45deg); transition: transform .15s; margin: 0 2px 3px 0; }
.acct-toggle[aria-expanded="false"] .chev { transform: rotate(-45deg); margin-bottom: 0; }
tbody.acct.collapsed .acct-link { display: none; }
@media (max-width: 700px) { .accounts-table .share-col { display: none; } .accounts-table .acct-link .url { max-width: 200px; } }

/* ---------- sync run strip ---------- */
.run-strip { display: flex; align-items: flex-end; gap: 4px; height: 64px; padding: 12px 0 0; }
.run { display: inline-block; width: 10px; border-radius: 2px; background: var(--green); flex: none; }
.run-partial { background: var(--yellow); }
.run-failed, .run-skipped { background: var(--red); }
.run-running { background: var(--blue); }
.run-legend { display: flex; gap: 6px 14px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.run-legend .run { height: 10px; width: 10px; margin-right: 2px; }

/* ---------- audit log ---------- */
.audit { list-style: none; margin: 0; padding: 0; }
.audit-day h2 { font-size: 13px; color: var(--ink-3); font-weight: 500; padding: 20px 0 8px; border-bottom: 1px solid var(--line); }
.audit-day:first-child h2 { padding-top: 0; }
.audit-entry { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.audit-entry time { font-size: 12.5px; color: var(--ink-3); padding-top: 1px; }
.audit-entry.sensitive { box-shadow: inset 3px 0 0 var(--yellow); padding-left: 10px; margin-left: -10px; }
.audit-what { font-size: 13.5px; }
.audit-diff { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; font-size: 12.5px; }
.audit-diff .k { color: var(--ink-3); display: inline-block; min-width: 110px; }
.audit-diff del { color: var(--red); text-decoration: line-through; background: var(--red-soft); padding: 0 4px; border-radius: 3px; }
.audit-diff ins { color: var(--green); text-decoration: none; background: var(--green-soft); padding: 0 4px; border-radius: 3px; overflow-wrap: anywhere; }
.audit-meta { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

/* ---------- settings layout: purpose on the left, controls on the right ---------- */
.settings-row { display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); gap: 16px 48px; padding: 28px 0; border-top: 1px solid var(--line); }
.settings > .settings-row:first-child, .settings > .settings-row-group:first-child > .settings-row:first-child { border-top: 0; padding-top: 8px; }
.settings-intro h2 { margin-bottom: 4px; }
.settings-intro p { color: var(--ink-3); font-size: 13px; }
.settings-body { max-width: 620px; }
.settings-save { border-top: 1px solid var(--line); padding: 16px 0 8px; justify-content: flex-start; }
.conn { display: flex; gap: 14px; align-items: flex-start; }
.conn-name { font-weight: 600; }
@media (max-width: 900px) { .settings-row { grid-template-columns: minmax(0, 1fr); gap: 12px; } }

/* ---------- video page: approval steps ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; counter-reset: step; }
.step { position: relative; padding-top: 22px; }
.step::before { content: ""; position: absolute; top: 6px; left: 14px; right: -16px; height: 2px; background: var(--line-2); }
.step:last-child::before { display: none; }
.step-done::before { background: var(--green); }
.step-dot { position: absolute; top: 0; left: 0; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--line-2); }
.step-done .step-dot { background: var(--green); border-color: var(--green); }
.step-current .step-dot { border-color: var(--navy-3); box-shadow: 0 0 0 4px var(--blue-soft); }
.step-stopped .step-dot { background: var(--red); border-color: var(--red); }
.step-title { font-weight: 600; margin-top: 4px; }
.step-later .step-title { color: var(--ink-3); font-weight: 500; }
.step-detail { font-size: 12.5px; color: var(--ink-3); }
.decide { display: flex; justify-content: space-between; align-items: center; gap: 16px 24px; flex-wrap: wrap; margin-top: 24px; padding: 16px 20px; background: var(--amber-soft); border-radius: var(--r-sheet); }
.video-figure { margin: 14px 0 6px; }
.video-figure strong { font-size: 28px; font-weight: 600; letter-spacing: -0.01em; margin-right: 10px; }
.video-figure span { color: var(--ink-3); font-size: 13px; }
.video-figure.not-counting strong { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 1.5px; }
@media (max-width: 700px) { .steps { grid-template-columns: minmax(0, 1fr); gap: 14px; } .step::before { display: none; } }

/* ---------- badges & status ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 1px 8px 1px 7px; border-radius: 4px; white-space: nowrap; line-height: 20px; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green { color: var(--green); background: var(--green-soft); }
.badge-amber { color: var(--amber); background: var(--amber-soft); }
.badge-red { color: var(--red); background: var(--red-soft); }
.badge-grey { color: var(--ink-2); background: #EDF1F6; }
.badge-blue { color: var(--blue); background: var(--blue-soft); }
.track .badge { background: rgba(255,255,255,.12); color: #fff; }

.sync-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-3); }
.sync-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.sync-pill[data-state="live"] .dot { background: var(--green); }
.sync-pill[data-state="syncing"] .dot { background: var(--blue); animation: pulse 1.2s infinite; }
.sync-pill[data-state="stale"] .dot, .sync-pill[data-state="delayed"] .dot { background: var(--yellow); }
.sync-pill[data-state="failed"] .dot { background: var(--red); }
.sync-pill b { color: var(--ink-2); font-weight: 500; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- alerts & toasts ---------- */
.alert { border-radius: var(--r-control); padding: 10px 14px; margin-bottom: 16px; font-size: 13.5px; display: flex; gap: 12px; align-items: flex-start; }
.alert > :first-child { flex: 1; }
.alert-ok { background: var(--green-soft); color: #0E5A43; }
.alert-err { background: var(--red-soft); color: #8E2A1F; }
.alert-warn { background: var(--amber-soft); color: #6B4400; }
.alert-info { background: var(--blue-soft); color: #1D4A7C; }
.alert .dismiss { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0 2px; opacity: .7; }
.alert .dismiss:hover { opacity: 1; }

.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 80; width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--navy); color: #fff; border-radius: 8px; padding: 11px 14px; box-shadow: var(--float); font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; animation: toast-in .18s var(--ease); }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #5BD6A5; margin-top: 6px; flex: none; }
.toast.error::before { background: #FF8A7A; }
.toast.leaving { animation: toast-out .16s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12.5px; font-weight: 500; color: var(--ink-3); padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .primary { font-weight: 600; color: var(--ink); text-decoration: none; }
.table a.primary:hover { text-decoration: underline; }
.table .sub { display: block; font-size: 12.5px; color: var(--ink-3); }
.table .url { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.empty { padding: 36px 20px; text-align: center; color: var(--ink-2); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }
tr.row-out { animation: row-out .22s var(--ease) forwards; }
@keyframes row-out { to { opacity: 0; transform: translateX(12px); } }
.changed { animation: changed 1.2s ease; border-radius: 4px; }
@keyframes changed { 0%, 30% { background: var(--yellow-soft); } 100% { background: transparent; } }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r-control); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 500 13.5px/1 inherit; font-family: inherit; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s; }
.btn:hover { background: var(--surface-2); border-color: #B7C3D4; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-3); border-color: var(--navy-3); color: #fff; }
.btn-accent { background: var(--yellow); border-color: var(--yellow); color: var(--navy); font-weight: 600; }
.btn-accent:hover { background: #E8AF00; border-color: #E8AF00; color: var(--navy); }
.btn-danger { color: var(--red); border-color: #EBC2BC; background: var(--surface); }
.btn-danger:hover { background: var(--red-soft); color: var(--red); border-color: #E0A69D; }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-solid:hover { background: #9C2C22; border-color: #9C2C22; color: #fff; }
.btn-success { color: var(--green); border-color: #BFE2D3; }
.btn-success:hover { background: var(--green-soft); color: var(--green); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(16,45,83,.05); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--ink-3) transparent var(--ink-3) transparent; animation: spin .7s linear infinite; }
.btn-primary.is-busy::after, .btn-danger-solid.is-busy::after { border-color: #fff transparent #fff transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
.form { display: grid; gap: 16px; }
.form-row { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field > span, .label { font-size: 13px; font-weight: 500; color: var(--ink); }
.hint { display: block; font-size: 12.5px; color: var(--ink-3); font-weight: 400; margin-top: 1px; }
.field > span .hint { display: inline; margin-left: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=datetime-local], input[type=date], input[type=search], select, textarea {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r-control); background: #fff; color: var(--ink); font: inherit; font-size: 14px; transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #B7C3D4; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy-3); box-shadow: 0 0 0 3px rgba(29,74,130,.14); }
input[aria-invalid="true"] { border-color: var(--red); }
.checks { display: flex; gap: 8px 16px; flex-wrap: wrap; }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--navy); }
.choice { display: inline-flex; gap: 8px; align-items: center; padding: 7px 12px; border: 1px solid var(--line-2); border-radius: var(--r-control); background: #fff; cursor: pointer; font-size: 13.5px; }
.choice:has(input:checked) { border-color: var(--navy-3); background: var(--blue-soft); }
.choice input { accent-color: var(--navy); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input[type=search] { width: 260px; }
.toolbar select { width: auto; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.form-actions .hint { margin-right: auto; }
fieldset.group { border: 0; padding: 0; margin: 0; display: grid; gap: 16px; }
fieldset.group + fieldset.group { border-top: 1px solid var(--line); padding-top: 20px; }
fieldset.group legend { font-weight: 600; font-size: 15px; padding: 0; margin-bottom: 4px; }
fieldset.group legend + p { margin: -10px 0 0; color: var(--ink-3); font-size: 13px; }

/* Live link check */
.linkcheck { font-size: 12.5px; color: var(--ink-3); min-height: 18px; display: flex; gap: 6px; align-items: center; }
.linkcheck::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: transparent; flex: none; }
.linkcheck.ok { color: var(--green); }
.linkcheck.ok::before { background: var(--green); }
.linkcheck.bad { color: var(--red); }
.linkcheck.bad::before { background: var(--red); }
.account-chip { display: inline-flex; gap: 8px; align-items: center; height: 38px; padding: 0 12px; border-radius: var(--r-control); background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 28px 0 0; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 12px; text-decoration: none; color: var(--ink-3); font-weight: 500; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"], .tabs a[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--navy); }
.tabs a .tab-count { font-size: 11.5px; color: var(--ink-3); background: #EDF1F6; border-radius: 9px; padding: 0 6px; }
.tab-panel { padding-top: 24px; }
.js .tab-panel[data-tab]:not(.active) { display: none; }
.js .tab-panel.active { animation: fade .16s ease; }
@keyframes fade { from { opacity: 0; } }

.segmented { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-control); overflow: hidden; background: #fff; }
.segmented button { border: 0; background: none; padding: 6px 11px; font: 500 12.5px/1 inherit; font-family: inherit; color: var(--ink-3); cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button[aria-pressed="true"] { background: var(--navy); color: #fff; }

/* ---------- chart & feed ---------- */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); font-size: 13px; text-align: center; padding: 20px; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 12px; padding: 10px 0; position: relative; }
.feed li + li::after { content: ""; position: absolute; left: 4px; top: -10px; height: 18px; width: 1px; background: var(--line); }
.feed .pip { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); margin-top: 6px; }
.feed .pip.t-milestone, .feed .pip.t-target_reached { background: var(--yellow); }
.feed .pip.t-synced, .feed .pip.t-client_approved, .feed .pip.t-launched { background: var(--green); }
.feed .pip.t-video_approved, .feed .pip.t-video_submitted { background: var(--navy-3); }
.feed .pip.t-video_rejected, .feed .pip.t-client_rejected { background: var(--red); }
.feed-title { font-weight: 500; font-size: 13.5px; }
.feed-detail { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.feed-time { font-size: 12px; color: var(--ink-3); }

dl.kv { display: grid; grid-template-columns: minmax(120px, 34%) minmax(0, 1fr); gap: 10px 16px; margin: 0; font-size: 13.5px; }
dl.kv dt { color: var(--ink-3); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }

details.panel { border: 1px solid var(--line); border-radius: var(--r-control); background: #fff; }
details.panel > summary { cursor: pointer; padding: 9px 12px; font-weight: 500; font-size: 13px; list-style: none; display: flex; gap: 6px; align-items: center; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(-45deg); transition: transform .15s; }
details.panel[open] > summary::before { transform: rotate(45deg); }
details.panel > div { padding: 0 12px 12px; }

/* ---------- dialog ---------- */
dialog.dialog { border: 0; padding: 0; border-radius: 12px; box-shadow: var(--float); width: min(480px, calc(100vw - 32px)); color: var(--ink); }
dialog.dialog::backdrop { background: rgba(16, 45, 83, .42); }
dialog.dialog[open] { animation: dialog-in .16s var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px) scale(.99); } }
.dialog-body { padding: 22px 24px 8px; }
.dialog-body h2 { font-size: 18px; margin-bottom: 6px; }
.dialog-body p { color: var(--ink-2); }
.dialog-body .form { margin-top: 14px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 20px; }

/* Inline decision (approve / reject with reason) */
.decision { display: grid; gap: 6px; }
.decision-actions { display: flex; gap: 6px; }
.decision-reason { display: grid; gap: 6px; }
.decision input[type=text] { height: 32px; font-size: 13px; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 1fr); }
.auth-brand { background: var(--navy); color: #fff; padding: 40px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.auth-brand h1 { color: #fff; font-size: 30px; max-width: 18ch; line-height: 1.2; }
.auth-brand p { color: rgba(255,255,255,.72); max-width: 44ch; margin-top: 12px; }
.auth-logo { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 10px; text-decoration: none; }
.auth-logo img { width: 86px; height: auto; }
.auth-logo span { color: var(--yellow); font-size: 13px; font-weight: 500; }
.auth-demo { background: var(--navy-2); border-radius: var(--r-hero); padding: 22px 24px 18px; max-width: 520px; }
.auth-demo .track-rail { margin: 22px 0 30px; }
.auth-demo .caption { font-size: 12.5px; color: rgba(255,255,255,.6); }
.auth-form { display: grid; place-items: center; padding: 32px 20px; background: var(--surface); }
.auth-form > div { width: 100%; max-width: 360px; }
.auth-form h2 { font-size: 22px; }

/* ---------- notices ---------- */
.notice { max-width: 460px; margin: 72px auto; }
.notice .icon { width: 44px; height: 44px; border-radius: 10px; background: #EDF1F6; display: grid; place-items: center; margin-bottom: 18px; }
.notice .icon svg { width: 22px; height: 22px; stroke: var(--ink-2); fill: none; stroke-width: 2; }
.notice h1 { font-size: 22px; margin-bottom: 8px; }
.notice p { color: var(--ink-2); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  /* When stacked, the column holding the user's next action comes first. */
  .grid-main.actions-first > aside { order: -1; }
  .main { padding: 24px 28px 56px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: var(--navy); color: #fff; padding: 10px 16px; position: sticky; top: 0; z-index: 30; }
  .topbar .brand { padding: 0; }
  .topbar .brand img { width: 30px; height: 30px; }
  .menu-btn { background: none; border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: var(--r-control); height: 34px; padding: 0 12px; font: 500 13px/1 inherit; font-family: inherit; cursor: pointer; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 85vw); z-index: 40; transform: translateX(-100%); transition: transform .2s var(--ease); }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(10, 20, 40, .45); }
  .main { padding: 20px 16px 48px; }
  .grid-2, .grid-3, .form-row { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 .metric:nth-child(3) { padding-left: 0; border-left: 0; }
  .grid-4 .metric:nth-child(n+3) { border-top: 1px solid var(--line); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { padding: 28px 20px; }
  .auth-demo { display: none; }
  .row-link { grid-template-columns: minmax(0, 1fr) auto; }
  .row-link .row-track { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  h1 { font-size: 22px; }
  .track { padding: 18px 18px 16px; }
  .track-figure { text-align: left; }
  .track-figure strong { font-size: 32px; }
  .track-tick span { display: none; }
  .track-verdict { margin-left: 0; }
  .toolbar input[type=search] { width: 100%; }
  .card, .sheet { padding: 16px; }
  dl.kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  dl.kv dd { margin-bottom: 10px; }
  .needs li { grid-template-columns: 4px minmax(0, 1fr); }
  .needs li > .btn, .needs li > a.btn { grid-column: 2; justify-self: start; }
  /* Decision tables become stacked rows so the actions stay on screen. */
  .table.stack-sm, .table.stack-sm tbody, .table.stack-sm tr, .table.stack-sm td { display: block; width: 100%; }
  .table.stack-sm thead { display: none; }
  .table.stack-sm tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .table.stack-sm tbody tr:last-child { border-bottom: 0; }
  .table.stack-sm td { border: 0; padding: 3px 16px; min-width: 0 !important; }
  .table.stack-sm td.num { text-align: left; }
  .table.stack-sm td.num .sub { display: inline; margin-left: 6px; }
  .table.stack-sm .decision { margin-top: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
@media print {
  .sidebar, .topbar, .head-actions, .btn, .tabs, .toasts { display: none !important; }
  .shell { display: block; }
  .js .tab-panel[data-tab] { display: block !important; }
}

/* ---------- comment thread (client portal and DOPR video page) ---------- */
.thread-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; max-width: 72ch; }
.msg { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line-2); border-radius: var(--r-control); padding: 10px 14px; }
.msg-client { border-left-color: var(--yellow); }
.msg-dopr { border-left-color: var(--navy-3); background: var(--surface-2); }
.msg-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; color: var(--ink-3); }
.msg-meta strong { color: var(--ink); font-size: 13px; }
.msg-body { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.thread-form { margin-top: 14px; max-width: 72ch; }
.thread-form textarea { width: 100%; }
