/* ---- tokens.css, from the 卷不死 app ---- */
/* 卷不死 shared tokens.
   Color, type and control geometry are copied from Magpie 0.1.1246
   (internal/gui/assets/app.css), so the two windows read as one product.
   Change a value here only when Magpie changes it; motion values follow
   the better-ui rules and are marked where they differ from Magpie. */
:root {
  color-scheme: light;
  --bg: #f4f4f6;
  --card: #ffffff;
  --card-2: #f9f9fb;
  --pill: #f1f1f4;
  --pill-hover: #e9e9ee;
  --seg-track: #e6e6eb;
  --seg-thumb: var(--card);
  --seg-edge: 0 1px 2px rgba(0, 0, 0, .14), 0 0 0 .5px rgba(0, 0, 0, .08);
  --ctl-fg: #63636b;
  --line: #e3e3e8;
  --line-2: #ececf0;
  --fg: #1c1c21;
  --fg-2: #4b4b53;
  --muted: #85858d;
  --faint: #b9b9c2;
  --accent: #4f46e5;
  --accent-soft: #eeedfd;
  --accent-fg: #ffffff;
  --sel: #ecebfb;
  --green: #189a58;
  --green-soft: #e4f6ec;
  --red: #d64545;
  --red-soft: #fbe9e9;
  --amber: #b45309;
  --amber-soft: #fbf0df;
  --pop-bg: rgba(255, 255, 255, .94);
  --shadow: 0 16px 44px rgba(20, 22, 30, .16), 0 2px 8px rgba(20, 22, 30, .06), 0 0 0 .5px rgba(20, 22, 30, .1);
  --logo-invert: 0;

  /* Secondary text that carries meaning. Magpie's --muted is 3.4:1 on --bg;
     its own --ctl-fg is the 4.5:1 step, so informative text uses that. */
  --sub: var(--ctl-fg);

  /* Cards: a shadow ring in place of Magpie's 1px --line border, same look. */
  --shadow-border:
    0px 0px 0px 1px oklch(0 0 0 / 0.06),
    0px 1px 2px -1px oklch(0 0 0 / 0.06),
    0px 2px 4px 0px oklch(0 0 0 / 0.04);
  --shadow-border-hover:
    0px 0px 0px 1px oklch(0 0 0 / 0.08),
    0px 1px 2px -1px oklch(0 0 0 / 0.08),
    0px 2px 4px 0px oklch(0 0 0 / 0.06);
  --shadow-dialog: 0 0 0 1px var(--line), 0 24px 60px rgba(0, 0, 0, .32), 0 2px 8px rgba(0, 0, 0, .12);
  --backdrop: rgba(0, 0, 0, .28);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  --code: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --text: 13px;
  --text-control: 12.5px;
  --text-button: 12px;
  --text-sub: 11.5px;
  --text-label: 11px;
  --text-title: 16px;
  --text-figure: 22px;

  /* Magpie's radii. Outer = inner + padding where surfaces nest:
     segment 8 = 6 + 2, menu 12 = 7 + 5. */
  --r-field: 6px;
  --r-control: 7px;
  --r-segment: 8px;
  --r-card: 12px;
  --r-dialog: 14px;
  --r-pill: 999px;

  --h-header: 50px;
  --h-row: 48px;
  --h-control: 27px;
  --h-control-lg: 30px;
  --h-field: 25px;
  --h-segment: 24px;
  --h-icon: 26px;

  /* better-ui motion, exact. */
  --press-scale: 0.96;
  --dur-press: 150ms;
  --dur-enter: 300ms;
  --dur-exit: 150ms;
  --stagger: 100ms;
  --ease-swap: cubic-bezier(0.2, 0, 0, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1a1a1e; --card: #232327; --card-2: #1f1f23; --pill: #2d2d33; --pill-hover: #36363d;
    --seg-track: rgba(255, 255, 255, .035); --seg-thumb: rgba(255, 255, 255, .15);
    --seg-edge: inset 0 .5px 0 rgba(255, 255, 255, .08), 0 1px 2px rgba(0, 0, 0, .3);
    --line: #333339; --line-2: #2c2c32; --fg: #ededf1; --fg-2: #b9b9c1; --muted: #8b8b94; --faint: #56565f; --ctl-fg: #a1a1aa;
    --accent: #a5b4fc; --accent-soft: #2b2c47; --accent-fg: #14142a; --sel: #33345a;
    --green: #6fd99b; --green-soft: #1e3a2b; --red: #f28b82; --red-soft: #45272a; --amber: #f2b544; --amber-soft: #3f3220;
    --pop-bg: rgba(38, 38, 43, .96);
    --shadow: 0 16px 44px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .3), 0 0 0 .5px rgba(255, 255, 255, .1);
    --logo-invert: 1;
    --shadow-border: 0 0 0 1px oklch(1 0 0 / 0.08);
    --shadow-border-hover: 0 0 0 1px oklch(1 0 0 / 0.13);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1a1a1e; --card: #232327; --card-2: #1f1f23; --pill: #2d2d33; --pill-hover: #36363d;
  --seg-track: rgba(255, 255, 255, .035); --seg-thumb: rgba(255, 255, 255, .15);
  --seg-edge: inset 0 .5px 0 rgba(255, 255, 255, .08), 0 1px 2px rgba(0, 0, 0, .3);
  --line: #333339; --line-2: #2c2c32; --fg: #ededf1; --fg-2: #b9b9c1; --muted: #8b8b94; --faint: #56565f; --ctl-fg: #a1a1aa;
  --accent: #a5b4fc; --accent-soft: #2b2c47; --accent-fg: #14142a; --sel: #33345a;
  --green: #6fd99b; --green-soft: #1e3a2b; --red: #f28b82; --red-soft: #45272a; --amber: #f2b544; --amber-soft: #3f3220;
  --pop-bg: rgba(38, 38, 43, .96);
  --shadow: 0 16px 44px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .3), 0 0 0 .5px rgba(255, 255, 255, .1);
  --logo-invert: 1;
  --shadow-border: 0 0 0 1px oklch(1 0 0 / 0.08);
  --shadow-border-hover: 0 0 0 1px oklch(1 0 0 / 0.13);
}

/* Windows faces, as Magpie sets them. */
:root.win {
  --font: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  --code: "Cascadia Mono", Consolas, "Microsoft YaHei UI", "Microsoft YaHei", monospace;
}

/* ---- components.css, without third-party logo definitions ---- */
/* 卷不死 components: Magpie's controls, measured from its app.css, with
   better-ui press, enter/exit and icon-swap motion. Tokens live in tokens.css. */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font: 400 var(--text)/1.4 var(--font);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: default; appearance: none; -webkit-appearance: none; text-align: center; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--code); font-size: 11.5px; }

/* ---- icons: one 16-unit grid, 1.5px rendered stroke beside 400-weight text */
.i { display: block; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.i * { vector-effect: non-scaling-stroke; }
.ic { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 22px; height: 22px; }
.ic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ic .mask { width: 100%; height: 100%; background: currentColor; -webkit-mask: var(--logo) center / contain no-repeat; mask: var(--logo) center / contain no-repeat; }
.ic.generic { color: var(--muted); }
/* a mark inside a picture frame: Magpie Image's */
.ic.framed { position: relative; }
.ic.framed > .i { width: 100%; height: 100%; }
.ic.framed > .mask { position: absolute; inset: 21% 17% 15%; width: auto; height: auto; }
/* a set of agents as Magpie shows a routing group's providers: overlapping discs */
.ic-stack { display: inline-flex; flex: none; align-items: center; }
.ic-stack .disc { position: relative; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--card); box-shadow: 0 0 0 1px var(--line); }
.ic-stack .disc + .disc { margin-inline-start: -4px; }
.ic-stack .disc:nth-child(1) { z-index: 3; }
.ic-stack .disc:nth-child(2) { z-index: 2; }
.ic-stack .disc > .ic { width: 13px; height: 13px; }

/* ---- buttons (Magpie .text / .text.action / .text.primary / .icon) ------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  font-size: var(--text-button); color: var(--ctl-fg); white-space: nowrap;
  padding: 3px 7px; border-radius: var(--r-field);
  transition-property: scale, background-color, color, border-color, box-shadow, filter;
  transition-duration: var(--dur-press); transition-timing-function: ease-out;
}
.btn.action, .btn.primary { height: var(--h-control); padding: 0 10px; }
.btn.action { border: 1px solid var(--line); background: var(--card); color: var(--fg-2); box-shadow: 0 1px 1px rgba(0, 0, 0, .04); }
.btn.primary { border: 1px solid transparent; background: var(--accent); color: var(--accent-fg); font-weight: 500; }
.btn.lg { height: var(--h-control-lg); padding: 0 14px; font-size: var(--text-control); border-radius: var(--r-segment); }
.btn.wide { width: 100%; }
a.btn { text-decoration: none; }
/* optical: an icon side gets 2px less than the text side */
.btn.lead-icon { padding-inline-start: 8px; }
.btn.trail-icon { padding-inline-end: 8px; }
.btn:not(:disabled):not([aria-disabled="true"]):active { scale: var(--press-scale); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; }
.btn[aria-busy="true"] { opacity: 1; }
.btn.link { color: var(--accent); padding-inline: 4px; }
.icon-btn {
  width: var(--h-icon); height: var(--h-icon); border-radius: var(--r-control);
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted);
  transition-property: scale, background-color, color; transition-duration: var(--dur-press); transition-timing-function: ease-out;
}
.icon-btn:not(:disabled):active { scale: var(--press-scale); }
.icon-btn[aria-expanded="true"] { background: var(--pill); color: var(--fg); }
@media (hover: hover) {
  .btn:not(.action):not(.primary):not(:disabled):hover { color: var(--fg); background: var(--pill); }
  .btn.link:not(:disabled):hover { color: var(--accent); background: var(--accent-soft); }
  .btn.action:not(:disabled):not([aria-disabled="true"]):hover { border-color: var(--muted); background: var(--card-2); color: var(--fg); }
  .btn.primary:not(:disabled):not([aria-disabled="true"]):hover { filter: brightness(1.08); }
  .icon-btn:not(:disabled):hover { background: var(--pill); color: var(--fg); }
}

