/* Guts AI console v2: shell, components and shared page parts.
   Loads after theme.css (fonts) and v2.css (tokens, base). Pages add their own sheet. */

/* Console-only tokens (pen variables v2-*) */
:root{
  --accent-hover:#156A5C;--accent-press:#11594D;--accent-text:#156B5C;
  --line-control:#7C8784;--surface-hover:#E6EBE7;--scrim:#14201F38;--scrim-flat:color-mix(in srgb,#14201F 22%,var(--bg));
  --warn:#8F6000;--ok-fill:#2EA36B;--warn-fill:#E5B012;--err-fill:#E5484D;--warn-soft:#E5B0121F;
  --heat-2:#18756530;--heat-3:#18756566;--heat-4:#187565A6;
  --fade-soft-0:#F5F6F400;
  --side-w:256px;--rail-w:72px;--top-h:62px;
  --sh-card:0 6px 24px var(--card-shadow);
  /* Motion: --dur-1 hover/press colour, border, shadow, tooltips; --dur-2 enter/exit (menus, popovers,
     toasts, scrim + dialog fade, toggles, chevrons); --dur-3 movement (segmented/tab indicator, accordion).
     --ease-out for anything entering or moving to a new place, --ease-std for two-way flips. */
  --dur-1:120ms;--dur-2:180ms;--dur-3:280ms;
  --ease-out:cubic-bezier(.16,1,.3,1);--ease-std:cubic-bezier(.4,0,.2,1);
  /* Radii and control heights */
  --r-xs:4px;--r-sm:6px;--r-md:8px;--r-lg:10px;--r-xl:16px;--r-pill:999px;
  --h-xs:28px;--h-sm:34px;--h-md:40px;--h-lg:48px;
  /* Elevation and focus */
  --sh-pop:0 12px 32px var(--card-shadow);
  --modal-shadow:#14201F3D;
  --sh-modal:0 24px 64px var(--modal-shadow);
  --sh-sheet:-12px 0 40px var(--card-shadow);
  --ring:0 0 0 3px var(--accent-soft);
  --seg-ind:var(--surface);
  --seg-ind-sh:0 1px 2px var(--card-shadow),0 0 0 1px var(--line);
  --on-err:#fff;
}
[data-theme=dark]{
  --accent-hover:#86E6D1;--accent-press:#4CC3AA;--accent-text:#5FD9BF;
  --line-control:#6E7A78;--surface-hover:#232E30;--scrim:#00000080;--scrim-flat:color-mix(in srgb,#000 50%,var(--bg));
  --warn:#F0C445;--ok-fill:#46C38A;--warn-fill:#E8B730;--err-fill:#EE5A5E;--warn-soft:#E8B7301F;
  --heat-2:#5FD9BF33;--heat-3:#5FD9BF66;--heat-4:#5FD9BFA6;
  --fade-soft-0:#0F141600;
  --modal-shadow:#00000099;
  --seg-ind:var(--surface-hover);
}

/* Country flags: Windows draws the regional-indicator emoji as two letters, so flags come
   from Twemoji Country Flags (graphics: Twemoji, CC-BY 4.0; font: npm country-flag-emoji-polyfill
   0.1.8, MIT), only for the flag code points. */
@font-face{font-family:"Twemoji Country Flags";font-style:normal;font-weight:400;font-display:swap;src:url(/static/fonts/TwemojiCountryFlags.woff2) format("woff2");unicode-range:U+1F1E6-1F1FF,U+1F3F4,U+E0062-E0063,U+E0065,U+E0067,U+E006C,U+E006E,U+E0073-E0074,U+E0077,U+E007F}

/* Base */
html,body{height:100%}
/* The page scrollbar's gutter is always reserved, so a page growing past the window (or shrinking
   back) never moves the layout sideways when a classic scrollbar comes and goes. */
html{scrollbar-gutter:stable}
body.cx{font-size:14px;line-height:1.45;overflow-x:hidden}
/* Inner scroll areas (settings column, drawers, lists in dialogs, menus, tables): thin, themed. */
.cx *{scrollbar-width:thin;scrollbar-color:var(--line-strong) transparent}
.cx ::-webkit-scrollbar{width:8px;height:8px}
.cx ::-webkit-scrollbar-track{background:transparent}
.cx ::-webkit-scrollbar-thumb{background:var(--line-strong);border-radius:8px;border:2px solid transparent;background-clip:content-box}
.cx ::-webkit-scrollbar-corner{background:transparent}
.cx .i{width:16px;height:16px}
/* Brand marks fill their whole 24x24 box; on a fractional pixel the svg box cut their antialiased
   edge (a flat side on the Telegram circle and the Discord mark), so they paint past it. */
.cx svg:has(> use[href^="#b-"]){overflow:visible}
.mono{font-family:var(--font-code);font-variant-numeric:tabular-nums}
.t2{color:var(--text-2)}.t3{color:var(--text-3)}.ok{color:var(--ok)}.err{color:var(--err)}.warn{color:var(--warn)}.acc{color:var(--accent-text)}
.nowrap{white-space:nowrap}.ell{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.grow{flex:1 1 auto;min-width:0}
.hide{display:none!important}
.cx :focus-visible{outline:2px solid var(--accent);outline-offset:2px}
/* Text fields whose box (or wrapper) draws its own focus (accent border + --ring) get no outline on
   top of it: the palette search, the Playground composer and system prompt, the search boxes. */
.cx :is(.cmdk-in input,.pg-box textarea,.pg-sys,.pg-srch input,.md-search input,.acct-tz-q input,.shr-hd input,.c-in input,.c-in textarea,.c-in select):focus-visible{outline:none}
.cx a.lnk{color:var(--accent-text);font-weight:500;display:inline-flex;align-items:center;gap:6px}
.cx a.lnk:hover{text-decoration:underline;text-underline-offset:3px}
.cx a.lnk .i{width:14px;height:14px}

/* Boot: before /api/auth/me answers, html.is-auth shows the shell, otherwise sign in */
.boot-hide{visibility:hidden}

/* ---------- Shell ---------- */
.cshell{display:flex;min-height:100vh}
html:not(.is-auth) .cshell{display:none}
html.is-auth .signin{display:none}
/* The brand row and the balance + account block stay put; only the nav between them scrolls. */
.side{position:sticky;top:0;height:100vh;width:var(--side-w);flex:0 0 var(--side-w);background:var(--bg-alt);border-right:1px solid var(--line);display:flex;flex-direction:column;justify-content:space-between;padding:20px 14px;gap:20px;overflow:visible;z-index:30}
.side-top{display:flex;flex-direction:column;gap:20px;flex:1 1 auto;min-height:0}
.side-top > .brand-row,.side-bottom{flex:0 0 auto}
/* An opaque background of its own, the sidebar colour: in the transparent scroll layer a hovered label could be redrawn a pixel lower. */
.side .nav{flex:1 1 auto;min-height:0;overflow-y:auto;scrollbar-width:none;margin:-4px -6px;padding:4px 6px;background:var(--bg-alt)}
.side .nav::-webkit-scrollbar{display:none}
.brand-row{display:flex;align-items:center;gap:10px;padding:0 6px;color:var(--text)}
.brand-row .gmark{width:28px;height:28px}
.brand-t{display:flex;flex-direction:column;gap:1px;flex:1;min-width:0}
.brand-t b{font-size:16px;font-weight:600;letter-spacing:-.3px;line-height:20px}
.brand-t span{font-size:12px;color:var(--text-3);line-height:15px}
/* flex:none: next to a long title a flex row would otherwise squeeze the square into a narrow bar. */
.icon-btn{display:inline-grid;place-items:center;flex:none;width:28px;height:28px;border-radius:8px;color:var(--text-3);transition:background-color var(--dur-1) var(--ease-std),color var(--dur-1) var(--ease-std)}
.icon-btn:hover:not(:disabled){background:var(--surface-hover);color:var(--text)}
.nav{display:flex;flex-direction:column;gap:18px}
.nav-g{display:flex;flex-direction:column;gap:2px}
.nav-h{font-size:12px;font-weight:500;color:var(--text-3);padding:0 0 4px;line-height:15px}
/* Hover and the current page change colours only, at once: a fade left a trail of half-lit items
   behind a fast pointer, so the highlight never seemed to stay on the item under it. */
.nav-a{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:8px;color:var(--text-2);font-size:14px;line-height:18px;position:relative}
.nav-a .i{color:var(--text-3)}
.nav-a:hover{background:var(--surface-hover);color:var(--text)}
/* The current page is marked by its background and icon, never a heavier label. */
.nav-a.on{background:var(--surface);color:var(--text);box-shadow:0 1px 2px var(--card-shadow)}
.nav-a.on .i{color:var(--accent)}
.nav-a .ext{margin-left:auto;width:13px;height:13px;color:var(--text-3)}
.nav-a .lbl{flex:1;min-width:0}
.side-bottom{display:flex;flex-direction:column;gap:12px}
.bal-mini{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:14px;display:flex;flex-direction:column;gap:10px}
.bal-mini .l{font-size:12px;font-weight:500;color:var(--text-3)}
.bal-mini .v{font-size:22px;font-weight:500;letter-spacing:-.6px;line-height:26px}
.bal-mini .s{font-size:11px;color:var(--text-3);font-family:var(--font-code)}
/* The sidebar Top up is a small block button (c-btn sm block). */
.bal-mini .c-btn{width:100%;height:var(--h-sm);padding:0 12px;font-size:13px;line-height:16px}
.bal-mini .c-btn .i{width:14px;height:14px}
.user-row{display:flex;align-items:center;gap:10px;padding:6px;border-radius:10px;position:relative;text-align:left;width:100%}
.user-row:hover{background:var(--surface-hover)}
.avatar{width:30px;height:30px;border-radius:50%;background:var(--surface-2);color:var(--text-2);font-size:13px;font-weight:600;display:grid;place-items:center;flex:0 0 30px;overflow:hidden}
/* The photo lies over the initial and fades in once loaded (core.js bindShell). */
.avatar{position:relative}
.avatar img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;background:var(--surface-2);opacity:0;transition:opacity var(--dur-2) var(--ease-std)}
.avatar img.in{opacity:1}
.user-t{display:flex;flex-direction:column;gap:1px;flex:1;min-width:0}
.user-t b{font-size:13px;font-weight:500;line-height:17px}
.user-t span{font-size:12px;color:var(--text-3);line-height:15px}
.user-row > .i{color:var(--text-3)}

