/* Zyqual design tokens — verbatim values from the design handoff README ("Design Tokens").
   LIGHT is the default (:root); dark applies via [data-theme="dark"] or, when no manual
   choice is stored (localStorage sg-theme), via prefers-color-scheme. */
:root {
  --zq-primary:#4a148c; --zq-primary-light:#7b1fa2; --zq-primary-soft:#efe9f6;
  --zq-secondary:#1B5062; --zq-teal:#1B5062;
  --zq-accent:#ffeb3b; --zq-coral:#f44236;
  --zq-text:#2e2e2e; --zq-muted:#6b7280;
  --zq-bg:#f8fafc; --zq-card:#ffffff; --zq-border:#e5e7eb; --zq-border-soft:#e5e7eb; --zq-card-border:rgba(0,0,0,.06);
  --zq-success:#4caf50; --zq-success-soft:#e8f5e9;
  --zq-warning:#ff9800; --zq-warning-soft:#fff3e0; --zq-warning-text:#e65100;
  --zq-danger:#f44336; --zq-danger-soft:#ffebee;
  --zq-info:#2196f3; --zq-info-soft:#e3f2fd;
  --zq-indigo:#3f51b5; --zq-orange:#ff9800; --zq-cyan:#00bcd4; --zq-pink:#e91e63;
  --zq-thead:#f9fafb; --zq-input:#ffffff; --zq-rowhover:rgba(74,20,140,.03); --zq-skeleton:#eceef2;
  --zq-scrim:rgba(20,12,38,.38); --zq-raw:#f6f7f9;
  --zq-header-grad:linear-gradient(to right,#2e2e2e,#4a148c);
  --r1:#9c27b0; --r2:#e91e63; --r3:#00bcd4; --r4:#2196f3; --r5:#ff9800; --r6:#4caf50; --r7:#7986cb;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --zq-primary:#bb86fc; --zq-primary-light:#ce93d8; --zq-primary-soft:#2d1b3e;
    --zq-secondary:#80cbc4; --zq-teal:#80cbc4;
    --zq-text:#e0e0e0; --zq-muted:#808080; --zq-bg:#121212; --zq-card:#1e1e1e;
    --zq-border:#2c2c2c; --zq-border-soft:#2c2c2c; --zq-card-border:#2c2c2c;
    --zq-thead:#242424; --zq-input:#161616; --zq-rowhover:rgba(187,134,252,.06); --zq-skeleton:#2a2a2a;
    --zq-scrim:rgba(0,0,0,.6); --zq-raw:#171717;
  }
}
:root[data-theme="dark"] {
  --zq-primary:#bb86fc; --zq-primary-light:#ce93d8; --zq-primary-soft:#2d1b3e;
  --zq-secondary:#80cbc4; --zq-teal:#80cbc4;
  --zq-text:#e0e0e0; --zq-muted:#808080; --zq-bg:#121212; --zq-card:#1e1e1e;
  --zq-border:#2c2c2c; --zq-border-soft:#2c2c2c; --zq-card-border:#2c2c2c;
  --zq-thead:#242424; --zq-input:#161616; --zq-rowhover:rgba(187,134,252,.06); --zq-skeleton:#2a2a2a;
  --zq-scrim:rgba(0,0,0,.6); --zq-raw:#171717;
}

/* --- Shared header window selector (win.js) — handoff "Global Shell".
   Track rgba(255,255,255,.13); active chip = white bg + #4a148c text (both themes:
   the header is always the brand gradient). --- */