/* ---- icon swap: both icons stay in the DOM and cross-fade ---------------- */
.swap { display: inline-grid; flex: none; width: 14px; height: 14px; }
.swap > * { grid-area: 1 / 1; opacity: 0; scale: .25; filter: blur(4px); transition-property: opacity, scale, filter; transition-duration: var(--dur-enter); transition-timing-function: var(--ease-swap); }
.swap[data-show="add"] > [data-icon="add"],
.swap[data-show="busy"] > [data-icon="busy"],
.swap[data-show="done"] > [data-icon="done"] { opacity: 1; scale: 1; filter: blur(0); }
.swap [data-icon="busy"] .i { animation: spin .9s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }

/* ---- segmented control (Magpie .seg) ------------------------------------ */
.seg { display: inline-flex; padding: 2px; gap: 0; border-radius: var(--r-segment); background: var(--seg-track); }
.seg.bare { background: transparent; }
:root[data-theme="dark"] .seg.bare { background: var(--seg-track); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg.bare { background: var(--seg-track); } }
.seg button {
  height: var(--h-segment); padding: 0 12px; border-radius: var(--r-field);
  font-size: var(--text-control); color: var(--ctl-fg); white-space: nowrap;
  transition-property: color, background-color; transition-duration: 120ms; transition-timing-function: ease-out;
}
.seg button[aria-pressed="true"], .seg button[aria-current="page"] { color: var(--fg); background: var(--seg-thumb); box-shadow: var(--seg-edge); }
@media (hover: hover) { .seg button:not([aria-pressed="true"]):not([aria-current="page"]):not(:disabled):hover { color: var(--fg-2); } }
.seg button:disabled { opacity: .45; }

/* ---- surfaces ------------------------------------------------------------ */
.label { display: block; padding: 14px 4px 6px; font-size: var(--text-label); font-weight: 600; letter-spacing: .05em; color: var(--sub); }
.lede { padding: 2px 4px 12px; color: var(--fg-2); }
.lede b { color: var(--fg); font-weight: 600; }
.list {
  background: var(--card); border-radius: var(--r-card);
  border: 1px solid transparent; box-shadow: var(--shadow-border);
  overflow: clip;
}
.row { display: flex; align-items: center; gap: 12px; min-height: var(--h-row); padding: 7px 12px 7px 14px; }
.row + .row { border-top: 1px solid var(--line-2); }
.row .who { flex: 1 1 auto; min-width: 0; }
.row .name { font-weight: 500; letter-spacing: -.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { display: flex; align-items: center; gap: 6px; margin-top: 1px; font-size: var(--text-sub); color: var(--sub); overflow: hidden; white-space: nowrap; }
.row .sub > span { overflow: hidden; text-overflow: ellipsis; }
.dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.dot.ok { background: var(--green); }
.dot.warn { background: var(--amber); }
.dot.err { background: var(--red); }
.row .end { display: flex; align-items: center; gap: 8px; flex: none; margin-inline-start: auto; }
.foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 4px 0; font-size: var(--text-control); color: var(--sub); }

/* a pop-up-button-like value pill (Magpie .field) */
.field {
  display: inline-flex; align-items: center; gap: 6px; height: var(--h-field); padding: 0 8px;
  border-radius: var(--r-field); background: var(--pill); font-size: var(--text-control);
}
.field .k { color: var(--sub); font-size: var(--text-sub); }
.field .v { font-weight: 500; }

/* status pill (Magpie .status.ok / .warn / .err) */
.status {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  font-size: var(--text-sub); line-height: 16px; font-weight: 500; padding: 2px 8px; border-radius: var(--r-pill);
  color: var(--ctl-fg); background: color-mix(in srgb, currentColor 12%, var(--card));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 26%, transparent);
}
.status.ok { color: var(--green); }
.status.warn { color: var(--amber); }
.status.err { color: var(--red); }

/* the notice Magpie shows above an import from a link */
.notice {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; margin-bottom: 4px;
  border-radius: var(--r-card); background: var(--amber-soft);
  border: 1px solid transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--amber) 35%, transparent);
}
.notice .ic { width: 28px; height: 28px; color: var(--fg); }
.notice .copy { flex: 1 1 240px; min-width: 0; }
.notice .copy b { display: block; font-weight: 600; }
.notice .copy p { margin-top: 2px; color: var(--fg-2); font-size: var(--text-control); text-wrap: pretty; }
.notice .acts { display: flex; flex-wrap: wrap; gap: 6px; }

/* KPI strip (Magpie .led-strip) */
.strip { display: flex; align-items: center; gap: 12px; padding: 11px 12px 10px 15px; }
.strip .k { display: block; font-size: var(--text-label); color: var(--sub); }
.strip .v { display: block; margin-top: 2px; font-size: var(--text-figure); font-weight: 600; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }

/* ---- form controls ------------------------------------------------------- */
/* Magpie draws its own checkbox */
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; width: 14px; height: 14px; flex: none;
  display: inline-grid; place-content: center; vertical-align: middle;
  border: 1px solid var(--faint); border-radius: 4px; background: var(--card); color: var(--accent-fg);
}
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]::before {
  content: ""; width: 10px; height: 10px; background: currentColor; transform: scale(0);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 5.2l2 2L8 3' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 5.2l2 2L8 3' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
input[type="checkbox"]:checked::before { transform: scale(1); }
input[type="checkbox"]:disabled { opacity: .45; }
@media (hover: hover) { input[type="checkbox"]:not(:disabled):not(:checked):hover { border-color: var(--muted); } }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-control); color: var(--fg-2); }

.input {
  height: var(--h-control); width: 100%; min-width: 0; padding: 0 9px; border-radius: var(--r-control);
  border: 1px solid var(--line); background: var(--card); font-size: var(--text-control); outline: none;
  transition-property: border-color, box-shadow; transition-duration: 120ms; transition-timing-function: ease-out;
}
.input.lg { height: var(--h-control-lg); font-size: var(--text); }
.input::placeholder { color: var(--muted); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input[aria-invalid="true"] { border-color: var(--red); }
.form-row { display: grid; gap: 5px; }
.form-row + .form-row { margin-top: 12px; }
.form-row > label { font-size: var(--text-control); color: var(--fg-2); }
.error { font-size: var(--text-sub); color: var(--red); }
.affix { position: relative; display: block; }
.affix > span { position: absolute; inset-block: 0; inset-inline-start: 9px; display: grid; place-items: center; color: var(--sub); pointer-events: none; }
.affix > .input { padding-inline-start: 22px; }
.affix > .icon-btn { position: absolute; inset-block-start: 2px; inset-inline-end: 2px; }

/* amount chips (Magpie .chip; the chosen one as its picked model chips) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: var(--h-field); padding: 0 10px;
  border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--card); font-size: var(--text-button);
  transition-property: scale, border-color, background-color, color; transition-duration: var(--dur-press); transition-timing-function: ease-out;
}
.chip:not(:disabled):active { scale: var(--press-scale); }
.chip[aria-pressed="true"] { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-soft); color: var(--accent); }
@media (hover: hover) { .chip:not([aria-pressed="true"]):hover { border-color: var(--accent); color: var(--accent); } }

/* ---- menu (Magpie .pop) -------------------------------------------------- */
.pop {
  position: fixed; inset: auto; margin: 0; width: 232px; padding: 5px;
  border: 1px solid transparent; border-radius: var(--r-card);
  background: var(--pop-bg); color: var(--fg); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  box-shadow: var(--shadow); overscroll-behavior: contain;
  transform-origin: top right;
  opacity: 0; scale: .96;
  transition-property: opacity, scale, display, overlay;
  transition-duration: var(--dur-exit); transition-timing-function: ease-out; transition-behavior: allow-discrete;
}
.pop:popover-open { opacity: 1; scale: 1; }
@starting-style { .pop:popover-open { opacity: 0; scale: .96; } }
.pop .who { padding: 6px 8px 8px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.pop .who b { display: block; font-weight: 500; }
.pop .who span { font-size: var(--text-sub); color: var(--sub); }
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 30px; padding: 0 8px;
  border-radius: var(--r-control); font-size: var(--text-control); text-align: start; color: var(--fg);
  transition-property: background-color; transition-duration: 120ms; transition-timing-function: ease-out;
}
.menu-item .i { color: var(--muted); }
.menu-item:focus-visible { outline: none; background: var(--pill); }
@media (hover: hover) { .menu-item:hover { background: var(--pill); } }

/* ---- dialog (Magpie .modal .dialog with a framed editor) ----------------- */
.dialog {
  position: fixed; inset: 0; margin: auto; width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  flex-direction: column; overflow: hidden;
  border: 1px solid transparent; border-radius: var(--r-dialog); background: var(--card); color: var(--fg);
  box-shadow: var(--shadow-dialog);
  opacity: 0; translate: 0 -12px; filter: blur(4px);
  transition-property: opacity, translate, filter, display, overlay;
  transition-duration: var(--dur-exit); transition-timing-function: ease-out; transition-behavior: allow-discrete;
}
.dialog:not([open]) { display: none; pointer-events: none; }
.dialog[open] { display: flex; opacity: 1; translate: 0 0; filter: blur(0); transition-duration: var(--dur-enter); }
@starting-style { .dialog[open] { opacity: 0; translate: 0 12px; filter: blur(4px); } }
.dialog::backdrop {
  background: var(--backdrop); -webkit-backdrop-filter: blur(8px) saturate(1.1); backdrop-filter: blur(8px) saturate(1.1);
  opacity: 0; transition-property: opacity, display, overlay; transition-duration: var(--dur-exit); transition-timing-function: ease-out; transition-behavior: allow-discrete;
}
.dialog[open]::backdrop { opacity: 1; transition-duration: var(--dur-enter); }
@starting-style { .dialog[open]::backdrop { opacity: 0; } }
.dialog .head { display: flex; align-items: center; gap: 10px; flex: none; min-height: 48px; padding: 0 12px 0 18px; border-bottom: 1px solid var(--line-2); }
.dialog .head h2 { flex: 1; font-size: var(--text); font-weight: 600; }
.dialog .head h2:focus { outline: none; }
.dialog .body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 16px 18px; }
.dialog .body p { color: var(--fg-2); }
.dialog .body p + p { margin-top: 8px; }
.dialog .bar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: none; min-height: 48px; padding: 0 18px; border-top: 1px solid var(--line-2); }
.dialog .bar .grow { flex: 1; }