.main{flex:1 1 auto;min-width:0;display:flex;flex-direction:column}
.top{position:sticky;top:0;z-index:20;height:var(--top-h);display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 28px;border-bottom:1px solid var(--line);background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:saturate(1.4) blur(10px);-webkit-backdrop-filter:saturate(1.4) blur(10px)}
.top-title{display:flex;align-items:center;gap:10px;font-size:15px;font-weight:500;min-width:0}
.top-title .gmark{display:none}
#top-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.top-act{display:flex;align-items:center;gap:10px}
/* Top bar controls share one border tier (--line-strong) and one hover (--surface-hover). */
.search-btn{display:flex;align-items:center;gap:8px;width:220px;height:34px;padding:0 10px;background:var(--surface);border:1px solid var(--line-strong);border-radius:8px;color:var(--text-3);font-size:13px;transition:background-color var(--dur-1) var(--ease-std),border-color var(--dur-1) var(--ease-std),color var(--dur-1) var(--ease-std)}
.search-btn:hover{background:var(--surface-hover);color:var(--text-2)}
.search-btn:active{background:var(--surface-2)}
.search-btn .i{width:14px;height:14px}
.search-btn span{flex:1;text-align:left}
kbd,.kbd{font-family:var(--font-code);font-size:11px;color:var(--text-3);border:1px solid var(--line);border-radius:4px;padding:1px 5px;line-height:15px;background:transparent}
.clock{font-family:var(--font-code);font-size:12px;color:var(--text-2);border:1px solid var(--line-strong);border-radius:8px;padding:7px 10px;line-height:18px;white-space:nowrap}
.sq-btn{position:relative;flex:none;width:34px;height:34px;border:1px solid var(--line-strong);border-radius:8px;display:grid;place-items:center;color:var(--text-2);transition:background-color var(--dur-1) var(--ease-std),color var(--dur-1) var(--ease-std),border-color var(--dur-1) var(--ease-std);background:transparent}
.sq-btn:hover:not(:disabled),.sq-btn[aria-expanded=true]{background:var(--surface-hover);color:var(--text)}
.sq-btn:active:not(:disabled){background:var(--surface-2)}
.sq-btn .i{width:15px;height:15px}
.sq-btn .dot{position:absolute;top:6px;right:6px;width:7px;height:7px;border-radius:50%;background:var(--accent);box-shadow:0 0 0 2px var(--bg)}
.wallet-chip{display:none;align-items:center;gap:8px;height:34px;padding:0 12px;border:1px solid var(--line-strong);border-radius:8px;font-family:var(--font-code);font-size:13px;color:var(--text);transition:background-color var(--dur-1) var(--ease-std)}
.wallet-chip:hover{background:var(--surface-hover)}
.wallet-chip .i{width:15px;height:15px;color:var(--text-2)}

.view{flex:1 1 auto;display:flex;flex-direction:column;gap:20px;padding:24px 28px 40px;min-width:0;max-width:1600px;width:100%}
.view.wide{max-width:none}
.page-head{display:flex;justify-content:space-between;align-items:flex-end;gap:16px;flex-wrap:wrap}
.page-head h1{font-size:28px;font-weight:500;letter-spacing:-.9px;line-height:34px}
.page-head p{font-size:14px;color:var(--text-2);margin-top:6px}
.page-head .acts{display:flex;align-items:center;gap:10px;flex-wrap:wrap}

/* Mobile tab bar */
.tabbar{display:none}

/* ---------- Cards ---------- */
.card{background:var(--surface);border-radius:16px;box-shadow:var(--sh-card);min-width:0}
.card.pad{padding:22px}
.card-h{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}
.card-h h2,.card-t{font-size:16px;font-weight:500;line-height:20px}
.card-s{font-size:12px;color:var(--text-3);margin-top:3px}
.card-meta{font-size:12px;color:var(--text-3);font-family:var(--font-code)}
.card-meta.sans{font-family:inherit;font-weight:500}
.card-foot{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:14px 22px;border-top:1px solid var(--line);font-size:12px;color:var(--text-3)}
.card.tinted{background:var(--accent-soft);box-shadow:none;border:1px solid var(--accent-line)}
.edge-card{border-radius:16px}
/* Gradient outlines are the landing's .edge-ring: v2.css draws the ring, core.js GC.edge moves it as
   home.js does. Its moving layer lies over the border, so a ringed box never clips its overflow
   (that cut the outer half of the ring off); an art panel inside stays within the box instead, clear of
   the 1.5px stroke and its 3px live layer, on the inner radius of the 16px card. The stroke is the
   landing's; only the glow is tighter, since console cards sit close together. */
.edge-ring.edge-ring{overflow:visible}
.cx .edge-ring.edge-ring{box-shadow:0 0 14px var(--edge-glow)}
.edge-ring > .art{top:3px;right:3px;bottom:3px;border-radius:0 13px 13px 0}
.row{display:flex;gap:16px;min-width:0}
.row > *{min-width:0}
.grid2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.grid3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
.grid4{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}

