/* ============================================================
   RESERVD CUSTOMER APP THEME — Phase 7.9 "Workspace", Phase 8.0 navy shell

   A distinct hybrid, separate from both the light public website and the
   dark Admin console:
     · DARK BRANDED SHELL — sidebar, phone business header, bottom bar
       (Phase 8.0: deep RESERVD navy — calm and clearly not the near-black,
       technical Admin console)
     · LIGHT WORKSPACE — matte warm off-white (not yellow, not beige, not
       stark white), white/near-white elevated surfaces, RESERVD blue, pale
       grey-blue and warm stone, restrained purple only for Ask RESERVD
     · SELECTIVE LIGHT GLASS — only the decision, insights, chart cards, Ask
       panel and menus; dense tables, forms, settings and lists stay solid.
   Colour carries meaning only: green safe · amber review · red risk · blue
   accounting/informational. Everything is scoped to :root[data-theme="app"].
   Text contrast (WCAG AA): --ink 15:1, --ink-muted 8:1, --ink-faint ≥ 5:1 on
   the workspace and on white; accent text 6.6:1; white on --accent-strong 7:1.
   ============================================================ */
:root[data-theme="app"]{
  /* workspace */
  --bg:#F4F1EB;
  --surface:#FFFFFF;
  --surface-2:#F7F5F1;
  --surface-3:#ECE8E1;
  --line:rgba(44,36,28,.09);
  --line-strong:rgba(44,36,28,.16);

  /* ink (warm near-black) */
  --ink:#1A1916;
  --ink-muted:#4B4740;
  --ink-faint:#6A645C;

  /* RESERVD blue — the accent; purple is reserved for Ask RESERVD */
  --brand:#5F8FB5;
  --accent:#2C5C86;
  --accent-strong:#285678;
  --accent-hover:#1F4664;
  --accent-ink:#FFFFFF;
  --accent-soft:#E7EFF6;
  --steel:var(--accent); --steel-strong:var(--accent-strong);
  --violet:#5E49A8; --violet-soft:#EEEAF8;

  /* semantic */
  --good:#1D7A4E;   --good-soft:#E3F2EA;
  --warn:#8C5A0E;   --warn-soft:#FBF0DB;
  --danger:#B23A2E; --danger-soft:#FBE8E5;
  --info:#3B5E80;   --info-soft:#E7EEF5;
  --safe:var(--good);  --safe-soft:var(--good-soft);
  --attention:var(--warn); --attention-soft:var(--warn-soft);
  --risk:var(--danger); --risk-soft:var(--danger-soft);
  --safe-fill:#2E9E6B;

  /* Cash Line */
  --cl-protected:#4C6E92;
  --cl-operating:#86AACB;
  --cl-retained:#C2A27A;
  --cl-allocated:#D3CABE;
  --cl-held-a:#EEEAE3; --cl-held-b:#D8D0C4;
  --cl-unallocated:#F1EEE8;

  /* elevation — soft, warm */
  --shadow-sm:0 1px 2px rgba(44,36,28,.05);
  --shadow-md:0 1px 2px rgba(44,36,28,.05), 0 10px 28px -16px rgba(44,36,28,.20);
  --shadow-lg:0 2px 6px rgba(44,36,28,.07), 0 28px 60px -20px rgba(44,36,28,.28);
  --shadow:var(--shadow-md);
  --scrim:rgba(12,22,38,.38);
  --focus-ring:0 0 0 2px #FFFFFF, 0 0 0 4px #2C5C86;

  /* selective light glass */
  --glass:linear-gradient(180deg, rgba(255,255,255,.78), rgba(255,255,255,.62));
  --glass-strong:linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.78));
  --glass-border:rgba(255,255,255,.75);
  --glass-edge:rgba(44,36,28,.08);
  --glass-blur:blur(16px) saturate(140%);
  --glass-shadow:0 1px 2px rgba(44,36,28,.04), 0 14px 34px -20px rgba(44,36,28,.22);

  color-scheme:light;
}

/* the workspace: matte warm off-white — 95% plain, 5% atmosphere (Phase 9.1A refinement).
   A barely-there tonal shift top → bottom, one faint cool-navy depth near the top (behind the
   hero, never behind the cards' content), and an almost invisible warm grain. No colour blobs. */