/* ---- staged entrance for an infrequent success moment -------------------- */
.enter > * { animation: enter var(--dur-enter) ease-out both; }
.enter > :nth-child(2) { animation-delay: calc(var(--stagger) * 1); }
.enter > :nth-child(3) { animation-delay: calc(var(--stagger) * 2); }
.enter > :nth-child(4) { animation-delay: calc(var(--stagger) * 3); }
.enter > :nth-child(n+5) { animation-delay: calc(var(--stagger) * 4); }
@keyframes enter { from { opacity: 0; filter: blur(4px); translate: 0 12px; } }

/* ---- reduced motion: movement, scale and blur become a cross-fade -------- */
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .btn:not(:disabled):active, .icon-btn:not(:disabled):active, .chip:not(:disabled):active { scale: 1; }
  .swap > * { scale: 1; filter: none; transition-property: opacity; }
  .swap [data-icon="busy"] .i { animation: none; }
  .pop, .pop:popover-open { scale: 1; }
  @starting-style { .pop:popover-open { scale: 1; } }
  .dialog, .dialog[open] { translate: none; filter: none; }
  @starting-style { .dialog[open] { translate: none; filter: none; } }
  .enter > * { animation-name: fade; }
}

/* forced colors keeps an edge where shadows draw one */
@media (forced-colors: active) {
  .btn.primary { background: ButtonText; color: ButtonFace; }
  .seg button[aria-pressed="true"], .seg button[aria-current="page"] { outline: 1px solid CanvasText; }
}

/* ---- the wallet section of app.css, from the 卷不死 app ---- */
/* ---- wallet -------------------------------------------------------------- */
.strip.list { align-items: flex-start; }
.strip .blk { min-width: 0; padding-inline-end: 4px; }
.strip .blk + .blk { padding-inline-start: 15px; border-inline-start: 1px solid var(--line-2); }
.strip .v + .k { margin-top: 1px; }
.strip > .btn { margin-inline-start: auto; align-self: center; }
.pay-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: center; gap: 12px; min-height: var(--h-row); padding: 9px 14px; }
.pay-row + .pay-row { border-top: 1px solid var(--line-2); }
.pay-row > .k { color: var(--sub); font-size: var(--text-control); text-align: end; }
.pay-row .amount-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.pay-row .affix { width: 112px; }
.pay-row .total { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pay-row .total b { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.pay-row .pay-note { margin-inline-start: 8px; font-size: var(--text-sub); color: var(--sub); }
.order-row .end .num { color: var(--fg-2); }
/* Alipay's and WeChat Pay's marks beside their names */
.pay-ic { display: block; flex: none; }
/* the payment methods as big tiles: Magpie's tile, at card size; the picked
   one has the selection fill, an accent ring and a check */
.pay-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; max-width: 440px; }
.pay-tile {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 12px; text-align: start;
  border-radius: var(--r-card); border: 1px solid transparent; background: var(--card); box-shadow: inset 0 0 0 1px var(--line);
  transition-property: background-color, box-shadow; transition-duration: 120ms; transition-timing-function: ease-out;
}
.pay-tile .pay-name { flex: 1; min-width: 0; display: grid; gap: 1px; }
.pay-tile .pay-name b { font-weight: 500; font-size: var(--text); }
.pay-tile .pay-name span { font-size: var(--text-sub); color: var(--sub); }
.pay-tile .pay-check { width: 18px; height: 18px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--accent-fg); background: var(--accent); opacity: 0; scale: .6; transition-property: opacity, scale; transition-duration: 150ms; transition-timing-function: ease-out; }
.pay-tile .pay-check .i { width: 12px; height: 12px; stroke-width: 2; }
.pay-tile[aria-pressed="true"] { background: var(--sel); box-shadow: inset 0 0 0 1.5px var(--accent); }
.pay-tile[aria-pressed="true"] .pay-check { opacity: 1; scale: 1; }
@media (hover: hover) { .pay-tile:not([aria-pressed="true"]):hover { background: var(--card-2); box-shadow: inset 0 0 0 1px var(--muted); } }
@media (prefers-reduced-motion: reduce) { .pay-tile .pay-check { scale: 1; } }
@media (forced-colors: active) { .pay-tile[aria-pressed="true"] { outline: 2px solid Highlight; } }
.dialog .head h2:has(.pay-ic) { display: flex; align-items: center; gap: 7px; }
.order { display: grid; justify-items: center; gap: 10px; text-align: center; }
.order .figure { font-size: var(--text-figure); font-weight: 600; letter-spacing: -.02em; }
.order .meta { font-size: var(--text-sub); color: var(--sub); }

.code-shop { display: flex; align-items: center; gap: 12px; min-width: 0; }
.code-mark { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: var(--r-control); color: var(--accent); background: var(--accent-soft); }
.code-copy { flex: 1; min-width: 0; display: grid; gap: 2px; }
.code-copy b { font-size: var(--text); font-weight: 500; }
.code-copy > span, .code-hint { font-size: var(--text-control); color: var(--sub); line-height: 1.6; }
.code-hint { margin: 0; }
.code-entry { display: flex; align-items: center; gap: 8px; }
.code-entry .input { flex: 1; min-width: 0; height: var(--h-control-lg); }
.code-entry .btn, .code-shop > .btn { flex: none; }
.code-entry + .code-hint { margin-top: 6px; }
.code-result { display: flex; align-items: flex-start; gap: 6px; margin-top: 10px; padding: 8px 10px; font-size: var(--text-control); border-radius: var(--r-control); color: var(--fg); background: var(--green-soft); }
.code-result .i { flex: none; margin-top: 2px; color: var(--green); }
@media (max-width: 540px) {
  .code-shop { flex-wrap: wrap; }
  .code-shop > .btn { width: 100%; }
  .code-entry .input { font-size: 16px; }
}


/* ---- the status bar (.uptime) of app.css, from the 卷不死 app ---- */
.uptime { display: grid; gap: 3px; flex: none; justify-items: end; margin-inline-start: auto; }
.uptime-bars { display: flex; gap: 1px; height: 14px; }
.uptime-bars i { width: 3px; border-radius: 1px; background: var(--line); }
.uptime-bars i.operational { background: var(--green); }
.uptime-bars i.degraded { background: var(--amber); }
.uptime-bars i.down { background: var(--red); }
.uptime-k { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-sub); color: var(--sub); white-space: nowrap; }
.uptime-k b { font-weight: 500; color: var(--fg-2); }
.uptime.none .uptime-k { color: var(--muted); }
/* ---- channel-models.css (the homepage has it too) ---- */
/* A channel's model table (src/js/views/channel-models.js), one look on the
   homepage and the console's pages: build.mjs puts this file in both. They
   name a few colours differently (the homepage's --ink, the console's --fg),
   hence the fallbacks. */
.models { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.models th { padding: 6px 0; text-align: end; font-size: 11.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.models th:first-child, .models td:first-child { text-align: start; }
.models td { padding: 7px 0; text-align: end; border-top: 1px solid var(--line-2, var(--line)); white-space: nowrap; color: var(--ink-2, var(--fg-2)); }
.models td + td, .models th + th { padding-inline-start: 14px; }
/* a model's name wraps rather than being cut short (which models there are
   is the point) and takes the room the prices leave, the prices kept tight
   on the right; a table with picture or video tiers shares its width out
   instead, so a row of tiers keeps to one line where it can */
.models td:first-child { white-space: normal; overflow-wrap: anywhere; font-family: var(--mono, var(--code)); font-size: 12.5px; color: var(--ink, var(--fg)); }
.models:not(:has(td.each)) td:first-child { max-width: 0; width: 100%; }
/* a picture's or a second's tiers (1K ¥0.0054 · 2K ¥0.0072): a tier never
   parted from its price, the next tier on a new line when there's no room */
.models td.each { white-space: normal; }
.models .tier { white-space: nowrap; }
.models td.site { color: var(--ink, var(--fg)); font-weight: 600; }
.models td.off { color: var(--muted); }
.models .aka { display: block; margin-top: 1px; font-size: 11px; color: var(--muted); }
/* a token price: 输入 / 输出 on top, 缓存读 / 写 under them, two columns so
   each sits under its like; each figure named in small grey */
.models .price { display: inline-grid; grid-template-columns: auto auto; column-gap: 10px; justify-items: end; }
.models .price i, .models .tier i { font-style: normal; font-size: 11px; font-weight: 400; color: var(--muted); }
.models .cache { font-size: 11px; font-weight: 400; color: var(--muted); }
.models .cache b { font-weight: 600; color: var(--ink-2, var(--fg-2)); }
.models .cache sup { font-size: 9px; vertical-align: 3px; }
.models td.site .cache b { color: var(--ink, var(--fg)); }
/* 比官方: green; dearer than the official, grey */
.models td.cut { color: var(--green); }
.models .cut b { font-weight: 600; }
.models .cut b.more { font-weight: 500; color: var(--muted); }
.models .cuts { display: inline-grid; justify-items: end; }
.models .cut i { font-style: normal; font-size: 11px; font-weight: 400; color: var(--muted); }
.models .cut-cache { font-size: 11px; }
.models .cut-k { display: none; }
/* the first models, then 「展开全部 N 个模型」 */
.models:has(+ .more) { margin-bottom: 6px; }
.more { display: block; width: 100%; margin-top: auto; padding: 8px 0 2px; border-top: 1px solid var(--line-2, var(--line)); font-size: 13px; color: var(--accent); text-align: center; }
@media (hover: hover) { .more:hover { text-decoration: underline; text-underline-offset: 3px; } }
/* Where the table is narrow (a dialog's card, a phone), a model's name has a
   line of its own and its two prices sit under it, side by side, so neither
   the names nor the prices are squeezed. By the box's width, not the window's:
   the same table is in wide and narrow places on one page. */
.models-box { container-type: inline-size; display: flex; flex-direction: column; flex: 1; }
@container (max-width: 380px) {
  .models, .models thead, .models tbody { display: block; }
  .models tr { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; padding: 7px 0; border-top: 1px solid var(--line-2, var(--line)); }
  .models thead tr { padding: 0 0 4px; border-top: 0; }
  .models th:first-child { display: none; }
  .models td { padding: 0; border-top: 0; }
  .models td:first-child, .models:not(:has(td.each)) td:first-child { grid-column: 1 / -1; max-width: none; width: auto; padding-bottom: 3px; }
  .models td + td, .models th + th { padding-inline-start: 0; }
  /* 比官方 a line of its own under the prices, named, its header gone */
  .models th:nth-child(4) { display: none; }
  .models td.cut { grid-column: 1 / -1; padding-top: 3px; }
  .models .cuts { display: flex; flex-wrap: wrap; justify-content: flex-end; column-gap: 10px; }
  .models .cut-k { display: inline; }
}
/* narrower still (a phone, a dialog's card): a price's four figures one
   under another, each still named */
@container (max-width: 360px) {
  .models .price { grid-template-columns: auto; }
}

/* ---- console.css ---- */
/* 卷不死's web pages. Above this file in style.css are the 卷不死 window's own
   tokens.css and components.css (Magpie's values), read from juanbu-desktop
   at build time; this file adds only what a web page needs on top: the page
   frame, the sign-in card, the console's header, and bigger targets for
   fingers. */
html { -webkit-text-size-adjust: 100%; }
/* the scrollbar's place is kept on every page, long or short, so moving
   between them (or a list arriving) never moves the page sideways. Browsers
   without it (Safari before 18.2) mostly draw scrollbars over the page. */
html { scrollbar-gutter: stable; }
body { min-height: 100vh; min-height: 100dvh; }
.page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
button:not(:disabled), a.btn, .icon-btn:not(:disabled), .chip, label.check { cursor: pointer; }
.boot { flex: 1; }
/* the next page, drawn out of sight until it is shown whole (app.js show) */
.page.coming { position: absolute; inset: 0 0 auto; visibility: hidden; pointer-events: none; }
.skip-link { position: absolute; inset-inline-start: 16px; top: -100px; z-index: 40; padding: 6px 10px; border-radius: var(--r-control); background: var(--card); box-shadow: var(--shadow); }
.skip-link:focus { top: 8px; }
.toast {
  position: fixed; z-index: 50; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); translate: -50% 0; max-width: calc(100vw - 32px);
  padding: 4px 12px; border-radius: var(--r-pill); font-size: var(--text-control); font-weight: 500; color: var(--fg);
  background: color-mix(in srgb, var(--fg) 8%, var(--card)); box-shadow: inset 0 0 0 1px var(--line), 0 6px 20px rgba(0, 0, 0, .2);
}
.preview-banner { flex: none; padding: 4px 16px; text-align: center; font-size: var(--text-sub); color: var(--amber); background: var(--amber-soft); }

/* ---- the bars ------------------------------------------------------------------ */
/* the header and footer line up with the page's content */
.bar-in { width: min(960px, 100% - 32px); margin-inline: auto; display: flex; align-items: center; gap: 8px; }
.top { flex: none; height: var(--h-header); }
.top .bar-in { height: 100%; }
.brand { display: flex; align-items: center; gap: 6px; font-weight: 600; letter-spacing: .01em; margin-inline-end: auto; border-radius: var(--r-control); }
.brand .mark { width: 20px; height: 20px; }
.top-links { display: flex; align-items: center; gap: 4px; }
.top-links .btn.action { gap: 5px; }

.site-foot { flex: none; font-size: var(--text-sub); color: var(--sub); }
.site-foot .bar-in { flex-wrap: wrap; gap: 6px 16px; padding: 14px 0 max(22px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line-2); }
.site-foot a { color: var(--fg-2); }
.site-foot .classic { margin-inline-start: auto; }
@media (hover: hover) { .site-foot a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; } }

