/* Admin panel design system — warm palette, Vazirmatn, RTL-first, light/dark, phone-to-desktop. No inline styles anywhere (strict CSP). */
@font-face{font-family:"Vazirmatn";src:url("/admin/static/fonts/Vazirmatn.woff2") format("woff2");font-weight:100 900;font-display:block}
/* Design tokens. Neutrals + status colours are shared; the BRAND comes from a palette (teal / sky / indigo / emerald) chosen in the panel
   (<html data-palette="…">). A palette only sets the --pal-* variables below; every component uses --brand & friends, so a new palette is ~10 lines. */
:root{
  --bg:#eff6f9;--surface:#ffffff;--surface-2:#e5eef3;--ink:#16252e;--ink-2:#4e6270;--ink-3:#8296a3;--line:#d5e1e8;
  --ok:#2a8a63;--ok-soft:#dcf1e7;--warn:#a8710f;--warn-soft:#faefd0;--bad:#bf453d;--bad-soft:#fbe2df;--info:#2f7fb5;--info-soft:#dcecf7;
  /* palette: teal (default) */
  --pal-brand:#0891b2;--pal-hover:#0e7490;--pal-soft:#d3f1f8;--pal-accent:#38bdf8;--pal-accent-soft:#dff3fd;--pal-g1:#0b5c73;--pal-g2:#0891b2;--pal-g3:#38bdf8;
  --pal-brand-d:#35c4e2;--pal-hover-d:#6ad6ec;--pal-soft-d:#0f3a47;--pal-accent-d:#5cc8fb;--pal-accent-soft-d:#12354a;--pal-g1d:#073747;--pal-g2d:#0a6f89;--pal-g3d:#2a86bb;
  --brand:var(--pal-brand);--brand-hover:var(--pal-hover);--brand-ink:#ffffff;--brand-soft:var(--pal-soft);--accent:var(--pal-accent);--accent-soft:var(--pal-accent-soft);
  --g1:var(--pal-g1);--g2:var(--pal-g2);--g3:var(--pal-g3);
  --grad-brand:linear-gradient(135deg,var(--g1) 0%,var(--g2) 52%,var(--g3) 100%);
  --shadow:0 1px 2px rgba(15,60,80,.06),0 10px 28px -14px rgba(15,60,80,.24);--radius:14px;--radius-sm:9px;--side:264px;
  color-scheme:light}