:root[data-theme="app"] body{
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .17 0 0 0 0 .14 0 0 0 0 .11 0 0 0 .028 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(1400px 460px at 50% -160px, rgba(34,49,70,.05), transparent 72%),
    linear-gradient(180deg, #F6F4EF 0%, #F4F1EB 42%, #F1EDE6 100%);
  background-attachment:scroll, fixed, fixed;
  background-color:#F4F1EB;
  color:var(--ink);
}
:root[data-theme="app"] .app-shell, :root[data-theme="app"] .app-main{background:transparent}

/* ---------- the dark branded shell: these pieces re-map the tokens to the shell palette ---------- */
:root[data-theme="app"] :is(.sidenav, .bottomnav, .ask-orb, .sn-biz-menu){
  --bg:#223146; --surface:#2A3A51; --surface-2:rgba(232,240,250,.06); --surface-3:rgba(232,240,250,.1);
  --line:rgba(214,228,245,.09); --line-strong:rgba(214,228,245,.17);
  --ink:#F2F6FB; --ink-muted:#C3CEDC; --ink-faint:#93A2B6;
  --accent:#AFC8E2; --accent-soft:rgba(143,176,214,.16);
  --good:#8DD3AE; --good-soft:rgba(110,200,150,.14); --warn:#E8BF75; --warn-soft:rgba(232,191,117,.14);
  --danger:#F09389; --danger-soft:rgba(240,147,137,.14); --info:#A9BDD9; --info-soft:rgba(143,176,214,.13);
  --safe:var(--good); --safe-soft:var(--good-soft); --attention:var(--warn); --attention-soft:var(--warn-soft); --risk:var(--danger); --risk-soft:var(--danger-soft);
  --focus-ring:0 0 0 2px #223146, 0 0 0 4px #AFC8E2;
  color:var(--ink);
}
@media (max-width:899px){
  :root[data-theme="app"] .topbar{
    --ink:#F2F6FB; --ink-muted:#C3CEDC; --ink-faint:#93A2B6; --surface-2:rgba(232,240,250,.07);
    --good:#8DD3AE; --good-soft:rgba(110,200,150,.14); --warn:#E8BF75; --warn-soft:rgba(232,191,117,.14); --danger:#F09389; --danger-soft:rgba(240,147,137,.14);
    --safe:var(--good); --safe-soft:var(--good-soft); --attention:var(--warn); --attention-soft:var(--warn-soft); --risk:var(--danger); --risk-soft:var(--danger-soft);
    --focus-ring:0 0 0 2px #223146, 0 0 0 4px #AFC8E2;
  }
}

/* ---------- selective glass (decision, insights, charts, health summary, Ask, menus) ---------- */
:root[data-theme="app"] :is(.ov-decision, .ov-noticed, .ov-actual, #ovHealth, .chc, .ask-panel, .acct-menu, .pf-card, .more-me, .ask-ctx){
  background:var(--glass); border:1px solid var(--glass-edge); box-shadow:var(--glass-shadow), inset 0 1px 0 var(--glass-border);
  -webkit-backdrop-filter:var(--glass-blur); backdrop-filter:var(--glass-blur);
}
/* solid, calm surfaces where reading and editing matter */
:root[data-theme="app"] :is(.ov-card:not(.ov-noticed):not(.ov-actual):not(#ovHealth):not(.chc), .ov-attn-list, .ov-clear, .mi-list, .mi-jobs-sum, .mi-dryrun, .st-sec, .qt-create, .qt-list, .r-card, .jb-table, .hk, .hp, .jb-kpi){
  background:#FFFFFF; border-color:var(--line); box-shadow:var(--shadow-sm);
}

/* ---------- forms & buttons on the workspace ---------- */
:root[data-theme="app"] :is(input[type=number], input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], select, textarea){ background:#FFFFFF; border-color:var(--line-strong) }
:root[data-theme="app"] :is(input, textarea)::placeholder{color:#857E75}
:root[data-theme="app"] :is(input, select, textarea):focus-visible{border-color:var(--accent); box-shadow:0 0 0 3px rgba(44,92,134,.16)}
:root[data-theme="app"] .btn{box-shadow:0 1px 2px rgba(44,36,28,.12), inset 0 1px 0 rgba(255,255,255,.12)}
:root[data-theme="app"] .btn.secondary{background:#FFFFFF; border-color:var(--line-strong); color:var(--ink)}
:root[data-theme="app"] .btn.secondary:hover{background:var(--surface-2)}
:root[data-theme="app"] .sheet, :root[data-theme="app"] .sheet-head{background:#FFFFFF}
:root[data-theme="app"] .loading-screen{background:transparent}
:root[data-theme="app"] .r-sync.compact{background:rgba(255,245,235,.08)}