/* ---- the sign-in card: the 卷不死 window's login, on a page ----------------------- */
.auth { flex: 1; display: grid; place-items: center; padding: 24px 16px 56px; }
.auth:focus { outline: none; }
.auth-card { width: min(100%, 340px); }
.auth-card .logo-motion { margin-bottom: 12px; }
.auth-card .mark { width: 48px; height: 48px; }
.auth-card h1 { font-size: var(--text-title); font-weight: 600; text-wrap: balance; }
.auth-card h1:focus { outline: none; }
.auth-card .lead { margin: 4px 0 16px; color: var(--sub); font-size: var(--text-control); text-wrap: pretty; }
.auth-card .lead b { color: var(--fg); font-weight: 500; overflow-wrap: anywhere; }
.auth-card form { padding: 16px; }
.auth-card form > .btn.primary { margin-top: 16px; }
.label-line { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.label-line label { font-size: var(--text-control); color: var(--fg-2); }
.label-line .btn.link { padding: 0 2px; font-size: var(--text-sub); }
.hint { font-size: var(--text-sub); color: var(--sub); text-wrap: pretty; }
.hint:empty { display: none; }
/* a field's error says it all; its standing hint steps aside */
.form-row:has(> .error:not([hidden])) > .hint { display: none; }
.hint.ok { color: var(--green); }
/* the show-password eye inside the field */
.affix.reveal > .input { padding-inline: 9px 34px; }
.affix.reveal > .icon-btn { inset-block-start: 50%; translate: 0 -50%; }
.input.code { font-family: var(--code); font-size: 16px; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.input.code::placeholder { letter-spacing: normal; }
/* Turnstile's flexible widget is 65px tall; the space is kept while it loads */
.captcha { min-height: 65px; }
.captcha .hint { padding-top: 22px; text-align: center; }
.reveal-promo { margin-top: 10px; padding-inline: 0; gap: 4px; }
.after { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px; margin-top: 12px; font-size: var(--text-control); color: var(--sub); }
.after.split { justify-content: space-between; }
.after .btn.link:disabled { color: var(--sub); opacity: 1; }
.problem { padding: 10px 0 0; font-size: var(--text-sub); color: var(--red); text-wrap: pretty; }
.problem .btn.link.inline { padding: 0 2px; font-size: inherit; }
.note { margin: -4px 0 12px; padding: 8px 12px; border-radius: var(--r-card); font-size: var(--text-control); color: var(--fg); background: var(--pill); }
.note.warn { background: var(--amber-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--amber) 35%, transparent); }
.note.ok { background: var(--green-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 30%, transparent); }
/* a finished card: what to do next */
.auth-actions { display: grid; gap: 10px; }
.auth-actions .note { margin: 0; }
.auth-actions .btn.link { justify-self: center; }
.auth-card h1 + .list, .auth-card h1 + .auth-actions { margin-top: 14px; }
.app-hint { padding: 10px 12px; border-radius: var(--r-card); font-size: var(--text-control); color: var(--fg); background: var(--accent-soft); text-wrap: pretty; }
.tips { padding: 12px 14px 12px 30px; border-radius: var(--r-card); background: var(--card); box-shadow: var(--shadow-border); font-size: var(--text-control); color: var(--fg-2); }
.tips li + li { margin-top: 4px; }

/* GitHub OAuth controls & callback cards */
.i-fill { display: block; flex: none; }
.oauth-divider { display: flex; align-items: center; gap: 10px; margin: 14px 0 12px; color: var(--muted); font-size: var(--text-sub); }
.oauth-divider::before, .oauth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.oauth-stack { display: flex; flex-direction: column; gap: 8px; }
.oauth-btn { gap: 7px; color: var(--fg); font-weight: 500; }
.oauth-hint { margin-top: 8px; text-align: center; }
.oauth-id {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 12px;
  border-radius: var(--r-segment); background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--fg);
}
.auth-actions .oauth-id { margin-bottom: 0; background: var(--card); box-shadow: var(--shadow-border); }
.oauth-id .mono { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oauth-id .icon-btn { margin: -4px -4px -4px 0; }
.oauth-status {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 24px 16px; color: var(--sub); font-size: var(--text-control);
}
.oauth-spin {
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.oauth-panel { padding: 16px; }
.oauth-err-head { margin-bottom: 8px; }
.oauth-err-msg { color: var(--fg); font-size: var(--text-control); text-wrap: pretty; }
.oauth-err-detail { margin-top: 6px; }
.oauth-err-acts { margin-top: 14px; }

/* ---- fingers -------------------------------------------------------------------- */
@media (pointer: coarse) {
  /* 16px keeps iOS from zooming into a field it focuses */
  .input.lg { height: 42px; font-size: 16px; }
  .input.code { font-size: 18px; }
  .btn.lg { height: 42px; font-size: 15px; }
  .affix.reveal > .icon-btn { width: 36px; height: 36px; inset-inline-end: 3px; }
  .affix.reveal > .input { padding-inline-end: 42px; }
  .label-line .btn.link, .after .btn.link { min-height: 32px; }
}
@media (max-width: 540px) {
  .top-links .btn:not(.action):not(.lang-btn) { display: none; }
  .auth { place-items: start center; padding-top: 20px; }
  .site-foot .classic { margin-inline-start: 0; }
}

/* ---- the console: the 卷不死 window's header and column --------------------------- */
/* (these few are app.css's, which the build does not bring along) */
.view { flex: 1; width: min(960px, 100% - 32px); margin-inline: auto; padding: 2px 0 28px; }
.view:focus { outline: none; }
.empty-state { padding: 28px 20px; text-align: center; color: var(--sub); }
.avatar { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--pill-hover); color: var(--fg-2); font-size: 11px; font-weight: 600; }
.list-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 6px 0 14px 4px; }
.head-copy { min-width: 0; }
.head-title { display: flex; align-items: center; gap: 8px; font-size: var(--text-title); font-weight: 600; }
.head-desc { margin-top: 2px; font-size: var(--text-sub); color: var(--sub); text-wrap: pretty; }
.strip .blk { min-width: 0; padding-inline-end: 4px; }
.strip .blk + .blk { padding-inline-start: 15px; border-inline-start: 1px solid var(--line-2); }
.strip .v + .k { margin-top: 1px; }