[data-palette=sky]{--pal-brand:#0284c7;--pal-hover:#0369a1;--pal-soft:#d6ebf9;--pal-accent:#22d3ee;--pal-accent-soft:#d8f5fa;--pal-g1:#0a4a78;--pal-g2:#0284c7;--pal-g3:#4cc3f7;
  --pal-brand-d:#4db3ee;--pal-hover-d:#7cc7f3;--pal-soft-d:#0f3550;--pal-accent-d:#4fdcf0;--pal-accent-soft-d:#0f3a44;--pal-g1d:#08324f;--pal-g2d:#0b6aa3;--pal-g3d:#2f95c9}
[data-palette=indigo]{--pal-brand:#4f46e5;--pal-hover:#4338ca;--pal-soft:#e2e0fb;--pal-accent:#818cf8;--pal-accent-soft:#e6e8fd;--pal-g1:#2f2b7d;--pal-g2:#4f46e5;--pal-g3:#8b95f8;
  --pal-brand-d:#8d88f5;--pal-hover-d:#a8a4f8;--pal-soft-d:#25225c;--pal-accent-d:#a5b4fc;--pal-accent-soft-d:#262a5c;--pal-g1d:#1d1b52;--pal-g2d:#3b35b5;--pal-g3d:#6068d6}
[data-palette=emerald]{--pal-brand:#059669;--pal-hover:#047857;--pal-soft:#d4f1e5;--pal-accent:#34d399;--pal-accent-soft:#d8f6ea;--pal-g1:#055140;--pal-g2:#059669;--pal-g3:#43d9a3;
  --pal-brand-d:#3fd3a1;--pal-hover-d:#6be1b9;--pal-soft-d:#0f3a2c;--pal-accent-d:#5ee0b0;--pal-accent-soft-d:#103d2f;--pal-g1d:#06362b;--pal-g2d:#087a5a;--pal-g3d:#26a37a}
:root[data-theme=dark]{
  --bg:#0f1a20;--surface:#162329;--surface-2:#1c2e36;--ink:#e6f0f4;--ink-2:#9db2bd;--ink-3:#6f858f;--line:#27404a;
  --ok:#5cc79a;--ok-soft:#14352a;--warn:#e3b45a;--warn-soft:#3a2e12;--bad:#ef8077;--bad-soft:#3d2220;--info:#7fb8e6;--info-soft:#15303f;
  --brand:var(--pal-brand-d);--brand-hover:var(--pal-hover-d);--brand-ink:#031a22;--brand-soft:var(--pal-soft-d);--accent:var(--pal-accent-d);--accent-soft:var(--pal-accent-soft-d);
  --g1:var(--pal-g1d);--g2:var(--pal-g2d);--g3:var(--pal-g3d);
  --shadow:0 1px 2px rgba(0,0,0,.4),0 10px 28px -14px rgba(0,0,0,.65);color-scheme:dark}
@media (prefers-color-scheme:dark){:root:not([data-theme=light]){
  --bg:#0f1a20;--surface:#162329;--surface-2:#1c2e36;--ink:#e6f0f4;--ink-2:#9db2bd;--ink-3:#6f858f;--line:#27404a;
  --ok:#5cc79a;--ok-soft:#14352a;--warn:#e3b45a;--warn-soft:#3a2e12;--bad:#ef8077;--bad-soft:#3d2220;--info:#7fb8e6;--info-soft:#15303f;
  --brand:var(--pal-brand-d);--brand-hover:var(--pal-hover-d);--brand-ink:#031a22;--brand-soft:var(--pal-soft-d);--accent:var(--pal-accent-d);--accent-soft:var(--pal-accent-soft-d);
  --g1:var(--pal-g1d);--g2:var(--pal-g2d);--g3:var(--pal-g3d);
  --shadow:0 1px 2px rgba(0,0,0,.4),0 10px 28px -14px rgba(0,0,0,.65);color-scheme:dark}}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;overflow-anchor:none}body{overflow-anchor:none}
body{margin:0;background:var(--bg);color:var(--ink);font:400 15px/1.75 "Vazirmatn",Tahoma,system-ui,sans-serif;font-feature-settings:"ss01"}
a{color:var(--brand);text-decoration:none}a:hover{text-decoration:underline}
h1,h2,h3{margin:0;line-height:1.4;font-weight:700}h1{font-size:1.45rem}h2{font-size:1.15rem}h3{font-size:1rem}
p{margin:0 0 .75rem}
code,.mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.88em;direction:ltr;unicode-bidi:embed}
.muted{color:var(--ink-2)}.faint{color:var(--ink-3)}.ltr{direction:ltr;unicode-bidi:embed;text-align:left}.nowrap{white-space:nowrap}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
svg.i{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex:none}
/* ---------- shell ---------- */
.shell{display:grid;grid-template-columns:var(--side) 1fr;min-height:100vh}
.side{position:sticky;top:0;align-self:start;height:100vh;overscroll-behavior:contain;background:var(--surface);border-inline-end:1px solid var(--line);display:flex;flex-direction:column;padding:18px 14px;gap:6px;overflow-y:auto}
.brand{display:flex;align-items:center;gap:10px;padding:6px 10px 16px;font-weight:800;font-size:1.05rem}
.brand .logo{width:38px;height:38px;border-radius:12px;background:var(--grad-brand);display:grid;place-items:center;color:#fff}
.brand small{display:block;font-weight:500;color:var(--ink-2);font-size:.74rem;margin-top:-4px}
.nav-group{margin:12px 10px 4px;font-size:.72rem;color:var(--ink-3);letter-spacing:.02em}
.nav a{display:flex;align-items:center;gap:11px;padding:9px 12px;border-radius:var(--radius-sm);color:var(--ink-2);font-weight:500}
.nav a:hover{background:var(--surface-2);color:var(--ink);text-decoration:none}
.nav a[aria-current=page]{background:var(--brand-soft);color:var(--brand);font-weight:700}
.avatar.sm{width:32px;height:32px;font-size:.9rem}
.chip-account{display:flex;align-items:center;gap:9px;padding:4px 12px 4px 6px;border:1px solid var(--line);border-radius:12px;background:var(--surface);color:var(--ink);height:40px}
.chip-account:hover{background:var(--surface-2);text-decoration:none}
.chip-t{display:flex;flex-direction:column;line-height:1.2}.chip-t b{font-size:.84rem}.chip-t small{font-size:.7rem;color:var(--ink-2)}
@media (max-width:640px){.chip-t{display:none}.chip-account{padding:4px}}
.avatar{width:36px;height:36px;border-radius:50%;background:var(--brand-soft);color:var(--brand);display:grid;place-items:center;font-weight:800;flex:none}
.main{min-width:0;display:flex;flex-direction:column}
.top{display:flex;align-items:center;gap:10px;padding:12px 28px;position:sticky;top:0;z-index:20;background:var(--bg);border-bottom:1px solid var(--line)}
.top h1{font-size:1.2rem}.top .grow{flex:1}
.content{padding:26px 28px 60px;max-width:1280px;width:100%}
.icon-btn{border:1px solid var(--line);background:var(--surface);color:var(--ink);width:40px;height:40px;border-radius:11px;display:grid;place-items:center;cursor:pointer}
.icon-btn:hover{background:var(--surface-2)}
.burger{display:none}
.scrim{display:none}
@media (max-width:960px){
  .shell{grid-template-columns:1fr}
  .side{position:fixed;inset-block:0;inset-inline-start:0;height:auto;align-self:stretch;overflow-y:auto;-webkit-overflow-scrolling:touch;padding-bottom:calc(88px + env(safe-area-inset-bottom));width:min(84vw,300px);transform:translateX(105%);transition:transform .22s ease;z-index:50;box-shadow:var(--shadow)}
  html[dir=rtl] .side{transform:translateX(105%)}
  body.drawer .side{transform:none}
  body.drawer .scrim{display:block;position:fixed;inset:0;background:rgba(8,30,36,.5);z-index:40}
  .burger{display:grid}.top{padding:12px 16px}.content{padding:18px 16px 60px}
}
/* ---------- surfaces ---------- */
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:20px}
.card+.card{margin-top:18px}
.card-h{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px;flex-wrap:wrap}
.page-h{display:flex;align-items:flex-end;justify-content:space-between;gap:14px;margin-bottom:20px;flex-wrap:wrap}
.page-h p{margin:2px 0 0;color:var(--ink-2)}
.grid{display:grid;gap:16px}.g-2{grid-template-columns:repeat(auto-fit,minmax(340px,1fr))}.g-3{grid-template-columns:repeat(auto-fit,minmax(200px,1fr))}
.section-gap{margin-top:18px}.stack>*+*{margin-top:16px}.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.row.end{justify-content:flex-end}.sp{flex:1}
/* ---------- stats + charts ---------- */
.stat{position:relative;overflow:hidden}
.stat .label{color:var(--ink-2);font-size:.85rem;display:flex;align-items:center;gap:8px}
.stat .value{font-size:1.9rem;font-weight:800;line-height:1.3;margin-top:4px;font-variant-numeric:tabular-nums}
.stat .hint{font-size:.78rem;color:var(--ink-3)}
.stat .tone{position:absolute;inset-inline-end:14px;top:14px;width:36px;height:36px;border-radius:11px;display:grid;place-items:center}
.tone.brand{background:var(--brand-soft);color:var(--brand)}.tone.ok{background:var(--ok-soft);color:var(--ok)}.tone.info{background:var(--info-soft);color:var(--info)}
.tone.warn{background:var(--warn-soft);color:var(--warn)}.tone.bad{background:var(--bad-soft);color:var(--bad)}
.spark{display:block;width:100%;height:46px;margin-top:8px}
.spark .a{fill:var(--brand-soft)}.spark .l{fill:none;stroke:var(--brand);stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.bars{display:block;width:100%;height:auto}
.bars .b{fill:var(--brand);opacity:.88}.bars .b:hover{opacity:1}.bars text{fill:var(--ink-3);font-size:10px;font-family:inherit}.bars .grid-l{stroke:var(--line);stroke-dasharray:3 4}
.health{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px}
.health>div{padding:12px 14px;border-radius:var(--radius-sm);background:var(--surface-2);display:flex;align-items:center;gap:10px}
.dot{width:10px;height:10px;border-radius:50%;background:var(--ink-3);flex:none}.dot.ok{background:var(--ok);box-shadow:0 0 0 4px var(--ok-soft)}.dot.bad{background:var(--bad);box-shadow:0 0 0 4px var(--bad-soft)}
/* ---------- buttons, badges ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border:1px solid transparent;border-radius:11px;padding:9px 18px;font:600 .92rem/1.5 inherit;cursor:pointer;background:var(--brand);color:var(--brand-ink);transition:background .15s,transform .05s}
.btn:hover{background:var(--brand-hover);text-decoration:none}.btn:active{transform:translateY(1px)}
.btn.ghost{background:var(--surface);border-color:var(--line);color:var(--ink)}.btn.ghost:hover{background:var(--surface-2)}
.btn.danger{background:var(--bad);color:#fff}.btn.danger:hover{filter:brightness(.92)}
.btn.soft{background:var(--brand-soft);color:var(--brand)}.btn.sm{padding:5px 12px;font-size:.82rem;border-radius:9px}.btn.block{width:100%}
.btn[disabled]{opacity:.5;cursor:not-allowed}
.badge{display:inline-flex;align-items:center;gap:6px;padding:2px 10px;border-radius:99px;font-size:.78rem;font-weight:600;background:var(--surface-2);color:var(--ink-2)}
.badge.ok{background:var(--ok-soft);color:var(--ok)}.badge.warn{background:var(--warn-soft);color:var(--warn)}.badge.bad{background:var(--bad-soft);color:var(--bad)}.badge.info{background:var(--info-soft);color:var(--info)}.badge.brand{background:var(--brand-soft);color:var(--brand)}
/* ---------- forms ---------- */
.field{display:flex;flex-direction:column;gap:6px;margin-bottom:16px}
.field>label,.lbl{font-weight:600;font-size:.88rem}
.help{font-size:.78rem;color:var(--ink-3)}
input:not([type]),input[type=text],input[type=tel],input[type=email],input[type=password],input[type=number],input[type=search],input[type=date],select,textarea{width:100%;font:inherit;padding:10px 14px;border:1px solid var(--line);border-radius:11px;background:var(--surface);color:var(--ink);transition:border-color .15s,box-shadow .15s}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 4px var(--brand-soft)}
.switch{appearance:none;width:44px;height:26px;border-radius:99px;background:var(--line);position:relative;cursor:pointer;transition:background .18s;flex:none;margin:0}
.switch::after{content:"";position:absolute;top:3px;inset-inline-start:3px;width:20px;height:20px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.3);transition:inset-inline-start .18s}
.switch:checked{background:var(--ok)}.switch:checked::after{inset-inline-start:21px}
.switch:focus-visible{outline:3px solid var(--brand-soft)}
.check{display:flex;align-items:center;gap:10px;cursor:pointer}
.tri{display:inline-flex;border:1px solid var(--line);border-radius:10px;overflow:hidden}
.tri label{padding:3px 10px;font-size:.78rem;cursor:pointer;color:var(--ink-2);border-inline-start:1px solid var(--line)}
.tri label:first-child{border:0}.tri input{display:none}
.tri input:checked+span{color:var(--brand);font-weight:700}
.tri label:has(input:checked){background:var(--brand-soft)}
.tri label:has(input[value=allow]:checked){background:var(--ok-soft)}.tri label:has(input[value=allow]:checked) span{color:var(--ok)}
.tri label:has(input[value=deny]:checked){background:var(--bad-soft)}.tri label:has(input[value=deny]:checked) span{color:var(--bad)}
.err{background:var(--bad-soft);color:var(--bad);border-radius:11px;padding:10px 14px;margin-bottom:14px;font-size:.9rem}
/* ---------- tables (become cards on phones) ---------- */
.table-wrap{overflow-x:auto}
table.t{width:100%;border-collapse:collapse}
.t th{text-align:start;font-size:.78rem;color:var(--ink-2);font-weight:600;padding:10px 14px;border-bottom:1px solid var(--line);white-space:nowrap}
.t td{padding:12px 14px;border-bottom:1px solid var(--line);vertical-align:middle;white-space:nowrap}
.t td .wrap{display:inline-block;white-space:normal;min-width:150px;max-width:340px}
.t tbody tr:hover{background:var(--surface-2)}.t tr:last-child td{border-bottom:0}
@media (max-width:760px){
  .t td{white-space:normal}.t td .wrap{min-width:0;max-width:none;display:inline}
  .t thead{display:none}.t,.t tbody,.t tr,.t td{display:block;width:100%}
  .t tr{border:1px solid var(--line);border-radius:12px;padding:8px 12px;margin-bottom:10px;background:var(--surface)}
  .t td{border:0;display:flex;justify-content:space-between;gap:14px;padding:6px 0;text-align:end}
  .t td::before{content:attr(data-label);color:var(--ink-3);font-size:.78rem;text-align:start;flex:none}
  .t td[data-label=""]::before{display:none}
  .t td.actions{justify-content:flex-end}
}
.nw{white-space:nowrap}
/* an empty table shows just its message: no column headers over nothing, centred on every screen size */
table.t:has(td > .empty) thead{display:none}
.t td:has(> .empty){display:block;text-align:center;white-space:normal}
/* ---------- permission matrix ---------- */
.matrix th,.matrix td{text-align:center}.matrix td:first-child,.matrix th:first-child{text-align:start}
.matrix .sec td{background:var(--surface-2);font-weight:700;font-size:.82rem;color:var(--ink-2)}
.matrix input[type=checkbox]{width:18px;height:18px;accent-color:var(--brand)}
@media (max-width:760px){.matrix .t,.matrix table,table.matrix{display:table}.matrix thead{display:table-header-group}.matrix tr{display:table-row;border:0;padding:0;margin:0}.matrix td,.matrix th{display:table-cell;width:auto}.matrix td::before{display:none}}
/* ---------- misc ---------- */
.flashes{position:fixed;inset-inline:0;top:70px;display:flex;flex-direction:column;align-items:center;gap:8px;z-index:60;pointer-events:none}
.flash{pointer-events:auto;min-width:260px;max-width:92vw;padding:12px 18px;border-radius:12px;background:var(--surface);border:1px solid var(--line);box-shadow:var(--shadow);display:flex;gap:10px;align-items:center;animation:in .25s ease}
.flash.ok{border-inline-start:5px solid var(--ok)}.flash.err{border-inline-start:5px solid var(--bad)}.flash.warn{border-inline-start:5px solid var(--warn)}
@keyframes in{from{opacity:0;transform:translateY(-8px)}}
.empty{text-align:center;padding:20px 12px;color:var(--ink-2)}
.pager{display:flex;justify-content:space-between;align-items:center;margin-top:14px}
.secret{display:flex;gap:8px;align-items:center;background:var(--warn-soft);border:1px dashed var(--warn);padding:12px 14px;border-radius:12px}
.secret code{font-size:1.05rem;font-weight:700;flex:1;word-break:break-all}
dialog{border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);color:var(--ink);padding:22px;max-width:min(92vw,420px);box-shadow:var(--shadow)}
dialog::backdrop{background:rgba(8,30,36,.55)}
.diff{display:grid;grid-template-columns:1fr 1fr;gap:10px}.diff pre{margin:0;background:var(--surface-2);padding:10px;border-radius:9px;overflow:auto;font-size:.78rem;direction:ltr;text-align:left;white-space:pre-wrap}
details.json summary{cursor:pointer;color:var(--brand);font-size:.82rem}
/* ---------- password / icon fields (physical left/right on purpose: the inputs are dir=ltr inside an RTL page) ---------- */
.pw,.fld{position:relative}
.pw input{padding-left:48px}
.pw button,.fld .toggle{position:absolute;left:6px;top:50%;transform:translateY(-50%);width:38px;height:38px;border:0;background:none;color:var(--ink-3);cursor:pointer;border-radius:9px;display:grid;place-items:center}
.pw button:hover,.fld .toggle:hover{background:var(--surface-2);color:var(--ink)}
.fld .lead{position:absolute;right:14px;top:50%;transform:translateY(-50%);color:var(--ink-3);pointer-events:none;display:grid;place-items:center}
.fld input{padding-right:44px;padding-left:48px;height:48px}
.fld input:focus~.lead,.fld:focus-within .lead{color:var(--brand)}
/* ---------- login ----------
   Columns: art : form = 1fr : 1fr (the form column never narrower than 440px). Breakpoints: >=1600 wide desktop (larger art type) · 1200-1599 laptop (two equal columns, default) · 901-1199 small laptop/tablet landscape (tighter art)
   · <=900 tablet/phone (single column, compact banner, card overlaps it) · <=480 small phone · height<=760 short laptop screen (drop the feature list)
   · height<=620 (drop the dashboard preview).  prefers-reduced-motion switches every animation off. */
