/* DDReg Regulatory Operations.
   Brand: ddregpharma.com blue (#09598E) and the logo's cyan. Shell patterns follow the Intech portal:
   light sidebar with per-dashboard colour chips, collapsible icon rail, app bar with search / bell / theme,
   KPI cards with drill-down, chart cards that expand. */
@font-face { font-family: "Archivo"; src: url("/static/fonts/archivo-latin.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-style: normal; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("/static/fonts/archivo-latin-italic.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-style: italic; font-display: swap; }

:root {
  --brand: #09598E;
  --brand-accent: #09598E;
  --navy: #06243d;
  --navy-2: #0a3152;
  --cyan: #07b0e7;

  --page: #eef2f5;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --ink: #0d1f2d;
  --ink-2: #4a5f6c;
  --ink-3: #8597a3;
  --line: #e1e7ec;
  --line-strong: #cfd9e1;
  --axis: #b9c7d1;
  --wash: #e6f1f9;
  --hover: #eef3f7;

  /* charts (validated: tools/validate_palette, light + dark) */
  --s1: #09598E; --s2: #eb6834; --s3: #1baf7a;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --good-text: #006300;

  /* each dashboard's signature colour: nav chip, KPI chips, card hover */
  --a-overview: #09598E;
  --a-client_a: #1baf7a;
  --a-client_b: #eb6834;
  --a-ga: #6250d6;
  --a-tasks: #d6457f;
  --a-admin: #557174;

  --shadow: 0 1px 2px rgba(6, 36, 61, .06), 0 1px 1px rgba(6, 36, 61, .03);
  --shadow-pop: 0 18px 48px -14px rgba(6, 36, 61, .35);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --side-w: 248px;
  color-scheme: light;
  font-family: "Archivo", system-ui, "Segoe UI", sans-serif;
}
/* Night mode: calm midnight slate, colours lifted just enough to read on dark cards. */
:root[data-theme="dark"] {
  --brand-accent: #6cb8ef;
  --page: #0e131a;
  --surface: #161c25;
  --surface-2: #1c2330;
  --ink: #e7ebf1;
  --ink-2: #b3bbc8;
  --ink-3: #8590a1;
  --line: #252d3a;
  --line-strong: #323c4c;
  --axis: #3a4556;
  --wash: #17304a;
  --hover: #1f2836;
  --s1: #3d9be0; --s2: #d95926; --s3: #199e70;
  --good-text: #6ee08f;
  --a-overview: #3d9be0; --a-client_a: #2fbf8f; --a-client_b: #f59a4a; --a-ga: #a197f0; --a-tasks: #e27aa5; --a-admin: #8fb3b6;
  --shadow: inset 0 1px 0 rgba(255,255,255,.03), 0 1px 3px rgba(0,0,0,.35);
  --shadow-pop: 0 18px 48px -14px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
code, kbd { background: var(--hover); padding: 1px 6px; border-radius: 4px; font-size: 11.5px; font-family: inherit; }
kbd { border: 1px solid var(--line-strong); background: transparent; color: var(--ink-3); }
:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 2px; border-radius: 4px; }
button { font: inherit; color: inherit; }
svg { flex: none; }

/* ================= splash (logo arrows sweep in, then the mark lands) ================= */
.splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: radial-gradient(circle at 50% 45%, #0b3a61 0%, var(--navy) 65%); overflow: hidden; }
.splash.leave { animation: splash-out .55s var(--ease) forwards; }
.splash-swoosh { position: absolute; width: min(900px, 120vw); top: 50%; left: 50%; transform: translate(-50%, -58%); }
.sw { fill: none; stroke-width: 14; stroke-linecap: round; stroke-dasharray: 700; stroke-dashoffset: 700; animation: draw .9s var(--ease) forwards; }
.sw-2 { stroke-width: 10; animation-delay: .18s; }
.splash-mark { position: relative; display: grid; justify-items: center; gap: 18px; }
.splash-disc { position: relative; width: 210px; height: 210px; border-radius: 50%; background: #fff; display: grid; place-items: center; overflow: hidden; transform: scale(.2); opacity: 0;
  box-shadow: 0 0 0 10px rgba(7, 176, 231, .12), 0 0 80px rgba(7, 176, 231, .35); animation: disc-in .7s .55s var(--ease) forwards; }
.splash-disc img { width: 160px; }
.sheen { position: absolute; inset: -20%; background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,.85) 50%, transparent 60%); transform: translateX(-120%); animation: sheen .9s 1.15s ease-out forwards; }
.splash-name { margin: 0; color: #cfe6f6; font-size: 15px; font-stretch: 115%; letter-spacing: .02em; opacity: 0; animation: fade-up .5s 1.05s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes disc-in { to { transform: scale(1); opacity: 1; } }
@keyframes sheen { to { transform: translateX(120%); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes splash-out { to { opacity: 0; transform: scale(1.04); visibility: hidden; } }

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Quick cut (about a second): sign-out over the whole screen, dashboard switches over the page area. */
.splash.quick .splash-swoosh { width: min(760px, 110%); }
.splash.quick .sw { animation-duration: .5s; }
.splash.quick .sw-2 { animation-delay: .08s; }
.splash.quick .splash-disc { width: 132px; height: 132px; animation: disc-in .4s .2s var(--ease) forwards; }
.splash.quick .splash-disc img { width: 100px; }
.splash.quick .sheen { animation: sheen .55s .48s ease-out forwards; }
.splash.quick .splash-name { color: #fff; font-size: 17px; font-weight: 650; animation: fade-up .35s .36s var(--ease) forwards; }
.splash.quick .splash-name::after { content: ""; display: block; width: 44px; height: 3px; margin: 10px auto 0; border-radius: 3px; background: var(--swap-accent, var(--cyan)); }
.splash.quick.leave { animation: splash-out .36s var(--ease) forwards; }
/* The switch covers only the page area, so the sidebar you just clicked in stays put. */
.swap { position: fixed; inset: 0 0 0 var(--side-w); z-index: 25; }
@media (max-width: 960px) { .swap { left: 0; } }

/* ================= loader: the logo arrows drawing on a loop, the mark breathing between them ================= */
.loader-wrap { display: grid; place-items: center; padding: 80px 0; gap: 12px; color: var(--ink-3); font-size: 13px; }
.mini-splash { position: relative; width: 150px; height: 72px; display: grid; place-items: center; }
.mini-splash svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.mini-splash .sw { animation: draw-loop 1.5s var(--ease) infinite; }
.mini-splash .sw-2 { animation-delay: .15s; }
.mini-splash img { position: relative; width: 40px; height: 40px; border-radius: 50%; background: #fff; padding: 5px; box-shadow: 0 0 0 5px rgba(7, 176, 231, .14); animation: breathe 1.5s ease-in-out infinite; }
@keyframes draw-loop { 0% { stroke-dashoffset: 700; opacity: 1; } 55% { stroke-dashoffset: 0; opacity: 1; } 85% { stroke-dashoffset: 0; opacity: 0; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes breathe { 50% { transform: scale(.88); } }

/* ================= login ================= */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.25fr minmax(380px, 1fr); }
.login-hero { position: relative; background: radial-gradient(ellipse at 30% 40%, #0b3a61 0%, var(--navy) 70%); color: #fff; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 44px 56px; }
#login-map { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-plate { position: relative; align-self: flex-start; background: #fff; border-radius: 14px; padding: 10px 18px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); animation: fade-up .6s .1s var(--ease) both; }
.hero-plate img { height: 62px; display: block; }
.login-copy { position: relative; max-width: 520px; animation: fade-up .7s .2s var(--ease) both; }
.login-copy h1 { font-size: clamp(34px, 4.2vw, 56px); line-height: 1.02; font-weight: 800; font-style: italic; font-stretch: 118%; letter-spacing: -.01em; }
.login-copy p { color: #a9c6dc; font-size: 16px; max-width: 44ch; margin: 18px 0 0; }
.login-copy small { display: block; margin-top: 26px; color: #6f93ae; font-size: 12px; }
.login-side { background: var(--page); display: grid; place-items: center; padding: 32px; }
.login-card { width: min(430px, 100%); display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 18px; padding: 30px; box-shadow: var(--shadow-pop); animation: fade-up .6s .1s var(--ease) both; }
.login-card h2 { font-size: 22px; font-weight: 750; font-stretch: 108%; }
.login-card > p { margin: -10px 0 4px; color: var(--ink-3); font-size: 13px; }
.field { display: grid; gap: 6px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.field span.in { position: relative; display: block; }
.field svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-3); }
.field input { width: 100%; padding: 11px 12px 11px 38px; border: 1.5px solid var(--line-strong); border-radius: 10px; font: inherit; font-size: 14.5px; background: var(--surface-2); color: var(--ink); transition: border-color .2s, box-shadow .2s; }
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
.error { color: var(--critical); margin: 0; min-height: 1.2em; font-size: 13px; }
.login-card.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.btn-primary { position: relative; overflow: hidden; background: linear-gradient(100deg, var(--brand) 0%, #0b6fae 100%); color: #fff; border: 0; padding: 12px; border-radius: 10px; font-weight: 700; font-size: 15px; cursor: pointer; transition: transform .15s, box-shadow .2s; }
.btn-primary:hover { box-shadow: 0 8px 20px -8px rgba(9, 89, 142, .7); }
.btn-primary:active { transform: scale(.98); }
.btn-primary.busy { opacity: .7; pointer-events: none; }
.demo p { margin: 2px 0 8px; }
.demo-users { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.demo-users button { text-align: left; border: 1px solid var(--line-strong); background: var(--surface-2); border-radius: 10px; padding: 7px 9px; cursor: pointer; transition: border-color .15s, background .15s, transform .15s; display: flex; gap: 9px; align-items: center; }
.demo-users button:hover { border-color: var(--brand); background: var(--wash); transform: translateY(-1px); }
.demo-users b { display: block; font-size: 12.5px; }
.demo-users .r { color: var(--ink-2); font-size: 11px; }

/* ================= shell ================= */
.shell { display: flex; min-height: 100vh; background: linear-gradient(to right, var(--surface) calc(var(--side-w) - 1px), var(--line) calc(var(--side-w) - 1px), var(--line) var(--side-w), var(--page) var(--side-w)); }
.shell.enter { animation: fade-in .5s var(--ease); }
@keyframes fade-in { from { opacity: 0; } }
.sidebar { width: var(--side-w); flex: none; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; transition: width .2s var(--ease); z-index: 30; overflow: hidden; }
.side-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px 18px; }
.side-logo { height: 54px; width: auto; }
:root[data-theme="dark"] .side-logo, :root[data-theme="dark"] .side-mark { background: rgba(255,255,255,.94); border-radius: 10px; padding: 4px 8px; }
.side-mark { width: 40px; height: 40px; object-fit: contain; }
.side-head .icon-btn { margin-left: auto; }
#nav { display: grid; gap: 4px; padding: 8px 12px; }
#nav a { display: flex; align-items: center; gap: 11px; height: 42px; padding: 0 9px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-size: 13.5px; font-weight: 500; transition: background .15s, color .15s; white-space: nowrap; }
#nav a:hover { background: var(--hover); color: var(--ink); }
#nav a.active { color: var(--ink); font-weight: 650; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.chip { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); transition: background .2s, color .2s, transform .2s var(--ease); }
.chip svg { width: 16px; height: 16px; }
#nav a.active .chip { background: var(--accent); color: #fff; transform: scale(1.04); }
.chip.lg { width: 42px; height: 42px; border-radius: 12px; background: var(--accent); color: #fff; box-shadow: 0 8px 18px -8px var(--accent); }
.chip.lg svg { width: 21px; height: 21px; }
.side-foot { margin-top: auto; padding: 12px; display: grid; gap: 6px; }
.user-card { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 8px 10px; }
.avatar { position: relative; width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--cyan), var(--brand)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.avatar .online { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: var(--good); border: 2px solid var(--surface-2); }
.user-text { min-width: 0; flex: 1; display: grid; line-height: 1.2; }
.user-text b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-text small { color: var(--ink-3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-scope { margin: 0 4px; color: var(--ink-3); font-size: 11.5px; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--ink-2); display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s, border-color .15s; position: relative; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.signout:hover { color: var(--critical); background: color-mix(in srgb, var(--critical) 9%, transparent); border-color: color-mix(in srgb, var(--critical) 30%, transparent); }
.icon-btn.signout:hover svg { transform: translateX(2px); }
.icon-btn.signout svg { transition: transform .15s; }
.only-collapsed, .only-mobile { display: none !important; }

/* collapsed icon rail */
@media (min-width: 961px) {
  :root[data-sidebar="collapsed"] { --side-w: 76px; }
  :root[data-sidebar="collapsed"] .only-expanded { display: none !important; }
  :root[data-sidebar="collapsed"] .only-collapsed { display: block !important; }
  :root[data-sidebar="collapsed"] .side-head { flex-direction: column; padding: 14px 0 6px; }
  :root[data-sidebar="collapsed"] .side-head .icon-btn { margin: 0; }
  :root[data-sidebar="collapsed"] #nav a { justify-content: center; padding: 0; height: 48px; }
  :root[data-sidebar="collapsed"] #nav a .label { display: none; }
  :root[data-sidebar="collapsed"] #nav a .chip { width: 38px; height: 38px; }
  :root[data-sidebar="collapsed"] .user-card { justify-content: center; border-color: transparent; background: transparent; padding: 0; }
}

main { flex: 1; min-width: 0; }
.appbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 28px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.appbar-right { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.palette-btn { display: flex; align-items: center; gap: 9px; width: 320px; max-width: 50vw; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink-3); font-size: 13px; cursor: pointer; transition: border-color .15s; }
.palette-btn:hover { border-color: var(--brand); }
.palette-btn kbd { margin-left: auto; }
.palette-btn .pb-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pb-icon { display: inline-grid; color: var(--ink-3); }
.pb-icon svg { width: 15px; height: 15px; }
.bell-wrap { position: relative; }
.badge { position: absolute; top: 1px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--critical); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); animation: pop .4s var(--ease); }
@keyframes pop { from { transform: scale(0); } }
.bell-ring svg { animation: ring 1.2s .4s ease-in-out 2; transform-origin: 50% 10%; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(8deg); } 60% { transform: rotate(-4deg); } }
.pop { position: absolute; right: 0; top: 44px; width: 360px; max-width: calc(100vw - 24px); max-height: min(480px, calc(100vh - 80px)); overflow: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: var(--shadow-pop); animation: drop .22s var(--ease); }
@keyframes drop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.pop header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 650; font-size: 14px; }
.pop ul { list-style: none; margin: 0; padding: 6px; display: grid; gap: 2px; }
.pop li a { display: flex; gap: 10px; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.pop li a:hover { background: var(--hover); }
.pop li i { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; }
.pop li b { display: block; font-weight: 550; font-size: 13.5px; line-height: 1.3; }
.pop li small { color: var(--ink-3); font-size: 12px; }
.count-pill { background: var(--hover); color: var(--ink-2); border-radius: 99px; padding: 1px 8px; font-size: 11.5px; }

.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding: 22px 28px 4px; }
.ph-title { display: flex; gap: 14px; align-items: center; }
.pagehead h1 { font-size: 25px; font-weight: 800; font-style: italic; font-stretch: 114%; letter-spacing: -.01em; line-height: 1.1; }
.pagehead p { margin: 3px 0 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters label { display: grid; gap: 3px; font-size: 11.5px; color: var(--ink-2); font-weight: 600; }
.filters select { font: inherit; font-size: 13px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink); min-width: 140px; cursor: pointer; transition: border-color .2s; }
.filters select:hover { border-color: var(--accent); }
.filters select.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.content { padding: 16px 28px 48px; display: grid; gap: 16px; }
.content.enter > * { animation: rise .45s var(--ease) both; }
.content.enter > *:nth-child(2) { animation-delay: .05s; }
.content.enter > *:nth-child(3) { animation-delay: .1s; }
.content.enter > *:nth-child(n+4) { animation-delay: .15s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* cards pick up the dashboard's accent on hover */
.card { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; min-width: 0; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line-strong)); }
.card.link:hover, .card:focus-within { border-color: color-mix(in srgb, var(--accent) 65%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent); }

/* ================= overview hero (world map) ================= */
.hero { position: relative; border-radius: 20px; overflow: hidden; background: radial-gradient(ellipse at 60% 30%, #0b3a61 0%, var(--navy) 75%); color: #fff; min-height: 370px; display: grid; grid-template-columns: minmax(260px, 330px) 1fr; }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-copy { position: relative; padding: 26px 28px; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(90deg, rgba(6,36,61,.92) 55%, transparent); }
.hero-copy h2 { font-size: 29px; font-weight: 800; font-style: italic; font-stretch: 115%; line-height: 1.05; }
.hero-copy p { margin: 0; color: #a9c6dc; font-size: 14px; max-width: 34ch; }
.hero-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.hero-list li { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; font-size: 13px; color: #dbeaf5; }
.hero-list .bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.hero-list .bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--brand), var(--cyan)); transform-origin: left; animation: grow .9s .3s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }
.hero-list b { font-variant-numeric: tabular-nums; font-weight: 650; }
.hero-legend { margin-top: auto; display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: #a9c6dc; }
.hero-legend span { display: inline-flex; align-items: center; gap: 6px; }
.hero-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ================= KPI cards ================= */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
/* minmax(0, 1fr): a long value (a date never wraps) can't push the card's contents wider than the card. */
.kpi { --accent: inherit; padding: 13px 14px 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; align-content: start; text-align: left; position: relative; overflow: hidden; container-type: inline-size; }
button.kpi { cursor: pointer; font: inherit; color: inherit; }
.kpi .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.kpi .label { color: var(--ink-2); font-size: 12.5px; font-weight: 600; line-height: 1.25; min-height: 31px; }
.kpi .chip { width: 28px; height: 28px; }
.kpi .chip svg { width: 15px; height: 15px; }
.kpi .value { font-size: 28px; font-weight: 750; font-stretch: 108%; letter-spacing: -.01em; line-height: 1.1; font-variant-numeric: tabular-nums; }
/* Long values such as "23 Nov 2026" shrink with the card instead of running off its edge. */
.kpi .value.long { font-size: 22px; font-size: clamp(16px, 12.5cqi, 28px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .note { color: var(--ink-3); font-size: 11.5px; min-height: 15px; }
.kpi .more { position: absolute; right: 12px; bottom: 10px; font-size: 11px; color: var(--accent); font-weight: 650; opacity: 0; transform: translateX(-4px); transition: opacity .15s, transform .15s; }
button.kpi:hover .more, button.kpi:focus-visible .more { opacity: 1; transform: none; }
.kpi.alert::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--critical); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.status i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.status i.pulse { animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(208, 59, 59, .55); } 100% { box-shadow: 0 0 0 8px rgba(208, 59, 59, 0); } }

/* ================= panels & charts ================= */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 14px; }
.panel { padding: 16px 18px; }
.panel > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.panel .ttl { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.panel .ttl .chip { width: 26px; height: 26px; border-radius: 7px; }
.panel .ttl .chip svg { width: 14px; height: 14px; }
.panel h2 { font-size: 15px; font-weight: 700; font-stretch: 106%; line-height: 1.25; }
.panel header p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-2); }
.panel .expand { opacity: .6; }
.panel:hover .expand { opacity: 1; }
.chart-box { position: relative; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.seg { display: flex; gap: 2px; height: 30px; margin: 4px 0 10px; }
.seg div { color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; padding-left: 9px; white-space: nowrap; border-radius: 5px; min-width: 0; transform-origin: left; animation: grow .8s var(--ease) both; cursor: default; transition: filter .15s; }
.seg div:hover { filter: brightness(1.08); }
.seg div.dark-ink { color: #0d1f2d; }

/* ================= tables ================= */
.table-tools { display: flex; gap: 10px; align-items: center; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); color: var(--ink-3); }
.search input { font: inherit; font-size: 13px; padding: 7px 10px 7px 32px; border: 1px solid var(--line-strong); border-radius: 9px; width: 240px; background: var(--surface-2); color: var(--ink); transition: border-color .2s, width .25s var(--ease); }
.search input:focus { outline: none; border-color: var(--accent); width: 300px; }
.table-wrap { overflow: auto; max-height: 540px; border: 1px solid var(--line); border-radius: 10px; margin-top: 10px; scrollbar-width: thin; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); font-weight: 650; font-size: 12px; color: var(--ink-2); white-space: nowrap; cursor: pointer; user-select: none; }
th:hover { color: var(--accent); }
td.nowrap { white-space: nowrap; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--hover); }
td .clamp { max-width: 460px; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
td .clamp.open { -webkit-line-clamp: unset; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--ink); white-space: nowrap; }
.notes { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 13px; display: grid; gap: 5px; }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child, .matrix td:last-child { text-align: left; }
.yes { color: var(--good-text); font-weight: 800; }
.no { color: var(--ink-3); }
.empty { padding: 36px; text-align: center; color: var(--ink-2); }

/* ================= overlays: palette & modal ================= */
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(6, 20, 34, .5); display: flex; justify-content: center; align-items: flex-start; padding: 9vh 16px 16px; animation: fade-in .18s; }
.palette { width: min(560px, 100%); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 18px; box-shadow: var(--shadow-pop); overflow: hidden; animation: drop .22s var(--ease); }
.pal-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.pal-input input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 15.5px; }
.pal-list { max-height: 380px; overflow: auto; padding: 6px; }
.pal-group { padding: 8px 10px 4px; font-size: 11.5px; font-weight: 650; color: var(--ink-3); }
.pal-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.pal-item .chip { width: 28px; height: 28px; }
.pal-item small { margin-left: auto; color: var(--ink-3); font-size: 12px; }
.pal-item.on { background: var(--hover); }
.modal { width: min(980px, 100%); max-height: 84vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 18px; box-shadow: var(--shadow-pop); animation: drop .25s var(--ease); }
.modal > header { display: flex; justify-content: space-between; gap: 12px; padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.modal h2 { font-size: 18px; font-weight: 750; font-stretch: 106%; }
.modal-body { padding: 16px 20px 20px; overflow: auto; display: grid; gap: 14px; }

/* skeleton / tooltip / toasts */
.tip { position: fixed; z-index: 90; background: #06243d; color: #fff; font-size: 12px; padding: 7px 10px; border-radius: 8px; pointer-events: none; box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 95; display: grid; gap: 8px; }
.toast { background: var(--navy); color: #fff; padding: 11px 16px 11px 14px; border-radius: 10px; font-size: 13px; box-shadow: 0 12px 30px -10px rgba(0,0,0,.45); animation: toast-in .35s var(--ease); border-left: 3px solid var(--cyan); }
.toast.warn { border-left-color: var(--critical); }
.toast.out { animation: toast-out .3s forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 25; }

@media (max-width: 960px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { min-height: 320px; padding: 24px; }
  .only-mobile { display: grid !important; }
  .only-desktop { display: none !important; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .22s var(--ease); box-shadow: var(--shadow-pop); }
  .sidebar.open { transform: none; }
  .hero { display: flex; flex-direction: column; }
  .hero canvas { position: relative; inset: auto; height: 250px; order: 2; }
  .hero-copy { background: none; }
  .shell { background: var(--page); }
  .grid-2 { grid-template-columns: 1fr; }
  .appbar, .pagehead, .content { padding-left: 14px; padding-right: 14px; }
  .palette-btn { width: auto; flex: 1; }
  .palette-btn kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
