/* =========================================================================
   Webszeal Backoffice — Tideline design system
   Calm, precise control room. Teal = do/go. Amber = AI only.
   Light + dark via [data-theme]. No framework; ~fast.
   ========================================================================= */

:root {
  --ink:#10242E; --text:#10242E; --mut:#5A6F78; --mut2:#7B8E96;
  --bg:#EDF1F2; --surface:#FFFFFF; --surface2:#F5F8F9; --surface3:#EEF3F4;
  --bd:#D5DFE2; --bd2:#E6ECEE;
  --rail:#0B2730; --rail2:#14404C; --railtx:#A3BCC4; --railmut:#5E8792;
  --acc:#0E7C86; --acc-h:#0A646C; --acc2:#E2F1F2; --acc3:#C9E6E8; --tide-l:#5CC7CF;
  --ember:#F2A93B; --ember-h:#E4951F; --ember-d:#8F5300; --ember2:#FFF5E6; --ember-ink:#2B1A00;
  --ok:#1E9A69; --ok2:#E3F5EC; --warn:#C98B00; --warn2:#FBF2DC; --err:#D3423C; --err2:#FCEBEA; --run:#0E7C86; --run2:#E2F1F2;
  --shadow:0 1px 2px rgba(16,36,46,.05);
  --shadow-lg:0 12px 32px -8px rgba(11,39,48,.22), 0 2px 6px rgba(11,39,48,.08);
  --f-ui:'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-disp:'Bricolage Grotesque', 'Onest', system-ui, sans-serif;
  --f-code:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --side:232px; --top:60px; --tbar:44px; --r:14px; --r-btn:9px;
  color-scheme: light;
}
[data-theme="dark"] {
  --ink:#E4EEF1; --text:#E4EEF1; --mut:#8DA6AE; --mut2:#6F8A93;
  --bg:#09181D; --surface:#0E2229; --surface2:#122E36; --surface3:#163640; --bd:#22424C; --bd2:#1A3741;
  --rail:#061317; --rail2:#123540; --railtx:#8EAAB2; --railmut:#4F7580;
  --acc:#35B4BE; --acc-h:#5CC7CF; --acc2:#0D3037; --acc3:#124148;
  --ember:#F5B556; --ember-d:#F5B556; --ember2:#2B2010;
  --ok:#3CC48C; --ok2:#0F2E22; --warn:#E5AE2E; --warn2:#2E2610; --err:#F06A64; --err2:#3A1716; --run:#35B4BE; --run2:#0D3037;
  --shadow:0 1px 2px rgba(0,0,0,.3);
  --shadow-lg:0 16px 40px -8px rgba(0,0,0,.6);
  color-scheme: dark;
}