/* the pages as Magpie's segmented control, centred in the bar; they are links */
.console-top .bar-in { position: relative; }
.console-top .seg { position: absolute; left: 50%; top: calc(50% + 1px); translate: -50% -50%; }
.seg a {
  display: inline-flex; align-items: center; height: var(--h-segment); padding: 0 12px; border-radius: var(--r-field);
  font-size: var(--text-control); color: var(--ctl-fg); white-space: nowrap;
  transition-property: color, background-color; transition-duration: 120ms; transition-timing-function: ease-out;
}
.seg a[aria-current="page"] { color: var(--fg); background: var(--seg-thumb); box-shadow: var(--seg-edge); }
@media (hover: hover) { .seg a:not([aria-current="page"]):hover { color: var(--fg-2); } }
.top .actions { display: flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.balance-pill { display: inline-flex; align-items: center; height: var(--h-icon); padding: 0 9px; border-radius: var(--r-pill); font-size: var(--text-sub); font-weight: 500; color: var(--fg-2); background: var(--pill); transition: background-color 120ms ease-out; }
@media (hover: hover) { .balance-pill:hover { background: var(--pill-hover); color: var(--fg); } }
.pop a.menu-item { text-decoration: none; }

/* ---- 概览 ------------------------------------------------------------------------- */
.page-head { padding-top: 14px; }
.page-head .btn.primary { gap: 4px; }
#notices:not(:empty) { display: grid; gap: 8px; padding-top: 10px; }
.notice > .ic { width: 22px; height: 22px; color: var(--amber); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; }
.kpis .k { text-wrap: pretty; }
.label-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding-inline-end: 1px; }
.label-row .label { padding-bottom: 6px; }
.label-row .seg { margin-bottom: 6px; }
.chart-card { padding: 12px 14px 10px; }
.chart-sum { font-size: var(--text-control); color: var(--sub); }
.chart-sum b { color: var(--fg); font-weight: 600; }
/* seven columns from one baseline: 24px at most, 4px rounded tops, square at the base */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); height: 168px; margin-top: 8px; border-bottom: 1px solid var(--line-2); }
.week .day { position: relative; display: grid; grid-template-rows: auto 1fr; justify-items: center; align-items: end; padding-top: 4px; border-radius: var(--r-control); outline-offset: -2px; }
.week .val { font-size: var(--text-sub); color: var(--fg-2); min-height: 16px; white-space: nowrap; }
.week .bar { width: min(24px, 60%); height: var(--h); min-height: 0; border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--accent) 72%, var(--card)); transition: background-color 120ms ease-out; }
.week .day.today .bar { background: var(--accent); }
.week .d { position: absolute; bottom: -20px; font-size: var(--text-sub); color: var(--sub); }
.week .day.today .d { color: var(--fg); font-weight: 500; }
.chart-card .week { margin-bottom: 22px; }
.skeleton-bars { grid-column: 1 / -1; }

.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.row .name.mono { font-size: 12px; }
.row .cost { font-size: var(--text-control); color: var(--fg); font-weight: 500; }
.share { display: block; width: 56px; height: 4px; border-radius: 2px; background: var(--pill); overflow: hidden; }
.share i { display: block; width: var(--w); height: 100%; border-radius: 2px; background: var(--accent); }
.juanbu-ic { width: 28px; height: 28px; border-radius: 8px; background: var(--pill); color: var(--fg-2); }
.row code.mono { padding: 0 4px; border-radius: 4px; background: var(--pill); color: var(--fg-2); font-size: 11px; }
.row .sub > span { white-space: normal; }

@media (max-width: 760px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 12px; }
  .kpis .blk:nth-child(3) { padding-inline-start: 0; border-inline-start: 0; }
  .two { grid-template-columns: minmax(0, 1fr); }
  /* the tabs leave the bar for a row of their own */
  .console-top { height: auto; }
  .console-top .bar-in { flex-wrap: wrap; height: auto; padding-top: 10px; row-gap: 8px; }
  .console-top .seg { position: static; translate: none; order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; margin-bottom: 6px; }
  .console-top .seg a { flex: 1 0 auto; justify-content: center; }
}
@media (pointer: coarse) {
  .seg a { height: 32px; }
  .console-top .icon-btn { width: 36px; height: 36px; }
  .balance-pill { height: 32px; }
}
/* the 卷不死 client's row: the cat as its icon, the other systems under it */
.cat-ic { color: var(--fg); }
.cat-ic .mark { width: 18px; height: 18px; }
.client-row .ver { margin-inline-start: 8px; font-size: var(--text-sub); font-weight: 400; color: var(--sub); }
.client-row .ver:empty { display: none; }
.client-row .others { flex-wrap: wrap; gap: 2px 10px; white-space: normal; }
.client-row .others a { color: var(--accent); }
@media (hover: hover) { .client-row .others a:hover { text-decoration: underline; text-underline-offset: 3px; } }
.client-row .end .btn { gap: 5px; }
/* the providers the site takes, offered under an address it doesn't */
.suffix-pick { display: grid; gap: 6px; }
.suffix-pick .chips { gap: 6px; }
.suffix-pick .chip { font-family: var(--code); font-size: 11.5px; }
@media (pointer: coarse) { .suffix-pick .chip { height: 32px; padding-inline: 12px; } }

/* ---- shared by the console pages ----------------------------------------------------- */
.btn.sm { height: 22px; padding: 0 7px; font-size: var(--text-label); }
.icon-btn.sm { width: 20px; height: 20px; border-radius: var(--r-field); }
.btn.danger { color: var(--red); }
@media (hover: hover) { .btn.danger:not(:disabled):hover { color: var(--red); background: var(--red-soft); } }
.btn.danger-fill { height: var(--h-control); padding: 0 10px; border: 1px solid transparent; border-radius: var(--r-field); background: var(--red); color: #fff; font-weight: 500; }
@media (hover: hover) { .btn.danger-fill:not(:disabled):hover { filter: brightness(1.08); } }
.btn.link.inline { height: auto; padding: 0 2px; font-size: inherit; vertical-align: baseline; }
.foot .pager { display: inline-flex; align-items: center; gap: 8px; }
.foot .pager .num { min-width: 48px; text-align: center; }
.dialog.wide { width: min(620px, calc(100vw - 32px)); }
.dialog .head .status { margin-inline-end: 4px; }
.dialog .bar .btn:not(.icon-btn) { height: var(--h-control); }
textarea.input.area { height: auto; min-height: 52px; padding: 6px 9px; line-height: 1.5; resize: vertical; }
select.input { padding-inline-end: 24px; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4.5 6.5 3.5 3.5 3.5-3.5' fill='none' stroke='%2385858d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 6px center; background-size: 14px; }

/* ---- Key --------------------------------------------------------------------------- */
.key-row .name { display: flex; align-items: center; gap: 6px; }
.group-tag { display: inline-block; padding: 0 6px; border-radius: var(--r-pill); font-size: 11px; line-height: 16px; font-weight: 500; color: var(--fg-2); background: var(--pill); white-space: nowrap; }
.group-tag.none { color: var(--amber); background: var(--amber-soft); }
.key-row .sub { gap: 4px; }
.key-text { font-size: 11px; color: var(--fg-2); }
.key-row .sub .icon-btn { flex: none; }
.key-row .end { gap: 6px; }
.key-form .form-row + .form-row, .key-form details { margin-top: 12px; }
.key-form .form-row > label, .key-form .row-label { font-size: var(--text-control); color: var(--fg-2); }
.key-form .check { margin-top: 4px; }
details.more summary { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-control); color: var(--accent); cursor: pointer; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary .i { transition: rotate 150ms ease-out; }
details.more[open] summary .i { rotate: 90deg; }
details.more > .form-row { margin-top: 10px; }
.limits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.limits label { display: grid; gap: 4px; font-size: var(--text-sub); color: var(--sub); }
/* 使用方法 */
.how { display: grid; gap: 12px; }
.how-app { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-card); background: var(--accent-soft); }
.how-app > div { flex: 1; min-width: 0; }
.how-app b { display: block; font-weight: 600; }
.how-app p { margin-top: 2px; font-size: var(--text-sub); color: var(--fg-2); }
.how-app .juanbu-ic { background: var(--card); }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; padding: 10px 12px; border-radius: var(--r-card); box-shadow: var(--shadow-border); font-size: var(--text-control); }
.kv > span:nth-child(3n + 1) { color: var(--sub); }
.kv code { overflow-wrap: anywhere; color: var(--fg); }
.how-title { margin-top: 4px; font-size: var(--text); font-weight: 600; }
.how-os { justify-self: start; }
.snippet { border-radius: var(--r-card); background: var(--card-2); box-shadow: var(--shadow-border); overflow: hidden; }
.snippet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 6px 12px; font-size: var(--text-sub); color: var(--sub); border-bottom: 1px solid var(--line-2); }
.snippet pre { margin: 0; padding: 10px 12px; overflow-x: auto; font-size: 11.5px; line-height: 1.6; color: var(--fg); white-space: pre; }
.how code.mono { font-size: 11px; }