/* Dither art panel inside a card (art fades into the card from the left) */
.art{position:absolute;top:-8px;right:-8px;bottom:-8px;pointer-events:none;overflow:hidden;border-radius:inherit}
.art img{height:100%;width:100%;object-fit:cover;object-position:left center;image-rendering:auto;-webkit-mask-image:linear-gradient(90deg,transparent 0,#000 60%);mask-image:linear-gradient(90deg,transparent 0,#000 60%)}
.art.f70 img{-webkit-mask-image:linear-gradient(90deg,transparent 0,#000 70%);mask-image:linear-gradient(90deg,transparent 0,#000 70%)}
.on-d{display:none!important}
[data-theme=dark] .on-l{display:none!important}
[data-theme=dark] .on-d{display:block!important}

/* Metric strip: one card, N cells split by hairlines */
.metrics{display:grid;grid-template-columns:repeat(var(--n,4),minmax(0,1fr))}
.metric{display:flex;flex-direction:column;gap:6px;padding:18px 20px;border-right:1px solid var(--line);min-width:0}
.metric:last-child{border-right:0}
.metric .l,.stat .l{font-size:12px;font-weight:500;color:var(--text-3);line-height:15px}
.metric .v{font-size:24px;font-weight:500;letter-spacing:-.6px;line-height:30px;font-variant-numeric:tabular-nums}
.metric .s,.stat .s{font-size:12px;color:var(--text-3);line-height:15px}
.metric .s.up,.stat .s.up{color:var(--ok)}
.metric .s.down,.stat .s.down{color:var(--err)}
/* Separate stat cards (API keys, activity, gateway): one recipe. Label 12/500 --text-3, value
   24/30/500, sub-line sans 12 --text-3 (never mono), no icon tile. */
.stat{display:flex;flex-direction:column;gap:6px;padding:18px}
.stat .v{font-size:24px;font-weight:500;letter-spacing:-.6px;line-height:30px;font-variant-numeric:tabular-nums}
.stat .v small{font-size:11px;color:var(--text-3);font-family:var(--font-code);letter-spacing:0;font-weight:400;margin-left:6px}
.stat.ic{flex-direction:row;align-items:center;gap:16px}
.stat.ic > div{display:flex;flex-direction:column;gap:4px;min-width:0}
.ic-box{width:38px;height:38px;border-radius:10px;background:var(--accent-soft);color:var(--accent);display:grid;place-items:center;flex:0 0 38px}
.ic-box .i{width:17px;height:17px}
.ic-box.sm{width:34px;height:34px;flex-basis:34px;border-radius:8px}
.ic-box.neutral{background:var(--surface-2);color:var(--text-2)}
.ic-box.warn{background:var(--warn-soft);color:var(--warn)}
.ic-box.err{background:var(--err-soft);color:var(--err)}
.ic-box.ok{background:var(--ok-soft);color:var(--ok)}

/* ---------- Buttons ---------- */
/* Sizes are heights: md 40 (default), sm 34, xs 28, lg 44 (sign in). Only height and horizontal
   padding change per size; every variant is weight 500 except the primary (600). */
.c-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:var(--h-md);padding:0 16px;border-radius:8px;font-size:14px;font-weight:500;line-height:18px;white-space:nowrap;border:1px solid transparent;transition:background-color var(--dur-1) var(--ease-std),border-color var(--dur-1) var(--ease-std),color var(--dur-1) var(--ease-std),box-shadow var(--dur-1) var(--ease-std);user-select:none}
.c-btn .i{width:15px;height:15px}
.c-btn.pri{background:var(--accent);color:var(--on-accent);font-weight:600}
.c-btn.pri:hover{background:var(--accent-hover)}
.c-btn.pri:active{background:var(--accent-press)}
.c-btn.sec{background:var(--surface);border-color:var(--line-strong);color:var(--text)}
.c-btn.sec:hover{background:var(--surface-hover)}
.c-btn.sec:active{background:var(--surface-2);border-color:var(--line-control)}
.c-btn.ghost{color:var(--text-2)}
.c-btn.ghost:hover{background:var(--surface-hover);color:var(--text)}
.c-btn.ghost:active{background:var(--surface-2);color:var(--text)}
.c-btn.danger{background:var(--surface);border-color:var(--err);color:var(--err)}
.c-btn.danger:hover{background:var(--err-soft)}
.c-btn.danger:active{background:color-mix(in srgb,var(--err) 16%,var(--surface))}
.c-btn.danger.solid{background:var(--err-fill);border-color:var(--err-fill);color:var(--on-err)}
.c-btn.danger.solid:hover{background:var(--err)}
.c-btn.danger.solid:active{background:color-mix(in srgb,var(--err) 85%,#000)}
.c-btn.sm{height:var(--h-sm);padding:0 12px;font-size:13px;line-height:16px}
.c-btn.sm .i{width:14px;height:14px}
.c-btn.xs{height:var(--h-xs);padding:0 10px;font-size:12px;line-height:16px;border-radius:6px;gap:6px}
.c-btn.xs .i{width:13px;height:13px}
.c-btn.lg{height:44px;padding:0 18px}
.c-btn.block{width:100%}
/* One disabled look for every variant. A busy button is disabled too but keeps its variant colours
   (dimmed a little), so "Deleting…" stays red and "Saving…" stays teal. */
.c-btn:is(:disabled,[aria-disabled=true]):not(.busy),.c-btn:is(:disabled,[aria-disabled=true]):not(.busy):is(:hover,:active){background:var(--tint-2);border-color:transparent;color:var(--text-3);cursor:not-allowed}
.c-btn.busy{pointer-events:none;opacity:.85}
.spin{width:15px;height:15px;animation:cx-spin .8s linear infinite}
@keyframes cx-spin{to{transform:rotate(360deg)}}
.link-btn{color:var(--accent-text);font-weight:500;font-size:13px;display:inline-flex;align-items:center;gap:6px}
.link-btn:hover:not(:disabled){text-decoration:underline;text-underline-offset:3px}
.link-btn .i{width:14px;height:14px}
/* Disabled for the small button families (the c-btn has its own recipe above). */
:is(.sq-btn,.icon-btn,.copy,.link-btn,.seg > button,.menu button,.chip):disabled:not(.busy){opacity:.45;cursor:not-allowed}
:is(.sq-btn,.icon-btn,.copy,.menu button,.chip):disabled:not(.busy){background:transparent}
/* Press feedback for the icon families and menu items: a colour step, never a move. */
:is(.icon-btn,.copy):active:not(:disabled){background:var(--surface-2)}

/* ---------- Form controls ---------- */
.fld{display:flex;flex-direction:column;gap:6px;min-width:0}
/* Field label: 13/18/500 --text everywhere (dialogs, sheets, Settings, Playground). */
.fld > label,.fld-l{font-size:13px;line-height:18px;font-weight:500;color:var(--text)}
.fld-h{font-size:12px;color:var(--text-3)}
.fld-e{font-size:12px;color:var(--err);display:flex;align-items:center;gap:6px}
.fld-e .i{width:13px;height:13px}
/* Input box: 40px (sm 34 in toolbars), --line-control border, --text-3 on hover, accent + ring on focus. */
.c-in{display:flex;align-items:center;gap:8px;height:var(--h-md);padding:0 12px;background:var(--surface);border:1px solid var(--line-control);border-radius:8px;color:var(--text);transition:border-color var(--dur-1) var(--ease-std),box-shadow var(--dur-1) var(--ease-std);min-width:0}
.c-in:hover{border-color:var(--text-3)}
.c-in:focus-within{border-color:var(--accent);box-shadow:var(--ring)}
.c-in.sm{height:var(--h-sm)}
.c-in.sm input,.c-in.sm select{font-size:13px}
.c-in input,.c-in textarea,.c-in select{flex:1;min-width:0;border:0;outline:0;background:transparent;color:inherit;font:inherit;font-size:14px;padding:0}
.c-in input::placeholder,.c-in textarea::placeholder{color:var(--text-3)}
.c-in .pre{color:var(--text-3);font-family:var(--font-code);font-size:13px}
.c-in.mono input{font-family:var(--font-code)}
.c-in .i{width:15px;height:15px;color:var(--text-3)}
.c-in.bad{border-color:var(--err)}
.c-in.bad:focus-within{box-shadow:0 0 0 3px var(--err-soft)}
.c-in.dis{background:var(--tint-2);border-color:var(--line);color:var(--text-3)}
.c-in.area{height:auto;padding:10px 12px;align-items:stretch}
.c-in.area textarea{resize:vertical;min-height:90px;line-height:20px}
.c-in.filled{background:var(--tint-2)}
input.c-plain{border:0;outline:0;background:transparent;font:inherit;color:inherit}
.c-in input:focus-visible,.c-in textarea:focus-visible,.c-in select:focus-visible{outline:none}

/* Toggle switch */
.tgl{position:relative;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;margin:-8px -1px;flex:0 0 auto;cursor:pointer}
.tgl input{position:absolute;inset:0;opacity:0;margin:0;cursor:inherit}
.tgl .tr{width:34px;height:20px;border-radius:10px;background:var(--line-control);position:relative;transition:background-color var(--dur-2) var(--ease-std)}
.tgl .tr::after{content:"";position:absolute;top:3px;left:3px;width:14px;height:14px;border-radius:50%;background:#fff;box-shadow:0 1px 2px #0003;transition:transform var(--dur-2) var(--ease-std)}
.tgl input:checked + .tr{background:var(--accent)}
.tgl input:checked + .tr::after{transform:translateX(14px)}
[data-theme=dark] .tgl input:checked + .tr::after{background:var(--on-accent)}
.tgl input:focus-visible + .tr{outline:2px solid var(--accent);outline-offset:3px}
.tgl input:disabled + .tr{opacity:.45}
.tgl input:disabled{cursor:not-allowed}

/* Segmented control (range pickers, currency, effort) */
/* Every option is as wide as the widest one, so the sliding highlight moves without growing or shrinking. */
/* Two sizes. Base (sm, 34 tall): page heads, card heads, toolbars. .md (40 tall): dialogs, sheets,
   Settings. The old .sans and .lg classes add nothing any more and may be dropped from markup. */
.seg{display:inline-grid;grid-auto-flow:column;grid-auto-columns:1fr;gap:2px;padding:3px;background:var(--tint-2);border:1px solid var(--line);border-radius:8px;position:relative}
/* Every option keeps one weight, selected or not: the sliding highlight and the darker colour
   mark the choice, so no label ever grows or shrinks. */
.seg > button{position:relative;z-index:1;height:26px;padding:0 12px;border-radius:6px;font-family:inherit;font-size:12px;font-weight:500;line-height:16px;color:var(--text-2);white-space:nowrap;transition:color var(--dur-1) var(--ease-std);display:inline-flex;flex-direction:column;align-items:center;justify-content:center}
.seg > button:hover:not(:disabled),.seg > button.on{color:var(--text)}
.seg .seg-ind{position:absolute;left:0;top:0;z-index:0;background:var(--seg-ind);box-shadow:var(--seg-ind-sh);border-radius:6px;pointer-events:none;opacity:0;transition:transform var(--dur-3) var(--ease-out),width var(--dur-3) var(--ease-out),height var(--dur-3) var(--ease-out),opacity var(--dur-1) var(--ease-std)}
.seg.md > button{height:32px;padding:0 14px;font-size:13px;line-height:18px}
.seg.fill{display:grid}
.seg.fill > button{flex:1}

/* Select-like dropdown button */
.dd{position:relative;display:inline-flex}
/* Select trigger: the input box in the toolbar size (34), --line-control border; open = accent + ring. */
.dd-btn{display:inline-flex;align-items:center;gap:8px;height:var(--h-sm);padding:0 12px;background:var(--surface);border:1px solid var(--line-control);border-radius:8px;font-size:13px;color:var(--text);white-space:nowrap;transition:border-color var(--dur-1) var(--ease-std),background-color var(--dur-1) var(--ease-std),box-shadow var(--dur-1) var(--ease-std)}
.dd-btn:hover{background:var(--surface-hover)}
.dd-btn .i{width:14px;height:14px;color:var(--text-2)}
.dd-btn .chev{color:var(--text-3);transition:transform var(--dur-2) var(--ease-std)}
.dd.open .dd-btn{border-color:var(--accent);box-shadow:var(--ring)}
.dd.open .dd-btn .chev{transform:rotate(180deg);color:var(--accent)}
/* Popover / menu: 6px from the trigger, fades in, never moves. .r anchors right, .up opens upwards. */
.menu{position:absolute;top:calc(100% + 6px);left:0;min-width:180px;max-width:calc(100vw - 32px);max-height:320px;overflow:auto;overscroll-behavior:contain;background:var(--surface);border:1px solid var(--line-strong);border-radius:10px;box-shadow:var(--sh-pop);padding:5px;z-index:60;display:none;flex-direction:column;gap:1px}
.menu.r{left:auto;right:0}
.menu.up{top:auto;bottom:calc(100% + 6px)}
.dd.open .menu,.menu.show{display:flex;animation:cx-pop var(--dur-2) var(--ease-out)}
/* Popups only fade in: a slide or scale moves their text on the way in. */
@keyframes cx-pop{from{opacity:0}to{opacity:1}}
/* Items change colour at once on hover (a fade trails behind a fast pointer). */
.menu button,.menu a{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:6px;font-size:13px;line-height:18px;color:var(--text-2);text-align:left;width:100%;white-space:nowrap;flex:none}
.menu button > span,.menu a > span{min-width:0;overflow:hidden;text-overflow:ellipsis}
.menu button:focus-visible,.menu a:focus-visible{outline-offset:-2px}
.menu button:hover:not(:disabled),.menu a:hover,.menu button.kb{background:var(--surface-hover);color:var(--text)}
.menu button:active:not(:disabled),.menu a:active{background:var(--surface-2)}
/* Selected: accent tint + check, same weight. */
.menu button.on,.menu button.on:hover:not(:disabled){background:var(--accent-soft);color:var(--text)}
.menu button.on::after{content:"";margin-left:auto;flex:0 0 14px;width:14px;height:14px;background:var(--accent);-webkit-mask:var(--chk) center/contain no-repeat;mask:var(--chk) center/contain no-repeat}
.menu .i{width:15px;height:15px;color:var(--text-3);flex:none}
.menu .sep{height:1px;background:var(--line);margin:4px 2px}
.menu .danger{color:var(--err)}
#user-menu{left:auto;right:0}
/* The theme menu is a plain menu (the top bar button hovers like the bell). */
.theme-menu{min-width:140px}
.menu .danger .i{color:var(--err)}
.menu .mh{font-size:11px;color:var(--text-3);padding:6px 10px 4px;font-weight:500}

/* Date and month picker (core.js GC.dateHTML): one field, calendar icon on the left only, and a
   calendar drawn like a menu (same surface, line, radius, shadow and fade). Pages, months and years
   switch in place; the day grid is always six weeks, so the calendar never changes height. */
.dp{position:relative;min-width:0}
.c-in.dp-btn{width:100%;cursor:pointer;text-align:left;font:inherit}
.dp-btn > .i{flex:0 0 15px}
.dp-v{flex:1;min-width:0;font-family:var(--font-code);font-size:13px;line-height:18px;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dp-v.ph{color:var(--text-3)}
.dp.open .c-in.dp-btn{border-color:var(--accent);box-shadow:var(--ring)}
.dp.open .dp-btn > .i{color:var(--accent)}
.dp.bad .c-in.dp-btn{border-color:var(--err)}
.dp-pop{position:fixed;z-index:90;width:272px;max-width:calc(100vw - 16px);background:var(--surface);border:1px solid var(--line-strong);border-radius:10px;box-shadow:var(--sh-pop);padding:10px;animation:cx-pop var(--dur-2) var(--ease-out);cursor:default}
.dp-h{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px}
.dp-t{display:inline-flex;align-items:center;gap:4px;height:var(--h-xs);padding:0 8px;border-radius:var(--r-sm);font-size:13px;line-height:18px;font-weight:500;color:var(--text)}
button.dp-t{transition:background-color var(--dur-1) var(--ease-std)}
button.dp-t:hover{background:var(--surface-hover)}
button.dp-t:focus-visible{outline-offset:-2px}
.dp-t .i{width:13px;height:13px;color:var(--text-3)}
.dp-nav{width:var(--h-xs);height:var(--h-xs);display:grid;place-items:center;border-radius:var(--r-sm);color:var(--text-2);transition:background-color var(--dur-1) var(--ease-std),color var(--dur-1) var(--ease-std)}
.dp-nav .i{width:15px;height:15px}
.dp-nav:hover:not(:disabled){background:var(--surface-hover);color:var(--text)}
.dp-nav:disabled{opacity:.35;cursor:not-allowed}
.dp-wd,.dp-g{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px}
.dp-wd span{height:26px;display:grid;place-items:center;font-size:11px;font-weight:500;color:var(--text-3)}
/* Month and year pages fill the height of a page of days (weekday row + six weeks), so the calendar
   keeps one size while it climbs from days to months to years. */
.dp-g.m{grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(4,minmax(0,1fr));gap:4px;height:228px;padding:2px 0}
.dp-c{height:32px;display:grid;place-items:center;border-radius:var(--r-sm);font-family:var(--font-code);font-size:12px;color:var(--text)}
.dp-g.m .dp-c{height:auto;font-family:inherit;font-size:13px}
.dp-c.out{color:var(--text-3)}
.dp-c:hover:not(:disabled):not(.on){background:var(--surface-hover)}
.dp-c.now:not(.on){box-shadow:inset 0 0 0 1px var(--accent-line);color:var(--accent-text);font-weight:600}
.dp-c.on{background:var(--accent);color:var(--on-accent);font-weight:600}
.dp-c:disabled{opacity:.35;cursor:not-allowed}
.dp-c:focus-visible,.dp-nav:focus-visible,.dp-f button:focus-visible{outline-offset:-2px}
.dp-f{display:flex;justify-content:flex-end;margin-top:8px;padding-top:8px;border-top:1px solid var(--line)}
.dp-f button{height:var(--h-xs);padding:0 10px;border-radius:var(--r-sm);font-size:12px;font-weight:500;color:var(--accent-text);transition:background-color var(--dur-1) var(--ease-std)}
.dp-f button:hover:not(:disabled){background:var(--surface-hover)}
.dp-f button:disabled{opacity:.45;cursor:not-allowed}
:root{--chk:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")}

/* ---------- Badges / pills ---------- */
.badge{display:inline-flex;align-items:center;gap:5px;padding:3px 8px;border-radius:6px;font-size:12px;font-weight:500;line-height:16px;white-space:nowrap}
.badge::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor;flex:0 0 6px}
.badge.nd::before{display:none}
.badge.ok{background:var(--ok-soft);color:var(--ok)}
.badge.ok::before{background:var(--ok-fill)}
.badge.warn{background:var(--warn-soft);color:var(--warn)}
.badge.warn::before{background:var(--warn-fill)}
.badge.err{background:var(--err-soft);color:var(--err)}
.badge.err::before{background:var(--err-fill)}
.badge.mute{background:var(--tint-2);color:var(--text-2)}
.badge.mute::before{background:var(--text-3)}
.badge.acc{background:var(--accent-soft);color:var(--accent-text)}
/* The outline is the landing's .edge-ring (p-home.js GC.savedPill), on the landing pill's fill; the padding
   makes up for its 1.5px border. Inside an already ringed card it is a plain chip (.plain). */
.cx .saved-pill{--ring-fill:var(--bg)}
.saved-pill.plain{padding:5px 12px;border:1px solid var(--line);background:var(--bg)}
.saved-pill{display:inline-flex;align-items:center;gap:8px;padding:4.5px 11.5px;border-radius:100px;font-size:13px;font-weight:500;color:var(--text);white-space:nowrap}
.saved-pill b{font-family:var(--font-code);font-weight:600;font-size:12px;color:var(--ok)}
.dot{display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--ok-fill);flex:0 0 7px}
.dot.warn{background:var(--warn-fill)}.dot.err{background:var(--err-fill)}.dot.mute{background:var(--tint-4)}
/* Filter / toggle chip: 28 tall, pill. Selected (.on or aria-pressed=true): accent tint, accent line, --text. */
.chip{display:inline-flex;align-items:center;gap:6px;height:var(--h-xs);padding:0 12px;border-radius:var(--r-pill);border:1px solid var(--line-strong);background:transparent;font-size:12px;font-weight:500;line-height:16px;color:var(--text-2);white-space:nowrap;transition:background-color var(--dur-1) var(--ease-std),border-color var(--dur-1) var(--ease-std),color var(--dur-1) var(--ease-std)}
.chip .i{width:13px;height:13px}
button.chip:hover:not(:disabled){background:var(--surface-hover);color:var(--text)}
button.chip:active:not(:disabled){background:var(--surface-2)}
.chip.on,.chip[aria-pressed=true],button.chip.on:hover:not(:disabled),button.chip[aria-pressed=true]:hover:not(:disabled){background:var(--accent-soft);border-color:var(--accent-line);color:var(--text)}
.keymask{display:inline-flex;align-items:center;gap:8px}
.keymask code{background:var(--tint-2);border-radius:6px;padding:4px 9px;font-size:12px;color:var(--text-2);white-space:nowrap}
.copy{display:inline-grid;place-items:center;width:26px;height:26px;border-radius:6px;color:var(--text-3);transition:background-color var(--dur-1) var(--ease-std),color var(--dur-1) var(--ease-std);flex:0 0 26px}
.copy:hover:not(:disabled){background:var(--surface-hover);color:var(--text)}
.copy .i{width:14px;height:14px}
/* Copied (core.js GC.copy): an icon button shows a check; a text button keeps its label and swaps its icon. */
.copy.done{color:var(--ok)}
.done > .i{color:var(--ok)}

/* Provider logo tile */
.plogo{width:32px;height:32px;border-radius:8px;background:var(--surface-2);display:grid;place-items:center;flex:0 0 32px}
.plogo img{width:18px;height:18px;object-fit:contain}
.plogo.sm{width:auto;height:auto;background:none;flex-basis:auto}
.plogo.sm img{width:14px;height:14px}
.plogo .i{width:16px;height:16px;color:var(--text-3)}

/* ---------- Tables ---------- */
.tbl-wrap{overflow-x:auto;min-width:0}
table.tbl{width:100%;border-collapse:collapse;font-size:13px}
/* Header 12/16/500 --text-3 on --bg-alt; cells 13/18 with 12px vertical padding (.dense: 10).
   Pages keep their own horizontal padding; row hover is instant and only where a pointer hovers. */
.tbl th{text-align:left;font-size:12px;font-weight:500;line-height:16px;color:var(--text-3);padding:10px 12px;background:var(--bg-alt);border-bottom:1px solid var(--line);white-space:nowrap}
.tbl th:first-child,.tbl td:first-child{padding-left:22px}
.tbl th:last-child,.tbl td:last-child{padding-right:22px}
.tbl td{padding:12px 12px;line-height:18px;border-bottom:1px solid var(--line);vertical-align:middle}
.tbl.dense td{padding-top:10px;padding-bottom:10px}
.tbl tr:last-child td{border-bottom:0}
.tbl .r{text-align:right}
.tbl td.mono,.tbl .mono{font-family:var(--font-code);font-size:12px;color:var(--text-2);white-space:nowrap}
.tbl td.strong{color:var(--text);font-weight:500}
@media (hover:hover){.tbl.hover tbody tr:hover{background:var(--tint-2)}}
.tbl.click tbody tr{cursor:pointer}
.tbl tbody tr.sel{background:var(--accent-soft);box-shadow:inset 0 0 0 1px var(--accent-line)}
.tbl tbody tr:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
.tbl .namecell{display:flex;align-items:center;gap:12px;min-width:0}
.tbl .namecell b{font-weight:500;color:var(--text);font-size:14px}
.tbl .sub{font-size:11px;color:var(--text-3);font-family:var(--font-code);margin-top:2px}
/* Pager (core.js GC.pager), the same on every table: "Showing a-b of n" left, Previous / Next right.
   The page's footer around it sets the padding and the top border. */
.pager{display:flex;justify-content:space-between;align-items:center;gap:12px;width:100%;min-height:var(--h-sm);font-size:12px;line-height:16px;color:var(--text-3)}
.pager-t{min-width:0}
.pager-b{display:flex;align-items:center;gap:8px;flex:none}

/* Progress track */
.track{height:6px;border-radius:3px;background:var(--tint-2);overflow:hidden;position:relative;min-width:40px}
.track > i{position:absolute;left:0;top:0;bottom:0;border-radius:3px;background:var(--accent)}
.track.mute > i{background:var(--tint-4)}
.track.warn > i{background:var(--warn-fill)}
.track.err > i{background:var(--err-fill)}
.share{display:flex;align-items:center;gap:12px}
.share .track{flex:1}
.share span{font-family:var(--font-code);font-size:11px;color:var(--text-2);width:34px;text-align:right}

/* ---------- Bar chart ---------- */
.bars{display:flex;align-items:flex-end;gap:var(--bar-gap,8px);height:100%;min-height:120px;position:relative}
.bars .b{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:6px;height:100%;min-width:0;position:relative}
.bars .b > i{display:block;width:100%;background:var(--heat-3);border-radius:3px 3px 0 0;min-height:2px;transition:background-color var(--dur-1) var(--ease-std)}
.bars .b.now > i{background:var(--accent)}
.bars .b:hover > i{background:var(--heat-4)}
.bars .b.now:hover > i{background:var(--accent-hover)}
.bars .b.zero > i{background:var(--tint-2)}
.bars .b > em{font-style:normal;font-family:var(--font-code);font-size:11px;color:var(--text-3);line-height:14px}
.bars .b > u{display:block;width:100%;height:5px;border-radius:1px;background:var(--err-fill);text-decoration:none}
.bars .b > u.none{background:transparent}
.axis{display:flex;justify-content:space-between;font-family:var(--font-code);font-size:11px;color:var(--text-3);margin-top:10px}
.tip{position:fixed;z-index:90;pointer-events:none;background:var(--surface);border:1px solid var(--line-strong);border-radius:8px;box-shadow:var(--sh-pop);padding:9px 11px;font-size:12px;min-width:150px;opacity:0;transition:opacity var(--dur-1) var(--ease-std)}
.tip.show{opacity:1}
/* Hover hints for icon buttons (from their title), drawn like the chart tooltips. */
.ttip{position:fixed;z-index:95;pointer-events:none;background:var(--surface);border:1px solid var(--line-strong);border-radius:8px;box-shadow:var(--sh-pop);padding:6px 9px;font-size:12px;font-weight:500;line-height:16px;color:var(--text);white-space:nowrap;max-width:280px;opacity:0;transition:opacity var(--dur-1) var(--ease-std)}
.ttip.show{opacity:1}
.tip .th{font-weight:500;margin-bottom:6px;color:var(--text)}
.tip .tr{display:flex;justify-content:space-between;gap:16px;color:var(--text-2);line-height:20px}
.tip .tr b{font-family:var(--font-code);font-weight:400;color:var(--text)}
.tip .tr i{display:inline-block;width:7px;height:7px;border-radius:2px;margin-right:6px;vertical-align:1px}

/* ---------- Overlays ---------- */
/* The scrim takes no clicks while it fades out (core.js sets pointer-events on close). */
.scrim{position:fixed;inset:0;background:var(--scrim);z-index:80;display:flex;align-items:center;justify-content:center;padding:24px;opacity:0;transition:opacity var(--dur-2) var(--ease-std);overscroll-behavior:contain}
.scrim.show{opacity:1}
/* The scrim covers the viewport, which leaves out the stable scrollbar gutter; the root's own
   background (the canvas, under the gutter) turns the scrim colour over --bg with it, so that
   strip dims too. --scrim-flat is --scrim already laid over --bg. */
html{background-color:var(--bg);transition:background-color var(--dur-2) var(--ease-std)}
html:has(.scrim.show){background-color:var(--scrim-flat)}
/* While a dialog is open the page behind does not scroll (core.js adds cx-lock only when the page
   has a scrollbar; the gutter keeps its width so nothing shifts). */
html.cx-lock{overflow:hidden;scrollbar-gutter:stable}
/* With the root's overflow set, body.cx's overflow-x no longer passes to the viewport and would make
   the body its own scroller (the page would jump to the top): it stays visible while locked. */
html.cx-lock body.cx{overflow:visible}
/* Dialogs and sheets fade in with the scrim and do not move: a moving dialog shifts its text and
   can carry its close button away from the pointer. Widths: 400 (.w400), 480 default, 560, 640. */
.modal{background:var(--surface);border:1px solid var(--line-strong);border-radius:16px;box-shadow:var(--sh-modal);width:min(480px,100%);max-height:calc(100vh - 48px);max-height:calc(100dvh - 48px);overflow:auto;overscroll-behavior:contain}
.scrim.show .modal{transform:none}
.modal.w400{width:min(400px,100%)}
.modal.w560{width:min(560px,100%)}
.modal.w640{width:min(640px,100%)}
/* A dialog whose content changes height (top up, pay) keeps its top edge in one place, like the
   command palette, so a tab or method change never makes it jump up and down. Phones keep the sheet. */
.modal.pin{align-self:flex-start;margin-top:min(6vh,56px);max-height:calc(100vh - 48px - min(6vh,56px));max-height:calc(100dvh - 48px - min(6vh,56px))}
.modal-h{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;padding:22px 24px 0}
.modal-h h3{font-size:18px;font-weight:500;letter-spacing:-.3px;line-height:24px}
.modal-h p{font-size:13px;line-height:19px;color:var(--text-2);margin-top:4px}
.modal-h .icon-btn{width:32px;height:32px;margin:-4px -6px 0 0}
.modal-h .icon-btn .i{width:16px;height:16px}
.modal-b{padding:20px 24px;display:flex;flex-direction:column;gap:16px}
.modal-f{display:flex;justify-content:flex-end;gap:10px;padding:14px 24px;border-top:1px solid var(--line);background:var(--bg-alt)}
.modal-f.split{justify-content:space-between;align-items:center}
/* The More sheet on phones (core.js moreSheet). */
.modal.more{width:min(520px,100%)}
.modal.more .modal-b{padding:12px 8px 8px}
/* Callout / alert: soft status fill, a 35% status line, 16px status icon. */
.callout{display:flex;gap:10px;padding:12px 14px;border-radius:10px;font-size:13px;line-height:19px;background:var(--tint-2);border:1px solid var(--line);color:var(--text-2)}
.callout .i{width:16px;height:16px;flex:0 0 16px;margin-top:2px}
.callout.warn{background:var(--warn-soft);border-color:color-mix(in srgb,var(--warn-fill) 35%,transparent);color:var(--text)}
.callout.warn .i{color:var(--warn)}
.callout.err{background:var(--err-soft);border-color:color-mix(in srgb,var(--err-fill) 35%,transparent);color:var(--text)}
.callout.err .i{color:var(--err)}
.callout.ok{background:var(--ok-soft);border-color:color-mix(in srgb,var(--ok-fill) 35%,transparent);color:var(--text)}
.callout.ok .i{color:var(--ok)}
.callout.acc{background:var(--accent-soft);border-color:color-mix(in srgb,var(--accent) 35%,transparent);color:var(--text)}
.callout.acc .i{color:var(--accent)}
.callout b{font-weight:500;color:var(--text)}
/* Read-only / copy field: value on --bg-alt, trailing c-btn sec xs. */
.secret{display:flex;align-items:center;gap:10px;min-height:var(--h-md);padding:6px 6px 6px 12px;border-radius:8px;background:var(--bg-alt);border:1px solid var(--line);font-family:var(--font-code);font-size:13px;line-height:18px;word-break:break-all;color:var(--text)}
.secret span{flex:1}

/* Toasts */
.toasts{position:fixed;right:20px;bottom:20px;z-index:100;display:flex;flex-direction:column;gap:8px;pointer-events:none}
/* Drawn like the console's menus and tooltips (a surface card), fading in and out without moving. */
.toast{pointer-events:auto;display:flex;align-items:center;gap:10px;min-width:240px;max-width:380px;padding:11px 14px;border-radius:10px;background:var(--surface);color:var(--text);border:1px solid var(--line-strong);font-size:13px;font-weight:500;line-height:18px;box-shadow:var(--sh-pop);animation:cx-toast var(--dur-2) var(--ease-out)}
.toast .i{width:16px;height:16px;flex:0 0 16px;color:var(--text-3)}
.toast.ok .i{color:var(--ok)}.toast.err .i{color:var(--err)}
.toast.out{opacity:0;transition:opacity var(--dur-2) var(--ease-std)}
@keyframes cx-toast{from{opacity:0}to{opacity:1}}

/* Side panel (request detail, notifications) */
.panel{background:var(--surface);border-radius:16px;box-shadow:var(--sh-card);padding:20px;display:flex;flex-direction:column;gap:14px;min-width:0}
.kv{display:flex;flex-direction:column;gap:8px}
.kv > div{display:flex;justify-content:space-between;align-items:center;gap:12px;font-size:13px;line-height:18px}
.kv > div > span:first-child{color:var(--text-2);white-space:nowrap}
.kv > div > span:last-child,.kv > div > b{font-family:var(--font-code);font-weight:400;font-size:12px;color:var(--text);text-align:right;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:inline-flex;align-items:center;gap:6px;justify-content:flex-end}
.hr{height:1px;background:var(--line);border:0;margin:0}

/* Empty / loading states */
.empty{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:10px;padding:48px 24px;color:var(--text-2)}
.empty .ic-box{width:44px;height:44px;border-radius:10px;margin-bottom:4px;background:var(--surface-2);color:var(--text-2)}
.empty .ic-box .i{width:20px;height:20px}
.empty h3{font-size:16px;font-weight:500;line-height:20px;color:var(--text)}
.empty p{font-size:13px;line-height:20px;max-width:420px}
.empty .acts{display:flex;gap:10px;margin-top:6px;flex-wrap:wrap;justify-content:center}
/* Compact empty state for tables and popovers (GC.empty({sm:true})). */
.empty.sm{padding:28px 20px;gap:8px}
.empty.sm .ic-box{width:36px;height:36px;flex-basis:36px;border-radius:8px;margin-bottom:2px}
.empty.sm .ic-box .i{width:16px;height:16px}
.empty.sm h3{font-size:14px;line-height:18px}
.sk{display:block;border-radius:6px;background:linear-gradient(90deg,var(--tint-2) 0,var(--tint-3) 40%,var(--tint-2) 80%);background-size:300% 100%;animation:cx-sk 1.4s ease-in-out infinite;height:12px}
@keyframes cx-sk{0%{background-position:100% 0}100%{background-position:0 0}}
.loading-line{position:absolute;left:0;right:0;top:0;height:2px;overflow:hidden}
.loading-line::after{content:"";position:absolute;inset:0;width:30%;background:var(--accent);animation:cx-line 1.1s ease-in-out infinite}
@keyframes cx-line{from{transform:translateX(-100%)}to{transform:translateX(340%)}}
.err-box{display:flex;align-items:center;gap:10px;padding:12px 14px;border-radius:10px;background:var(--err-soft);border:1px solid color-mix(in srgb,var(--err-fill) 35%,transparent);color:var(--text);font-size:13px;line-height:19px}
.err-box .i{color:var(--err);width:16px;height:16px;flex:0 0 16px}
/* A region reloading in place (core.js GC.busyRegion): the old content stays, dimmed, under a 2px
   progress line; skeletons are only for a first load. Put it on a container (card, section), not on
   a table part or a control: it sets the container's opacity transition. */
.busy-rg{transition:opacity var(--dur-2) var(--ease-std)}
.is-busy{opacity:.55}
.is-busy::after{content:"";position:absolute;left:0;right:0;top:0;height:2px;z-index:3;pointer-events:none;border-radius:2px;background:linear-gradient(90deg,transparent,var(--accent),transparent);background-size:40% 100%;background-repeat:no-repeat;animation:cx-busy 1.1s ease-in-out infinite}
@keyframes cx-busy{from{background-position:-40% 0}to{background-position:140% 0}}

/* Code block */
.code{background:var(--code-bg);border:1px solid var(--code-line-strong);border-radius:10px;padding:14px 16px;font-family:var(--font-code);font-size:13px;line-height:23px;color:var(--code-text);overflow-x:auto;white-space:pre;position:relative}
.code .k{color:var(--code-key)}.code .s{color:var(--code-str)}.code .c{color:var(--code-comment)}.code .f{color:var(--code-fn)}
.code .copy{position:absolute;top:8px;right:8px;width:28px;height:28px;flex-basis:28px;background:var(--code-bg);border:1px solid var(--code-line-strong)}
.code .copy:hover:not(:disabled){background:var(--code-bg)}
.code:has(> .copy){padding-right:48px}
@media (max-width:720px){.code{white-space:pre-wrap;overflow-wrap:anywhere}}

/* Command palette */
.cmdk{width:min(620px,100%);align-self:flex-start;margin-top:12vh;padding:0;overflow:hidden}
.cmdk-in{display:flex;align-items:center;gap:10px;padding:14px 18px;border-bottom:1px solid var(--line)}
.cmdk-in .i{width:17px;height:17px;color:var(--text-3)}
.cmdk-in input{flex:1;border:0;outline:0;background:transparent;font:inherit;font-size:15px;color:var(--text)}
.cmdk-l{max-height:380px;overflow:auto;padding:6px}
.cmdk-g{font-size:11px;font-weight:500;color:var(--text-3);padding:10px 12px 4px}
.cmdk-i{display:flex;align-items:center;gap:12px;padding:9px 12px;border-radius:8px;font-size:14px;color:var(--text-2);width:100%;text-align:left}
.cmdk-i .i{width:16px;height:16px;color:var(--text-3)}
.cmdk-i span{flex:1}
.cmdk-i .plogo{flex:none}
.cmdk-i em{font-style:normal;font-size:12px;color:var(--text-3)}
.cmdk-i.kb{background:var(--surface-hover);color:var(--text)}
.cmdk-i.kb .i{color:var(--accent)}
.cmdk-f{display:flex;gap:16px;padding:10px 16px;border-top:1px solid var(--line);font-size:12px;color:var(--text-3)}
.cmdk-f span{display:inline-flex;align-items:center;gap:6px}

/* Notifications popover */
.notif{position:absolute;top:calc(100% + 6px);right:0;width:380px;max-width:calc(100vw - 24px);background:var(--surface);border:1px solid var(--line-strong);border-radius:10px;box-shadow:var(--sh-pop);z-index:70;display:none;flex-direction:column;overflow:hidden}
.notif.show{display:flex;animation:cx-pop var(--dur-2) var(--ease-out)}
.notif-h{display:flex;justify-content:space-between;align-items:center;padding:14px 16px;border-bottom:1px solid var(--line)}
.notif-h b{font-size:14px;font-weight:500}
.notif-l{max-height:420px;overflow:auto;overscroll-behavior:contain}
.notif-i{display:flex;gap:12px;padding:13px 16px;border-bottom:1px solid var(--line);font-size:13px;width:100%;text-align:left}
.notif-i:last-child{border-bottom:0}
.notif-i .ic-box{width:30px;height:30px;flex-basis:30px;border-radius:8px}
.notif-i .ic-box .i{width:14px;height:14px}
.notif-i b{display:block;font-weight:500;color:var(--text);margin-bottom:2px}
.notif-i p{color:var(--text-2);line-height:18px}
.notif-i time{display:block;font-size:11px;color:var(--text-3);margin-top:4px;font-family:var(--font-code)}
.notif-i.unread{background:var(--accent-soft)}
.wrap-rel{position:relative}

/* ---------- Sign in ---------- */
.signin{min-height:100vh;display:grid;grid-template-columns:minmax(0,760fr) minmax(0,680fr);background:var(--bg)}
.si-art{position:relative;overflow:hidden;display:flex;flex-direction:column;justify-content:space-between;padding:48px}
.si-art > img{position:absolute;inset:-8px;width:calc(100% + 16px);height:calc(100% + 16px);object-fit:cover;-webkit-mask-image:linear-gradient(180deg,#000 35%,transparent 100%);mask-image:linear-gradient(180deg,#000 35%,transparent 100%)}
.si-brand{position:relative;display:inline-flex;align-items:center;gap:10px;align-self:flex-start;background:var(--surface);border-radius:10px;padding:8px 14px 8px 10px;font-size:16px;font-weight:600;letter-spacing:-.3px;color:var(--text);box-shadow:0 2px 8px var(--card-shadow)}
.si-brand .gmark{width:26px;height:26px}
.si-pitch{position:relative;display:flex;flex-direction:column;gap:16px;max-width:520px}
.si-pitch h2{font-size:48px;font-weight:500;letter-spacing:-2px;line-height:50px;color:var(--text)}
.si-pitch p{font-size:15px;color:var(--text-2);line-height:24px}
.si-logos{display:flex;gap:8px;margin-top:12px;flex-wrap:wrap}
.si-logos span{width:36px;height:36px;border-radius:8px;background:var(--surface);display:grid;place-items:center;box-shadow:0 1px 3px var(--card-shadow)}
.si-logos img{width:18px;height:18px;object-fit:contain}
.si-side{position:relative;display:flex;align-items:center;justify-content:center;padding:48px}
.si-box{width:min(400px,100%);display:flex;flex-direction:column;gap:0}
.si-box h1{font-size:28px;font-weight:500;letter-spacing:-.8px;line-height:34px}
.si-box > p.lead{font-size:14px;color:var(--text-2);margin-top:8px}
.si-box .stack{display:flex;flex-direction:column;gap:10px;margin-top:24px}
.si-opt{display:flex;align-items:center;justify-content:center;gap:10px;height:44px;border-radius:10px;background:var(--surface);border:1px solid var(--line-strong);font-size:14px;font-weight:600;color:var(--text);transition:background-color var(--dur-1) var(--ease-std),border-color var(--dur-1) var(--ease-std)}
.si-opt:hover{background:var(--surface-hover)}
.si-opt svg{width:16px;height:16px}
.si-legal{font-size:12px;color:var(--text-2);margin-top:30px;line-height:18px}
.si-legal a{color:var(--accent-text);font-weight:500;text-decoration:underline;text-decoration-color:transparent;text-decoration-thickness:1px;text-underline-offset:3px;transition:text-decoration-color var(--dur-1) var(--ease-std)}
.si-legal a:hover,.si-legal a:focus-visible{text-decoration-color:currentColor}
.si-back{display:inline-flex;align-items:center;gap:8px;font-size:13px;color:var(--text-2);margin-bottom:28px;align-self:flex-start}
.si-back:hover{color:var(--text)}
.si-back .i{width:14px;height:14px}
.otp{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:8px}
.otp input{height:60px;width:100%;text-align:center;font-family:var(--font-code);font-size:20px;color:var(--text);background:var(--tint-2);border:1px solid var(--line);border-radius:10px;outline:0;transition:border-color var(--dur-1) var(--ease-std),box-shadow var(--dur-1) var(--ease-std),background-color var(--dur-1) var(--ease-std);caret-color:var(--accent)}
.otp input:focus{border-color:var(--accent);background:var(--surface);box-shadow:var(--ring)}
.otp.bad input{border-color:var(--err);background:var(--surface)}
.otp-meta{display:flex;justify-content:space-between;align-items:center;margin-top:8px;font-size:12px;min-height:16px}
.otp-meta .mono{font-size:11px;color:var(--text-3)}
.si-msg{margin-top:16px}
.ts-wrap{min-height:65px;display:block;width:100%}
.ts-wrap>div,.ts-wrap iframe{width:100%!important;max-width:100%}

/* ---------- Responsive ---------- */
@media (max-width:1180px){
  .grid4{grid-template-columns:repeat(2,minmax(0,1fr))}
}
/* Tablet: icon rail */
@media (max-width:1024px){
  .side{width:var(--rail-w);flex-basis:var(--rail-w);padding:16px 12px;align-items:center}
  .brand-t,.nav-h,.nav-a .lbl,.nav-a .ext,.bal-mini,.user-t,.user-row > .i,.side .collapse-btn{display:none}
  .brand-row{padding:0;justify-content:center}
  .nav{gap:6px;align-items:center}
  .nav-g{align-items:center}
  .nav-a{width:44px;height:44px;justify-content:center;padding:0}
  .nav-a .i{width:18px;height:18px}
  .user-row{justify-content:center;padding:4px}
  #user-menu{left:0;right:auto}
  .wallet-chip{display:inline-flex}
  .clock{display:none}
  .view{padding:24px 24px 40px}
  .top{padding:14px 24px}
  .metrics{grid-template-columns:repeat(2,minmax(0,1fr))}
  .metric:nth-child(2n){border-right:0}
  .metric:nth-child(-n+2){border-bottom:1px solid var(--line)}
  .grid3{grid-template-columns:repeat(2,minmax(0,1fr))}
  .row.wrap-md{flex-direction:column}
  .row.wrap-md > *{width:auto!important;flex:1 1 auto!important}
  .signin{grid-template-columns:1fr}
  .si-art{display:none}
}
/* Desktop: collapsed sidebar on demand */
@media (min-width:1025px){
  html.sb-collapsed .side{width:var(--rail-w);flex-basis:var(--rail-w);padding:20px 12px;align-items:center}
  html.sb-collapsed .brand-t,html.sb-collapsed .nav-h,html.sb-collapsed .nav-a .lbl,html.sb-collapsed .nav-a .ext,html.sb-collapsed .bal-mini,html.sb-collapsed .user-t,html.sb-collapsed .user-row > .i{display:none}
  html.sb-collapsed .brand-row{flex-direction:column;padding:0;gap:14px}
  html.sb-collapsed .nav-a{width:44px;height:44px;justify-content:center;padding:0}
  html.sb-collapsed .nav-a .i{width:18px;height:18px}
  html.sb-collapsed .wallet-chip{display:inline-flex}
  html.sb-collapsed #user-menu{left:0;right:auto}
}
/* Phone: top bar + bottom tab bar */
@media (max-width:720px){
  .side{display:none}
  .top{height:64px;padding:12px 16px;border-bottom:1px solid var(--line)}
  .top-title{font-size:16px;font-weight:600}
  .top-title .gmark{display:inline-block;width:26px;height:26px}
  .search-btn{width:38px;height:38px;padding:0;justify-content:center}
  .sq-btn{width:38px;height:38px}
  .search-btn span,.search-btn kbd,.clock,.wallet-chip,.top-act .theme-sq{display:none}
  .view{padding:16px 16px calc(84px + env(safe-area-inset-bottom));gap:14px}
  .page-head h1{font-size:22px;line-height:28px;letter-spacing:-.6px}
  .page-head p{font-size:13px}
  .metrics{grid-template-columns:1fr}
  .metric{flex-direction:row;justify-content:space-between;align-items:center;border-right:0;border-bottom:1px solid var(--line);padding:14px 16px}
  .metric:last-child{border-bottom:0}
  .metric .v{font-size:16px;line-height:20px;order:2}
  .metric .s{display:none}
  .grid2,.grid3,.grid4{grid-template-columns:1fr}
  .row{flex-direction:column}
  .row > *{width:auto!important;flex:1 1 auto!important}
  .card.pad{padding:16px}
  .tabbar{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:40;background:color-mix(in srgb,var(--bg) 94%,transparent);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border-top:1px solid var(--line);padding:8px 6px calc(8px + env(safe-area-inset-bottom))}
  .tabbar a,.tabbar button{flex:1;display:flex;flex-direction:column;align-items:center;gap:4px;font-size:11px;color:var(--text-2);padding:4px 0}
  .tabbar .i{width:22px;height:22px;stroke-width:1.75}
  .tabbar .on{color:var(--accent-text)}
  .tabbar .on .i{color:var(--accent)}
  .toasts{left:16px;right:16px;bottom:calc(84px + env(safe-area-inset-bottom))}
  .toast{max-width:none}
  /* Bottom sheets sit above the home indicator and fit the visible viewport (dvh), so the footer's
     primary action is never under the browser toolbar. */
  /* One bottom sheet for every phone dialog (More, top up, pay, key sheets, share, export, confirm):
     flush to the bottom and sides, 16px top corners, a top border, at most 92% of the visible
     viewport; the footer (or the sheet itself without one) clears the home indicator. */
  .scrim{padding:0;align-items:flex-end;justify-content:center}
  .scrim > .modal:not(.cmdk){width:100%!important;max-width:none!important;height:auto!important;max-height:92vh!important;max-height:92dvh!important;margin:0!important;align-self:flex-end!important;border:0!important;border-top:1px solid var(--line-strong)!important;border-radius:16px 16px 0 0!important;box-shadow:var(--sh-modal)!important}
  .scrim > .modal:not(.cmdk):not(:has(.modal-f,.bill-mf,.bill-pf,.bill-end)){padding-bottom:env(safe-area-inset-bottom)}
  .modal-f,.bill-mf,.bill-pf{padding-bottom:calc(14px + env(safe-area-inset-bottom))}
  /* Without :has() the rule above is dropped: a sheet that ends in its body clears the home
     indicator there instead (only in those browsers, so it never adds to the rule above). */
  @supports not selector(:has(a)){
    .scrim > .modal:not(.cmdk) > .modal-b:last-child{padding-bottom:calc(20px + env(safe-area-inset-bottom))}
  }
  .cmdk{margin:12px 12px 0;align-self:flex-start;width:calc(100% - 24px);max-height:calc(100dvh - 24px)}
  .cmdk-f{display:none}
  .si-side{padding:24px 20px;align-items:flex-start;padding-top:96px}
  .si-box h1{font-size:24px}
  .otp input{height:52px}
  .tbl th:first-child,.tbl td:first-child{padding-left:16px}
  .tbl th:last-child,.tbl td:last-child{padding-right:16px}
  /* Pager buttons turn into icon squares, the size of the phone's square buttons. */
  .pager-b .c-btn{width:38px;height:38px;padding:0}
  .pager-b .c-btn span{display:none}
  .pager-b .c-btn .i{width:16px;height:16px}
}
/* "More" sheet on phones */
.more-sheet{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;padding:8px 16px 20px}
.more-sheet a,.more-sheet button{display:flex;flex-direction:column;align-items:center;gap:8px;padding:14px 6px;border-radius:12px;background:var(--tint-1);border:1px solid var(--line);font-size:12px;color:var(--text-2);text-align:center}
.more-sheet .i{width:20px;height:20px;color:var(--text-2)}
.more-sheet .on{color:var(--accent-text);border-color:var(--accent-line);background:var(--accent-soft)}
.more-sheet .on .i{color:var(--accent)}

/* Circular theme switch (core.js GC.setTheme), the same motion as the public pages */
html.theme-vt:not(#theme-vt),html.theme-vt:not(#theme-vt) *,html.theme-vt:not(#theme-vt) *::before,html.theme-vt:not(#theme-vt) *::after{transition:none!important}
html.theme-vt::view-transition-group(root),html.theme-vt::view-transition-old(root),html.theme-vt::view-transition-new(root){animation:none;mix-blend-mode:normal}
html.theme-vt::view-transition-new(root){clip-path:circle(0 at var(--vt-x,50%) var(--vt-y,0))}
/* Both snapshots at their own size, so the page never appears to shrink while the circle runs. */
html.theme-vt::view-transition-old(root),html.theme-vt::view-transition-new(root){inline-size:auto;block-size:auto}
/* The pressed theme segment (core.js vtSeg) cross-fades into the new theme above the circle while
   its highlight slides, as long as the slide itself. */
html.theme-vt::view-transition-old(theme-seg),html.theme-vt::view-transition-new(theme-seg){animation-duration:var(--dur-3)}
/* The guard above stops colours fading on their own; moves still run. The theme segment's highlight
   slides and the top bar icon turns inside the new theme as the circle opens. */
@media (prefers-reduced-motion:no-preference){
  html.theme-vt:not(#theme-vt) .seg > .seg-ind{transition:transform var(--dur-3) var(--ease-out),width var(--dur-3) var(--ease-out),height var(--dur-3) var(--ease-out),opacity var(--dur-1) var(--ease-std)!important}
  html.theme-vt:not(#theme-vt) .tb-ic{transition:transform .5s cubic-bezier(.16,1,.3,1),opacity .25s ease!important}
}
/* Theme button: the sun in light, the moon in dark, turning into place as on the public pages. */
.tb-stack{position:relative;display:block;width:20px;height:20px}
.theme-sq .tb-ic,.tb-stack .tb-ic{position:absolute;inset:0;margin:auto;transition:transform .5s cubic-bezier(.16,1,.3,1),opacity .25s ease}
[data-theme=dark] .tb-sun,html:not([data-theme=dark]) .tb-moon{opacity:0;transform:rotate(-90deg) scale(.4)}

@media (prefers-reduced-motion:reduce){
  .seg .seg-ind,.tgl .tr::after,.modal,.scrim{transition:none}
  /* v2.css stops every animation under reduced motion; loading cues keep a slow sweep so a busy
     region or spinner still reads as working. */
  .spin,.loading-line::after,.is-busy::after{animation-duration:2.4s!important;animation-iteration-count:infinite!important}
}