.win { position:relative; display:flex; align-items:center; background:rgba(255,255,255,.13); border-radius:50px; padding:3px; gap:2px; }
.win > button { border:0; background:transparent; color:#fff; padding:6px 14px; border-radius:50px; font:inherit; font-size:13px; cursor:pointer; white-space:nowrap; display:inline-flex; align-items:center; }
.win > button.active { background:#fff; color:#4a148c; font-weight:600; }
.win > button:focus-visible { outline:2px solid #ffeb3b; outline-offset:1px; }
.win .windot { width:8px; height:8px; border-radius:50%; background:#4caf50; display:inline-block; margin-right:6px; flex:0 0 auto; }
.winpop[hidden] { display:none; }
.winpop { position:absolute; top:calc(100% + 10px); right:0; z-index:60; background:var(--zq-card); color:var(--zq-text); border:1px solid var(--zq-card-border); border-radius:10px; box-shadow:0 16px 30px rgba(0,0,0,.14); padding:14px; display:flex; flex-direction:column; gap:10px; min-width:232px; }
.winpop label { font-size:11px; font-weight:600; letter-spacing:.5px; text-transform:uppercase; color:var(--zq-muted); display:flex; flex-direction:column; gap:4px; }
.winpop input { font:inherit; font-size:13px; padding:7px 10px; border:1px solid var(--zq-border); border-radius:8px; background:var(--zq-input); color:var(--zq-text); }
.winpop .winpop-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:2px; }
.winpop .winpop-actions button { font:inherit; font-size:13px; font-weight:600; border-radius:50px; padding:7px 15px; cursor:pointer; }
.winpop .winpop-cancel { background:transparent; border:1px solid var(--zq-border); color:var(--zq-text); }
.winpop .winpop-apply { background:var(--zq-primary); border:0; color:#fff; }
@media (max-width:860px) { .win > button { padding:6px 9px; font-size:12px; } }

/* ===== Global chrome (chrome.js): search · bell · account · palette · scope =====
   Glass buttons already defined per page (.glass 36px circle). Shared bits below. */
.glass:focus-visible { outline:2px solid #ffeb3b; outline-offset:1px; }
.sg-acct { display:flex; align-items:center; justify-content:center; padding:0; }
.sg-avatar { width:26px; height:26px; border-radius:50%; background:rgba(255,255,255,.22); color:#fff; font-size:11px; font-weight:700; display:flex; align-items:center; justify-content:center; }
.sg-avatar-lg { width:40px; height:40px; font-size:15px; background:var(--zq-primary); }
.sg-badge { position:absolute; top:-3px; right:-3px; min-width:16px; height:16px; padding:0 4px; border-radius:50px; background:var(--zq-coral); color:#fff; font-size:10px; font-weight:700; line-height:16px; text-align:center; box-shadow:0 0 0 2px var(--zq-primary); }

/* scope banner (View-as locked pill) */
.sg-scopebar { display:flex; align-items:center; gap:9px; flex-wrap:wrap; background:var(--zq-warning-soft); color:var(--zq-warning-text); font-size:12.5px; padding:8px 22px; border-bottom:1px solid var(--zq-border); }
:root[data-theme="dark"] .sg-scopebar { background:#3a2a10; }
.sg-scopebar b { font-weight:700; }
.sg-lockpill { display:inline-flex; align-items:center; gap:5px; background:var(--zq-primary); color:#fff; border-radius:50px; padding:3px 11px; font-size:11.5px; font-weight:700; }
.chip.sg-locked { cursor:default; opacity:.9; }

/* dropdown menus (account + bell) */
.sg-menu { position:fixed; z-index:70; background:var(--zq-card); color:var(--zq-text); border:1px solid var(--zq-card-border); border-radius:12px; box-shadow:0 16px 30px rgba(0,0,0,.18); overflow:hidden; animation:sgpop .16s ease; }
.sg-menu[hidden] { display:none; }
@keyframes sgpop { from{opacity:0;transform:translateY(-6px);} to{opacity:1;transform:none;} }
.sg-acctmenu { width:252px; }
.sg-bellmenu { width:320px; max-height:70vh; overflow-y:auto; }
.sg-idhead { display:flex; gap:12px; align-items:center; padding:16px; border-bottom:1px solid var(--zq-border); }
.sg-idname { font-weight:700; font-size:14px; }
.sg-idmail { font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:11px; color:var(--zq-muted); margin:1px 0 5px; }
.sg-idpill { display:inline-block; background:var(--zq-primary-soft); color:var(--zq-primary); border-radius:50px; padding:2px 9px; font-size:10.5px; font-weight:700; }
.sg-item { display:block; padding:11px 16px; font-size:13px; color:var(--zq-text); text-decoration:none; background:transparent; border:0; width:100%; text-align:left; cursor:pointer; font:inherit; font-size:13px; }
.sg-item:hover { background:var(--zq-rowhover); }
.sg-danger { color:var(--zq-danger); font-weight:600; border-top:1px solid var(--zq-border); }
.sg-group { padding:10px 16px; border-top:1px solid var(--zq-border); }
.sg-grouplbl { font-size:10.5px; font-weight:700; letter-spacing:.5px; text-transform:uppercase; color:var(--zq-muted); margin-bottom:8px; }
.sg-radio { display:flex; align-items:flex-start; gap:9px; padding:5px 0; font-size:13px; cursor:pointer; }
.sg-radio input { margin-top:2px; accent-color:var(--zq-primary); }
.sg-sub { display:block; font-size:11px; color:var(--zq-muted); font-weight:400; }
.sg-switchrow { display:flex; align-items:center; justify-content:space-between; gap:12px; font-size:13px; cursor:pointer; }
.sg-switch { width:38px; height:22px; border-radius:50px; background:var(--zq-border); position:relative; flex:0 0 auto; transition:background .18s; }
.sg-switch::after { content:''; position:absolute; top:2px; left:2px; width:18px; height:18px; border-radius:50%; background:#fff; transition:transform .18s; box-shadow:0 1px 2px rgba(0,0,0,.3); }
.sg-switch.on { background:var(--zq-primary); }
.sg-switch.on::after { transform:translateX(16px); }
.sg-switch:focus-visible { outline:2px solid var(--zq-primary); outline-offset:2px; }

/* bell items */
.sg-menuhead { padding:12px 16px 8px; font-size:11px; font-weight:700; letter-spacing:.4px; text-transform:uppercase; color:var(--zq-muted); }
.sg-alert { display:flex; gap:10px; align-items:flex-start; padding:10px 16px; text-decoration:none; color:var(--zq-text); font-size:13px; }
.sg-alert:hover { background:var(--zq-rowhover); }
.sg-alertbody b { font-weight:700; display:block; }
.sg-sev { width:9px; height:9px; border-radius:50%; margin-top:4px; flex:0 0 auto; }
.sg-sev-danger { background:var(--zq-danger); } .sg-sev-warning { background:var(--zq-warning); } .sg-sev-info { background:var(--zq-info); }
.sg-empty { padding:22px 16px; text-align:center; color:var(--zq-muted); font-size:12.5px; }
.sg-manage { border-top:1px solid var(--zq-border); color:var(--zq-primary); font-weight:600; }

/* command palette */
.sg-palette { position:fixed; inset:0; z-index:80; background:var(--zq-scrim); display:flex; justify-content:center; align-items:flex-start; }
.sg-palette[hidden] { display:none; }
.sg-palcard { width:min(560px,92vw); margin-top:11vh; background:var(--zq-card); border:1px solid var(--zq-card-border); border-radius:14px; box-shadow:0 16px 40px rgba(0,0,0,.3); overflow:hidden; animation:sgpop .16s ease; }
.sg-palinput { width:100%; border:0; border-bottom:1px solid var(--zq-border); background:var(--zq-card); color:var(--zq-text); font:inherit; font-size:15px; padding:16px 18px; outline:0; }
.sg-pallist { max-height:52vh; overflow-y:auto; }
.sg-palrow { display:flex; flex-direction:column; gap:1px; padding:11px 18px; cursor:pointer; }
.sg-palrow.sel { background:var(--zq-primary-soft); }
.sg-pallabel { font-size:13.5px; font-weight:600; }
.sg-palhint { font-size:11.5px; color:var(--zq-muted); }
.sg-palfoot { padding:9px 18px; font-size:11px; color:var(--zq-muted); border-top:1px solid var(--zq-border); }
.sg-palfoot kbd { background:var(--zq-thead); border:1px solid var(--zq-border); border-radius:4px; padding:1px 5px; font-family:ui-monospace,monospace; font-size:11px; }

/* signed-out screen */
.sg-signedout { position:fixed; inset:0; z-index:100; background:var(--zq-header-grad); display:flex; align-items:center; justify-content:center; }
.sg-signedout-card { background:var(--zq-card); color:var(--zq-text); border-radius:16px; box-shadow:0 20px 50px rgba(0,0,0,.35); padding:40px 44px; text-align:center; max-width:360px; }
.sg-so-brand { font-weight:800; font-size:22px; letter-spacing:-.3px; color:var(--zq-primary); margin-bottom:18px; } .sg-so-brand span { font-weight:500; opacity:.9; }
.sg-so-title { font-size:20px; font-weight:700; margin-bottom:6px; }
.sg-so-sub { font-size:13.5px; color:var(--zq-muted); margin-bottom:22px; }
.sg-so-btn { background:var(--zq-primary); color:#fff; border:0; border-radius:50px; padding:11px 26px; font:inherit; font-size:14px; font-weight:600; cursor:pointer; }

/* toast */
.sg-toast { position:fixed; left:50%; bottom:26px; transform:translate(-50%,20px); z-index:110; background:#2e2e2e; color:#fff; border-radius:50px; padding:11px 20px; font-size:13px; font-weight:500; box-shadow:0 8px 24px rgba(0,0,0,.3); opacity:0; transition:opacity .3s, transform .3s; pointer-events:none; }
.sg-toast.show { opacity:1; transform:translate(-50%,0); }

/* ================= left sidebar (handoff "Sidebar") ================= */
.sg-sidebar { position:fixed; top:58px; left:0; bottom:0; width:242px; overflow-y:auto; z-index:30;
  background:var(--zq-card); border-right:1px solid var(--zq-border); padding:14px 12px 20px; display:flex; flex-direction:column; gap:2px; }
body.sg-has-sidebar main.wrap { margin-left:242px; max-width:none; }
body.sg-has-sidebar .snav { display:none; }   /* surfaces now live in the sidebar */
.sg-navover { font-size:10.5px; font-weight:700; letter-spacing:.6px; text-transform:uppercase; color:var(--zq-muted); margin:14px 8px 6px; }
.sg-navover:first-child { margin-top:2px; }
.sg-navitem { display:flex; align-items:center; gap:11px; padding:9px 10px 9px 11px; border-radius:9px; text-decoration:none; color:var(--zq-text); position:relative; border-left:3px solid transparent; }
.sg-navitem:hover { background:var(--zq-rowhover,rgba(74,20,140,.04)); }
.sg-navitem.on { background:var(--zq-primary-soft); border-left-color:var(--sc,var(--zq-primary)); }
.sg-navicon { font-family:'Material Icons'; font-size:20px; flex:none; }
.sg-navtext { display:flex; flex-direction:column; min-width:0; }
.sg-navlabel { font-size:13.5px; font-weight:600; line-height:1.2; }
.sg-navitem.on .sg-navlabel { font-weight:700; }
.sg-navdesc { font-size:11px; color:var(--zq-muted); line-height:1.25; margin-top:1px; }
.sg-navbadge { margin-left:auto; min-width:20px; height:18px; padding:0 6px; border-radius:50px; background:var(--zq-success); color:#fff; font-size:11px; font-weight:700; line-height:18px; text-align:center; }
.sg-scopecard { display:flex; align-items:center; gap:9px; margin:14px 4px 6px; padding:10px 12px; border-radius:10px; background:var(--zq-bg); border:1px solid var(--zq-border); }
.sg-scopecard .mi { font-family:'Material Icons'; font-size:18px; color:var(--zq-primary); }
.sg-scopecard b { font-size:12.5px; display:block; } .sg-scopecard .sg-sub { font-size:11px; color:var(--zq-muted); }
.sg-simcard { margin:6px 4px; padding:10px 12px; border-radius:10px; background:var(--zq-bg); border:1px dashed var(--zq-border); }
.sg-simrow { display:flex; flex-wrap:wrap; gap:5px; }
.sg-simbtn { font-size:11px; padding:3px 9px; border-radius:50px; border:1px solid var(--zq-border); background:var(--zq-card); color:var(--zq-muted); cursor:pointer; }
.sg-simbtn.on { background:var(--zq-primary); color:#fff; border-color:var(--zq-primary); }
.sg-navghost { margin:auto 8px 0; padding-top:14px; font-size:11.5px; color:var(--zq-muted); opacity:.7; }
.sg-navghost span { display:block; font-size:10px; margin-top:2px; }
@media (max-width:1080px){
  .sg-sidebar { width:64px; padding:14px 8px; }
  body.sg-has-sidebar main.wrap { margin-left:64px; }
  .sg-navtext, .sg-navover, .sg-scopecard > div, .sg-simcard .sg-navover, .sg-simrow, .sg-navghost, .sg-navbadge { display:none; }
  .sg-navitem { justify-content:center; padding:10px 0; border-left:0; border-radius:10px; }
  .sg-navitem.on { box-shadow:inset 3px 0 0 var(--sc,var(--zq-primary)); }
  .sg-scopecard { justify-content:center; padding:10px 0; } .sg-simcard { text-align:center; }
}
@media (max-width:760px){
  .sg-sidebar { display:none; }
  body.sg-has-sidebar main.wrap { margin-left:0; }
  body.sg-has-sidebar .snav { display:flex; }   /* fall back to top-tabs on phones */
}