/* ---- 用量 ---------------------------------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.filters .dates { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-control); color: var(--sub); }
.filters .dates .input { width: 140px; }
.filters .key-pick { width: auto; min-width: 140px; margin-inline-start: auto; }
.filters .input { height: var(--h-control); }

@media (max-width: 760px) {
  .key-row { flex-wrap: wrap; }
  .key-row .who { flex-basis: calc(100% - 34px); }
  .key-row .end { margin-inline-start: 34px; }
  .key-row .sub { flex-wrap: wrap; row-gap: 2px; }
  .key-row .sub > span:last-child { flex-basis: 100%; }
  .filters .key-pick { margin-inline-start: 0; flex: 1; }
  .limits { grid-template-columns: minmax(0, 1fr); }
}
@media (pointer: coarse) {
  .icon-btn.sm { width: 32px; height: 32px; }
  .btn.sm { height: 30px; }
  .filters .input, .filters .seg button { height: 34px; font-size: 16px; }
  .key-form .input, .key-form select.input { height: 40px; font-size: 16px; }
}

/* ---- 充值 and 兑换码 ------------------------------------------------------------------- */
.view.narrow { width: min(640px, 100% - 32px); }
.results-note { padding: 8px 4px 0; font-size: var(--text-sub); color: var(--sub); text-wrap: pretty; }
.balance-now { flex: none; font-size: var(--text-control); color: var(--sub); }
.balance-now b { margin-inline-start: 4px; font-size: var(--text-title); font-weight: 600; color: var(--fg); }
/* the three steps, in a row */
.steps-row { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0 0 4px; padding: 0 4px; list-style: none; font-size: var(--text-control); color: var(--fg-2); }
.steps-row li { display: inline-flex; align-items: center; gap: 6px; }
.steps-row .n { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); font-variant-numeric: tabular-nums; }
.buy-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 0 16px; align-items: start; }
/* an amount: a card that opens the shop's product */
.shop-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.shop-tile {
  display: grid; gap: 2px; padding: 12px 14px 10px; border-radius: var(--r-card); background: var(--card); box-shadow: var(--shadow-border);
  transition-property: box-shadow, background-color, scale; transition-duration: 120ms; transition-timing-function: ease-out;
}
.shop-tile .price { font-size: var(--text-figure); font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.shop-tile .credit { font-size: var(--text-sub); color: var(--sub); }
.shop-tile .credit b { font-weight: 500; color: var(--fg-2); }
.shop-tile .bonus { margin-inline-start: 6px; padding: 0 5px; border-radius: var(--r-pill); font-size: 11px; font-weight: 500; color: var(--green); background: var(--green-soft); }
.shop-tile .go { display: inline-flex; align-items: center; gap: 3px; margin-top: 8px; font-size: var(--text-control); font-weight: 500; color: var(--accent); }
.shop-tile:active { scale: var(--press-scale); }
@media (hover: hover) { .shop-tile:hover { box-shadow: var(--shadow-border-hover), 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); } }
/* the redeem box */
.redeem-box { padding: 14px; }
.redeem-box .form-row > label { font-size: var(--text-control); color: var(--fg-2); }
.redeem-line { display: flex; gap: 8px; }
.redeem-line .input { flex: 1; letter-spacing: .02em; }
.redeem-line .btn { flex: none; }
.redeem-done { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding: 8px 10px; border-radius: var(--r-control); font-size: var(--text-control); color: var(--fg); background: var(--green-soft); }
.redeem-done .i { color: var(--green); }
.redeem-done b { font-weight: 600; }
@media (max-width: 760px) {
  .buy-grid { grid-template-columns: minmax(0, 1fr); }
  .shop-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head .balance-now { display: none; }
}
@media (pointer: coarse) {
  .redeem-line .input { font-size: 16px; }
}

/* ---- 充值 (online), 订单, 付款结果 ------------------------------------------------------ */
#pending-slot:not(:empty) { margin-bottom: 10px; }
#pending-slot .notice .ic { width: 22px; height: 22px; }
.strip > .btn { gap: 5px; }
.qr-box { display: grid; justify-items: center; gap: 6px; font-size: var(--text-control); color: var(--fg-2); }
.qr-box .qr { width: 188px; height: 188px; border-radius: var(--r-card); box-shadow: var(--shadow-border); }
.dialog .order p { color: var(--fg-2); text-wrap: pretty; }
.dialog .bar a.btn { text-decoration: none; }
.order-row .end { gap: 6px; }
.result-card h1 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.result-card .lead b { color: var(--fg); }
@media (max-width: 540px) {
  /* the window's wallet stacks its rows on a phone (app.css does this outside its wallet section) */
  .pay-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .pay-row > .k { text-align: start; }
  .order-row { flex-wrap: wrap; }
  .order-row .end { flex-basis: 100%; justify-content: flex-end; }
}
@media (pointer: coarse) {
  .pay-row .input, .pay-row .chip { height: 34px; font-size: 16px; }
}

/* ---- 用量: the request table ------------------------------------------------------- */
/* Sub2API's own marks: latency bands green → amber → orange → red, and a hue
   per kind of token; the hues are the app's own where it has one */
:root {
  --lat-good: var(--green); --lat-warn: var(--amber); --lat-slow: color-mix(in srgb, var(--amber) 45%, var(--red)); --lat-bad: var(--red);
  --tok-in: var(--green); --tok-out: var(--accent); --tok-read: #0ea5e9; --tok-write: var(--amber);
}
.usage-table { display: grid; grid-template-columns: max-content minmax(80px, .7fr) minmax(0, 1.3fr) minmax(0, 1.2fr) max-content max-content; }
.u-head, .u-row { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; column-gap: 16px; padding: 8px 14px; }
.u-head { padding-block: 8px 6px; font-size: var(--text-label); font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--line-2); }
.u-row { min-height: 54px; font-size: var(--text-sub); }
.u-row + .u-row { border-top: 1px solid var(--line-2); }
.u-r, .u-cost { justify-self: end; }
.u-time { color: var(--fg-2); white-space: nowrap; }
.u-key { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-2); }
.u-model { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; min-width: 0; }
.u-model code { font-size: 12px; color: var(--fg); overflow-wrap: anywhere; }
.kind { padding: 0 6px; border-radius: var(--r-pill); font-size: 10.5px; line-height: 16px; font-weight: 500; white-space: nowrap; color: var(--ctl-fg); background: var(--pill); }
.kind.stream { color: var(--accent); background: var(--accent-soft); }
.kind.ws_v2 { color: color-mix(in srgb, var(--accent) 60%, #a855f7); background: color-mix(in srgb, #a855f7 12%, var(--card)); }
.kind.cyber { color: var(--red); background: var(--red-soft); }
.kind.long { color: var(--amber); background: var(--amber-soft); }
.u-tok { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.t { display: inline-flex; align-items: center; gap: 3px; color: var(--fg-2); white-space: nowrap; }
.t.in .i { color: var(--tok-in); }
.t.out .i { color: var(--tok-out); }
.t.read .i { color: var(--tok-read); }
.t.write .i { color: var(--tok-write); }
.t.img .i { color: var(--accent); }
/* the wait: a bar that runs from the first token's band to the whole request's */
.u-lat { display: flex; align-items: stretch; gap: 8px; }
.lat-bar { flex: none; width: 3px; border-radius: 2px; background: linear-gradient(to bottom, var(--top) 40%, var(--bottom) 60%); }
.lat-grid { display: grid; grid-template-columns: max-content max-content; column-gap: 6px; row-gap: 1px; font-size: 11.5px; line-height: 1.35; }
.lat-grid .k { color: var(--muted); }
.lat-grid b { font-weight: 500; }
.lat-good { color: var(--lat-good); }
.lat-warn { color: var(--lat-warn); }
.lat-slow { color: var(--lat-slow); }
.lat-bad { color: var(--lat-bad); }
.lat-grid .speed { color: var(--fg-2); }
.u-cost { font-size: var(--text-control); font-weight: 600; color: var(--green); white-space: nowrap; }
@media (max-width: 760px) {
  .usage-table { display: block; }
  .u-head { display: none; }
  .u-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "model cost" "time key" "tok tok" "lat lat"; row-gap: 5px; column-gap: 10px; }
  .u-model { grid-area: model; }
  .u-cost { grid-area: cost; }
  .u-time { grid-area: time; }
  .u-key { grid-area: key; justify-self: end; max-width: 50vw; }
  .u-tok { grid-area: tok; }
  .u-lat { grid-area: lat; }
  .lat-grid { grid-template-columns: repeat(6, max-content); column-gap: 5px; }
  .lat-grid b { margin-inline-end: 6px; }
}

/* ---- 概览: the week split by model --------------------------------------------------- */
/* a colour per vendor, the data-viz reference palette's hues in an order that
   passes its adjacent-pair and colour-blindness checks, light and dark; the
   rest is grey */
:root { --vendor-claude: #eb6834; --vendor-openai: #1baf7a; --vendor-gemini: #2a78d6; --vendor-grok: #e87ba4; --vendor-other: #b9b9c2; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --vendor-claude: #d95926; --vendor-openai: #199e70; --vendor-gemini: #3987e5; --vendor-grok: #d55181; --vendor-other: #56565f; }
}
:root[data-theme="dark"] { --vendor-claude: #d95926; --vendor-openai: #199e70; --vendor-gemini: #3987e5; --vendor-grok: #d55181; --vendor-other: #56565f; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: var(--text-sub); color: var(--fg-2); }
.legend:empty { display: none; }
.legend > span { display: inline-flex; align-items: center; gap: 5px; }
.legend .mono { font-size: 11px; }
.sw { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 2px; }
/* a day's column: its parts from the baseline up, 2px of card between them */
.week .stack { display: flex; flex-direction: column-reverse; gap: 2px; width: min(24px, 60%); height: var(--h); min-height: 0; }
.week .stack > i { display: block; min-height: 2px; flex-basis: 0; background: color-mix(in srgb, var(--accent) 72%, var(--card)); }
.week .stack > i:last-child { border-radius: 4px 4px 0 0; }
.week .day.today .stack:not(.split) > i { background: var(--accent); }

/* the list as the chart's key: the vendor's logo on its colour */
.vendor-mark { position: relative; display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 8px; background: color-mix(in srgb, var(--c) 14%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 35%, transparent); }
.vendor-mark .ic { width: 18px; height: 18px; color: var(--fg); }
.vendor-mark::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--card); }
.vendor-row .name { display: flex; align-items: baseline; gap: 8px; font-weight: 600; }
.vendor-row .share-text { font-size: var(--text-sub); font-weight: 400; color: var(--sub); }
.vendor-row .sub .mono { font-size: 11px; color: var(--fg-2); }
/* a model's maker, small, before its name */
.ic.xs { width: 14px; height: 14px; vertical-align: -2px; margin-inline-end: 5px; }
.ic.xs .i { width: 12px; height: 12px; }
.legend .ic.xs { margin-inline-end: 0; }
.u-model .ic.xs { margin-inline-end: 0; }
.row .name.mono .ic.xs { margin-inline-end: 6px; }
/* the key, vendor by vendor */
.legend .lg-vendor { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.legend .lg-vendor > b { font-weight: 600; color: var(--fg); margin-inline-end: 2px; }
.legend .lg-model { display: inline-flex; align-items: center; gap: 4px; }
.legend { gap: 6px 18px; }

/* the day under the pointer: the others step back, a panel beside it */
.chart-card { position: relative; overflow: visible; }
.week .day { cursor: default; }
.week .stack { transition: opacity 120ms ease-out; }
.week.focusing .day:not(.on) .stack { opacity: .35; }
.week.focusing .day:not(.on) .val { opacity: .35; }
.day-panel {
  position: absolute; z-index: 5; width: 260px; padding: 0; border-radius: var(--r-card); pointer-events: none;
  background: var(--pop-bg); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); box-shadow: var(--shadow);
  font-size: var(--text-sub); color: var(--fg);
}
.dp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 12px 8px; border-bottom: 1px solid var(--line-2); }
.dp-head b { font-weight: 600; }
.dp-head .num { font-size: var(--text-control); font-weight: 600; }
.dp-body { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto 34px; column-gap: 6px; padding: 4px 12px 8px; }
.dp-vendor, .dp-model { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; min-height: 20px; }
.dp-vendor { margin-top: 6px; font-weight: 600; }
.dp-vendor .ic.xs { margin: 0; }
.dp-vendor b { font-weight: 600; }
.dp-model { color: var(--fg-2); }
.dp-model .sw { justify-self: center; }
.dp-model .mono { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-model > span:only-child { grid-column: 1 / -1; color: var(--sub); }
.dp-body .num { text-align: end; font-variant-numeric: tabular-nums; }
.dp-pct { color: var(--muted); font-size: 11px; }
.more-row { justify-content: center; width: 100%; min-height: 40px; font-size: var(--text-control); color: var(--accent); border-top: 1px solid var(--line-2); }
@media (hover: hover) { .more-row:hover { background: var(--pill); } }

/* the two lists side by side end level: as tall as each other, each closing
   on a row that leads on (展开全部 / 全部用量) */
.two { align-items: stretch; }
.two > section { display: flex; flex-direction: column; }
.two > section > .list { flex: 1; display: flex; flex-direction: column; }
.two > section > .list > .more-row { margin-top: auto; }
a.more-row { display: flex; align-items: center; gap: 3px; text-decoration: none; }

/* ---- 状态 -------------------------------------------------------------------------- */
/* above the groups: the day shown (and the way to the ones before) and what
   the colours mean, the colours as the bars' own cells */
.status-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; padding: 12px 4px 0; }
.window-nav { display: inline-flex; align-items: center; gap: 2px; font-size: var(--text-control); color: var(--fg-2); }
.window-nav > .num { min-width: 132px; padding-inline: 4px; text-align: center; white-space: nowrap; }
.window-nav .icon-btn:disabled { opacity: .35; }
.window-nav .btn.link { margin-inline-start: 6px; }
.status-legend { margin-top: 0; color: var(--sub); }
.status-legend .sw { display: inline-block; width: 3px; height: 12px; border-radius: 1px; background: var(--line); }
.status-legend .sw.operational { background: var(--green); }
.status-legend .sw.degraded { background: var(--amber); }
.status-legend .sw.down { background: var(--red); }
.cat-avail { padding: 14px 0 6px; font-size: var(--text-sub); color: var(--sub); white-space: nowrap; }
.cat-avail b { font-weight: 500; color: var(--fg-2); }
.now-state { display: inline-flex; align-items: center; gap: 7px; }
.now-state .dot { width: 8px; height: 8px; }
.status-notice { margin-top: 10px; }
.status-notice > .ic { width: 22px; height: 22px; color: var(--red); }
.status-note { padding: 10px 4px 0; font-size: var(--text-sub); color: var(--sub); text-wrap: pretty; }
/* a group's row: its name and what it is for, then its day as the client's
   status bar (the .uptime rules are the app's), every slot of it */
