/* ============================================================
   Entirely Marketing Cockpit

   The design handoff (the "Entirely Marketing Workspace" canvas)
   authored every style inline, because its prototype dialect
   streams markup. That did NOT come across: the CloudFront CSP is
   script-src 'self' with no 'unsafe-inline', so all of it lives in
   this file and all behaviour lives in app.js.

   Palette and type are the handoff's, which are the brand tokens in
   tokens/*.css: sand ground, white cards, black rail, neon accent,
   the six solution hues. Bar widths and solution hues are the only
   styles set from JS, as style attributes.
   ============================================================ */

:root {
  --neon: #c7f100;
  --moss: #003e26;
  --sage: #e3ebc2;
  --sand: #f2ebe3;
  --ink: #000;
  --slate: #2e2e2e;
  --cement: #9b9b9a;
  --line: rgba(0, 0, 0, 0.1);
  --line-strong: rgba(0, 0, 0, 0.16);
  --apricot: #ffa382;
  --rowan: #f44040;
  --aqua: #78ede3;
  --lime: #42dd41;

  --font-sans: 'Outfit', Aptos, Calibri, system-ui, sans-serif;
  --font-display: 'Bagoss Standard', Georgia, serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --fast: 120ms;
}

* { box-sizing: border-box; }

/* The `hidden` attribute is enforced by the UA stylesheet as
   [hidden] { display: none }, which ANY class rule that sets `display` beats on
   specificity. Global and !important on purpose - every `hidden` toggle in
   app.js depends on this, and the failure is silent (growth-radar hit it). */
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0; background: var(--sand); color: var(--ink);
  font-family: var(--font-sans); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--neon); outline-offset: 2px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ------------------------------------------------------------------ gate */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 32px; background: #000; color: #fff; }
.gate-card { max-width: 460px; text-align: center; display: flex; flex-direction: column; gap: 14px; }
.gate-eyebrow { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.6); }
.gate-title { margin: 0; font-family: var(--font-display); font-weight: 300; font-size: 38px; line-height: 1.15; color: var(--neon); }
.gate-message { margin: 0; font-size: 14.5px; color: rgba(255,255,255,.78); text-wrap: pretty; }
.gate-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }

/* --------------------------------------------------------------- buttons */
.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; gap: 8px; border-radius: 999px;
  padding: 10px 18px; font-weight: 600; font-size: 13px; text-decoration: none;
  border: 1px solid transparent; transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.btn-primary { background: var(--neon); color: #000; border-color: var(--neon); }
.btn-primary:hover:not(:disabled) { background: var(--lime); border-color: var(--lime); }
.btn-ghost { background: #fff; color: #000; border-color: var(--line-strong); }
.btn-ghost:hover:not(:disabled) { border-color: #000; }
.gate .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.btn-primary:disabled, .btn-ghost:disabled { opacity: .55; cursor: default; }
.sm { padding: 7px 13px; font-size: 12.5px; }
.icon-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(255,255,255,.2); background: transparent; color: #fff; display: grid; place-items: center; font-size: 18px; line-height: 1; }

/* ----------------------------------------------------------------- shell */
.shell { display: flex; height: 100vh; overflow: hidden; }

.rail { width: 248px; flex-shrink: 0; background: #000; color: #fff; display: flex; flex-direction: column; padding: 20px 14px 16px; }
.rail-brand { padding: 4px 10px 18px; }
.lockup { font-family: var(--font-display); font-size: 22px; font-weight: 400; letter-spacing: -.01em; }
.rail-workspace { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 9px 11px; margin-bottom: 16px; }
.ws-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--neon); color: #000; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.ws-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ws-name { font-size: 12.5px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-sub { font-size: 10.5px; color: rgba(255,255,255,.5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-label { margin: 0; font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.35); padding: 0 10px 8px; }
.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: transparent; border: 0; border-left: 3px solid transparent; border-radius: 9px;
  padding: 10px 11px; font-size: 14px; color: rgba(255,255,255,.72); text-decoration: none;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item[aria-current="page"] { background: rgba(255,255,255,.1); border-left-color: var(--neon); color: #fff; font-weight: 600; }
.nav-item svg { flex-shrink: 0; }
.rail-live { margin-top: 16px; padding: 14px; border-radius: 14px; background: rgba(199,241,0,.1); border: 1px solid rgba(199,241,0,.28); }
.rail-live-head { margin: 0 0 6px; display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--neon); }
.rail-live-text { margin: 0; font-size: 12px; line-height: 1.45; color: rgba(255,255,255,.72); }
.rail-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 2px; border-top: 1px solid rgba(255,255,255,.1); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--sage); color: var(--moss); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex-shrink: 0; border: 0; }
.pulse { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--neon); animation: sparkpulse 1.8s ease-in-out infinite; }
@keyframes sparkpulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }

.column { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { flex-shrink: 0; min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 10px 30px; background: #fff; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.top-titles { min-width: 0; }
.top-title { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 22px; line-height: 1.1; }
.top-sub { margin: 1px 0 0; font-size: 12.5px; color: var(--cement); }
.top-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.pill-dark { background: #000; color: #fff; }
.pill-mark { width: 16px; height: 16px; border-radius: 4px; background: var(--neon); color: #000; display: grid; place-items: center; font-size: 9px; font-weight: 800; }
.pill-warn { background: var(--apricot); color: #000; }
.badge { font-size: 11px; font-weight: 700; color: #000; background: var(--neon); border-radius: 999px; min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; }
.usermenu { position: relative; }
.avatar-btn { width: 38px; height: 38px; border: 1px solid var(--line-strong); font-size: 13px; }
.menu { position: absolute; top: 46px; right: 0; z-index: 41; width: 250px; background: #fff; border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.16); padding: 8px 0; }
.menu p { margin: 0; padding: 0 16px; }
.menu-name { font-size: 13.5px; font-weight: 600; padding-top: 6px !important; }
.menu-email { font-size: 12px; color: var(--cement); margin-top: 2px !important; word-break: break-all; }
.menu-role { display: inline-block; font-size: 10.5px; font-weight: 600; color: var(--moss); background: var(--sage); padding: 3px 9px; border-radius: 999px; margin: 8px 16px 6px !important; }
.menu-item { display: block; width: 100%; text-align: left; background: transparent; border: 0; padding: 10px 16px; font-size: 13px; color: var(--slate); text-decoration: none; }
.menu-item:hover { background: var(--sand); }
.menu-item.danger { color: #c0362c; font-weight: 600; }

.main { flex: 1; min-height: 0; overflow: auto; }
.page { padding: 26px 34px 56px; max-width: 1180px; margin: 0 auto; }

/* ------------------------------------------------------------ typography */
.h2 { margin: 0; font-family: var(--font-display); font-weight: 300; font-size: 30px; line-height: 1.15; letter-spacing: -.01em; text-wrap: balance; }
.h3 { margin: 0; font-size: 15px; font-weight: 600; }
.eyebrow { margin: 0 0 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--cement); }
.muted { color: var(--cement); }
.small { font-size: 12.5px; }
.lead { margin: 6px 0 0; font-size: 14px; color: var(--slate); max-width: 62ch; }
.mono { font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------- cards */
.card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 20px 22px; min-width: 0; }
.card-dark { background: #000; color: #fff; border-color: #000; }
.card-dark .muted { color: rgba(255,255,255,.55); }
.card-neon { background: var(--neon); border-color: var(--neon); }
.card-neon .muted { color: var(--moss); }
.card-moss { background: var(--moss); color: #fff; border-color: var(--moss); }
.card-moss .muted { color: rgba(255,255,255,.6); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head .h3 { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-hero { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.section { margin-top: 24px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head .h3 { font-size: 16px; }
@media (max-width: 1080px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3, .grid-hero { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .grid-4, .grid-2 { grid-template-columns: 1fr; } .rail { display: none; } .page { padding: 18px; } }

/* ------------------------------------------------------------------ KPIs */
.kpi { display: flex; flex-direction: column; gap: 4px; min-height: 128px; }
.kpi-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--cement); }
.card-dark .kpi-label, .card-moss .kpi-label { color: rgba(255,255,255,.55); }
.card-neon .kpi-label { color: var(--moss); }
.kpi-value { font-family: var(--font-display); font-weight: 400; font-size: 34px; line-height: 1.05; margin-top: auto; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--cement); }
.card-dark .kpi-sub, .card-moss .kpi-sub { color: rgba(255,255,255,.6); }
.card-neon .kpi-sub { color: var(--moss); }

/* ------------------------------------------------------------ concept tabs */
.tabs { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.tab { border: 0; background: transparent; border-radius: 999px; padding: 8px 15px; font-size: 12.5px; font-weight: 600; color: var(--slate); }
.tab[aria-selected="true"] { background: #000; color: #fff; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.caption { font-size: 12px; color: var(--cement); max-width: 52ch; text-align: right; }

/* ------------------------------------------------------------------- bars */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 1.2fr) minmax(0, 3fr) auto auto; align-items: center; gap: 12px; font-size: 13px; }
.bar-row.two { grid-template-columns: minmax(120px, 1.2fr) minmax(0, 3fr) auto; }
.bar-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--cement); }
.bar-track { height: 10px; border-radius: 999px; background: var(--sand); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: #000; min-width: 2px; transition: width 600ms var(--ease); }
.bar-val { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-meta { color: var(--cement); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card-dark .bar-track { background: rgba(255,255,255,.12); }
.card-dark .bar-fill { background: var(--neon); }
.card-dark .bar-meta { color: rgba(255,255,255,.5); }

/* ------------------------------------------------------------- stage flow */
.stages { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 1080px) { .stages { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stage {
  display: flex; flex-direction: column; gap: 6px; text-align: left; background: #fff;
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 12px 10px; min-height: 132px;
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.stage:hover { border-color: #000; }
.stage[aria-pressed="true"] { border-color: #000; box-shadow: 0 0 0 2px var(--neon) inset; }
.stage-num { width: 24px; height: 24px; border-radius: 50%; background: #000; color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.stage-name { font-size: 12px; font-weight: 600; line-height: 1.25; }
.stage-arr { font-family: var(--font-display); font-size: 20px; margin-top: auto; font-variant-numeric: tabular-nums; }
.stage-n { font-size: 11px; color: var(--cement); }
.stage-track { height: 5px; border-radius: 999px; background: var(--sand); overflow: hidden; }
.stage-fill { height: 100%; background: var(--neon); border-radius: 999px; }

/* --------------------------------------------------------------- objectives */
.objective { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 20px; align-items: center; }
@media (max-width: 720px) { .objective { grid-template-columns: 1fr; } }
.status { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; }
.status.on-track, .status.achieved { background: var(--sage); color: var(--moss); }
.status.behind { background: var(--apricot); color: #000; }
.status.unmeasured, .status.no-target { background: var(--sand); color: var(--slate); }
.status.provisional { background: #fff; border: 1px dashed var(--line-strong); color: var(--slate); }
.obj-title { margin: 8px 0 2px; font-family: var(--font-display); font-size: 20px; font-weight: 400; }
.obj-meta { font-size: 12.5px; color: var(--cement); }
.obj-detail { margin: 8px 0 0; font-size: 12.5px; color: var(--slate); max-width: 70ch; }
.obj-kpi { text-align: right; }
.obj-kpi .kpi-value { font-size: 28px; }
.progress { height: 8px; border-radius: 999px; background: var(--sand); overflow: hidden; margin-top: 10px; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--moss); }

/* --------------------------------------------------------------------- lists */
.list { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { font-size: 12px; color: var(--cement); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.row-sub { display: block; font-size: 11.5px; color: var(--cement); font-weight: 400; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--sand); color: var(--slate); }
.tag.neon { background: var(--neon); color: #000; }
.tag.apricot { background: var(--apricot); color: #000; }
.tag.aqua { background: var(--aqua); color: #000; }
.tag.rowan { background: var(--rowan); color: #fff; }
.tag.sage { background: var(--sage); color: var(--moss); }
.card-dark .tag { background: rgba(255,255,255,.12); color: #fff; }
.link { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; text-underline-offset: 3px; font: inherit; }

/* -------------------------------------------------------------------- table */
.table-scroll { overflow-x: auto; }
table.deals { width: 100%; border-collapse: collapse; font-size: 13px; }
.deals th { text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--cement); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.deals td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.deals td.num, .deals th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.deals tr:hover td { background: var(--sand); }

/* -------------------------------------------------------------------- insights */
.insight { display: flex; flex-direction: column; gap: 10px; }
.insight p { margin: 0; font-size: 14px; line-height: 1.5; }
.footprint { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 720px) { .footprint { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sol { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.sol-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; }
.sol-mark { width: 26px; height: 26px; border-radius: 8px; color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.sol-n { font-family: var(--font-display); font-size: 24px; }
.sol-sub { font-size: 11px; color: var(--cement); }

/* --------------------------------------------------------------------- notice */
.notice { border: 1px dashed var(--line-strong); border-radius: 18px; padding: 28px; background: rgba(255,255,255,.6); }
.notice .h3 { margin-bottom: 6px; }
.notice p { margin: 0; color: var(--slate); max-width: 70ch; }
.status-line { margin: 10px 0 0; font-size: 13px; color: var(--slate); }
.status-line.bad { color: #c0362c; }
.loading { display: inline-flex; align-items: center; gap: 10px; color: var(--cement); font-size: 13px; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: #000; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------------- drawer */
.drawer-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.28); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 61; width: 400px; max-width: 92vw; background: #000; color: #fff; display: flex; flex-direction: column; box-shadow: -16px 0 44px rgba(0,0,0,.3); animation: riseIn .24s ease both; }
@keyframes riseIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { flex-shrink: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px; border-bottom: 1px solid rgba(255,255,255,.12); }
.drawer-title { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.drawer-sub { margin: 4px 0 0; font-size: 11.5px; color: rgba(255,255,255,.55); }
.drawer-body { flex: 1; min-height: 0; overflow: auto; padding: 8px 0 14px; }
.act { display: flex; gap: 12px; padding: 10px 22px; }
.act .dot { margin-top: 6px; }
.act-title { font-size: 13px; font-weight: 600; }
.act-meta { font-size: 12px; color: rgba(255,255,255,.62); margin-top: 2px; }
.act-time { font-size: 10.5px; color: rgba(255,255,255,.4); margin-top: 3px; font-variant-numeric: tabular-nums; }
.drawer-foot { flex-shrink: 0; margin: 0; padding: 12px 22px; border-top: 1px solid rgba(255,255,255,.12); font-size: 10.5px; line-height: 1.5; color: rgba(255,255,255,.45); }