*,*::before,*::after { box-sizing:border-box; }
html { -webkit-text-size-adjust:100%; }
body { margin:0; font:400 13.5px/1.5 var(--f-ui); color:var(--text); background:var(--bg); -webkit-font-smoothing:antialiased; }
a { color:var(--acc); text-decoration:none; }
a:hover { color:var(--acc-h); text-decoration:underline; }
h1,h2,h3,h4 { font-family:var(--f-disp); font-weight:600; letter-spacing:-.02em; color:var(--ink); margin:0 0 .5rem; line-height:1.2; }
h1 { font-size:19px; } h2 { font-size:16px; } h3 { font-size:14px; }
p { margin:0 0 .75rem; }
code,.mono { font-family:var(--f-code); font-size:12px; }
code { background:var(--surface2); border:1px solid var(--bd2); padding:1px 5px; border-radius:5px; }
hr { border:0; border-top:1px solid var(--bd2); margin:1rem 0; }
.num, table, .tabular { font-variant-numeric: tabular-nums; }
.muted { color:var(--mut); } .small { font-size:12px; } .tiny { font-size:11.5px; }
.strong { font-weight:600; } .nowrap { white-space:nowrap; } .right { text-align:right; } .center { text-align:center; }
.ellipsis { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.hidden, [hidden] { display:none !important; }
:focus-visible { outline:2px solid var(--acc); outline-offset:2px; }
::selection { background:var(--acc3); }
.ic { width:16px; height:16px; flex:none; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; vertical-align:-3px; }
.ic.spark { fill:var(--ember); stroke:none; }
.ic-lg { width:20px; height:20px; } .ic-xl { width:28px; height:28px; }

/* ------------------------------------------------------------------ shell
   Top menu bar on every page (same groups as the old backoffice bar).
   Left sidebar only on the home page (body.is-home / .shell.with-side). */
.kbd { font:500 11px var(--f-ui); border:1px solid var(--bd); border-bottom-width:2px; border-radius:5px; padding:0 5px; color:var(--mut); background:var(--surface2); }
.tbar { position:sticky; top:0; z-index:50; height:var(--tbar); display:flex; align-items:center; gap:6px; padding:0 12px; background:var(--rail); border-bottom:1px solid rgba(255,255,255,.08); color:var(--railtx); }
.tbar-brand { display:inline-flex; align-items:center; gap:9px; padding:4px 8px 4px 4px; border-radius:8px; color:#fff; text-decoration:none !important; flex:none; }
.tbar-brand:hover { background:rgba(255,255,255,.05); }
.tbar-brand .mark { width:26px; height:26px; border-radius:8px; background:linear-gradient(135deg,var(--tide-l),var(--acc)); display:grid; place-items:center; color:#06262B; font:700 13px var(--f-disp); }
.tbar-brand .nm { font:600 14px var(--f-disp); letter-spacing:-.02em; white-space:nowrap; }
.tbar-div { width:1px; height:18px; background:rgba(255,255,255,.1); margin:0 4px; flex:none; }
.tbar-btn { width:32px; height:32px; padding:0; display:inline-grid; place-items:center; border-radius:8px; background:transparent; border:0; color:var(--railtx); cursor:pointer; flex:none; }
.tbar-btn:hover { background:rgba(255,255,255,.07); color:#fff; }
.tbar-actions { margin-left:auto; display:flex; align-items:center; gap:6px; flex:none; }
.tbar-actions .avatar.sm { width:28px; height:28px; font-size:11px; text-decoration:none !important; }
.tbar-cmd { height:32px; display:flex; align-items:center; gap:8px; padding:0 10px; border-radius:9px; border:1px solid var(--rail2); background:rgba(255,255,255,.04); color:var(--railtx); font:inherit; font-size:12.5px; cursor:pointer; }
.tbar-cmd:hover { border-color:var(--ember); color:#fff; }
.tbar-cmd .kbd { background:transparent; border-color:var(--rail2); color:var(--railmut); }
.tbar .burger { display:none; }
.tbar :focus-visible { outline:2px solid var(--tide-l); outline-offset:1px; }

.tnav { flex:1; min-width:0; }
.tnav-head { display:none; }
.tnav-list { display:flex; align-items:center; gap:2px; list-style:none; margin:0; padding:0; }
.tn-item { position:relative; }
.tn-top { display:inline-flex; align-items:center; gap:7px; height:32px; padding:0 10px; border-radius:8px; border:0; background:transparent; color:var(--railtx); font:500 12.8px var(--f-ui); white-space:nowrap; cursor:pointer; text-decoration:none !important; }
.tn-top .ic { width:14px; height:14px; color:var(--railmut); }
.tn-top .caret { width:12px; height:12px; transition:transform .15s; }
.tn-top:hover, .tn-item.has-sub:hover > .tn-top, .tn-item.has-sub:focus-within > .tn-top { background:rgba(255,255,255,.06); color:#fff; }
.tn-item.has-sub:hover > .tn-top .caret, .tn-item.has-sub:focus-within > .tn-top .caret { transform:rotate(180deg); }
.tn-top.active, .tn-item.active-parent > .tn-top { background:var(--rail2); color:#fff; box-shadow:inset 0 -2px 0 var(--tide-l); }
.tn-top.active .ic, .tn-item.active-parent > .tn-top .ic { color:var(--tide-l); }

.tn-sub { position:absolute; top:calc(100% + 8px); left:0; min-width:270px; max-height:calc(100vh - var(--tbar) - 24px); overflow-y:auto; background:var(--surface); border:1px solid var(--bd2); border-radius:12px; box-shadow:0 18px 40px -14px rgba(6,24,30,.35), 0 2px 6px rgba(16,36,46,.06); padding:6px; display:flex; flex-direction:column; gap:1px; opacity:0; visibility:hidden; pointer-events:none; transform:translateY(4px); transition:opacity .14s, transform .14s, visibility .14s; z-index:60; }
.tn-item.right .tn-sub { left:auto; right:0; }
.tn-item.has-sub::after { content:''; position:absolute; left:0; right:0; top:100%; height:10px; } /* hover bridge */
.tn-item.has-sub:hover > .tn-sub, .tn-item.has-sub:focus-within > .tn-sub { opacity:1; visibility:visible; pointer-events:auto; transform:none; }
.tn-head { font-size:11.5px; font-weight:600; color:var(--mut); padding:8px 8px 3px; display:flex; align-items:center; gap:6px; }
.tn-head:first-child { padding-top:3px; }
.tn-head.legacy { border-top:1px solid var(--bd2); margin-top:4px; padding-top:9px; }
.tn-head .badge { display:none; }
.tn-link { display:flex; align-items:center; gap:10px; padding:5px 8px; border-radius:7px; color:var(--ink); font-size:13px; font-weight:500; text-decoration:none !important; transition:background .12s; }
.tn-link .tn-ic { width:26px; height:26px; border-radius:7px; background:var(--surface2); border:1px solid var(--bd2); color:var(--acc); display:inline-grid; place-items:center; flex:none; }
.tn-link .tn-ic .ic { width:14px; height:14px; }
.tn-link:hover { background:var(--acc2); color:var(--acc-h); }
.tn-link:hover .tn-ic { background:var(--acc); border-color:var(--acc); color:#fff; }
.tn-link.active { background:var(--acc2); color:var(--acc-h); }
.tn-link.active .tn-ic { background:var(--acc); border-color:var(--acc); color:#fff; }
.tn-link .badge { margin-left:auto; font-size:11px; padding:0 7px; border-radius:20px; background:var(--surface2); color:var(--mut); line-height:18px; font-variant-numeric:tabular-nums; }
.tn-link .badge.hot { background:var(--err); color:#fff; }
.tn-link .ext { margin-left:auto; width:12px; height:12px; color:var(--mut2); }
.tn-link .badge + .ext { margin-left:6px; }
.nav-scrim { display:none; }

.shell { display:block; min-height:calc(100vh - var(--tbar)); }
.shell.with-side { display:grid; grid-template-columns:var(--side) minmax(0,1fr); }
.side { position:sticky; top:var(--tbar); height:calc(100vh - var(--tbar)); background:var(--rail); color:var(--railtx); display:flex; flex-direction:column; border-top:1px solid rgba(255,255,255,.04); }
.side-who { display:flex; align-items:center; gap:10px; padding:14px 16px 6px; }
.side-who .who { min-width:0; color:#fff; font-size:13px; line-height:1.25; }
.side-who .who small { display:block; color:var(--railmut); font-size:11.5px; }
.side-nav { flex:1; overflow-y:auto; padding:4px 10px 16px; scrollbar-width:thin; scrollbar-color:var(--rail2) transparent; }
.side-sec { font-size:11.5px; color:var(--railmut); padding:14px 10px 5px; font-weight:500; }
.side-link { display:flex; align-items:center; gap:10px; padding:7px 10px; border-radius:8px; color:var(--railtx); font-size:13.5px; text-decoration:none !important; position:relative; transition:background .12s, color .12s; }
.side-link .ic { color:var(--railmut); }
.side-link:hover { background:rgba(255,255,255,.05); color:#fff; }
.side-link:hover .ic { color:var(--railtx); }
.side-link.active { background:var(--rail2); color:#fff; box-shadow:inset 3px 0 0 var(--tide-l); }
.side-link.active .ic { color:var(--tide-l); }
.side-link .badge { margin-left:auto; font-size:11px; padding:0 7px; border-radius:20px; background:rgba(255,255,255,.08); color:var(--railtx); line-height:18px; font-variant-numeric:tabular-nums; }
.side-link .badge.hot { background:var(--err); color:#fff; }
.side-link .ext { margin-left:auto; width:12px; height:12px; opacity:.5; }
.side-sub { padding-left:26px; display:none; }
.side-group.open > .side-sub { display:block; }
.side-sub .side-link { font-size:13px; padding:5px 10px; }
.side-group > .side-link .chev { margin-left:auto; width:14px; height:14px; transition:transform .15s; }
.side-group > .side-link .badge + .chev { margin-left:6px; }
.side-group.open > .side-link .chev { transform:rotate(90deg); }
.avatar { width:30px; height:30px; border-radius:50%; display:grid; place-items:center; font:600 12px var(--f-ui); color:#fff; flex:none; background:var(--rail2); }

.main { min-width:0; display:flex; flex-direction:column; }
.phead { display:flex; align-items:center; gap:12px; flex-wrap:wrap; padding:1.1rem 1.6rem 0; }
.phead-t { min-width:0; flex:1 1 260px; }
.phead-t h1 { margin:0; font-size:19px; }
.phead-t p { margin:2px 0 0; font-size:12.5px; color:var(--mut); }
.phead-a { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.content { padding:1rem 1.6rem 3rem; flex:1; min-width:0; }

@media (max-width: 1680px) { .tbar-cmd .lbl { display:none; } .tn-top .ic:not(.caret) { display:none; } }
@media (max-width: 1360px) { .tbar-cmd .kbd { display:none; } .tn-top { padding:0 7px; font-size:12.4px; gap:4px; } .tbar-brand .nm { display:none; } }
@media (max-width: 1120px) { .tbar-div { display:none; } .tn-top .caret { display:none; } .tn-top { padding:0 6px; } }
@media (max-width: 960px) {
  .tbar .burger { display:inline-grid; }
  .tbar-brand .nm { display:inline; }
  .tnav { position:fixed; left:0; top:0; bottom:0; width:min(320px, 88vw); background:var(--rail); z-index:70; overflow-y:auto; transform:translateX(-100%); transition:transform .2s ease; box-shadow:var(--shadow-lg); padding:0 10px 24px; }
  body.nav-open .tnav { transform:none; }
  body.nav-open .tbar { z-index:80; }
  body.nav-open .nav-scrim { display:block; position:fixed; inset:0; background:rgba(6,19,23,.5); z-index:65; }
  .tnav-head { display:flex; align-items:center; justify-content:space-between; height:var(--tbar); color:#fff; font:600 14px var(--f-disp); padding:0 4px 0 8px; position:sticky; top:0; background:var(--rail); }
  .tnav-list { flex-direction:column; align-items:stretch; gap:0; }
  .tn-top { width:100%; justify-content:flex-start; height:36px; }
  .tn-top .ic:not(.caret) { display:inline; }
  .tn-top .caret { display:none; }
  .tn-item.has-sub > .tn-top { pointer-events:none; color:var(--railmut); font-size:11.5px; height:28px; margin-top:8px; background:transparent !important; box-shadow:none !important; }
  .tn-sub { position:static; opacity:1; visibility:visible; pointer-events:auto; transform:none; background:transparent; border:0; box-shadow:none; padding:0 0 0 6px; max-height:none; min-width:0; }
  .tn-head { color:var(--railmut); }
  .tn-head.legacy { border-color:rgba(255,255,255,.07); }
  .tn-link { color:var(--railtx); }
  .tn-link .tn-ic { background:transparent; border-color:rgba(255,255,255,.08); color:var(--tide-l); }
  .tn-link:hover, .tn-link.active { background:var(--rail2); color:#fff; }
  .tn-item.has-sub::after { display:none; }
  .shell.with-side { display:block; }
  .shell.with-side .side { display:none; }
  .phead { padding:.9rem .8rem 0; }
}
@media (max-width: 520px) { .tbar-brand .nm { display:none; } .tbar { gap:4px; padding:0 8px; } }
.page-head { display:flex; align-items:flex-end; gap:12px; flex-wrap:wrap; margin-bottom:1rem; }
.page-head .grow { flex:1; min-width:200px; }
.crumbs { font-size:12.5px; color:var(--mut); margin-bottom:4px; }
.crumbs a { color:var(--mut); } .crumbs a:hover { color:var(--acc); }

/* ------------------------------------------------------------------ layout helpers */
.grid { display:grid; gap:1rem; }
.g2 { grid-template-columns:repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns:repeat(3, minmax(0,1fr)); } .g4 { grid-template-columns:repeat(4, minmax(0,1fr)); }
.g-side { grid-template-columns:minmax(0,1fr) 340px; }
.row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.row.tight { gap:4px; } .row.between { justify-content:space-between; } .row.end { justify-content:flex-end; } .row.nowrap { flex-wrap:nowrap; }
.stack > * + * { margin-top:1rem; } .stack-sm > * + * { margin-top:.5rem; }
.grow { flex:1; min-width:0; }
.mt0{margin-top:0}.mt1{margin-top:.5rem}.mt2{margin-top:1rem}.mt3{margin-top:1.5rem}.mb0{margin-bottom:0}.mb1{margin-bottom:.5rem}.mb2{margin-bottom:1rem}

/* ------------------------------------------------------------------ cards */
.card { background:var(--surface); border:1px solid var(--bd2); border-radius:var(--r); box-shadow:var(--shadow); min-width:0; }
.card-h { display:flex; align-items:center; gap:10px; padding:12px 16px; border-bottom:1px solid var(--bd2); min-height:48px; }
.card-h h2, .card-h h3 { font:600 13.5px var(--f-ui); letter-spacing:0; margin:0; color:var(--ink); }
.card-h .sub { font-size:12px; color:var(--mut); }
.card-h .tools { margin-left:auto; display:flex; gap:6px; align-items:center; }
.card-b { padding:16px; }
.card-b.flush { padding:0; }
.card-f { padding:10px 16px; border-top:1px solid var(--bd2); background:var(--surface2); border-radius:0 0 var(--r) var(--r); }
.sec-label { font:600 12.5px var(--f-ui); color:var(--ink); margin:0 0 6px; }

/* ------------------------------------------------------------------ buttons */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:7px; height:34px; padding:0 13px; border-radius:var(--r-btn); border:1px solid transparent; font:550 13px var(--f-ui); cursor:pointer; white-space:nowrap; text-decoration:none !important; transition:background .12s, border-color .12s, color .12s, box-shadow .12s; user-select:none; }
.btn:disabled, .btn.is-loading { opacity:.6; cursor:not-allowed; }
.btn-secondary, .btn { background:var(--surface); border-color:var(--bd); color:var(--ink); }
.btn-secondary:hover, .btn:hover { background:var(--surface2); color:var(--ink); }
.btn-primary { background:var(--acc); color:#fff; }
.btn-primary:hover { background:var(--acc-h); color:#fff; }
[data-theme="dark"] .btn-primary { color:#05282C; }
.btn-primary { border-color:transparent; }
.btn-ghost { background:transparent; border-color:transparent; color:var(--mut); }
.btn-ghost:hover { background:var(--surface2); color:var(--ink); }
.btn-ai { background:var(--ember); color:var(--ember-ink); border-color:transparent; }
.btn-ai:hover { background:var(--ember-h); color:var(--ember-ink); }
.btn-ai .ic.spark { fill:var(--ember-ink); }
.btn-ai2 { background:var(--ember2); color:var(--ember-d); border-color:color-mix(in srgb, var(--ember) 60%, transparent); }
.btn-ai2:hover { background:color-mix(in srgb, var(--ember2) 70%, var(--ember) 30%); color:var(--ember-d); }
.btn-danger { background:transparent; color:var(--err); border-color:color-mix(in srgb, var(--err) 55%, transparent); }
.btn-danger:hover { background:var(--err2); color:var(--err); }
.btn-danger.confirming { background:var(--err); color:#fff; }
.btn-sm { height:28px; padding:0 10px; font-size:12.5px; border-radius:8px; gap:5px; }
.btn-xs { height:24px; padding:0 8px; font-size:12px; border-radius:7px; gap:4px; }
.btn-lg { height:42px; padding:0 18px; font-size:14px; }
.btn-block { width:100%; }
.icon-btn { width:32px; height:32px; padding:0; display:inline-grid; place-items:center; border-radius:8px; background:transparent; border:0; color:var(--mut); cursor:pointer; }
.icon-btn:hover { background:var(--surface2); color:var(--ink); }
.icon-btn.sm { width:26px; height:26px; }
.btn .spin, .spin { animation:spin .8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.btn-group { display:inline-flex; }
.btn-group > .btn { border-radius:0; margin-left:-1px; }
.btn-group > .btn:first-child { border-radius:var(--r-btn) 0 0 var(--r-btn); margin-left:0; }
.btn-group > .btn:last-child { border-radius:0 var(--r-btn) var(--r-btn) 0; }
.btn-group > .btn.on { background:var(--acc2); color:var(--acc); border-color:var(--acc3); z-index:1; }

/* ------------------------------------------------------------------ forms */
.field { display:flex; flex-direction:column; gap:5px; min-width:0; }
.field > label, .label { font:500 12.5px var(--f-ui); color:var(--ink); }
.field .help { font-size:12px; color:var(--mut); }
.field .err-msg { font-size:12px; color:var(--err); }
.input, .select, .textarea, input[type=text].input { width:100%; height:34px; padding:0 10px; border:1px solid var(--bd); border-radius:var(--r-btn); background:var(--surface); color:var(--text); font:400 13px var(--f-ui); transition:border-color .12s, box-shadow .12s; }
.textarea { height:auto; min-height:84px; padding:8px 10px; resize:vertical; line-height:1.5; }
.select { appearance:none; padding-right:28px; 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='%235A6F78' stroke-width='2.2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 9px center; }
.input:focus, .select:focus, .textarea:focus { outline:none; border-color:var(--acc); box-shadow:0 0 0 3px color-mix(in srgb, var(--acc) 18%, transparent); }
.input.ai:focus, .textarea.ai:focus { border-color:var(--ember); box-shadow:0 0 0 3px color-mix(in srgb, var(--ember) 28%, transparent); }
.input.sm, .select.sm { height:28px; font-size:12.5px; border-radius:8px; }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color:var(--err); }
.input::placeholder, .textarea::placeholder { color:var(--mut2); }
.input-icon { position:relative; }
.input-icon .ic { position:absolute; left:10px; top:50%; transform:translateY(-50%); color:var(--mut); pointer-events:none; }
.input-icon .input { padding-left:32px; }
.check { display:inline-flex; align-items:center; gap:8px; cursor:pointer; font-size:13px; }
input[type=checkbox], input[type=radio] { accent-color:var(--acc); width:15px; height:15px; margin:0; }
.switch { position:relative; display:inline-flex; align-items:center; gap:9px; cursor:pointer; }
.switch input { position:absolute; opacity:0; width:0; height:0; }
.switch .tr { width:34px; height:20px; border-radius:20px; background:var(--bd); position:relative; transition:background .15s; flex:none; }
.switch .tr::after { content:''; position:absolute; top:2px; left:2px; width:16px; height:16px; border-radius:50%; background:#fff; transition:transform .15s; box-shadow:0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .tr { background:var(--acc); }
.switch input:checked + .tr::after { transform:translateX(14px); }
.switch input:focus-visible + .tr { outline:2px solid var(--acc); outline-offset:2px; }
.form-grid { display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:12px 14px; }
.form-grid .full { grid-column:1 / -1; }
fieldset { border:0; padding:0; margin:0; }

/* ------------------------------------------------------------------ chips & badges */
.chip { display:inline-flex; align-items:center; gap:5px; height:22px; padding:0 9px; border-radius:20px; font:500 12px var(--f-ui); white-space:nowrap; background:var(--surface3); color:var(--mut); border:1px solid transparent; max-width:100%; overflow:hidden; text-overflow:ellipsis; }
.chip-ok { background:var(--ok2); color:var(--ok); }
.chip-run { background:var(--run2); color:var(--run); }
.chip-wait { background:var(--surface3); color:var(--mut); }
.chip-err { background:var(--err2); color:var(--err); }
.chip-warn { background:var(--warn2); color:var(--warn); }
.chip-ai { background:var(--ember2); color:var(--ember-d); }
.chip .dot { width:6px; height:6px; border-radius:50%; background:currentColor; }
.chip-sm { height:19px; font-size:11.5px; padding:0 7px; }
.tag { display:inline-block; padding:0 6px; border-radius:5px; font:500 11.5px var(--f-ui); background:var(--surface3); color:var(--mut); line-height:18px; }
.pill-tabs { display:flex; gap:4px; flex-wrap:wrap; }
.pill { display:inline-flex; align-items:center; gap:6px; height:30px; padding:0 12px; border-radius:20px; border:1px solid var(--bd); background:var(--surface); color:var(--ink); font:500 12.5px var(--f-ui); cursor:pointer; text-decoration:none !important; }
.pill:hover { background:var(--surface2); color:var(--ink); }
.pill.on { background:var(--ink); color:var(--surface); border-color:var(--ink); }
.pill .n { font-variant-numeric:tabular-nums; color:var(--mut); font-size:12px; }
.pill.on .n { color:inherit; opacity:.7; }

/* ------------------------------------------------------------------ tabs */
.tabs { display:flex; gap:2px; border-bottom:1px solid var(--bd2); margin-bottom:1rem; overflow-x:auto; scrollbar-width:none; }
.tab { padding:9px 12px; font:500 13px var(--f-ui); color:var(--mut); border-bottom:2px solid transparent; margin-bottom:-1px; white-space:nowrap; cursor:pointer; background:none; border-top:0; border-left:0; border-right:0; text-decoration:none !important; }
.tab:hover { color:var(--ink); }
.tab.on { color:var(--ink); border-bottom-color:var(--acc); }

/* ------------------------------------------------------------------ tables */
.table { width:100%; border-collapse:separate; border-spacing:0; font-size:13px; }
.table th { text-align:left; font:500 12px var(--f-ui); color:var(--mut); padding:8px 12px; border-bottom:1px solid var(--bd2); background:var(--surface2); white-space:nowrap; position:sticky; top:0; }
.table td { padding:9px 12px; border-bottom:1px solid var(--bd2); vertical-align:middle; }
.table tr:last-child td { border-bottom:0; }
.table tbody tr:hover td { background:color-mix(in srgb, var(--acc2) 45%, transparent); }
.table.compact td { padding:6px 10px; } .table.compact th { padding:6px 10px; }
.table-wrap { overflow:auto; }
dl.kv { display:grid; grid-template-columns:max-content 1fr; gap:6px 14px; margin:0; font-size:13px; }
dl.kv dt { color:var(--mut); } dl.kv dd { margin:0; min-width:0; overflow-wrap:anywhere; }

/* ------------------------------------------------------------------ data grid (Excel-like) */
.dg { display:flex; flex-direction:column; min-width:0; }
.dg-bar { display:flex; align-items:center; gap:8px; flex-wrap:wrap; padding:10px 12px; border-bottom:1px solid var(--bd2); }
.dg-bar .search { width:260px; max-width:100%; }
.dg-quick { display:flex; gap:4px; flex-wrap:wrap; padding:8px 12px 0; }
.dg-sel { display:none; align-items:center; gap:8px; padding:7px 12px; background:var(--acc2); border-bottom:1px solid var(--acc3); font-size:12.5px; color:var(--acc); flex-wrap:wrap; }
.dg-sel.on { display:flex; }
.dg-scroll { overflow:auto; max-height:calc(100vh - 250px); min-height:200px; position:relative; }
.dg table { border-collapse:separate; border-spacing:0; font-size:12px; width:max-content; min-width:100%; table-layout:fixed; }
.dg th, .dg td { border-right:1px solid var(--bd2); border-bottom:1px solid var(--bd2); padding:0 8px; height:28px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; text-align:left; }
.dg thead th { position:sticky; top:0; z-index:2; background:var(--surface2); font:600 12px var(--f-ui); color:var(--ink); user-select:none; height:30px; }
.dg thead tr.flt th { top:30px; background:var(--surface); padding:2px 3px; height:30px; }
.dg thead tr.flt input, .dg thead tr.flt select { width:100%; height:24px; border:1px solid var(--bd2); border-radius:6px; background:var(--surface); color:var(--text); font:12px var(--f-ui); padding:0 6px; }
.dg thead tr.flt input:focus, .dg thead tr.flt select:focus { outline:none; border-color:var(--acc); }
.dg thead th.sortable { cursor:pointer; }
.dg thead th.sortable:hover { color:var(--acc); }
.dg thead th .arr { opacity:.35; margin-left:3px; font-size:10px; }
.dg thead th.sorted .arr { opacity:1; color:var(--acc); }
.dg thead th .rz { position:absolute; right:-3px; top:0; bottom:0; width:7px; cursor:col-resize; z-index:3; }
.dg thead th .rz:hover, .dg thead th .rz.on { background:var(--acc); opacity:.4; }
.dg tbody tr:nth-child(even) td { background:color-mix(in srgb, var(--surface2) 55%, var(--surface)); }
.dg tbody tr:hover td { background:color-mix(in srgb, var(--acc2) 70%, var(--surface)); }
.dg tbody tr.sel td { background:color-mix(in srgb, var(--acc2) 100%, var(--surface)) !important; }
.dg tbody tr { cursor:default; }
.dg tbody tr.clickable { cursor:pointer; }
.dg td.r, .dg th.r { text-align:right; }
.dg td.c, .dg th.c { text-align:center; }
.dg .ck { width:34px; text-align:center; padding:0; }
.dg .sticky-l { position:sticky; left:0; z-index:1; }
.dg thead .sticky-l { z-index:3; }
.dg td.sticky-l { background:var(--surface); }
.dg td .chip { height:19px; font-size:11.5px; padding:0 7px; }
.dg td a { color:var(--acc); }
.dg-foot { display:flex; align-items:center; gap:10px; padding:8px 12px; border-top:1px solid var(--bd2); font-size:12.5px; color:var(--mut); flex-wrap:wrap; }
.dg-foot .pg { display:flex; gap:4px; align-items:center; margin-left:auto; }
.dg-empty { padding:40px 16px; text-align:center; color:var(--mut); }
.dg-loading { position:absolute; inset:0; background:color-mix(in srgb, var(--surface) 55%, transparent); display:none; place-items:center; z-index:5; }
.dg.loading .dg-loading { display:grid; }
.dg td.editing { padding:0; overflow:visible; }
.dg td.editing input, .dg td.editing select { width:100%; height:27px; border:2px solid var(--acc); border-radius:0; font:12px var(--f-ui); padding:0 6px; background:var(--surface); color:var(--text); }
.dg td.editable:hover { box-shadow:inset 0 0 0 1px var(--acc3); cursor:text; }
.dg td .mark { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:4px; vertical-align:middle; }
.dg tr.mark-row td:first-child { box-shadow:inset 3px 0 0 var(--mk, transparent); }

/* ------------------------------------------------------------------ dropdown / popover */
.dd { position:relative; display:inline-block; }
.dd-menu { position:absolute; right:0; top:calc(100% + 6px); min-width:200px; background:var(--surface); border:1px solid var(--bd2); border-radius:12px; box-shadow:var(--shadow-lg); padding:6px; z-index:60; display:none; max-height:70vh; overflow:auto; }
.dd.open .dd-menu { display:block; }
.dd-menu.left { right:auto; left:0; }
.dd-item { display:flex; align-items:center; gap:9px; width:100%; padding:7px 10px; border-radius:7px; font:13px var(--f-ui); color:var(--ink); background:none; border:0; cursor:pointer; text-align:left; text-decoration:none !important; }
.dd-item:hover { background:var(--surface2); color:var(--ink); }
.dd-item.danger { color:var(--err); }
.dd-sep { height:1px; background:var(--bd2); margin:5px 2px; }
.dd-label { font-size:11.5px; color:var(--mut); padding:6px 10px 3px; }

/* ------------------------------------------------------------------ modal / drawer */
.overlay { position:fixed; inset:0; background:color-mix(in srgb, var(--rail) 55%, transparent); z-index:80; display:none; animation:fade .12s; }
.overlay.open { display:block; }
@keyframes fade { from { opacity:0; } }
.modal { position:fixed; left:50%; top:8vh; transform:translateX(-50%); width:min(560px, calc(100vw - 24px)); max-height:84vh; display:none; flex-direction:column; background:var(--surface); border-radius:16px; box-shadow:var(--shadow-lg); z-index:81; overflow:hidden; border:1px solid var(--bd2); }
.modal.open { display:flex; animation:pop .14s ease-out; }
.modal.lg { width:min(860px, calc(100vw - 24px)); } .modal.xl { width:min(1120px, calc(100vw - 24px)); } .modal.sm { width:min(420px, calc(100vw - 24px)); }
@keyframes pop { from { opacity:0; transform:translate(-50%, 8px); } }
.modal-h { display:flex; align-items:center; gap:10px; padding:14px 18px; background:var(--surface2); border-bottom:1px solid var(--bd2); }
.modal-h h3 { margin:0; font:600 16px var(--f-disp); flex:1; }
.modal-b { padding:18px; overflow:auto; flex:1; }
.modal-f { display:flex; justify-content:flex-end; gap:8px; padding:12px 18px; border-top:1px solid var(--bd2); background:var(--surface2); }
.drawer { position:fixed; top:0; right:0; bottom:0; width:min(720px, 100vw); background:var(--bg); z-index:81; box-shadow:var(--shadow-lg); display:flex; flex-direction:column; transform:translateX(100%); transition:transform .2s ease; visibility:hidden; }
.drawer.open { transform:none; visibility:visible; }
.drawer.wide { width:min(980px, 100vw); }
.drawer-h { display:flex; align-items:center; gap:10px; padding:14px 18px; background:var(--surface); border-bottom:1px solid var(--bd2); }
.drawer-h h3 { margin:0; font:600 17px var(--f-disp); flex:1; min-width:0; }
.drawer-b { flex:1; overflow:auto; padding:16px 18px; }
.drawer-f { padding:12px 18px; border-top:1px solid var(--bd2); background:var(--surface); display:flex; gap:8px; justify-content:flex-end; }

/* ------------------------------------------------------------------ toasts / alerts */
.toasts { position:fixed; right:16px; bottom:16px; z-index:120; display:flex; flex-direction:column; gap:8px; max-width:min(380px, calc(100vw - 32px)); }
.toast { display:flex; gap:10px; align-items:flex-start; padding:11px 14px; border-radius:11px; background:var(--ink); color:var(--surface); box-shadow:var(--shadow-lg); font-size:13px; animation:pop2 .18s ease-out; }
.toast.err { background:var(--err); color:#fff; } .toast.ok .ic { color:#5BE3A8; } .toast.warn .ic { color:var(--ember); }
@keyframes pop2 { from { opacity:0; transform:translateY(8px); } }
.alert { display:flex; gap:10px; align-items:flex-start; padding:11px 14px; border-radius:11px; border:1px solid; font-size:13px; }
.alert .ic { margin-top:1px; }
.alert-ok { background:var(--ok2); border-color:color-mix(in srgb, var(--ok) 30%, transparent); color:var(--ok); }
.alert-warn { background:var(--warn2); border-color:color-mix(in srgb, var(--warn) 30%, transparent); color:var(--warn); }
.alert-err { background:var(--err2); border-color:color-mix(in srgb, var(--err) 30%, transparent); color:var(--err); }
.alert-info { background:var(--acc2); border-color:var(--acc3); color:var(--acc); }
.alert b, .alert strong { color:inherit; }
.alert .txt { color:var(--ink); }

/* ------------------------------------------------------------------ empty / progress / steps */
.empty { border:1.5px dashed var(--bd); border-radius:var(--r); padding:32px 20px; text-align:center; color:var(--mut); }
.empty .ic { width:28px; height:28px; color:var(--mut2); margin-bottom:6px; }
.empty p { margin:0; }
.bar { height:8px; border-radius:20px; background:var(--surface3); overflow:hidden; }
.bar > i { display:block; height:100%; border-radius:20px; background:var(--acc); transition:width .5s ease; }
.bar.thin { height:6px; } .bar.thick { height:12px; }
.bar.striped { background:repeating-linear-gradient(-45deg, var(--surface3) 0 6px, var(--surface2) 6px 12px); }
.bar > i.grad { background:linear-gradient(90deg, var(--acc), var(--tide-l)); }
.bar > i.ok { background:var(--ok); } .bar > i.warn { background:var(--warn); } .bar > i.err { background:var(--err); } .bar > i.ai { background:var(--ember); }
.steps { display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.step { display:flex; align-items:center; gap:8px; font-size:13px; color:var(--mut); }
.step .n { width:24px; height:24px; border-radius:50%; display:grid; place-items:center; border:1.5px solid var(--bd); font:600 12px var(--f-ui); }
.step.cur { color:var(--ink); } .step.cur .n { background:var(--ink); color:var(--surface); border-color:var(--ink); }
.step.done .n { background:var(--ok); border-color:var(--ok); color:#fff; }
.step + .step::before { content:''; width:22px; height:1.5px; background:var(--bd); margin-right:2px; }

/* ------------------------------------------------------------------ hero / detail rows (dashboards) */
.hero { padding:20px 22px; }
.hero-sentence { font:500 26px/1.25 var(--f-disp); letter-spacing:-.025em; color:var(--ink); margin:0 0 14px; }
.hero-sentence b { font-weight:600; color:var(--acc); }
.hero-sub { color:var(--mut); margin:-6px 0 14px; }
.detail-rows { display:flex; flex-direction:column; }
.drow { display:grid; grid-template-columns:minmax(150px, 1.1fr) minmax(80px, 1.2fr) auto auto; gap:14px; align-items:center; padding:11px 16px; border-top:1px solid var(--bd2); }
.drow:first-child { border-top:0; }
.drow .lbl { display:flex; align-items:center; gap:9px; font-weight:500; min-width:0; }
.drow .lbl .ic { color:var(--mut); }
.drow .cnt { font-variant-numeric:tabular-nums; color:var(--mut); font-size:12.5px; white-space:nowrap; text-align:right; min-width:90px; }
.drow .cnt b { color:var(--ink); font-size:13.5px; }
.drow.alert-row { box-shadow:inset 4px 0 0 var(--err); }
.drow.warn-row { box-shadow:inset 4px 0 0 var(--warn); }
.drow.ok-row { box-shadow:inset 4px 0 0 var(--ok); }
.stat-strip { display:grid; grid-template-columns:repeat(auto-fit, minmax(150px, 1fr)); border-top:1px solid var(--bd2); }
.stat-strip > div { padding:12px 16px; border-left:1px solid var(--bd2); }
.stat-strip > div:first-child { border-left:0; }
.stat-strip .k { font-size:12px; color:var(--mut); }
.stat-strip .v { font:600 17px var(--f-disp); letter-spacing:-.02em; font-variant-numeric:tabular-nums; }
.stat-strip .d { font-size:11.5px; color:var(--mut); }
.up { color:var(--ok); } .down { color:var(--err); }
.list-rows .lr { display:flex; align-items:center; gap:10px; padding:10px 14px; border-top:1px solid var(--bd2); box-shadow:inset 4px 0 0 var(--lr, var(--bd)); }
.list-rows .lr:first-child { border-top:0; }
.list-rows .lr .t { font-weight:550; }
.list-rows .lr .m { font-size:12px; color:var(--mut); }
.list-rows .lr.ok { --lr:var(--ok); } .list-rows .lr.err { --lr:var(--err); } .list-rows .lr.warn { --lr:var(--warn); } .list-rows .lr.run { --lr:var(--acc); }
.spark-bars { display:flex; align-items:flex-end; gap:3px; height:120px; padding-top:8px; }
.spark-bars .b { flex:1; display:flex; flex-direction:column; justify-content:flex-end; align-items:center; gap:4px; min-width:0; height:100%; }
.spark-bars .b i { width:100%; max-width:42px; border-radius:6px 6px 2px 2px; background:var(--acc); min-height:2px; transition:height .5s; }
.spark-bars .b i.alt { background:var(--err); opacity:.75; }
.spark-bars .b span { font-size:11px; color:var(--mut); white-space:nowrap; }
.legend { display:flex; gap:12px; font-size:12px; color:var(--mut); }
.legend i { display:inline-block; width:9px; height:9px; border-radius:3px; margin-right:5px; vertical-align:-1px; }

/* ------------------------------------------------------------------ AI co-pilot */
.ai-panel { border:1px solid color-mix(in srgb, var(--ember) 45%, var(--bd2)); background:linear-gradient(180deg, var(--ember2), var(--surface) 140px); border-radius:var(--r); }
.ai-panel .card-h { border-bottom-color:color-mix(in srgb, var(--ember) 25%, var(--bd2)); }
.ai-badge { width:26px; height:26px; border-radius:8px; background:var(--ember); display:grid; place-items:center; }
.ai-badge .ic.spark { fill:var(--ember-ink); width:15px; height:15px; }
.ai-sugg { display:flex; align-items:center; gap:9px; padding:9px 11px; border-radius:9px; border:1px solid var(--bd2); background:var(--surface); cursor:pointer; font-size:13px; color:var(--ink); width:100%; text-align:left; font-family:inherit; }
.ai-sugg:hover { border-color:var(--ember); background:var(--ember2); }
.ai-out { white-space:pre-wrap; background:var(--surface); border:1px solid var(--bd2); border-radius:10px; padding:10px 12px; font-size:13px; }
.ai-cost { font-size:11.5px; color:var(--ember-d); }

/* ------------------------------------------------------------------ command palette */
.cmd { position:fixed; left:50%; top:12vh; transform:translateX(-50%); width:min(620px, calc(100vw - 24px)); background:var(--surface); border-radius:16px; box-shadow:var(--shadow-lg); z-index:110; display:none; overflow:hidden; border:1px solid var(--bd2); }
.cmd.open { display:block; animation:pop .14s ease-out; }
.cmd-in { display:flex; align-items:center; gap:10px; padding:0 16px; border-bottom:1px solid var(--bd2); }
.cmd-in input { flex:1; height:52px; border:0; background:transparent; color:var(--text); font:15px var(--f-ui); outline:none; }
.cmd-list { max-height:56vh; overflow:auto; padding:6px; }
.cmd-grp { font-size:11.5px; color:var(--mut); padding:8px 10px 4px; }
.cmd-it { display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:9px; color:var(--ink); cursor:pointer; text-decoration:none !important; }
.cmd-it .m { font-size:12px; color:var(--mut); margin-left:auto; white-space:nowrap; }
.cmd-it.on, .cmd-it:hover { background:var(--acc2); color:var(--ink); }
.cmd-it .ic { color:var(--mut); }
.cmd-foot { display:flex; gap:14px; padding:8px 14px; border-top:1px solid var(--bd2); font-size:11.5px; color:var(--mut); background:var(--surface2); }

/* ------------------------------------------------------------------ timeline / thread */
.timeline { position:relative; padding-left:18px; }
.timeline::before { content:''; position:absolute; left:5px; top:4px; bottom:4px; width:1.5px; background:var(--bd2); }
.tl { position:relative; padding:0 0 12px; font-size:13px; }
.tl::before { content:''; position:absolute; left:-17px; top:5px; width:9px; height:9px; border-radius:50%; background:var(--surface); border:2px solid var(--acc); }
.tl .when { font-size:11.5px; color:var(--mut); }
.thread { display:flex; flex-direction:column; gap:10px; }
.msg { max-width:86%; padding:10px 13px; border-radius:12px; background:var(--surface); border:1px solid var(--bd2); font-size:13px; overflow-wrap:anywhere; }
.msg.me { align-self:flex-end; background:var(--acc2); border-color:var(--acc3); }
.msg .meta { font-size:11.5px; color:var(--mut); margin-bottom:4px; display:flex; gap:8px; }
.msg .body img { max-width:100%; height:auto; }
.msg .body { line-height:1.55; }
.note { background:var(--warn2); border:1px solid color-mix(in srgb, var(--warn) 30%, transparent); border-radius:10px; padding:8px 11px; font-size:13px; }

/* ------------------------------------------------------------------ auth pages */
.auth { min-height:100vh; display:grid; grid-template-columns:1.05fr 1fr; }
.auth-art { background:var(--rail); color:var(--railtx); padding:48px; display:flex; flex-direction:column; justify-content:space-between; position:relative; overflow:hidden; }
.auth-art::after { content:''; position:absolute; right:-120px; bottom:-120px; width:420px; height:420px; border-radius:50%; background:radial-gradient(circle, color-mix(in srgb, var(--tide-l) 30%, transparent), transparent 70%); }
.auth-art h2 { color:#fff; font-size:30px; max-width:420px; line-height:1.15; }
.auth-art p { max-width:400px; color:var(--railtx); }
.auth-form { display:grid; place-items:center; padding:32px 20px; }
.auth-card { width:min(380px, 100%); }
.auth-card h1 { font-size:24px; margin-bottom:4px; }
.otp-in { letter-spacing:.5em; text-align:center; font:600 22px var(--f-code); height:48px; }

/* ------------------------------------------------------------------ misc */
.kpi-inline { display:flex; gap:22px; flex-wrap:wrap; }
.kpi-inline .k { font-size:12px; color:var(--mut); }
.kpi-inline .v { font:600 18px var(--f-disp); font-variant-numeric:tabular-nums; letter-spacing:-.02em; }
.divider-v { width:1px; align-self:stretch; background:var(--bd2); }
.swatch { width:18px; height:18px; border-radius:6px; border:2px solid var(--surface); box-shadow:0 0 0 1px var(--bd); cursor:pointer; display:inline-block; }
.swatch.on { box-shadow:0 0 0 2px var(--acc); }
.code-block { background:var(--rail); color:#CFE3E8; border-radius:10px; padding:12px 14px; font:12px/1.55 var(--f-code); overflow:auto; white-space:pre-wrap; word-break:break-all; max-height:420px; }
.perm-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(260px, 1fr)); gap:12px; }
.perm-box { border:1px solid var(--bd2); border-radius:12px; padding:10px 12px; background:var(--surface); }
.perm-box h4 { font:600 13px var(--f-ui); display:flex; align-items:center; gap:8px; margin:0 0 6px; }
.perm-box label { display:flex; align-items:center; gap:8px; padding:3px 0; font-size:12.5px; cursor:pointer; }
.settings-nav { position:sticky; top:calc(var(--top) + 16px); }
.settings-nav a { display:flex; align-items:center; gap:9px; padding:7px 10px; border-radius:8px; color:var(--ink); font-size:13px; text-decoration:none !important; }
.settings-nav a:hover { background:var(--surface); }
.settings-nav a.on { background:var(--surface); box-shadow:var(--shadow); color:var(--acc); font-weight:550; }
.settings-nav .sec { font-size:11.5px; color:var(--mut); padding:12px 10px 4px; }
.secret-wrap { display:flex; gap:6px; }
.gallery { display:grid; grid-template-columns:repeat(auto-fill, minmax(110px, 1fr)); gap:8px; }
.gallery a { display:block; aspect-ratio:1; border-radius:10px; overflow:hidden; border:1px solid var(--bd2); background:var(--surface2); }
.gallery img, .gallery video { width:100%; height:100%; object-fit:cover; }
.maint-banner { background:var(--warn2); color:var(--warn); text-align:center; font-size:12.5px; padding:6px; border-bottom:1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.skeleton { background:linear-gradient(90deg, var(--surface2), var(--surface3), var(--surface2)); background-size:200% 100%; animation:sk 1.2s infinite; border-radius:6px; height:12px; }
@keyframes sk { to { background-position:-200% 0; } }

/* ------------------------------------------------------------------ mobile */
.bottom-nav { display:none; }
@media (max-width: 1100px) {
  .g4 { grid-template-columns:repeat(2, minmax(0,1fr)); }
  .g-side { grid-template-columns:1fr; }
}
@media (max-width: 860px) {
  .content { padding:1rem .8rem 5.5rem; }
  .g2, .g3, .g4, .form-grid { grid-template-columns:1fr; }
  .drow { grid-template-columns:1fr auto; }
  .drow > .bar { grid-column:1 / -1; order:3; }
  .hero-sentence { font-size:21px; }
  .auth { grid-template-columns:1fr; }
  .auth-art { display:none; }
  .bottom-nav { display:flex; position:fixed; left:0; right:0; bottom:0; height:60px; background:var(--surface); border-top:1px solid var(--bd2); z-index:35; padding-bottom:env(safe-area-inset-bottom); }
  .bottom-nav a { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; font-size:11px; color:var(--mut); text-decoration:none !important; }
  .bottom-nav a.on { color:var(--acc); }
  .bottom-nav .ic { width:20px; height:20px; }
  .dg-scroll { max-height:none; }
  .dg-bar .search { width:100%; }
  .modal { top:auto; bottom:0; border-radius:16px 16px 0 0; max-height:92vh; }
  .toasts { bottom:70px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration:.001ms !important; transition-duration:.001ms !important; }
}
@media print {
  .side, .tbar, .phead-a, .bottom-nav, .no-print, .dg-bar, .dg-foot { display:none !important; }
  .shell { display:block; } .content { padding:0; } body { background:#fff; }
  .card { box-shadow:none; border-color:#ccc; }
}
.g-settings { display:grid; grid-template-columns:220px minmax(0,1fr); gap:1.2rem; align-items:start; }
@media (max-width: 900px) { .g-settings { grid-template-columns:1fr; } .settings-nav { position:static; display:flex; flex-wrap:wrap; gap:4px; } .settings-nav .sec { width:100%; } }
.tn-code { margin-left:auto; font:600 10.5px var(--f-code); color:var(--mut); background:var(--surface2); border:1px solid var(--bd2); border-radius:5px; padding:0 5px; line-height:17px; }
.tn-link .badge + .tn-code { margin-left:6px; }
.tn-link:hover .tn-code, .tn-link.active .tn-code { color:var(--acc-h); border-color:var(--acc3); background:var(--surface); }
@media (max-width: 960px) { .tn-code { background:transparent; border-color:rgba(255,255,255,.1); color:var(--railmut); } }
.field-heading { margin-top:6px; padding-top:12px; border-top:1px solid var(--bd2); } .field-heading:first-child { border-top:0; padding-top:0; margin-top:0; } .field-heading h4 { margin:0; font:600 13.5px var(--f-ui); color:var(--ink); } .field-heading .help { margin-top:2px; }
.text-err { color:var(--err); }

/* ---- Admin area: white left sidebar with the admin tools (layout: .shell.admin-side / aside.side-light) ---- */
.side.side-light { background:#fff; color:#111; border-right:1px solid var(--bd2); border-top:0; }
.side-light .side-title { display:flex; align-items:center; gap:9px; padding:16px 20px 8px; font:600 15px var(--f-disp); letter-spacing:-.015em; color:#111; }
.side-light .side-title .ic { width:18px; height:18px; color:var(--acc); }
.side-light .side-nav { scrollbar-color:var(--bd) transparent; }
.side-light .side-sec { color:#111; font-weight:600; font-size:12px; opacity:.7; }
.side-light .side-link { color:#111; }
.side-light .side-link .ic { color:#111; opacity:.6; }
.side-light .side-link:hover { background:var(--surface2); color:#000; }
.side-light .side-link:hover .ic { opacity:.85; }
.side-light .side-link.active { background:var(--acc2); color:#000; font-weight:550; box-shadow:inset 3px 0 0 var(--acc); }
.side-light .side-link.active .ic { color:var(--acc); opacity:1; }
.side-light .side-link .badge { background:var(--surface2); color:#111; }
.side-light .side-back { display:flex; align-items:center; gap:8px; padding:12px 20px; border-top:1px solid var(--bd2); color:#111; font-size:13px; text-decoration:none; }
.side-light .side-back:hover { background:var(--surface2); }
.side-light .side-back .ic { width:14px; height:14px; }
[data-bs-theme="dark"] .side.side-light, [data-theme="dark"] .side.side-light { background:var(--surface); color:var(--ink); }
[data-bs-theme="dark"] .side-light .side-title, [data-bs-theme="dark"] .side-light .side-sec, [data-bs-theme="dark"] .side-light .side-link, [data-bs-theme="dark"] .side-light .side-link .ic, [data-bs-theme="dark"] .side-light .side-back,
[data-theme="dark"] .side-light .side-title, [data-theme="dark"] .side-light .side-sec, [data-theme="dark"] .side-light .side-link, [data-theme="dark"] .side-light .side-link .ic, [data-theme="dark"] .side-light .side-back { color:var(--ink); }
[data-bs-theme="dark"] .side-light .side-link.active, [data-theme="dark"] .side-light .side-link.active { color:#fff; }
@media (max-width: 960px) {
  .shell.with-side.admin-side .side { display:flex; position:static; height:auto; border-right:0; border-bottom:1px solid var(--bd2); }
  .shell.with-side.admin-side .side-nav { display:flex; flex-wrap:wrap; gap:4px; padding:4px 10px 10px; }
  .shell.with-side.admin-side .side-sec { display:none; }
}
.adm-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(260px, 1fr)); gap:1rem; }
.adm-card .card-h .chev { margin-left:auto; width:14px; height:14px; color:var(--mut2); }
.adm-ic { width:30px; height:30px; border-radius:9px; background:var(--acc2); color:var(--acc); display:inline-grid; place-items:center; flex:none; }
.adm-ic .ic { width:16px; height:16px; }
a.adm-one { text-decoration:none !important; color:inherit; transition:border-color .12s; }
a.adm-one:hover { border-color:var(--acc); }
.adm-links { display:flex; flex-direction:column; gap:2px; padding:8px; }
.adm-links a { display:flex; align-items:center; gap:10px; padding:7px 10px; border-radius:8px; color:var(--ink); text-decoration:none !important; font-size:13.5px; }
.adm-links a .ic { width:15px; height:15px; color:var(--mut); }
.adm-links a .chev { margin-left:auto; width:13px; height:13px; color:var(--mut2); }
.adm-links a:hover { background:var(--surface2); color:var(--acc); }

/* ---- Settings → Theme: theme picker cards (any theme; colours come from each theme's manifest 'preview') ---- */
.theme-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(260px, 1fr)); gap:14px; }
.theme-card { position:relative; display:flex; flex-direction:column; border:1px solid var(--bd); border-radius:var(--r); background:var(--surface); cursor:pointer; overflow:hidden; transition:border-color .12s, box-shadow .12s; }
.theme-card:hover { border-color:var(--mut2); }
.theme-card.on { border-color:var(--acc); box-shadow:0 0 0 1px var(--acc); }
.theme-card > input { position:absolute; top:12px; right:12px; z-index:2; }
.theme-card .tp { height:150px; display:flex; flex-direction:column; background:var(--p-bg); border-bottom:1px solid var(--bd2); }
.theme-card .tp-top { height:18px; background:var(--p-bar); flex:none; display:flex; align-items:center; gap:5px; padding:0 8px; }
.theme-card .tp-top i { width:18px; height:5px; border-radius:3px; background:rgba(255,255,255,.35); }
.theme-card .tp-body { flex:1; display:flex; min-height:0; }
.theme-card .tp-side { width:62px; background:var(--p-side); border-right:1px solid var(--p-bd); padding:10px 7px; display:flex; flex-direction:column; gap:6px; flex:none; }
.theme-card .tp-side i { height:5px; border-radius:3px; background:var(--p-ink); opacity:.18; }
.theme-card .tp-side i:first-child { opacity:.9; width:60%; margin-bottom:4px; }
.theme-card .tp-side i.on { opacity:.45; }
.theme-card .tp-main { flex:1; padding:10px; display:flex; flex-direction:column; gap:7px; min-width:0; }
.theme-card .tp-head { display:flex; align-items:center; justify-content:space-between; }
.theme-card .tp-head i { width:60px; height:7px; border-radius:3px; background:var(--p-ink); opacity:.85; }
.theme-card .tp-head b { width:34px; height:13px; border-radius:4px; background:var(--p-acc); }
.theme-card .tp-cards { display:grid; grid-template-columns:repeat(3, 1fr); gap:6px; }
.theme-card .tp-cards i, .theme-card .tp-table { background:var(--p-card); border:1px solid var(--p-bd); border-radius:5px; }
.theme-card .tp-cards i { height:30px; }
.theme-card .tp-table { flex:1; display:flex; flex-direction:column; justify-content:space-around; padding:4px 7px; }
.theme-card .tp-table i { height:4px; border-radius:2px; background:var(--p-ink); opacity:.13; }
.theme-card .theme-meta { padding:12px 14px; }
.theme-card .theme-meta .row { margin-bottom:3px; }
.theme-card .theme-meta b { font-size:13.5px; }
.theme-card .theme-meta p { margin:0; font-size:12.5px; color:var(--mut); }

/* ---- sign-in page brand row (was unstyled) ---- */
.auth-art .side-brand { display:flex; align-items:center; gap:10px; color:#fff; position:relative; z-index:1; }
.auth-art .side-brand .mark { width:32px; height:32px; border-radius:9px; display:grid; place-items:center; background:linear-gradient(135deg, var(--tide-l), var(--acc)); color:#06262B; font:700 15px var(--f-disp); flex:none; }
.auth-art .side-brand .nm { display:flex; flex-direction:column; font:600 15px/1.2 var(--f-disp); letter-spacing:-.015em; color:#fff; }
.auth-art .side-brand .nm small { font:400 12px var(--f-ui); color:var(--railmut); letter-spacing:0; }