.status-row { flex-wrap: wrap; row-gap: 6px; }
.status-row > .who { flex: 1 1 200px; }
/* the name, its rate, 比官方 and 「N 个模型」 wrap rather than clip on a narrow row */
.status-row .name { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; overflow: visible; white-space: normal; }
.status-row .ch-desc { margin-top: 1px; }
.uptime-bars i { transition: opacity 120ms ease-out; }
.uptime-bars.hovering i:not(.on) { opacity: .4; }
.incident-row .sub > span { white-space: normal; }
.incident-row .fails { font-size: var(--text-sub); color: var(--sub); white-space: nowrap; }
.incident-row .fails .num { color: var(--fg-2); }
/* a slot's numbers, over it */
.cell-tip {
  position: fixed; z-index: 30; display: grid; gap: 3px; max-width: 260px; padding: 8px 11px; border-radius: var(--r-field); pointer-events: none;
  background: var(--pop-bg); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); box-shadow: var(--shadow);
  font-size: var(--text-sub); color: var(--fg-2);
}
.cell-tip[hidden] { display: none; }
.cell-tip b { font-weight: 600; color: var(--fg); }
.cell-tip .tip-state { display: inline-flex; align-items: center; gap: 6px; color: var(--fg); }
/* a phone: the bar across the row under the name, its words centred under
   it, as the client has it */
@media (max-width: 760px) {
  .status-row .uptime { flex-basis: 100%; justify-items: center; margin-inline-start: 0; }
  .status-row .uptime-bars { justify-self: stretch; }
  .status-row .uptime-bars i { flex: 1 1 0; width: auto; min-width: 1px; }
  .status-bar { justify-content: center; }
}
/* a phone: what is true now on a line of its own over the two counts */
@media (max-width: 540px) {
  [data-summary] { flex-wrap: wrap; row-gap: 10px; }
  [data-summary] > .blk:first-child { flex-basis: 100%; padding-bottom: 10px; border-bottom: 1px solid var(--line-2); }
  [data-summary] > .blk:nth-child(2) { flex: 1 1 0; padding-inline-start: 0; border-inline-start: 0; }
  [data-summary] > .blk:nth-child(3) { flex: 1 1 0; }
}

/* ---- channels: the Key page's cards and the new-key dialog's choices ------------------- */
.channels-note { padding: 0 4px 8px; font-size: var(--text-sub); color: var(--sub); text-wrap: pretty; }
.ch-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ch-grid > .empty-state { grid-column: 1 / -1; }
.ch-card {
  display: flex; flex-direction: column; gap: 7px; min-width: 0; padding: 12px 14px 12px;
  background: var(--card); border-radius: var(--r-card); border: 1px solid transparent; box-shadow: var(--shadow-border);
  container-type: inline-size;
}
.ch-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ch-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ch-name .group-tag { vertical-align: 1px; }
.ch-state { display: inline-flex; align-items: center; gap: 5px; flex: none; font-size: var(--text-sub); color: var(--sub); white-space: nowrap; }
.ch-state b { font-weight: 500; color: var(--fg-2); }
/* an availability the week had no data for */
.no-data { color: var(--muted); font-weight: 400; }
/* a narrow card (the dialog's, a phone's): where it stands goes under its name */
@container (max-width: 400px) {
  .ch-head { flex-wrap: wrap; row-gap: 2px; }
  .ch-state { flex-basis: 100%; padding-inline-start: 38px; }
}
.ch-desc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: var(--text-sub); color: var(--sub); text-wrap: pretty; }
.ch-desc.open { display: block; }
.ch-more { align-self: flex-start; height: auto; margin-top: -4px; padding: 0; font-size: var(--text-sub); }
/* the facts, the bar and the button sit at the card's foot, so in a row of
   cards (one height) they line up whatever the descriptions above them */
.ch-facts { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: auto; font-size: var(--text-sub); color: var(--sub); }
.ch-facts b { font-weight: 600; color: var(--fg); }
/* the day's bar across the card, the client's cells stretched to fit */
.ch-bars { display: flex; gap: 1px; height: 14px; margin-top: 2px; }
.ch-bars i { flex: 1 1 0; width: auto; min-width: 1px; }
.ch-end { display: flex; justify-content: flex-end; padding-top: 2px; }
/* a channel's models: 「N 个模型」 opens the homepage's table (channel-models.css)
   under its card or status row; a card beside an opened one in the grid keeps
   its height (channels.js toggleModels), so only the opened card grows */
.ch-models-btn { height: auto; gap: 3px; padding: 0; font-size: var(--text-sub); color: var(--sub); }
.ch-models-btn b { font-weight: 600; color: var(--fg); }
.ch-models-btn .i { color: var(--muted); transition: rotate 120ms ease-out; }
.ch-models-btn[aria-expanded="true"] .i { rotate: 90deg; }
@media (hover: hover) { .ch-models-btn:hover { color: var(--fg); text-decoration: none; } }
.ch-card.open, .ch-card.beside-open { align-self: start; }
/* a channel's 比官方 tag (channel-models.js savingTag), by its name, as the
   卷不死 app has it: green, grey when dearer than the official */
.save { display: inline-block; padding: 0 6px; border-radius: var(--r-pill); font-size: 11px; line-height: 16px; font-weight: 500; vertical-align: 1px; color: var(--green); background: var(--green-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.save.more { color: var(--sub); background: var(--pill); }
/* the page's cards and the status rows open their models from anywhere on
   them (a click on the dialog's card picks it instead) */
.ch-card:not(.pick):has(.ch-models-btn), .status-row:has(.ch-models-btn) { cursor: pointer; }
@media (hover: hover) {
  .ch-card:not(.pick):not(.sk):has(.ch-models-btn):hover { box-shadow: var(--shadow-border), 0 0 0 1px var(--muted); }
  .status-row:has(.ch-models-btn):hover { background: color-mix(in srgb, var(--fg) 3%, var(--card)); }
}
.ch-models { cursor: auto; }
.ch-models .models { margin-top: 2px; }
.models-note { font-size: 11px; color: var(--muted); text-wrap: pretty; }
.status-row > .ch-models { flex-basis: 100%; padding-inline-start: 34px; }
.status-row .name .ch-models-btn { margin-inline-start: 2px; }
@media (prefers-reduced-motion: reduce) { .ch-models-btn .i { transition: none; } }
.ch-end .btn { gap: 4px; }
/* in the dialog: a radio a card, the picked one ringed in the accent */
.ch-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.ch-card.pick { position: relative; cursor: pointer; padding: 10px 12px; transition: box-shadow 120ms ease-out, background-color 120ms ease-out; }
.ch-card.pick:has(input:checked) { box-shadow: 0 0 0 2px var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--card)); }
.ch-card.pick:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) { .ch-card.pick:not(:has(input:checked)):hover { box-shadow: var(--shadow-border), 0 0 0 1px var(--muted); } }
.ch-pick[aria-invalid="true"] .ch-card.pick { box-shadow: 0 0 0 1px var(--red); }
.key-form .ch-pick + .error { margin-top: 6px; }
/* a key's channel: a dot for how it stands */
.group-tag .dot { display: inline-block; width: 6px; height: 6px; margin-inline-end: 4px; vertical-align: 1px; }
@media (max-width: 640px) {
  .ch-grid, .ch-pick { grid-template-columns: minmax(0, 1fr); }
}

