/* OWN Charts — Appearance overrides driven by appearance.js (data-* on <html>).
   Dark theme remaps the surface/ink tokens AND the hard-coded #fff card
   surfaces across the dashboard shell + settings. Compact tightens spacing.
   Reduced motion neutralizes animations & transitions. */

/* ============================================================  DARK
   Foundation: remap the WHOLE token set so every token-built surface,
   ink level, hairline, semantic colour and accent flips automatically.
   appearance.js normalizes any stray hard-coded light surface on top. */
:root[data-theme="dark"] {
  --ivory:#0C0D10; --bg:#0C0D10; --bone:#131519; --paper:#171A1F; --paper-warm:#181C22;
  --ink:#ECECEA; --obsidian:#0C0D10; --ink-2:#FFFFFF;
  --ink-soft:rgba(236,236,234,0.72); --ink-mute:rgba(236,236,234,0.54); --ink-faint:rgba(236,236,234,0.34);
  --line:rgba(236,236,234,0.13); --line-strong:rgba(236,236,234,0.24);
  --bg-elevated:#16191F; --bg-warm:#131519; --bg-inverse:#1C2027;
  --fg:#ECECEA; --fg-muted:rgba(236,236,234,0.72); --fg-subtle:rgba(236,236,234,0.54); --fg-inverse:#0C0D10;

  /* On-dark text tokens (already light) */
  --paper-light:rgba(236,236,234,0.92); --paper-soft:rgba(236,236,234,0.66);
  --paper-mute:rgba(236,236,234,0.50); --paper-faint:rgba(236,236,234,0.32);

  /* Accent — mid teal: reads as eyebrow/kicker text on the dark field AND
     still carries light text when used as a button / badge fill. */
  --ocean:#2F8A80; --sea:#86C7C0;
  --ocean-mute:rgba(134,199,192,0.14); --ocean-faint:rgba(134,199,192,0.22); --sea-soft:rgba(134,199,192,0.18);
  --focus:#4FB0A4;

  /* Semantic — lifted for legibility on dark; soft fills re-tinted */
  --gain:#5FB58C; --gain-soft:rgba(95,181,140,0.18);
  --loss:#E08C8C; --loss-soft:rgba(224,140,140,0.18);
  --alert:#C9A86B; --alert-soft:rgba(201,168,107,0.18);
  --info:#6FB7AE; --info-soft:rgba(111,183,174,0.16);

  /* Shadows — deeper on dark */
  --shadow-card:0 14px 38px rgba(0,0,0,0.42); --shadow-card-lg:0 16px 40px rgba(0,0,0,0.46);
  --shadow-hero:0 26px 64px rgba(0,0,0,0.55); --shadow-float:0 30px 66px rgba(0,0,0,0.55);

  /* ── Chart palette (mirrors window.C) — lifted for legibility on dark.
     Ink/grid go light; categorical "territory" series brighten to pastels
     so data stays readable against the #0C0D10 field. ─────────────── */
  --ck-ink:        #ECECEA;
  --ck-ink2:       #E4E4E2;
  --ck-ink-soft:   rgba(236,236,234,0.74);
  --ck-ink-mute:   rgba(236,236,234,0.56);
  --ck-ink-faint:  rgba(236,236,234,0.40);
  --ck-ink-very:   rgba(236,236,234,0.22);
  --ck-grid:       rgba(236,236,234,0.10);
  --ck-line:       rgba(236,236,234,0.14);
  --ck-line-strong:rgba(236,236,234,0.24);
  --ck-paper:      #16191F;
  --ck-ivory:      #ECECEA;
  --ck-bone:       #C9CCCF;
  --ck-ocean:      #3FA99C;
  --ck-sea:        #9FD8D1;
  --ck-obsidian:   #ECECEA;
  --ck-midnight:   #7E97D6;
  --ck-burgundy:   #E59A9A;
  --ck-espresso:   #C9A98C;
  --ck-slate:      #A6B6C8;
  --ck-forest:     #6FBF98;
  --ck-oxblood:    #E59A9A;
  --ck-clay:       #D89A78;
  --ck-brass:      #C9A86B;
  --ck-olive:      #B3C088;
  --ck-gain:       #6FBF98;
  --ck-gain-soft:  rgba(95,181,140,0.20);
  --ck-loss:       #E59A9A;
  --ck-loss-soft:  rgba(224,140,140,0.20);
  --ck-alert:      #C9A86B;
  --ck-alert-soft: rgba(201,168,107,0.20);
}
:root[data-theme="dark"] body { background:#0C0D10; color:#ECECEA; }
:root[data-theme="dark"] .dash { background:#0C0D10; }

/* hard-coded #fff surfaces across the shell + settings → elevated dark */
:root[data-theme="dark"] .hd,
:root[data-theme="dark"] .kpi-c,
:root[data-theme="dark"] .banner,
:root[data-theme="dark"] .story,
:root[data-theme="dark"] .cc,
:root[data-theme="dark"] .set-card,
:root[data-theme="dark"] .hv-acct,
:root[data-theme="dark"] .hv-traj,
:root[data-theme="dark"] .da-dom,
:root[data-theme="dark"] .da-card { background:#16191F !important; border-color:rgba(236,236,234,0.12) !important; }

:root[data-theme="dark"] .set-rail-i.on { background:#16191F; box-shadow:0 1px 0 rgba(0,0,0,0.2), inset 0 0 0 1px rgba(236,236,234,0.14); }
:root[data-theme="dark"] .set-rail-i:hover { background:rgba(236,236,234,0.05); }
:root[data-theme="dark"] .set-input,
:root[data-theme="dark"] .set-select,
:root[data-theme="dark"] .set-textarea { background:#0C0D10; color:#ECECEA; border-color:rgba(236,236,234,0.2); }
:root[data-theme="dark"] .set-select { background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ECECEA' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] .set-seg { background:rgba(236,236,234,0.08); }
:root[data-theme="dark"] .set-seg button.on { background:#22262D; color:#fff; }
:root[data-theme="dark"] .set-sw { background:rgba(236,236,234,0.24); }
:root[data-theme="dark"] .set-li-ic,
:root[data-theme="dark"] .set-check { background:rgba(236,236,234,0.06); }
:root[data-theme="dark"] .set-plan { background:linear-gradient(180deg,#181C22,#12151A); border-color:rgba(14,58,62,0.34); }
:root[data-theme="dark"] .set-btn.ghost { color:#ECECEA; }
:root[data-theme="dark"] .set-savebar { background:rgba(12,13,16,0.86); border-color:rgba(236,236,234,0.14); }
:root[data-theme="dark"] .hd-cog,
:root[data-theme="dark"] .sb-moon { background:transparent; }

/* the sidebar is dark in BOTH themes — keep it dark, and scope the "light"
   surface tokens back to light inside it (the global dark remap flips --ivory
   / --ink to near-black, which would hide the active item + brand wordmark). */
:root[data-theme="dark"] .sb {
  background:#0C0D10;
  --ivory:#ECECEA;
  --ink:#ECECEA;
  --paper-light:rgba(236,236,234,0.92);
  --paper-soft:rgba(236,236,234,0.70);
  --paper-mute:rgba(236,236,234,0.52);
  --paper-faint:rgba(236,236,234,0.34);
}
:root[data-theme="dark"] .sb-item.on { background:rgba(236,236,234,0.12); }

/* ── Atlas rail — hand-themed dark (excluded from the runtime normalizer in
   appearance.js). It ships as a WHITE card with warm-dark ink; here we flip
   the whole interior to a dark glass with light ink so it feels identical to
   the light version, just inverted. Mirrors the literal colours in
   category.css's .ar-* block. ─────────────────────────────────────────── */
:root[data-theme="dark"] .ar {
  background:#111317 !important;
  color:rgba(236,236,234,0.92) !important;
  border-color:rgba(236,236,234,0.10) !important;
  box-shadow:0 30px 70px rgba(0,0,0,0.55), 0 6px 18px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(236,236,234,0.04) !important;
}
:root[data-theme="dark"] .ar-bar { border-bottom-color:rgba(236,236,234,0.10); }
:root[data-theme="dark"] .ar-bar-eye { color:rgba(236,236,234,0.82); }
:root[data-theme="dark"] .ar-hero { border-bottom-color:rgba(236,236,234,0.10); }
:root[data-theme="dark"] .ar-hero h2 { color:#F2F2F0; }
:root[data-theme="dark"] .ar-noticed { color:rgba(236,236,234,0.50); }
:root[data-theme="dark"] .ar-min { background:rgba(236,236,234,0.06); border-color:rgba(236,236,234,0.16); color:rgba(236,236,234,0.80); }
:root[data-theme="dark"] .ar-min:hover { background:rgba(236,236,234,0.12); }
:root[data-theme="dark"] .ar-card { background:#191D24; border-color:rgba(236,236,234,0.10); box-shadow:0 1px 4px rgba(0,0,0,0.3); }
:root[data-theme="dark"] .ar-card:hover { box-shadow:0 8px 22px rgba(0,0,0,0.4); }
:root[data-theme="dark"] .ar-card-num { color:rgba(236,236,234,0.42); }
:root[data-theme="dark"] .ar-t { color:#F2F2F0; }
:root[data-theme="dark"] .ar-b { color:rgba(236,236,234,0.80); }
:root[data-theme="dark"] .ar-card.is-done .ar-t { color:rgba(236,236,234,0.40); }
:root[data-theme="dark"] .ar-check { border-color:rgba(236,236,234,0.24); }
:root[data-theme="dark"] .ar-snap-b { color:rgba(236,236,234,0.72); }
:root[data-theme="dark"] .ar-foot { border-top-color:rgba(236,236,234,0.10); background:#111317; }
:root[data-theme="dark"] .ar-composer { background:rgba(236,236,234,0.06); border-color:rgba(236,236,234,0.12); }
:root[data-theme="dark"] .ar-input { color:rgba(236,236,234,0.55) !important; }
:root[data-theme="dark"] .ar-status { color:rgba(236,236,234,0.52); }

/* ---- page-specific surfaces (literal #fff in page/card CSS + inline
   <style> blocks). !important beats the runtime-injected inline rules.
   Grouped: elevated panels · input fields · active segmented pills. ---- */
:root[data-theme="dark"] .gs-list,
:root[data-theme="dark"] .ps-list,
:root[data-theme="dark"] .pp-card,
:root[data-theme="dark"] .pp-table-wrap,
:root[data-theme="dark"] .cf-kpi,
:root[data-theme="dark"] .cf-pulse-kpi,
:root[data-theme="dark"] .cf-subs,
:root[data-theme="dark"] .cf-subs-row,
:root[data-theme="dark"] .cf-sleep-moves,
:root[data-theme="dark"] .cons-grp,
:root[data-theme="dark"] .prop-uni-detail,
:root[data-theme="dark"] .prop-uni-item.on,
:root[data-theme="dark"] .ins-build-panel,
:root[data-theme="dark"] .ins-lib-note,
:root[data-theme="dark"] .ap-glance-c,
:root[data-theme="dark"] .tx-bub,
:root[data-theme="dark"] .est-up-row,
:root[data-theme="dark"] .cx-locked-card,
:root[data-theme="dark"] .cx-law,
:root[data-theme="dark"] .cx-surface,
:root[data-theme="dark"] .onb-principle,
:root[data-theme="dark"] .onb-stage,
:root[data-theme="dark"] .onb-known,
:root[data-theme="dark"] .onb-opt,
:root[data-theme="dark"] .onb-module,
:root[data-theme="dark"] .onb-fm-step,
:root[data-theme="dark"] .onb-matrix-wrap,
:root[data-theme="dark"] .olb-side,
:root[data-theme="dark"] .olb-card,
:root[data-theme="dark"] .hub-bands .band,
:root[data-theme="dark"] .cards > .card { background:#16191F !important; border-color:rgba(236,236,234,0.12) !important; }

:root[data-theme="dark"] .cx-surface.engine { background:linear-gradient(180deg,#16191F,#0F1218) !important; }

/* input / search fields */
:root[data-theme="dark"] .tx-search,
:root[data-theme="dark"] .tx-sel,
:root[data-theme="dark"] .tx-dr-field input,
:root[data-theme="dark"] .tx-dr-quick button,
:root[data-theme="dark"] .onb-addr-in,
:root[data-theme="dark"] .onb-region { background:#0C0D10 !important; border-color:rgba(236,236,234,0.2) !important; }

/* active segmented pills that used white */
:root[data-theme="dark"] .cf-toggle-btn.on,
:root[data-theme="dark"] .ap-seg button.on,
:root[data-theme="dark"] .onb-seg-b.on { background:#22262D !important; color:#fff !important; }
:root[data-theme="dark"] .pp-billing { background:#16191F !important; border-color:rgba(236,236,234,0.24) !important; }

/* small white checkboxes / inputs on dark cards */
:root[data-theme="dark"] .ins-build-check,
:root[data-theme="dark"] .cf-check { background:#0C0D10 !important; border-color:rgba(236,236,234,0.28) !important; }

/* ============================================================  COMPACT  */
:root[data-density="compact"] .set-card { padding:18px 22px; }
:root[data-density="compact"] .set-card + .set-card { margin-top:12px; }
:root[data-density="compact"] .set-field { padding:11px 0; }
:root[data-density="compact"] .set-card-h { padding-bottom:13px; }
:root[data-density="compact"] .kpi-c { min-height:0; padding:15px 18px; }
:root[data-density="compact"] .kpi-c .val { font-size:clamp(22px, 13cqi, 32px); }
:root[data-density="compact"] .hd { padding:20px 30px 22px; }
:root[data-density="compact"] .set-li { padding:11px 0; }
:root[data-density="compact"] .set-wrap { margin-top:18px; }

/* ============================================================  FLOAT
   Buoyant lift-on-hover, applied platform-wide to every card / panel box.
   appearance.js tags the outermost box in each chain with .own-float (so
   nested tiles never double-lift). This mirrors the .cc / .story lift the
   category pages already use, extending it to every surface in the product.
   Loaded last, so its transition wins over a card's bespoke one; the listed
   props cover the common hover transitions (lift, shadow, border). */
@media (prefers-reduced-motion: no-preference) {
  .own-float {
    transition: box-shadow .38s cubic-bezier(.22,1,.36,1),
                border-color .25s ease;
  }
  .own-float:hover {
    box-shadow: 0 6px 18px rgba(0,0,0,0.09), 0 22px 52px rgba(0,0,0,0.11);
  }
  :root[data-theme="dark"] .own-float:hover {
    box-shadow: 0 30px 66px rgba(0,0,0,0.42);
  }
}
/* Honour an explicit "reduced motion" Appearance choice — no lift, no move. */
:root[data-motion="reduced"] .own-float { transition: none !important; }
:root[data-motion="reduced"] .own-float:hover { transform: none !important; }

/* ============================================================  REDUCED MOTION  */
:root[data-motion="reduced"] *,
:root[data-motion="reduced"] *::before,
:root[data-motion="reduced"] *::after {
  animation-duration:0.001ms !important;
  animation-iteration-count:1 !important;
  transition-duration:0.001ms !important;
  scroll-behavior:auto !important;
}

/* ============================================================  DEEP-LINK
   A chart opened from the Scenario Sandbox's "Open the full page →" link
   gets a brief ring so the eye lands on the right tool after the scroll.
   Honors reduced motion (the highlight just fades, no pulse). */
.story[data-deeplinked]{ animation: own-deeplink 2.2s var(--ease-standard, ease) both; border-radius:20px; }
@keyframes own-deeplink{
  0%{ box-shadow:0 0 0 0 rgba(14,58,62,0); }
  10%{ box-shadow:0 0 0 3px rgba(14,58,62,.40); }
  100%{ box-shadow:0 0 0 0 rgba(14,58,62,0); }
}
:root[data-motion="reduced"] .story[data-deeplinked]{ animation:none; box-shadow:0 0 0 3px rgba(14,58,62,.30); }

/* ============================================================  JUST ADDED
   A tool the member just published from the Scenario Sandbox onto this page
   carries a quiet standing ring + a "Just added" tag for the recency window,
   so a freshly-placed tool reads as new without shouting. */
.story.scn-new,.cc.scn-new{ box-shadow:0 0 0 1.5px rgba(28,58,42,.34), 0 14px 38px rgba(0,0,0,.06); border-radius:20px; animation:own-scn-land 1.6s var(--ease-standard, ease) both; }
@keyframes own-scn-land{
  0%{ box-shadow:0 0 0 0 rgba(28,58,42,0), 0 14px 38px rgba(0,0,0,.06); }
  16%{ box-shadow:0 0 0 4px rgba(28,58,42,.42), 0 14px 38px rgba(0,0,0,.06); }
  100%{ box-shadow:0 0 0 1.5px rgba(28,58,42,.34), 0 14px 38px rgba(0,0,0,.06); }
}
:root[data-motion="reduced"] .story.scn-new,:root[data-motion="reduced"] .cc.scn-new{ animation:none; }
.scn-new-tag{ display:inline-flex; align-items:center; gap:6px; font-family:var(--font-sans,system-ui); font-weight:600; font-size:9.5px; letter-spacing:.13em; text-transform:uppercase; padding:4px 10px 4px 8px; border-radius:999px; color:#3F6B43; background:rgba(91,122,75,.13); border:1px solid rgba(91,122,75,.28); white-space:nowrap; }
.scn-new-tag .d{ width:6px; height:6px; border-radius:999px; background:currentColor; flex:none; animation:cgpulse 2.4s ease-in-out infinite; }
@keyframes cgpulse{ 0%,100%{opacity:.35} 50%{opacity:1} }