.login{min-height:100vh;min-height:100dvh;display:grid;grid-template-columns:minmax(0,1fr) minmax(440px,1fr);background:var(--bg)}
.art{position:relative;overflow:hidden;isolation:isolate;color:#f3fdff;padding:48px 48px 48px 64px;display:flex;flex-direction:column;justify-content:space-between;gap:32px;
  background:radial-gradient(70% 55% at 88% 6%,color-mix(in srgb,var(--g3) 80%,transparent),transparent 68%),radial-gradient(60% 60% at 6% 96%,color-mix(in srgb,var(--g2) 85%,#000),transparent 70%),linear-gradient(155deg,var(--g1) 0%,var(--g2) 58%,var(--g3) 120%)}
@media (min-width:901px){.art{-webkit-mask-image:linear-gradient(to left,#000 0,#000 calc(100% - 120px),rgba(0,0,0,.55) calc(100% - 56px),transparent 100%);mask-image:linear-gradient(to left,#000 0,#000 calc(100% - 120px),rgba(0,0,0,.55) calc(100% - 56px),transparent 100%)}}
.art .deco{position:absolute;inset:0;width:100%;height:100%;z-index:-1;color:#fff;pointer-events:none}
.art .deco .ring{fill:none;stroke:currentColor;stroke-opacity:.14;stroke-width:1.2}
.art .deco .ring.f{stroke-opacity:.07;stroke-dasharray:3 7}
.art .deco .hex{fill:none;stroke:currentColor;stroke-opacity:.10;stroke-width:1}
.art .deco .dot{fill:currentColor;fill-opacity:.5}
.art .deco .glow{fill:currentColor;fill-opacity:.07}
.art-brand{display:flex;align-items:center;gap:12px;font-weight:800;font-size:1.05rem}
.art-brand .logo{width:44px;height:44px;border-radius:14px;display:grid;place-items:center;background:rgba(255,255,255,.18);border:1px solid rgba(255,255,255,.3);backdrop-filter:blur(8px)}
.art-brand small{display:block;font-weight:500;opacity:.78;font-size:.76rem;margin-top:-3px}
.art-copy,.glass,.art-feats{margin-inline-end:0}
.art-copy .eyebrow{display:inline-flex;align-items:center;gap:8px;font-size:.8rem;font-weight:700;letter-spacing:.02em;padding:6px 14px;border-radius:99px;background:rgba(255,255,255,.14);border:1px solid rgba(255,255,255,.26);backdrop-filter:blur(8px)}
.art-copy h1{font-size:2.2rem;line-height:1.5;font-weight:800;letter-spacing:-.015em;margin:18px 0 14px;max-width:15ch;text-wrap:balance}
.art-copy h1 em{font-style:normal;background:linear-gradient(90deg,#e9fbff,#9fe7ff);-webkit-background-clip:text;background-clip:text;color:transparent}
.art-copy p{font-size:1rem;opacity:.88;max-width:44ch;margin:0}
.glass{align-self:flex-start;width:100%;max-width:440px;padding:20px 22px 22px;border-radius:26px;background:linear-gradient(160deg,rgba(255,255,255,.2),rgba(255,255,255,.08));
  border:1px solid rgba(255,255,255,.3);backdrop-filter:blur(14px);box-shadow:0 30px 60px -28px rgba(2,24,40,.55),inset 0 1px 0 rgba(255,255,255,.35)}
.glass-h{display:flex;align-items:center;gap:6px;margin-bottom:14px}.glass-h i{width:9px;height:9px;border-radius:50%;background:rgba(255,255,255,.5)}.glass-h b{margin-inline-start:auto;font-size:.76rem;opacity:.9;font-weight:700}
.glass-g{display:grid;grid-template-columns:1.4fr 1fr;gap:12px}
.gl-chart{border-radius:14px;background:rgba(255,255,255,.12);padding:12px 14px 10px}
.gl-chart .lbl{font-size:.74rem;opacity:.85;margin-bottom:8px;display:block}
.bars-m{display:flex;align-items:flex-end;gap:6px;height:64px}.bars-m span{flex:1;border-radius:6px 6px 3px 3px;background:linear-gradient(180deg,#ffffff,rgba(255,255,255,.35))}
.bars-m .h1{height:30%}.bars-m .h2{height:52%}.bars-m .h3{height:41%}.bars-m .h4{height:70%}.bars-m .h5{height:58%}.bars-m .h6{height:88%}.bars-m .h7{height:76%}
.gl-side{display:grid;gap:10px}
.gl-pill{border-radius:14px;background:rgba(255,255,255,.12);padding:9px 12px;display:flex;align-items:center;gap:9px;font-size:.78rem}
.gl-pill .d{width:9px;height:9px;border-radius:50%;background:#7bf0b8;box-shadow:0 0 0 4px rgba(123,240,184,.22);flex:none}
.gl-pill.w .d{background:#ffd479;box-shadow:0 0 0 4px rgba(255,212,121,.2)}
.gl-line{grid-column:1/-1;border-radius:14px;background:rgba(255,255,255,.12);padding:8px 14px 4px}.gl-line svg{display:block;width:100%;height:42px}
.gl-line path.l{fill:none;stroke:#fff;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}.gl-line path.a{fill:rgba(255,255,255,.18);stroke:none}
.art-feats{display:flex;flex-wrap:wrap;gap:10px 22px;margin:0;padding:0;list-style:none;font-size:.88rem}
.art-feats li{display:flex;align-items:center;gap:9px;opacity:.92}.art-feats .fi{width:30px;height:30px;border-radius:10px;background:rgba(255,255,255,.16);display:grid;place-items:center}
.art-feats svg.i{width:17px;height:17px}
.formside{position:relative;display:grid;place-items:center;padding:40px;
  background:radial-gradient(60% 50% at 100% 0%,color-mix(in srgb,var(--brand) 11%,transparent),transparent 70%),radial-gradient(50% 50% at 0% 100%,color-mix(in srgb,var(--accent) 12%,transparent),transparent 70%),var(--bg)}
.box{position:relative;width:100%;max-width:460px;margin-inline:auto;background:var(--surface);border:1px solid var(--line);border-radius:26px;padding:42px 38px 30px;
  box-shadow:0 1px 2px rgba(10,40,60,.06),0 14px 28px -12px rgba(10,50,70,.18),0 50px 90px -40px color-mix(in srgb,var(--brand) 55%,transparent);animation:rise .6s cubic-bezier(.2,.8,.2,1) both}
.box::before{content:"";position:absolute;inset-inline:26px;top:-1px;height:3px;border-radius:0 0 4px 4px;background:var(--grad-brand)}
.box .mark{width:58px;height:58px;border-radius:18px;background:var(--grad-brand);display:grid;place-items:center;color:#fff;margin-bottom:22px;box-shadow:0 14px 28px -12px color-mix(in srgb,var(--brand) 75%,transparent),inset 0 1px 0 rgba(255,255,255,.35)}
.box .mark svg.i{width:26px;height:26px}
.box .eyebrow{font-size:.78rem;font-weight:700;color:var(--brand);letter-spacing:.03em;margin-bottom:6px}
.box h2{font-size:1.75rem;line-height:1.35;font-weight:800;margin-bottom:8px;letter-spacing:-.01em}
.box .sub{color:var(--ink-2);font-size:.95rem;margin-bottom:28px;max-width:34ch}
.box .field{margin-bottom:20px}.box .field>label{font-size:.84rem;font-weight:700;color:var(--ink);margin-bottom:2px}
.box .fld input{height:52px;border-radius:14px;border:1.5px solid var(--line);background:var(--surface);font-size:1rem;box-shadow:0 1px 0 rgba(10,40,60,.03);transition:border-color .18s,box-shadow .18s,transform .18s,background .18s}
.box .fld input:hover{border-color:color-mix(in srgb,var(--brand) 40%,var(--line))}
.box .fld input:focus{border-color:var(--brand);box-shadow:0 0 0 4px color-mix(in srgb,var(--brand) 18%,transparent),0 8px 18px -10px color-mix(in srgb,var(--brand) 60%,transparent);transform:translateY(-1px)}
.box .fld .lead{transition:color .18s}.box .fld .lead svg.i,.box .fld .toggle svg.i{width:20px;height:20px}
.box .fld .toggle{width:40px;height:40px;transition:background .15s,color .15s}
.box .btn.block{position:relative;height:54px;border-radius:15px;font-size:1.02rem;font-weight:800;letter-spacing:.01em;color:#fff;background:var(--grad-brand);border:0;
  box-shadow:0 14px 26px -12px color-mix(in srgb,var(--brand) 85%,transparent),inset 0 1px 0 rgba(255,255,255,.28);transition:transform .15s,box-shadow .2s,filter .2s;margin-top:6px;overflow:hidden}
.box .btn.block::after{content:"";position:absolute;inset:0;background:linear-gradient(110deg,transparent 30%,rgba(255,255,255,.28) 50%,transparent 70%);transform:translateX(120%);transition:transform .7s}
.box .btn.block:hover{transform:translateY(-2px);filter:saturate(1.08) brightness(1.05);box-shadow:0 20px 34px -14px color-mix(in srgb,var(--brand) 90%,transparent),inset 0 1px 0 rgba(255,255,255,.3)}
.box .btn.block:hover::after{transform:translateX(-120%)}
.box .btn.block:active{transform:translateY(0) scale(.985);box-shadow:0 8px 16px -10px color-mix(in srgb,var(--brand) 85%,transparent)}
.box .btn.block:focus-visible{outline:3px solid color-mix(in srgb,var(--brand) 35%,transparent);outline-offset:3px}
.box .secure{display:flex;align-items:center;gap:8px;justify-content:center;margin-top:24px;padding-top:18px;border-top:1px dashed var(--line);color:var(--ink-3);font-size:.8rem}
.box .secure svg.i{width:16px;height:16px;color:var(--ok)}
.theme-fab{position:fixed;top:14px;left:14px;z-index:30;width:42px;height:42px;background:rgba(255,255,255,.18);border:1px solid rgba(255,255,255,.34);color:#fff;backdrop-filter:blur(8px)}
.theme-fab:hover{background:rgba(255,255,255,.3)}
@keyframes rise{from{opacity:0;transform:translateY(18px) scale(.985)}}
@keyframes drift{from{transform:translateY(0)}50%{transform:translateY(-8px)}to{transform:translateY(0)}}
.glass{animation:rise .7s .15s cubic-bezier(.2,.8,.2,1) both,drift 9s 1s ease-in-out infinite}
.art-copy,.art-feats{animation:rise .7s .05s cubic-bezier(.2,.8,.2,1) both}
@media (min-width:1280px){.art{padding:56px 64px 56px 88px}.art-copy h1{font-size:2.6rem}.formside{padding:48px}}
@media (min-width:1600px){.art{padding:96px 112px 96px 140px}.art-copy h1{font-size:3rem}.glass{width:500px}.formside{padding:64px}.box{max-width:500px;padding:48px 44px 34px}}
@media (max-width:1199px){.art{padding:40px 36px 40px 56px}.art-feats{display:none}.glass{width:100%;max-width:380px}.art-copy h1{font-size:2rem}.formside{padding:32px}}
@media (max-width:900px){
  .login{grid-template-columns:1fr;grid-template-rows:auto 1fr}
  .art{padding:26px 22px 86px;gap:16px}.glass,.art-feats,.art-copy p{display:none}
  .art-copy h1{font-size:1.5rem;margin:14px 0 0;max-width:none}.art .deco{opacity:.8}
  .formside{padding:0 16px 30px;margin-top:-58px;background:transparent}.box{padding:34px 24px 24px;border-radius:24px}.theme-fab{top:16px}
}
@media (max-width:480px){.box{padding:28px 20px 22px;border-radius:22px}.box h2{font-size:1.45rem}.art{padding:22px 18px 80px}}
@media (min-width:901px) and (max-height:760px){.art{padding-block:30px;gap:16px}.art-feats{display:none}.box{padding-block:30px 22px}.box .mark{margin-bottom:14px;width:50px;height:50px}.box .sub{margin-bottom:20px}.box .field{margin-bottom:14px}}
@media (min-width:901px) and (max-height:620px){.glass{display:none}}
@media (prefers-reduced-motion:reduce){.box,.glass,.art-copy,.art-feats{animation:none}.box .btn.block::after{display:none}*{transition-duration:.01ms!important}}
/* ---- login on desktop (>=901px): ONE centred card on a full-page gradient, like the phone layout. (Replaces the earlier two-column layout.) ----
   Widths: 901-1279 card + brand only · >=1280 adds the dashboard preview (corner) and the three feature chips · >=1600 same, more air. Phone (<=900): banner + overlapping card (unchanged). */
@media (min-width:901px){
  .login{display:block;position:relative;min-height:100vh;min-height:100dvh}
  .art{position:absolute;inset:0;z-index:0;padding:36px 56px;gap:0;-webkit-mask-image:none;mask-image:none}
  .art-copy,.art-feats,.glass{display:none}
  .formside{position:relative;z-index:1;min-height:100vh;min-height:100dvh;display:grid;place-items:center;padding:56px 24px;background:none}
  .box{max-width:460px}
  .theme-fab{top:28px;left:28px}
}
@media (min-width:1280px){
  .glass{display:block;position:absolute;right:56px;bottom:56px;width:340px;max-width:340px}
  .art-feats{display:flex;position:absolute;left:56px;bottom:56px;flex-direction:column;gap:12px;align-items:flex-start}
  .box{max-width:480px}
}
@media (min-width:1280px) and (max-height:820px){.glass,.art-feats{display:none}}
/* ---- login: no scrolling. Everything below tightens the card so it fits the visible area (phones, short laptops) and enlarges it where the
   screen is wide but portrait ("Desktop site" on a phone, tablets held upright). ---- */
@media (max-width:900px){
  .login{min-height:100vh;min-height:100dvh}
  .art{padding:16px 18px 62px;gap:8px}
  .art-brand .logo{width:38px;height:38px;border-radius:12px}.art-brand{font-size:.98rem}
  .art-copy .eyebrow{display:none}.art-copy h1{font-size:1.2rem;line-height:1.5;margin:8px 0 0}
  /* the card grows with the screen height (and is centred in the space under the banner), so a tall phone is filled and a short one still fits */
  .formside{margin-top:-44px;padding:0 14px 16px;align-items:center;align-content:center}
  .box{padding:clamp(22px,4vh,34px) 22px clamp(18px,3vh,26px);padding-top:clamp(22px,4dvh,34px);padding-bottom:clamp(18px,3dvh,26px);border-radius:24px}
  .box .mark,.box .eyebrow{display:none}
  .box h2{font-size:clamp(1.35rem,1.35rem + (100vh - 640px) * .004,1.8rem);margin-bottom:6px}
  .box .sub{font-size:.9rem;margin-bottom:clamp(14px,2.6vh,24px);margin-bottom:clamp(14px,2.6dvh,24px)}
  .box .field{margin-bottom:clamp(12px,2.8vh,22px);margin-bottom:clamp(12px,2.8dvh,22px)}
  .box .fld input{height:clamp(46px,8vh,58px);height:clamp(46px,8dvh,58px);border-radius:14px}
  .box .fld .lead svg.i,.box .fld .toggle svg.i{width:19px;height:19px}
  .box .btn.block{height:clamp(48px,8.2vh,60px);height:clamp(48px,8.2dvh,60px);border-radius:14px;margin-top:4px}
  .box .secure{margin-top:clamp(12px,2.6vh,22px);margin-top:clamp(12px,2.6dvh,22px);padding-top:clamp(10px,2vh,16px);font-size:.76rem}
  .theme-fab{top:12px;left:12px;width:40px;height:40px}
  .m-feats{display:none}
}
@media (max-width:900px) and (min-height:700px){
  .box .mark{display:grid;width:52px;height:52px;border-radius:16px;margin-bottom:16px}.box .mark svg.i{width:23px;height:23px}
  .box .eyebrow{display:block;margin-bottom:4px}
  .formside{align-content:center;row-gap:14px}
  .m-feats{display:flex;flex-wrap:wrap;gap:8px 14px;justify-content:center;list-style:none;margin:0;padding:0 6px;font-size:.76rem;color:var(--ink-2)}
  .m-feats li{display:flex;align-items:center;gap:6px}.m-feats svg.i{width:15px;height:15px;color:var(--brand)}
}
@media (max-width:900px) and (max-height:680px){.art-copy h1{display:none}.art{padding-bottom:52px}}
@media (min-width:901px) and (max-height:820px){
  .formside{padding:24px}.box{padding:26px 34px 20px}.box .mark,.box .eyebrow{display:none}
  .box .sub{margin-bottom:16px}.box .field{margin-bottom:14px}.box .fld input{height:48px}.box .btn.block{height:50px}.box .secure{margin-top:16px;padding-top:12px}
}
@media (min-width:901px) and (orientation:portrait){
  .formside{padding:40px}.box{max-width:760px;padding:64px 60px 48px;border-radius:36px}
  .box .mark{display:grid;width:84px;height:84px;border-radius:26px;margin-bottom:30px}.box .mark svg.i{width:38px;height:38px}
  .box .eyebrow{display:block;font-size:1.05rem}.box h2{font-size:2.6rem}.box .sub{font-size:1.25rem;margin-bottom:38px;max-width:none}
  .box .field{margin-bottom:26px}.box .field>label{font-size:1.1rem;margin-bottom:6px}
  .box .fld input{height:72px;border-radius:20px;font-size:1.35rem;padding-right:64px;padding-left:72px}.box .fld .lead{right:22px}.box .fld .lead svg.i,.box .fld .toggle svg.i{width:28px;height:28px}
  .box .fld .toggle{width:56px;height:56px;left:10px}
  .box .btn.block{height:76px;border-radius:22px;font-size:1.45rem}
  .box .secure{font-size:1.02rem;margin-top:34px;padding-top:24px}.box .secure svg.i{width:22px;height:22px}
  .art{padding:56px 64px}.art-brand{font-size:1.5rem}.art-brand .logo{width:66px;height:66px;border-radius:20px}.art-brand small{font-size:1rem}
  .theme-fab{width:64px;height:64px;top:36px;left:36px;border-radius:20px}.theme-fab svg.i{width:30px;height:30px}
}
.err-page{min-height:70vh;display:grid;place-items:center;text-align:center}.err-page .big{font-size:5rem;font-weight:800;color:var(--brand);line-height:1}
/* ---------- filter chips + clickable stat cards ---------- */
.chips{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}
.chip{display:inline-flex;align-items:center;gap:8px;padding:6px 14px;border-radius:99px;background:var(--surface-2);color:var(--ink-2);font-size:.86rem;font-weight:600;border:1px solid transparent}
.chip b{background:var(--surface);color:var(--ink);border-radius:99px;padding:0 8px;font-size:.78rem;min-width:24px;text-align:center}
.chip:hover{text-decoration:none;border-color:var(--brand);color:var(--ink)}
.chip.on{background:var(--brand-soft);color:var(--brand);border-color:var(--brand)}
a.stat{display:block;color:inherit;transition:transform .12s,border-color .12s,box-shadow .12s}
a.stat:hover{text-decoration:none;border-color:var(--brand);transform:translateY(-2px)}
a.stat .go{position:absolute;inset-inline-end:16px;bottom:14px;color:var(--ink-3);font-size:.78rem;opacity:0;transition:opacity .12s}
a.stat:hover .go{opacity:1;color:var(--brand)}
/* ---------- system health ---------- */
.dot.warn{background:var(--warn);box-shadow:0 0 0 4px var(--warn-soft)}.dot.unknown{background:var(--ink-3);box-shadow:0 0 0 4px var(--surface-2)}
.badge.big{font-size:.92rem;padding:5px 16px}
.alert-card{border-inline-start:5px solid var(--ok)}.alert-card.warn{border-inline-start-color:var(--warn)}.alert-card.bad{border-inline-start-color:var(--bad)}
.problems{list-style:none;margin:0;padding:0}.problems li{display:flex;align-items:center;gap:10px;padding:8px 0;border-bottom:1px solid var(--line)}
.problems li:last-child{border-bottom:0}.problems li span{margin-inline-start:auto;color:var(--ink-2);font-size:.88rem}
.gauge{width:104px;height:104px;flex:none}
.gauge-bg{fill:none;stroke:var(--surface-2);stroke-width:10}.gauge-fg{fill:none;stroke-width:10;stroke-linecap:round;stroke:var(--ok)}
.gauge-fg.warn{stroke:var(--warn)}.gauge-fg.bad{stroke:var(--bad)}.gauge-t{font-size:20px;font-weight:800;fill:var(--ink)}
a.health-tile{display:block;color:inherit}a.health-tile:hover{text-decoration:none;border-color:var(--brand)}
/* ---------- roles & permissions ---------- */
.role-tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:12px}
.role-tile{display:flex;flex-direction:column;gap:6px;padding:14px 16px;border-radius:var(--radius);background:var(--surface);border:1px solid var(--line);color:var(--ink);box-shadow:var(--shadow)}
.role-tile:hover{text-decoration:none;border-color:var(--brand)}
.role-tile.on{border-color:var(--brand);background:var(--brand-soft)}
.rt-h{display:flex;justify-content:space-between;align-items:center;gap:8px}.rt-p{font-size:.82rem;color:var(--ink-2);line-height:1.6}
.perm-layout{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:18px;align-items:start}
.perm-main>*+*{margin-top:16px}
.perm-card{padding:6px 20px 8px}.perm-card .card-h{margin:14px 0 4px}
.perm-list{display:flex;flex-direction:column}
.perm-row{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:16px 0;border-top:1px solid var(--line)}
.perm-row:first-child{border-top:0}
label.perm-row{cursor:pointer}label.perm-row.locked{cursor:default}
.perm-txt{display:flex;flex-direction:column;gap:3px;min-width:0}.perm-txt b{font-size:.96rem}.perm-txt>span{color:var(--ink-2);font-size:.85rem;line-height:1.7}
.perm-txt code{font-size:.74rem}
.eff{font-size:.78rem!important;color:var(--ink-3)!important}.eff.on{color:var(--ok)!important}
.perm-side .sticky{position:sticky;top:84px}
.summary{display:flex;flex-direction:column;gap:12px;max-height:56vh;overflow:auto}
.sum-grp b{font-size:.84rem;color:var(--brand)}.sum-grp ul{margin:4px 0 0;padding-inline-start:18px;font-size:.86rem;color:var(--ink-2);line-height:1.8}
.note{display:flex;gap:12px;align-items:flex-start;padding:12px 16px;border-radius:12px;background:var(--surface-2);color:var(--ink-2);font-size:.9rem}
.note.info{background:var(--info-soft);color:var(--info)}.note.warn{background:var(--warn-soft);color:var(--warn)}
.tri{flex:none}.tri label{padding:5px 12px;font-size:.8rem}
@media (max-width:1100px){.perm-layout{grid-template-columns:1fr}.perm-side{order:-1}.perm-side .sticky{position:static}.summary{max-height:none}}
@media (max-width:560px){.perm-row{flex-direction:column;align-items:flex-start;gap:10px}}
.grid>.card+.card{margin-top:0}

/* ---------- appearance (palette picker) ---------- */
.pal-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:16px}
.pal-card{display:block;cursor:pointer;border:2px solid var(--line);border-radius:var(--radius);background:var(--surface);padding:14px;transition:border-color .15s,box-shadow .15s,transform .15s}
.pal-card:hover{transform:translateY(-2px);border-color:color-mix(in srgb,var(--brand) 45%,var(--line))}
.pal-card:has(input:checked){border-color:var(--brand);box-shadow:0 0 0 4px color-mix(in srgb,var(--brand) 16%,transparent)}
.pal-card input{position:absolute;opacity:0;pointer-events:none}
.pal-prev{--brand:var(--pal-brand);--brand-hover:var(--pal-hover);--brand-soft:var(--pal-soft);--g1:var(--pal-g1);--g2:var(--pal-g2);--g3:var(--pal-g3);--grad-brand:linear-gradient(135deg,var(--pal-g1),var(--pal-g2) 55%,var(--pal-g3));
  border-radius:12px;background:#f3f8fb;padding:12px;display:flex;flex-direction:column;gap:10px;color:#16252e}
.pal-prev .sw{height:56px;border-radius:10px;background:var(--grad-brand)}
.pal-prev .row2{display:flex;gap:8px;align-items:center}
.pal-prev .pb{padding:5px 12px;border-radius:9px;background:var(--brand);color:#fff;font-size:.78rem;font-weight:700}
.pal-prev .pbadge{padding:2px 10px;border-radius:99px;background:var(--brand-soft);color:var(--brand);font-size:.74rem;font-weight:700}
.pal-name{display:flex;justify-content:space-between;align-items:center;margin-top:12px;font-weight:700}

/* ---------- account: profile card at the TOP of the sidebar + user menu in the top bar ---------- */
.profile{display:flex;align-items:center;gap:12px;margin:2px 4px 10px;padding:12px;border-radius:16px;color:inherit;background:linear-gradient(135deg,var(--brand-soft),var(--surface-2));border:1px solid color-mix(in srgb,var(--brand) 22%,var(--line))}
.profile:hover{text-decoration:none;border-color:var(--brand)}.profile[aria-current=page]{border-color:var(--brand)}
.pf-t{display:flex;flex-direction:column;line-height:1.35;min-width:0;flex:1}.pf-t b{font-size:.95rem}.pf-t span{font-size:.76rem;color:var(--ink-2)}
.pf-go{color:var(--ink-3);display:grid;place-items:center}.pf-go svg.i{width:18px;height:18px}
.user-menu{position:relative}
.chip-account{cursor:pointer;font:inherit}
.chip-account .chev{display:grid;place-items:center;color:var(--ink-3);transform:rotate(-90deg)}.chip-account .chev svg.i{width:16px;height:16px}
.chip-account[aria-expanded=true]{border-color:var(--brand);background:var(--brand-soft)}
.menu-pop{position:absolute;top:calc(100% + 10px);left:0;min-width:248px;background:var(--surface);border:1px solid var(--line);border-radius:16px;box-shadow:0 18px 40px -16px rgba(10,40,60,.35),0 2px 6px rgba(10,40,60,.08);padding:8px;z-index:60;animation:pop .14s ease}
.menu-pop[hidden]{display:none}
@keyframes pop{from{opacity:0;transform:translateY(-6px) scale(.98)}}
.mp-head{display:flex;gap:12px;align-items:center;padding:10px 10px 12px;margin-bottom:6px;border-bottom:1px solid var(--line)}
.mp-head b{display:block;line-height:1.3}.mp-head small{color:var(--ink-2);font-size:.78rem}
.menu-pop a,.menu-pop button.mp-danger{display:flex;align-items:center;gap:12px;width:100%;padding:11px 12px;border-radius:11px;border:0;background:none;color:var(--ink);font:inherit;font-weight:600;cursor:pointer;text-align:start}
.menu-pop a:hover,.menu-pop button.mp-danger:hover{background:var(--surface-2);text-decoration:none}
.menu-pop button.mp-danger{color:var(--bad)}.menu-pop button.mp-danger:hover{background:var(--bad-soft)}
.menu-pop form{margin:6px 0 0;padding-top:6px;border-top:1px solid var(--line)}
@media (max-width:640px){
  .chip-account .chev{display:none}
  .menu-pop{position:fixed;top:64px;left:12px;right:12px;min-width:0}
}
/* ---------- dashboard blocks: two tidy groups, never an orphan card ---------- */
.sec-t{font-size:.84rem;font-weight:700;color:var(--ink-2);margin:6px 2px 10px;display:flex;align-items:center;gap:10px}
.sec-t::after{content:"";flex:1;height:1px;background:var(--line)}
.grid.stats{gap:14px;margin-bottom:22px}
.grid.stats.g4{grid-template-columns:repeat(4,minmax(0,1fr))}
.grid.stats.g6{grid-template-columns:repeat(3,minmax(0,1fr))}
.stat{padding:18px 18px 16px}
.stat .value{font-size:2rem;letter-spacing:-.01em}.stat .value.zero{color:var(--ink-3)}
.stat .label{padding-inline-end:46px;line-height:1.5}
.stat::before{content:"";position:absolute;inset-inline:0;top:0;height:3px;background:var(--grad-brand);opacity:.0;transition:opacity .15s}
a.stat:hover::before{opacity:1}
@media (max-width:1100px){.grid.stats.g4{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:640px){
  .grid.stats{gap:10px}.grid.stats.g6{grid-template-columns:repeat(2,minmax(0,1fr))}
  .stat{padding:14px 14px 12px;border-radius:16px}.stat .value{font-size:1.65rem;margin-top:2px}.stat .label{font-size:.8rem;padding-inline-end:38px}
  .stat .tone{width:30px;height:30px;inset-inline-end:10px;top:10px;border-radius:9px}.stat .tone svg.i{width:16px;height:16px}
  .stat .hint{font-size:.7rem;line-height:1.5}.stat .go{display:none}.spark{height:34px}
  .page-h h2{font-size:1.1rem}.page-h p{font-size:.85rem}
}
/* charts: gradient bars, the latest day highlighted */
.bars .b{fill:url(#barg);opacity:.9}.bars .b.today{fill:var(--accent);opacity:1}
.bars{max-height:210px}
.health-tile .health{grid-template-columns:repeat(auto-fit,minmax(112px,1fr))}
@media (max-width:640px){.health-tile .health{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.health>div{padding:10px 8px;flex-direction:column;align-items:flex-start;gap:6px;font-size:.78rem}}
.ga{stop-color:var(--brand)}.gb{stop-color:var(--accent)}
/* ---------- system health (v2) ---------- */
.dot{display:inline-block;vertical-align:middle}
.hero{display:flex;align-items:center;gap:16px;flex-wrap:wrap;padding:20px 22px;border-radius:var(--radius);border:1px solid var(--line);background:linear-gradient(135deg,var(--ok-soft),var(--surface) 70%);box-shadow:var(--shadow)}
.hero.warn{background:linear-gradient(135deg,var(--warn-soft),var(--surface) 70%)}.hero.bad{background:linear-gradient(135deg,var(--bad-soft),var(--surface) 70%)}.hero.unknown{background:var(--surface)}
.hero-ic{width:54px;height:54px;border-radius:17px;display:grid;place-items:center;background:var(--ok);color:#fff;flex:none}.hero.warn .hero-ic{background:var(--warn)}.hero.bad .hero-ic{background:var(--bad)}
.hero-ic svg.i{width:28px;height:28px}
.hero-t{flex:1;min-width:200px}.hero-t h2{font-size:1.3rem}.hero-t p{margin:2px 0 0;color:var(--ink-2);font-size:.86rem}
.hero-n{display:flex;gap:8px}.hn{display:flex;flex-direction:column;align-items:center;min-width:62px;padding:6px 10px;border-radius:12px;background:var(--surface);border:1px solid var(--line);font-size:.74rem;color:var(--ink-2)}
.hn b{font-size:1.15rem;color:var(--ink);line-height:1.3}.hn.ok b{color:var(--ok)}.hn.warn b{color:var(--warn)}.hn.bad b{color:var(--bad)}
.svc-grid,.res-grid{grid-template-columns:minmax(0,1fr)}
.svc-c{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:16px 18px;position:relative;overflow:hidden}
.svc-c::before{content:"";position:absolute;inset-inline:0;top:0;height:3px;background:var(--ok)}.svc-c.warn::before{background:var(--warn)}.svc-c.bad::before{background:var(--bad)}.svc-c.unknown::before{background:var(--ink-3)}
.svc-c>header{display:flex;align-items:center;gap:12px;margin-bottom:6px}
.svc-ic{width:40px;height:40px;border-radius:12px;display:grid;place-items:center;flex:none;background:var(--ok-soft);color:var(--ok)}
.svc-ic.warn{background:var(--warn-soft);color:var(--warn)}.svc-ic.bad{background:var(--bad-soft);color:var(--bad)}.svc-ic.unknown{background:var(--surface-2);color:var(--ink-3)}
.svc-tt{flex:1;min-width:0;display:flex;flex-direction:column;line-height:1.45}.svc-tt b{font-size:.98rem}.svc-tt span{font-size:.8rem;color:var(--ink-2)}
.rows{margin:0}.rows>div{display:flex;justify-content:space-between;align-items:baseline;gap:14px;padding:8px 0;border-top:1px dashed var(--line);font-size:.86rem}
.rows dt{color:var(--ink-2);flex:none;display:flex;align-items:center;gap:8px}.rows dd{margin:0;font-weight:600;text-align:end;word-break:break-word;direction:ltr;unicode-bidi:plaintext}
.res-body{display:flex;align-items:center;gap:16px}.res-body .rows{flex:1;min-width:0}.res-body .gauge{width:92px;height:92px}
@media (min-width:700px){
  .svc-grid,.res-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.svc-grid>:last-child:nth-child(odd),.res-grid>:last-child:nth-child(odd){grid-column:1/-1}
}
@media (min-width:1100px){
  .svc-grid{grid-template-columns:repeat(6,minmax(0,1fr))}.svc-grid>*{grid-column:span 2!important}.svc-grid>:nth-child(n+4){grid-column:span 3!important}
  .res-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.res-grid>*{grid-column:auto!important}
}
@media (max-width:640px){.hero{padding:16px}.hero-t h2{font-size:1.1rem}.hero-n{width:100%}.hn{flex:1}.hero-r{width:100%;justify-content:center}.svc-c{padding:14px 14px}.res-body .gauge{width:78px;height:78px}}

/* ---------- search bar on lists ---------- */
.searchbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:14px}.searchbar .sb{flex:1;min-width:220px}
.searchbar .sb input{height:46px;border-radius:12px}
/* ---------- user / report detail ---------- */
.u-hero{display:flex;align-items:center;gap:16px;flex-wrap:wrap;padding:18px 20px;border-radius:var(--radius);background:linear-gradient(135deg,var(--brand-soft),var(--surface) 70%);border:1px solid var(--line);box-shadow:var(--shadow)}
.u-t{flex:1;min-width:200px}.u-t h2{font-size:1.25rem;margin-bottom:6px}
.avatar.xl{width:60px;height:60px;font-size:1.5rem;border-radius:20px}
.kpis{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:10px}
.kpi{padding:12px 14px;border-radius:12px;background:var(--surface-2);display:flex;flex-direction:column;line-height:1.4}.kpi b{font-size:1.25rem}.kpi span{font-size:.76rem;color:var(--ink-2)}
.mini-row{display:flex;align-items:center;gap:12px;padding:9px 0;border-top:1px dashed var(--line);color:var(--ink)}.mini-row:first-of-type{border-top:0}.mini-row span:nth-child(2){flex:1}
a.mini-row:hover{text-decoration:none;background:var(--surface-2)}
textarea{width:100%;font:inherit;padding:10px 14px;border:1px solid var(--line);border-radius:11px;background:var(--surface);color:var(--ink);resize:vertical}
.mod-form{max-width:640px}
.convo{display:flex;flex-direction:column;gap:12px}
.bubble{padding:12px 14px;border-radius:14px;background:var(--surface-2);max-width:78%;align-self:flex-start}.bubble.rep{background:var(--info-soft);align-self:flex-end}.bubble.tgt{background:var(--bad-soft)}
.b-h{display:flex;gap:10px;align-items:center;flex-wrap:wrap;font-size:.8rem;margin-bottom:4px}.b-t{white-space:pre-wrap;word-break:break-word}.b-v{margin-top:8px;padding-top:8px;border-top:1px dashed var(--line);font-size:.85rem}
@media (max-width:640px){.bubble{max-width:100%}}
/* ---------- finance: catalog editor, rules, wallet ---------- */
.rules-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:12px 18px;margin-bottom:14px}.rule.field{margin-bottom:0}.check.rule{padding:10px 12px;border-radius:12px;background:var(--surface-2)}
.item-form{padding:16px}.item-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:10px 16px;align-items:end}.item-grid .field{margin-bottom:0}
.item-sw{padding-bottom:12px}.item-ben{grid-column:1/-1;display:flex;gap:16px;align-items:end;flex-wrap:wrap;padding-top:6px;border-top:1px dashed var(--line)}.item-ben .lbl{font-weight:700;font-size:.88rem}
.ok-t{color:var(--ok)}.bad-t{color:var(--bad)}
.wallet-tx{display:flex;align-items:center;gap:12px;padding:9px 0;border-top:1px dashed var(--line);font-size:.88rem}.wallet-tx:first-of-type{border-top:0}.wallet-tx .sp{flex:1;min-width:0}
.mini-form{display:flex;gap:8px;flex-wrap:wrap;align-items:end}.mini-form .field{margin-bottom:0}.mini-form input,.mini-form select{height:42px}
.tg-preview{background:var(--surface-2);border-radius:14px;padding:14px;line-height:1.9;min-height:60px}.tg-preview code,.tg-preview pre{font-family:ui-monospace,monospace;background:var(--surface);padding:1px 5px;border-radius:5px}
.tg-link{color:var(--accent);text-decoration:underline}.tg-spoiler{background:var(--ink-3);color:transparent;border-radius:4px}
.kb-preview{display:flex;flex-direction:column;gap:8px;background:var(--surface-2);border-radius:14px;padding:12px;max-width:420px}.kb-row{display:flex;gap:8px}
.kb-key{flex:1;text-align:center;background:var(--surface);border:1px solid var(--line);border-radius:9px;padding:9px 6px;font-size:.85rem}.narrow{max-width:84px}
.tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px}
.tile{display:block;background:var(--surface-2);border-radius:12px;padding:12px 10px;text-align:center;color:var(--ink)}a.tile:hover{text-decoration:none;background:var(--brand-soft)}
.tile b{display:block;font-size:1.55rem;line-height:1.3}.tile b small{font-size:.8rem;font-weight:500;color:var(--ink-2)}.tile span{display:block;font-size:.78rem;color:var(--ink-2);margin-top:2px}
@media (max-width:760px){
  /* compact cards: tighter rows, the first cell (usually the id) is the card title, empty values are not shown at all */
  .t tr{padding:6px 12px;margin-bottom:8px}
  .t td{padding:4px 0;font-size:.92rem}
  .t tr:has(.empty){border:0;padding:0;background:none}
  .t td:first-child{font-weight:700;padding-bottom:6px;margin-bottom:2px;border-bottom:1px dashed var(--line)}
  .t td:has(> .faint:only-child){display:none}
  .chips{flex-wrap:nowrap;overflow-x:auto;padding-bottom:6px;scrollbar-width:none}.chips::-webkit-scrollbar{display:none}.chip{flex:none;padding:5px 12px}
  .page-h h2{display:none}.page-h{margin-bottom:12px}
  .searchbar .sb{min-width:0;flex-basis:100%}.searchbar .btn{flex:1}
}
@media (max-width:760px){.kpis{grid-template-columns:repeat(auto-fit,minmax(96px,1fr))}}
.filters{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px;align-items:end;margin-bottom:12px}.filters .field{margin-bottom:0}
@media (max-width:760px){.t td.ltr,.t td.mono{direction:rtl}}

@media (max-width:760px){.item-grid{grid-template-columns:1fr 1fr!important}.item-grid .field:first-child,.item-grid .item-sw,.item-grid .item-ben{grid-column:1/-1}}
@media (max-width:760px){.item-ben{gap:8px 14px}.item-ben .field{flex:1 1 100%}.item-ben .field input{width:100%}.item-ben .check{flex:none}}
.t td:has(> .empty){padding:0}
.kpis:has(> :nth-child(6):last-child){grid-template-columns:repeat(3,1fr)}
.kpis:has(> :nth-child(4):last-child){grid-template-columns:repeat(4,1fr)}
@media (max-width:760px){.kpis:has(> :nth-child(4):last-child){grid-template-columns:repeat(2,1fr)}.kpis:has(> :nth-child(6):last-child){grid-template-columns:repeat(3,1fr)}}
/* phones: nothing inside a card may be wider than the card (a single nowrap cell used to widen the whole page and make it wobble sideways) */
body{overflow-x:clip}
@media (max-width:760px){
  .t td{min-width:0;overflow-wrap:anywhere}.t td .nw,.t td.nowrap{white-space:normal}
  .t td > .mono,.t td .mono{word-break:break-all}
  .card,.table-wrap{min-width:0;max-width:100%}
}
/* menu layout editors stay real tables on phones (button | row | position side by side) instead of one tall card per button */
@media (max-width:760px){
  table.lay{display:table;width:100%}.lay thead{display:table-header-group}.lay tbody{display:table-row-group}
  .lay tr{display:table-row;border:0;padding:0;margin:0;background:none}
  .lay th,.lay td{display:table-cell;width:auto;padding:6px 4px;font-size:.88rem;border-bottom:1px solid var(--line);white-space:normal;text-align:start}
  .lay td::before{display:none}.lay td:first-child{font-weight:400;margin:0}
  .lay td input.narrow{max-width:58px;text-align:center;padding:8px 4px}
}

.kb-preview{margin-inline:auto;width:100%}
.stack-cell{min-width:0}
@media (max-width:760px){.stack-cell{text-align:end;min-width:0;overflow-wrap:anywhere}}
@media (max-width:760px){.mini-form{flex-direction:column;align-items:stretch}.mini-form .field,.mini-form input,.mini-form select{width:100%}.mini-form .btn{width:100%}}
/* editable city / province rows: compact on desktop, a tidy 2-column grid per row on phones */
.cities-t td,.prov-t td{padding:8px 6px}.cities-t select{min-width:130px}.cities-t input[name=name]{min-width:120px}.cities-t input[name=aliases]{min-width:170px}
@media (max-width:760px){
  .cities-t tr,.prov-t tr{display:grid;grid-template-columns:1fr 1fr;gap:6px 10px;padding:10px 12px}
  .cities-t td,.prov-t td{display:flex;flex-direction:column;align-items:stretch;text-align:start;padding:0;border:0;font-size:.9rem}
  .cities-t td::before,.prov-t td::before{display:block;margin-bottom:2px}
  .cities-t td:first-child,.prov-t td:first-child{font-weight:400;border-bottom:0;margin:0;padding-bottom:0}
  .cities-t td:nth-child(1),.cities-t td:nth-child(2),.cities-t td:nth-child(3),.cities-t td:last-child,.prov-t td:nth-child(1),.prov-t td:last-child{grid-column:1/-1}
  .cities-t td:last-child .btn,.prov-t td:last-child .btn{width:100%}
  .cities-t td input.narrow,.prov-t td input.narrow{max-width:none;width:100%}
}
.steps{margin:0;padding-inline-start:20px;line-height:2}

/* ---- anti-fraud: puzzle picture gallery ---- */
.pz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-top: 12px; }
.pz { margin: 0; border: 1px solid var(--line, rgba(128, 128, 160, .25)); border-radius: 14px; overflow: hidden; background: var(--card, transparent); display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; }
.pz:hover { transform: translateY(-2px); box-shadow: 0 10px 26px -14px rgba(0, 0, 0, .5); }
.pz img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; }
.pz figcaption { padding: 8px 10px 4px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.pz-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 10px 10px; }
.pz.off img { filter: grayscale(1) opacity(.45); }
.pz.fixed { outline: 2px solid var(--accent, #6d5efc); outline-offset: -2px; }