/* ---- while a list loads ------------------------------------------------------ */
/* rows and cards standing in for the ones coming (ui.js ghost), shown when
   a page's answers take longer than it waits: their real layout with
   made-up words, the words grey bars, logos and buttons grey shapes */
.sk { pointer-events: none; user-select: none; animation: sk-pulse 1.2s ease-in-out infinite alternate; }
.sk, .sk * { color: transparent !important; }
.sk :is(svg, img, .mask, .dot) { visibility: hidden; }
.sk :is(.ic, .name, .sub > span, .sub > code, .status, .group-tag, .btn, .icon-btn, .uptime-k, .ch-name, .ch-desc, .ch-facts > span, .ch-state, .label, .cost) {
  background: var(--pill) !important; box-shadow: none !important; border-radius: 4px;
}
.sk :is(.name, .ch-name, .label) { width: fit-content; max-width: 100%; }
.sk .uptime-bars i { background: var(--pill); }
@keyframes sk-pulse { to { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* ---- 客户用量 (/customers, admins only) ----------------------------------------------- */
/* the accounts not counted, named at the top */
.cu-left { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 9px 14px; margin-bottom: 12px; font-size: var(--text-sub); }
.cu-left > .k { color: var(--sub); }
.cu-left .cu-how { margin-inline-start: auto; }
.cu-left code.mono { padding: 0 4px; border-radius: 4px; background: var(--pill); font-size: 11px; color: var(--fg-2); }
.cu-lo-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cu-lo { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; padding: 1px 9px; border-radius: 9px; background: var(--pill); color: var(--fg-2); }
.cu-lo b { font-weight: 600; color: var(--fg); }
.cu-lo [data-email]:empty { display: none; }
.cu-lo .cu-lo-note { color: var(--sub); }
/* a customer: the whole row opens their latest requests under it */
.cu-person + .cu-person { border-top: 1px solid var(--line-2); }
.cu-row { width: 100%; text-align: start; font: inherit; color: inherit; background: none; border: 0; cursor: pointer; transition: background-color 120ms ease-out; }
@media (hover: hover) { .cu-row:hover { background: var(--pill); } }
.cu-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cu-row .who, .cu-row .name, .cu-row .sub { display: block; }
.cu-row .sub { display: flex; }
.cu-row .uid { margin-inline-start: 6px; font-size: var(--text-sub); font-weight: 400; color: var(--muted); }
.cu-row .end > .i { color: var(--muted); transition: rotate 150ms ease-out; }
.cu-row[aria-expanded="true"] .end > .i { rotate: 90deg; }
.cu-detail { border-top: 1px solid var(--line-2); background: color-mix(in srgb, var(--pill) 45%, var(--card)); }
.cu-detail .more-row { border-top: 1px solid var(--line-2); }
.list-note { padding: 8px 14px; border-top: 1px solid var(--line-2); font-size: var(--text-sub); color: var(--sub); }
/* the requests: the 用量 page's table, with who and which channel */
.cu-table { grid-template-columns: max-content minmax(0, 1fr) minmax(0, .8fr) minmax(0, 1.3fr) max-content max-content; }
.cu-table.one { grid-template-columns: max-content minmax(0, .8fr) minmax(0, 1.3fr) max-content max-content; }
.u-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); }
.cu-table .u-row { min-height: 44px; }
.chart-note { margin-top: -10px; font-size: var(--text-sub); color: var(--sub); }
.cu-table .u-tok { color: var(--fg-2); }
@media (max-width: 760px) {
  .cu-left .cu-how { margin-inline-start: 0; }
  .cu-table .u-row { grid-template-areas: "model cost" "time key" "who tok"; }
  .cu-table.one .u-row { grid-template-areas: "model cost" "time key" "tok tok"; }
  .u-who { grid-area: who; }
  .cu-table .u-tok { justify-self: end; }
  .cu-table.one .u-tok { justify-self: start; }
}

/* ---- Language Switcher (i18n) -------------------------------------------- */
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: var(--h-control);
  padding: 0 8px;
  font-size: var(--text-sub);
  color: var(--fg-2);
  border-radius: var(--r-control);
}
.lang-btn svg.i { opacity: .82; }
.lang-pop { min-width: 148px; }
.lang-pop .menu-item { display: flex; align-items: center; gap: 8px; width: 100%; }
.lang-pop .menu-item.active { font-weight: 550; color: var(--fg); }
.lang-pop .lang-flag { font-size: 14px; line-height: 1; }
.lang-pop .lang-check { margin-inline-start: auto; display: inline-flex; color: var(--accent); }
html:not([lang^="zh"]) .top .seg a { padding-inline: 10px; }

/* ---- native USDT / USDC dedicated-address panel inside /purchase ---- */
.pay-tiles { max-width: 640px; }
.usdt-dual-ic { position: relative; display: inline-flex; align-items: center; flex: none; }
.usdt-dual-a { position: absolute; left: 0; top: 50%; transform: translateY(-50%); border-radius: 50%; }
.usdt-dual-b { position: absolute; right: 0; top: 50%; transform: translateY(-50%); border-radius: 50%; box-shadow: 0 0 0 2px var(--card); }
.usdt-ico { display: block; flex: none; border-radius: 50%; }
.usdt-pair { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.usdt-pair-b { position: absolute; right: -3px; bottom: -3px; border-radius: 50%; background: var(--card); box-shadow: 0 0 0 1.5px var(--card); display: inline-flex; align-items: center; justify-content: center; }
.usdt-wrap { display: grid; gap: 14px; margin-top: 12px; }
.usdt-bonus-notice { background: var(--green-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 28%, transparent); }
.usdt-ic-green { color: var(--green) !important; }
.usdt-green { color: var(--green); }
.usdt-strip .v { font-size: 17px; }
.usdt-live-notice { background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.usdt-bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 8px; }
.usdt-bar > span { display: block; height: 100%; background: var(--green); transition: width 300ms ease; }
.usdt-tok-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.usdt-tok-chip { height: auto !important; padding: 6px 12px 6px 8px !important; display: inline-flex; align-items: center; gap: 8px; border-radius: var(--r-card) !important; text-align: left; }
.usdt-tok-txt { display: grid; line-height: 1.25; }
.usdt-tok-txt b { font-size: 13px; font-weight: 600; color: var(--fg); }
.usdt-tok-txt span { font-size: 11px; color: var(--sub); font-weight: 400; }
.usdt-net-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.usdt-net-chip { height: 32px !important; padding: 0 11px 0 6px !important; display: inline-flex; align-items: center; gap: 6px; }
.usdt-rec { font-style: normal; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: var(--green); color: #fff; }
.usdt-sub-hint { margin: 7px 0 0; font-size: var(--text-sub); color: var(--sub); line-height: 1.5; }
.usdt-sub-hint b { color: var(--fg); font-weight: 500; }
.usdt-addr-row { align-items: start; padding-top: 14px; padding-bottom: 14px; }
.usdt-addr-box { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.usdt-qr-wrap { position: relative; flex: none; width: 152px; height: 152px; padding: 8px; border-radius: var(--r-card); background: #fff; box-shadow: 0 0 0 1px var(--line); }
.usdt-qr-svg { width: 100%; height: 100%; display: block; }
.usdt-qr-badge { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 9px; background: #fff; box-shadow: 0 1px 5px rgba(15, 23, 42, .22); display: inline-flex; align-items: center; justify-content: center; }
.usdt-qr-badge .usdt-pair-b { background: #fff; box-shadow: 0 0 0 1.5px #fff; }
.usdt-addr-meta { flex: 1; min-width: 220px; display: grid; gap: 8px; }
.usdt-addr-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.usdt-target-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--fg-2); padding: 3px 10px 3px 5px; border-radius: 999px; background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); }
.usdt-target-pill b { color: var(--fg); font-weight: 600; }
.usdt-live-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--sub); }
.usdt-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; box-shadow: 0 0 0 3px var(--green-soft); }
.usdt-addr-code { display: block; font-family: var(--code); font-size: 12.5px; font-weight: 600; word-break: break-all; padding: 9px 11px; border-radius: var(--r-control); background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); user-select: all; color: var(--fg); }
.usdt-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.usdt-min-line { margin: 2px 0 0; font-size: var(--text-sub); color: var(--sub); line-height: 1.55; }
.usdt-min-line b { color: var(--fg); font-weight: 600; }
.usdt-amt-box { display: inline-flex; align-items: center; width: 164px; height: var(--h-control); padding: 0 10px; gap: 6px; border-radius: var(--r-field); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow 120ms ease-out; }
.usdt-amt-box:focus-within { box-shadow: inset 0 0 0 1.5px var(--accent); }
.usdt-amt-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--fg); font-size: var(--text-control); font-weight: 600; padding: 0; }
.usdt-amt-input::placeholder { color: var(--muted); font-weight: 400; }
.usdt-amt-unit { flex: none; font-size: 12px; font-weight: 600; color: var(--sub); letter-spacing: .02em; }
.usdt-calc-summary { margin-top: 8px; }
.usdt-calc-line { margin: 0; font-size: var(--text); color: var(--fg-2); line-height: 1.6; }
.usdt-total-num { color: var(--green); font-size: 15px; }
.usdt-min-warn { margin: 5px 0 0; font-size: var(--text-sub); color: var(--red); }
.usdt-hist-head { margin-top: 4px; }
.usdt-sync-note { font-size: var(--text-sub); color: var(--sub); }
.usdt-tx { color: var(--accent); font-family: var(--code); text-decoration: none; }
.usdt-tx:hover { text-decoration: underline; }
.usdt-risk-body { display: grid; gap: 10px; font-size: var(--text-control); color: var(--fg-2); line-height: 1.6; }
.usdt-risk-lead { margin: 0; color: var(--fg); font-weight: 500; }
.usdt-risk-list { margin: 0; padding-left: 18px; display: grid; gap: 7px; }
.usdt-risk-list b { color: var(--fg); font-weight: 600; }
.usdt-risk-warn { padding: 10px 12px; border-radius: var(--r-control); background: var(--red-soft); color: var(--fg); font-size: var(--text-sub); line-height: 1.6; }
.usdt-risk-warn b { color: var(--red); font-weight: 600; }
.usdt-err-note { margin: 0; color: var(--red); }
@media (max-width: 640px) {
  .usdt-addr-row { grid-template-columns: 1fr; }
  .usdt-addr-row > .k { text-align: start; }
}
