/* Sub2API 账号池 — one visual system for the login page and the console.
   Layers: a tinted page (--canvas), surfaces on it (--bg: cards, bars, dialogs, fields) and quiet fills inside a surface
   (--bg-2, --bg-3). One brand colour (--accent, indigo) marks what is primary or chosen: the main button, the current
   page, a selection, a link, the focus ring. Green, amber and red are kept for states and never decorate.
   Order: tokens, font, base, icons, buttons and fields, controls, shell, login, overlays, phone layout, coarse pointers,
   reduced motion, forced colours.
   Each view (overview, remote, stock, history, settings) appends its own section at the end of this file. */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --canvas: #f5f7fb;
  --bg: #ffffff;
  --bg-2: #f6f8fb;
  --bg-3: #edf0f5;
  --line: #e4e8ef;
  --line-2: #d3d9e3;
  --ink: #101728;
  --ink-2: #3a4458;
  --muted: #5f6b80;      /* 5.4:1 on --bg, 5.0:1 on --canvas, 4.7:1 on --bg-3 */
  --faint: #9aa4b5;
  --accent: #4f46e5;     /* white on it 6.3:1 */
  --accent-ink: #4338ca; /* as text: 7.9:1 on --bg, 7.0:1 on --accent-soft */
  --accent-soft: #eef0fe;
  --accent-line: #c9cdfb;
  --good: #12a26b;
  --good-ink: #0b7a4e;
  --good-soft: #e3f6ec;
  --warn: #e08e0b;
  --warn-ink: #9c5800;   /* 5.5:1 on --bg, 5.0:1 on --warn-soft */
  --warn-soft: #fdf3dc;
  --bad: #e0424a;
  --bad-ink: #b3222b;
  --bad-soft: #fdeaeb;
  /* Derived. The primary button is the brand colour with white text in every scheme. */
  --btn: var(--accent);
  --btn-ink: #ffffff;
  --btn-hover: #4338ca;
  --btn-shadow: inset 0 1px 0 rgb(255 255 255 / .18), 0 1px 2px rgb(49 46 129 / .32);
  --mark: var(--accent);                  /* the logo's tile */
  --bar-fill: #6468f0;                    /* quota and share bars: the brand colour, a step lighter, never a state */
  --track: rgb(16 23 40 / .09);           /* the empty part of a bar, on any surface */
  --switch-off: #808ba0;                  /* 3:1 on --bg: the track of a switch that is off */
  --pop: #101728;                         /* the toast and the skip link: ink with white text */
  --pop-ink: #ffffff;
  --glass: rgb(255 255 255 / .8);         /* the top bar and the dock, over a blurred page */
  --glow: rgb(79 70 229 / .07);           /* the light behind the top of the page */
  --ring: rgb(79 70 229 / .22);           /* the halo of a focused field */
  --overlay: rgb(16 23 40 / .42);
  --shadow-xs: 0 1px 2px rgb(16 23 40 / .05);
  --shadow-sm: 0 1px 2px rgb(16 23 40 / .08), 0 1px 1px rgb(16 23 40 / .04);
  --shadow-card: 0 1px 2px rgb(16 23 40 / .04), 0 4px 12px -4px rgb(16 23 40 / .06);
  --shadow-pop: 0 2px 6px rgb(16 23 40 / .06), 0 12px 32px -8px rgb(16 23 40 / .16);
  --shadow-lg: 0 4px 12px rgb(16 23 40 / .06), 0 32px 72px -16px rgb(16 23 40 / .28);
  /* What stands out of a --bg-3 surface (the chosen item of a segmented control): white in the light scheme, a step
     lighter than the surface in the dark ones. */
  --raised: var(--bg);

  --font: "Geist", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);

  --r-sm: 9px;        /* buttons, fields, chips of a form */
  --r-md: 12px;       /* panels inside a card, notes */
  --r-lg: 16px;       /* cards */
  --r-xl: 20px;       /* the verdict, dialogs, the login card */

  --wide: 1280px;     /* the main column, gutters included */
  --gutter: 24px;     /* page side margin; 16px on phones */
  --block-gap: 20px;  /* between the cards of a view; 14px on phones */
  --bar-h: 60px;
  --dock-h: 62px;
  --tray-h: 0px;   /* the height of the progress tray while it shows (set by feedback.js); the floating bars rise above it */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --canvas: #0a0d14;
    --bg: #11151e;
    --bg-2: #161b26;
    --bg-3: #1f2633;
    --line: #222938;
    --line-2: #343d50;
    --ink: #e9edf4;
    --ink-2: #c1c9d7;
    --muted: #8f99ab;
    --faint: #5c6679;
    --accent: #818cf8;
    --accent-ink: #a5b0ff;
    --accent-soft: #1b1f3d;
    --accent-line: #343a78;
    --good: #2fbf84;
    --good-ink: #5ed6a2;
    --good-soft: #0e2a20;
    --warn: #f0ab37;
    --warn-ink: #f6c56d;
    --warn-soft: #2d2210;
    --bad: #ef5f65;
    --bad-ink: #ff9296;
    --bad-soft: #33161a;
    --btn: #5b5ef0;          /* white on it 4.9:1, 3.7:1 against --bg */
    --btn-hover: #5f62f0;
    --btn-shadow: inset 0 1px 0 rgb(255 255 255 / .14), 0 1px 2px rgb(0 0 0 / .5);
    --mark: #5b5ef0;
    --bar-fill: #7b82f6;
    --track: rgb(233 237 244 / .11);
    --switch-off: #5f6a80;
    --pop: #e9edf4;
    --pop-ink: #101728;
    --glass: rgb(13 16 24 / .78);
    --glow: rgb(129 140 248 / .09);
    --ring: rgb(129 140 248 / .3);
    --overlay: rgb(0 0 0 / .6);
    --shadow-xs: 0 1px 2px rgb(0 0 0 / .35);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .5);
    --shadow-card: 0 1px 2px rgb(0 0 0 / .3), inset 0 1px 0 rgb(255 255 255 / .03);
    --shadow-pop: 0 2px 6px rgb(0 0 0 / .4), 0 12px 32px -8px rgb(0 0 0 / .6);
    --shadow-lg: 0 4px 12px rgb(0 0 0 / .5), 0 32px 72px -16px rgb(0 0 0 / .7);
    --raised: #2d3548;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0a0d14;
  --bg: #11151e;
  --bg-2: #161b26;
  --bg-3: #1f2633;
  --line: #222938;
  --line-2: #343d50;
  --ink: #e9edf4;
  --ink-2: #c1c9d7;
  --muted: #8f99ab;
  --faint: #5c6679;
  --accent: #818cf8;
  --accent-ink: #a5b0ff;
  --accent-soft: #1b1f3d;
  --accent-line: #343a78;
  --good: #2fbf84;
  --good-ink: #5ed6a2;
  --good-soft: #0e2a20;
  --warn: #f0ab37;
  --warn-ink: #f6c56d;
  --warn-soft: #2d2210;
  --bad: #ef5f65;
  --bad-ink: #ff9296;
  --bad-soft: #33161a;
  --btn: #5b5ef0;
  --btn-hover: #5f62f0;
  --btn-shadow: inset 0 1px 0 rgb(255 255 255 / .14), 0 1px 2px rgb(0 0 0 / .5);
  --mark: #5b5ef0;
  --bar-fill: #7b82f6;
  --track: rgb(233 237 244 / .11);
  --switch-off: #5f6a80;
  --pop: #e9edf4;
  --pop-ink: #101728;
  --glass: rgb(13 16 24 / .78);
  --glow: rgb(129 140 248 / .09);
  --ring: rgb(129 140 248 / .3);
  --overlay: rgb(0 0 0 / .6);
  --shadow-xs: 0 1px 2px rgb(0 0 0 / .35);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .5);
  --shadow-card: 0 1px 2px rgb(0 0 0 / .3), inset 0 1px 0 rgb(255 255 255 / .03);
  --shadow-pop: 0 2px 6px rgb(0 0 0 / .4), 0 12px 32px -8px rgb(0 0 0 / .6);
  --shadow-lg: 0 4px 12px rgb(0 0 0 / .5), 0 32px 72px -16px rgb(0 0 0 / .7);
  --raised: #2d3548;
}

/* ---------- Font: Geist for Latin and digits, the system Hei for Chinese ---------- */
@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; scrollbar-gutter: stable; scrollbar-color: var(--line-2) transparent; scroll-padding-top: var(--bar-h); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px);
  /* The page: the canvas, with a faint light of the brand colour behind the top bar. */
  background: var(--canvas) radial-gradient(960px 340px at 50% -90px, var(--glow), transparent 72%) no-repeat;
  color: var(--ink);
  font: 400 15px/1.6 var(--font);
  font-variant-numeric: tabular-nums;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
/* Type scale: page title 26/650, dialog title 18/600, block title 16/600, body 15/400, labels, sub-lines and times 14/500.
   Smaller than 14px only where the words are few and set apart: column heads, badges, counts and the notes under a figure
   (13 to 13.5px). */
h1 { font-size: 26px; line-height: 1.25; font-weight: 650; letter-spacing: -.02em; }
h2 { font-size: 16px; line-height: 1.45; font-weight: 600; letter-spacing: -.005em; }
h3, h4 { font-size: 15px; line-height: 1.5; font-weight: 600; }
b, strong { font-weight: 600; }
small { font-size: 14px; }
code, kbd, samp { font-family: var(--mono); font-size: 14px; }
a { color: var(--accent-ink); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
[hidden] { display: none !important; }
::selection { background: color-mix(in oklab, var(--accent) 24%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
/* The text area copyText() selects when the Clipboard API is not there (a page served over plain http). */
.copy-buffer { position: fixed; top: 0; left: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.mono { font-family: var(--mono); font-size: 14px; }
.muted { color: var(--muted); }

/* ---------- Icons (sprite symbols, 1.9 stroke) ---------- */
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
/* The mark: the sprite paints .m-bg with currentColor and lets .m-bar inherit fill (page CSS cannot reach into an external
   <use>): a tile of the brand colour with white bars, lifted a little off the bar. */
.icon.mark { width: 28px; height: 28px; color: var(--mark); fill: #fff; stroke: none; filter: drop-shadow(0 2px 5px color-mix(in oklab, var(--mark) 38%, transparent)); }
.spin { animation: spin 900ms linear infinite; }

/* ---------- Buttons: primary (brand), secondary (outline), danger (red outline, confirm dialogs only), text ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 150ms var(--ease), background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.btn-lg { height: 46px; padding: 0 22px; border-radius: 11px; font-size: 16px; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 14px; }
.btn-sm .icon { width: 16px; height: 16px; }
.btn-block { width: 100%; }
/* The primary button: the brand colour under a light from above, on a short shadow of its own colour. */
.btn-primary { background-color: var(--btn); background-image: linear-gradient(rgb(255 255 255 / .13), rgb(255 255 255 / 0)); color: var(--btn-ink); box-shadow: var(--btn-shadow); }
.btn-secondary { background-color: var(--bg); color: var(--ink); border-color: var(--line-2); box-shadow: var(--shadow-xs); }
.btn-secondary > .icon { color: var(--muted); }
.btn-danger { background-color: var(--bg); color: var(--bad-ink); border-color: var(--bad); box-shadow: var(--shadow-xs); }
.btn:disabled { opacity: .5; box-shadow: none; }
@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled):hover { transform: translateY(-1px); }
  .btn-primary:not(:disabled):hover { background-color: var(--btn-hover); box-shadow: var(--btn-shadow), 0 6px 14px -4px color-mix(in oklab, var(--btn) 55%, transparent); }
  .btn-secondary:not(:disabled):hover { background-color: var(--bg-2); border-color: var(--faint); }
  .btn-danger:not(:disabled):hover { background-color: var(--bad-soft); border-color: var(--bad); }
}
.btn:not(:disabled):active { transform: translateY(1px) scale(.985); transition-duration: 90ms; }

/* A text button reads as a link: the brand's ink, and an underline drawn from left to right on hover. */
.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 calc(100% - 4px);
  background-size: 0 1px;
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  transition: background-size 150ms var(--ease), color 150ms var(--ease);
}
.text-btn .icon { width: 16px; height: 16px; }
.text-btn:disabled { color: var(--muted); opacity: .6; }
@media (hover: hover) and (pointer: fine) {
  .text-btn:not(:disabled):hover { background-size: 100% 1px; }
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.icon-btn[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); }
.icon-btn:disabled { opacity: .45; }
@media (hover: hover) and (pointer: fine) {
  .icon-btn:not(:disabled):not([aria-current="page"]):hover { background: var(--bg-3); color: var(--ink); }
}

/* ---------- Fields ---------- */
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field > span:first-child { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.field small { color: var(--muted); line-height: 1.55; }
.field-error { font-size: 14px; line-height: 1.55; color: var(--bad-ink); }
:is(input:not([type]), input[type="text"], input[type="url"], input[type="password"], input[type="number"], input[type="search"], input[type="email"], input[type="datetime-local"], select, textarea) {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background-color: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
/* A field in use: the brand colour on its edge and a soft halo round it. */
:is(input:not([type]), input[type="text"], input[type="url"], input[type="password"], input[type="number"], input[type="search"], input[type="email"], input[type="datetime-local"], select, textarea):focus-visible {
  border-color: var(--accent);
  outline: 3px solid var(--ring);
  outline-offset: 0;
}
@media (hover: hover) and (pointer: fine) {
  :is(input:not([type]), input[type="text"], input[type="url"], input[type="password"], input[type="number"], input[type="search"], input[type="email"], input[type="datetime-local"], select, textarea):not(:disabled):not(:focus-visible):hover { border-color: var(--faint); }
}
textarea { height: auto; min-height: 76px; padding: 8px 12px; resize: vertical; }
::placeholder { color: var(--muted); opacity: 1; }
:is(input, select, textarea):disabled { background-color: var(--bg-2); color: var(--muted); box-shadow: none; cursor: not-allowed; }
:is(input, select, textarea)[aria-invalid="true"] { border-color: var(--bad); }
select {
  appearance: none;
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }

/* ---------- Controls: switch, segmented control, status dot, facts, tone box, instance tabs ---------- */
/* <button class="switch" role="switch" aria-checked="true|false">. Off: a grey track; on: a green one. Both keep 3:1. */
.switch {
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--switch-off);
  transition: background-color 180ms var(--ease);
}
.switch::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(16 23 40 / .3);
  transition: transform 180ms var(--ease);
}
.switch[aria-checked="true"] { background: var(--good); }
.switch[aria-checked="true"]::before { transform: translateX(16px); }
.switch:disabled { opacity: .5; }

/* .seg holds <button aria-pressed> items, or <label><input type="radio"><span>…</span></label> items. */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; width: fit-content; max-width: 100%; padding: 3px; border-radius: 11px; background: var(--bg-3); }
.seg label { position: relative; display: inline-flex; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg button, .seg label > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 150ms var(--ease), color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.seg button[aria-pressed="true"], .seg input:checked + span { background: var(--raised); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg button:disabled, .seg input:disabled + span { opacity: .45; }
.seg input:disabled { cursor: not-allowed; }
@media (hover: hover) and (pointer: fine) {
  .seg button:not([aria-pressed="true"]):not(:disabled):hover, .seg input:not(:checked):not(:disabled):hover + span { color: var(--ink); }
}

/* A state dot; one that says something wears a halo of its colour. */
.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.dot[data-tone="good"] { background: var(--good); box-shadow: 0 0 0 3px color-mix(in oklab, var(--good) 20%, transparent); }
.dot[data-tone="warn"] { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in oklab, var(--warn) 22%, transparent); }
.dot[data-tone="bad"] { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in oklab, var(--bad) 20%, transparent); }

/* Key-value block to check before confirming: <dl class="facts"><div><dt>…</dt><dd>…</dd></div>…</dl>. */
.facts { display: grid; grid-template-columns: fit-content(40%) minmax(0, 1fr); column-gap: 16px; padding: 4px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-2); }
.facts > div { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--line); }
.facts > div:first-child { border-top: 0; }
.facts dt { font-size: 14px; font-weight: 500; color: var(--muted); }
.facts dd { min-width: 0; color: var(--ink); overflow-wrap: anywhere; }

/* A box in the colour of what it says, amber, or red with data-tone="bad": the lock and the plain HTTP note of the
   settings, and (.sm) the plain HTTP note of an instance card. */
.tone-box { display: flex; gap: 12px; padding: 12px 16px; border: 1px solid color-mix(in oklab, var(--warn) 32%, transparent); border-radius: var(--r-md); background: var(--warn-soft); color: var(--warn-ink); }
.tone-box[data-tone="bad"] { border-color: color-mix(in oklab, var(--bad) 30%, transparent); background: var(--bad-soft); color: var(--bad-ink); }
.tone-box > .icon { width: 16px; height: 16px; }
.tone-box.sm { gap: 8px; padding: 8px 12px; border-radius: var(--r-sm); font-size: 14px; }

/* The tabs that choose an instance (dom.js tabStrip) on the pool page and the settings, which add their own look
   (.pool-tabs and .pool-tab, .inst-tabs and .inst-tab): the instance chosen has aria-selected="true" and a line of the
   brand colour under its name. Where a strip scrolls sideways it shows no scrollbar. */
.tab-strip { display: flex; }
.tab-strip::-webkit-scrollbar { display: none; }
.strip-tab {
  flex: none;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: inset 0 -2px 0 transparent;
  transition: color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.strip-tab:is([aria-selected="true"], [aria-pressed="true"]) { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.strip-tab:focus-visible { outline-offset: -2px; }   /* inside: the strip clips what is drawn outside it */
@media (hover: hover) and (pointer: fine) {
  .strip-tab:is([aria-selected="false"], [aria-pressed="false"]):hover { color: var(--ink); box-shadow: inset 0 -2px 0 var(--line-2); }
}

/* ---------- Shell: skip link, top bar, banner, main column, dock ---------- */
.skip-link {
  position: absolute;
  top: 8px;
  left: max(16px, env(safe-area-inset-left, 0px));
  z-index: 60;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  background: var(--pop);
  color: var(--pop-ink);
  font-weight: 500;
  text-decoration: none;
  transform: translateY(calc(-100% - 16px));
}
/* The shadow only while shown: off screen, its blur would still reach into the page. */
.skip-link:focus { transform: none; box-shadow: var(--shadow-lg); }

/* The top bar: frosted, so that the page shows through it as it scrolls under. */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  flex: none;
  background: var(--glass);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
}
.bar-in { display: flex; align-items: center; gap: 20px; height: var(--bar-h); max-width: var(--wide); margin-inline: auto; padding-inline: var(--gutter); }
.logo { display: inline-flex; align-items: center; gap: 10px; flex: none; min-height: 44px; color: var(--ink); font-size: 16px; font-weight: 650; letter-spacing: .01em; text-decoration: none; white-space: nowrap; }
/* The instance switch, after the logo: the one place where the instance every page shows is chosen. A button that names
   it (the dot is its verdict's colour) behind a slash, as a path reads; under it a menu of the instances, the one shown
   ticked and tinted, each with its address and whether it replenishes, and at its foot the way to the settings. */
.inst-switch { position: relative; display: flex; flex: 0 1 auto; align-items: center; min-width: 0; margin-left: -8px; }
.inst-switch::before { content: "/"; flex: none; margin-right: 6px; color: var(--line-2); font-size: 20px; font-weight: 300; line-height: 1; }
.inst-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 200px;
  height: 36px;
  padding: 0 8px 0 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  transition: background-color 150ms var(--ease);
}
.inst-btn[aria-expanded="true"] { background: var(--bg-3); }
.inst-btn-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inst-btn > .icon { width: 14px; height: 14px; color: var(--muted); transition: transform 150ms var(--ease); }
.inst-btn[aria-expanded="true"] > .icon { transform: rotate(180deg); }
.inst-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  display: grid;
  gap: 2px;
  width: max-content;
  min-width: 260px;
  max-width: min(380px, calc(100vw - 72px));
  max-height: min(440px, calc(100vh - var(--bar-h) - 24px));
  overflow: auto;
  overscroll-behavior: contain;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
  box-shadow: var(--shadow-pop);
  animation: rise 160ms var(--ease);
}
.inst-item { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto 16px; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 6px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); text-align: left; transition: background-color 120ms var(--ease); }
.inst-item[aria-checked="true"] { background: var(--accent-soft); }
.inst-item:focus-visible { outline-offset: -2px; }
.inst-item-text { display: grid; min-width: 0; line-height: 1.4; }
.inst-item-text b { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.inst-item-text small { overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.inst-item-run { color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.inst-item-run[data-off] { color: var(--muted); }
.inst-item > .icon { width: 16px; height: 16px; color: var(--accent-ink); }
.inst-manage { display: flex; align-items: center; gap: 8px; min-height: 40px; margin-top: 4px; padding: 0 10px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; color: var(--ink-2); font-size: 14px; font-weight: 500; text-decoration: none; }
.inst-manage > .icon { width: 16px; height: 16px; color: var(--muted); }
.inst-manage:focus-visible { outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) {
  .inst-btn:hover { background: var(--bg-3); }
  .inst-item:not([aria-checked="true"]):hover, .inst-manage:hover { background: var(--bg-2); }
}

/* The pages: a pill each, the current one in the brand's soft colour. A count is a small badge after the name. */
.tabs { display: flex; align-items: center; gap: 2px; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  transition: color 150ms var(--ease), background-color 150ms var(--ease);
}
.tab > .icon { width: 16px; height: 16px; }
.tab .n { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--bg-3); color: var(--ink-2); font-size: 12.5px; font-weight: 600; line-height: 1; }
.tab[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); }
.tab[aria-current="page"] .n { background: color-mix(in oklab, var(--accent) 16%, transparent); color: var(--accent-ink); }
/* A count that is a problem keeps its colour on any page (its text colour is set with the other state words, below). */
.tab .n[data-tone="good"] { background: var(--good-soft); }
.tab .n[data-tone="warn"] { background: var(--warn-soft); }
.tab .n[data-tone="bad"] { background: var(--bad-soft); }
@media (hover: hover) and (pointer: fine) {
  .tab:not([aria-current="page"]):hover { background: var(--bg-3); color: var(--ink); }
}
.bar-end { display: flex; align-items: center; gap: 6px; margin-left: auto; }
/* #run[data-tone=good|warn|bad] colours the state word; #run-word may start with a small icon. */
.run { display: inline-flex; align-items: center; gap: 8px; height: 36px; margin-right: 6px; padding: 0 6px 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); box-shadow: var(--shadow-xs); }
.run-label { font-size: 14px; font-weight: 500; white-space: nowrap; }
.run-word { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.run-word .icon { width: 14px; height: 14px; }
.run[data-tone="good"] .run-word { color: var(--good-ink); }
.run[data-tone="warn"] .run-word { color: var(--warn-ink); }
.run[data-tone="bad"] .run-word { color: var(--bad-ink); }
/* With several instances the switch gives way to one button for every instance (#run-all: 全部启动 or 全部暂停), after
   自动补号 and how many of them run (#run-word, 1/2). On a phone the label goes, as it does beside the switch. */
.run-all {
  position: relative;
  flex: none;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}
.run-all:disabled { opacity: .45; }
@media (hover: hover) and (pointer: fine) {
  .run-all:not(:disabled):hover { background: var(--bg-3); border-color: var(--faint); }
}

/* #banner[data-tone=info|warn|bad]: an optional .icon, <span>one sentence</span>, then one .text-btn link. Aligned with the main column. */
.banner {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 12px max(var(--gutter), calc((100% - var(--wide)) / 2 + var(--gutter)));
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-2);
  font-weight: 500;
  overflow-wrap: anywhere;
}
.banner[data-tone="warn"] { border-bottom-color: color-mix(in oklab, var(--warn) 30%, transparent); background: var(--warn-soft); color: var(--warn-ink); }
.banner[data-tone="bad"] { border-bottom-color: color-mix(in oklab, var(--bad) 28%, transparent); background: var(--bad-soft); color: var(--bad-ink); }
.banner .icon { width: 16px; height: 16px; }
.banner > span { flex: 1 1 16em; min-width: 0; }
.banner .text-btn { color: inherit; font-size: 15px; font-weight: 600; background-size: 100% 1px; }

.main { flex: 1 0 auto; width: 100%; max-width: var(--wide); margin-inline: auto; padding: 28px var(--gutter) 72px; }
.main:focus { outline: none; }
.view { display: grid; gap: var(--block-gap); align-content: start; min-width: 0; }
.view > * { min-width: 0; }
.view.entering { animation: view-in 220ms var(--ease); }

.dock { display: none; }

/* ---------- Login: one card in the middle of the page ---------- */
.login {
  flex: 1 0 auto;
  display: grid;
  place-items: center;
  padding: 48px 16px;
  background:
    radial-gradient(560px 380px at 16% 10%, color-mix(in oklab, var(--accent) 13%, transparent), transparent 70%),
    radial-gradient(520px 360px at 88% 92%, color-mix(in oklab, var(--good) 9%, transparent), transparent 70%);
}
.login-form { display: grid; width: min(100%, 400px); padding: 36px 32px 32px; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--bg); box-shadow: var(--shadow-pop); }
.login-form .logo { justify-self: start; margin-bottom: 28px; }
.login-form h1 { font-size: 24px; }
.login-sub { margin: 6px 0 24px; color: var(--muted); font-size: 14px; }
.login-form input { height: 46px; }
.login-form .field-error { margin-top: 8px; }
.login-form .field-error:empty { margin-top: 0; }
.login-form .btn { margin-top: 16px; }

/* ---------- Overlays: dialogs, drawer, tray, toast ---------- */
dialog {
  width: min(480px, calc(100% - 32px));
  max-width: calc(100% - 32px);
  max-height: calc(100% - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: auto;
  overscroll-behavior: contain;
}
dialog::backdrop { background: var(--overlay, rgb(16 23 40 / .42)); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
dialog[open] { animation: rise 200ms var(--ease); }
dialog[open]::backdrop { animation: fade-in 200ms var(--ease); }
dialog:focus { outline: none; }
dialog h2 { font-size: 18px; line-height: 1.4; font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; }
dialog p { color: var(--ink-2); }
.dialog-body { display: grid; gap: 16px; padding: 24px 24px 22px; }
/* The buttons of a dialog sit on a band of their own at its foot. */
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--bg-2); }

/* A full-height sheet on the right, sliding in. */
dialog.drawer {
  inset: 0 0 0 auto;
  width: min(440px, 100%);
  max-width: 100%;
  height: auto;
  max-height: none;
  margin: 0;
  border-width: 0 0 0 1px;
  border-radius: var(--r-xl) 0 0 var(--r-xl);
}
dialog.drawer[open] { animation: drawer-in 240ms var(--ease); }

/* #tray: one .tray-sec per operation (manual push, upload):
   <div class="tray-sec"><div class="tray-head">.icon <div class="tray-title"><b>…</b><small>…</small></div> .icon-btn</div>
   <div class="meter"><i></i></div> (fill width from --v, 0 to 1) <ul class="tray-list"><li data-tone="good|warn|bad">.icon <span>…</span></li></ul></div>
   Any [data-tone] inside the tray colours its direct .icon children. */
.tray {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: 16px;
  z-index: 30;
  display: grid;
  gap: 16px;
  width: min(360px, calc(100% - 32px));
  max-height: min(480px, calc(100% - var(--bar-h) - 32px));
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg);
  box-shadow: var(--shadow-pop);
  animation: rise 180ms var(--ease);
}
.tray-sec { display: grid; gap: 8px; min-width: 0; }
.tray-sec + .tray-sec { padding-top: 16px; border-top: 1px solid var(--line); }
.tray-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tray-head > .icon { color: var(--accent); }
.tray-title { display: grid; flex: 1; min-width: 0; line-height: 1.4; }
.tray-title small { color: var(--muted); }
.tray-head .icon-btn { width: 28px; height: 28px; margin: -4px -8px -4px 0; }
.tray-list { display: grid; gap: 4px; max-height: 176px; overflow: auto; font-size: 14px; }
.tray-list li { display: flex; align-items: flex-start; gap: 8px; min-width: 0; color: var(--ink-2); }
.tray-list li > span { min-width: 0; overflow-wrap: anywhere; }
.tray-list .icon { width: 16px; height: 16px; margin-top: 2px; color: var(--muted); }
.tray [data-tone="good"] > .icon { color: var(--good-ink); }
.tray [data-tone="warn"] > .icon { color: var(--warn-ink); }
.tray [data-tone="bad"] > .icon { color: var(--bad-ink); }
.meter { height: 6px; overflow: hidden; border-radius: 999px; background: var(--track); }
.meter > i { display: block; width: calc(var(--v, 0) * 100%); height: 100%; border-radius: inherit; background: var(--accent); transition: width 180ms var(--ease); }
.meter[data-tone="warn"] > i { background: var(--warn); }
.meter[data-tone="bad"] > i { background: var(--bad); }

/* #toast: ink for a normal message, red outline for an error ([data-tone=bad]), amber for a request that changed nothing
   ([data-tone=warn]); may end with a close .icon-btn.
   It is a manual popover (top layer, so it stays above an open dialog): the popover UA rules put it at inset: 0 and
   give it a border, padding and margin, so the top is reset here and the rest is set below. The shell toggles
   `hidden` as well, because the display rule below would otherwise show a closed popover. */
.toast {
  position: fixed;
  top: auto;
  right: 16px;
  bottom: 24px;
  left: 16px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  max-width: 560px;
  margin-inline: auto;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--pop);
  color: var(--pop-ink);
  box-shadow: var(--shadow-pop);
  font-weight: 500;
  overflow-wrap: anywhere;
  animation: rise 180ms var(--ease);
}
.toast[data-tone="bad"] { border-color: var(--bad); background: var(--bad-soft); color: var(--bad-ink); }
.toast[data-tone="warn"] { border-color: var(--warn); background: var(--warn-soft); color: var(--warn-ink); }
.toast .icon-btn { width: 28px; height: 28px; margin: -4px -8px -4px 0; color: inherit; }
@media (hover: hover) and (pointer: fine) {
  .toast .icon-btn:not(:disabled):hover { background: color-mix(in oklab, currentColor 14%, transparent); color: inherit; }
}
/* The toast never covers the tray: it centres in the space left of the tray (on phones it moves under the top bar). */
.tray:not([hidden]) ~ .toast { right: calc(min(360px, 100% - 32px) + 32px); }

@keyframes fade-in { from { opacity: 0; } }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes drawer-in { from { transform: translateX(100%); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Narrow desktop: tighten the top bar so tabs, counts and the switch still fit at 720px ---------- */
@media (max-width: 1199px) {
  /* The names alone: their icons come back in the dock of a phone. */
  .tab > .icon { display: none; }
}
@media (max-width: 1039px) {
  .tabs { min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; gap: 6px; padding: 0 9px; }
  /* The counts are plain figures here: as badges the five pages would not fit beside the two switches. */
  .tabs .tab .n, .tabs .tab .n[data-tone], .tabs .tab[aria-current="page"] .n { min-width: 0; height: auto; padding: 0; background: none; font-size: 14px; font-weight: 500; }
  .inst-btn { max-width: 150px; }
}
@media (max-width: 959px) {
  .bar-in { gap: 12px; }
  .bar-end { flex: none; gap: 2px; }
  .run { margin-right: 2px; padding-left: 12px; }
  /* The auto-replenish switch keeps its state word and gives up its name, as on a phone. */
  .run-label { display: none; }
}
@media (max-width: 899px) {
  /* The mark alone stands for the console; the instance's name follows it without the slash. */
  .logo > span { display: none; }
  .inst-switch { margin-left: -4px; }
  .inst-switch::before { display: none; }
}
@media (max-width: 859px) {
  /* The appearance and the logout are at the foot of the settings page, as on a phone: the five pages fit down to 720px. */
  .bar-end [data-logout], .bar-end [data-theme-toggle] { display: none; }
}

/* ---------- Phones (viewport under 720px): logo, switch and settings on top, five tabs in a dock at the bottom ---------- */
@media (max-width: 719px) {
  :root { --gutter: 16px; --block-gap: 14px; }
  /* A focused control scrolls clear of the fixed dock as well as the sticky top bar. */
  html { scroll-padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px)); }
  .bar-in { gap: 12px; }
  /* The appearance and the logout move to the foot of the settings page. */
  .tabs, .run-label, .bar-end [data-logout], .bar-end [data-theme-toggle] { display: none; }
  .bar-end { gap: 4px; }
  .run { margin-right: 4px; }
  /* The instance's name takes what the two ends of the bar leave, and is cut short there. */
  .inst-switch { flex: 1 1 0; }
  .inst-btn { max-width: 100%; padding-inline: 6px; }
}
@media (max-width: 359px) {
  /* The narrowest phones: the name keeps the room of the arrow and of the bar's wider gaps. */
  .bar-in { gap: 8px; }
  .inst-btn { gap: 6px; }
  .inst-btn > .icon { display: none; }
  .run { gap: 6px; padding-left: 10px; }
}
@media (max-width: 719px) {
  .main { padding: 20px var(--gutter) calc(var(--dock-h) + 32px + env(safe-area-inset-bottom, 0px)); }
  .dock {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    height: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px));
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    border-top: 1px solid var(--line);
    background: var(--glass);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
  }
  .dock a { display: grid; justify-items: center; align-content: center; gap: 1px; min-width: 0; color: var(--muted); font-size: 13px; font-weight: 500; line-height: 1.4; text-decoration: none; }
  .dock a[aria-current="page"] { color: var(--accent-ink); font-weight: 600; }
  /* The icon of the current page sits on a pill of the brand's soft colour. */
  .dock .icon { box-sizing: content-box; width: 20px; height: 20px; padding: 3px 14px; border-radius: 999px; transition: background-color 150ms var(--ease); }
  .dock a[aria-current="page"] .icon { background: var(--accent-soft); }
  /* The label and its count on one line, as in the top bar. */
  .dock a > span { white-space: nowrap; }
  .dock .n { font-weight: 600; }
  .tray { right: 16px; left: 16px; width: auto; bottom: calc(var(--dock-h) + 16px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(var(--dock-h) + 16px + env(safe-area-inset-bottom, 0px)); }
  .tray:not([hidden]) ~ .toast { top: calc(var(--bar-h) + 16px); right: 16px; bottom: auto; }
  dialog.drawer { width: 100%; border-width: 0; border-radius: 0; }
  .login-form { padding: 28px 22px 24px; }
}

/* ---------- Coarse pointers: every target at least 44px (min-* so later sections cannot shrink them) ---------- */
@media (pointer: coarse) {
  .btn, .btn-sm { min-height: 44px; }
  .icon-btn { min-width: 44px; min-height: 44px; }
  :is(input:not([type]), input[type="text"], input[type="url"], input[type="password"], input[type="number"], input[type="search"], input[type="email"], input[type="datetime-local"], select) { min-height: 44px; }
  .seg button, .seg label > span { min-height: 44px; }
  .tab, .dock a, .logo, .inst-btn, .inst-manage { min-height: 44px; }
  .tab-strip .strip-tab { min-height: 44px; }   /* over the 40px of a pool tab */
  /* Text buttons, the switch and the button for every instance keep their look and get a 44px hit area. */
  .text-btn { position: relative; }
  .text-btn::after { content: ""; position: absolute; inset: -8px -4px; }
  .switch::after { content: ""; position: absolute; inset: -11px -4px; }
  .run-all::after { content: ""; position: absolute; inset: -9px -4px; }
}

/* ---------- Reduced motion: every change is instant ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::backdrop {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
  .btn:not(:disabled):hover, .btn:not(:disabled):active { transform: none; }
}

/* ---------- No blur behind a surface: the bars are opaque ---------- */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .bar, .dock { background: var(--bg); }
}

/* ---------- Forced colours: keep the dots, the switch, the meters and the current page visible ---------- */
@media (forced-colors: active) {
  .dot { forced-color-adjust: none; box-shadow: none; }
  .switch { border-color: ButtonText; }
  .switch::before { forced-color-adjust: none; background: ButtonText; box-shadow: none; }
  .switch[aria-checked="true"] { forced-color-adjust: none; border-color: Highlight; background: Highlight; }
  .switch[aria-checked="true"]::before { background: HighlightText; }
  .switch:disabled { border-color: GrayText; }
  .switch:disabled::before { background: GrayText; }
  .seg { border: 1px solid CanvasText; }
  .seg button[aria-pressed="true"], .seg input:checked + span { forced-color-adjust: none; background: Highlight; color: HighlightText; }
  .tab[aria-current="page"], .dock a[aria-current="page"] { text-decoration-line: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
  .inst-menu { border-color: CanvasText; }
  .inst-item[aria-checked="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
  .meter > i { forced-color-adjust: none; background: CanvasText; }
  .tone-box { border: 1px solid CanvasText; }
  .btn-primary { border-color: ButtonText; }
}

/* ---------- View sections (overview, remote, stock, history, settings) follow below. ---------- */

/* ===== 总览 ===== */
/* The verdict: .hero[data-tone=neutral|good|warn|bad] holds .hero-ic and .hero-body (small status line, h1, text and
   .hero-extras with the connection form, the key help and .hero-actions). Below it come the blocks .blk, each a card:
   conditions, schedulable accounts, and .duo with the things to look at and the recent activity.
   The verdict is the one card that takes the colour of its state: a wash of it from the corner of its icon, and its edge. */
.hero {
  --tone: var(--faint);
  --tone-ink: var(--muted);
  --tone-soft: var(--bg-3);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 24px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: linear-gradient(125deg, var(--tone-soft), transparent 58%) var(--bg);
  box-shadow: var(--shadow-card);
}
.hero[data-tone="good"] { --tone: var(--good); --tone-ink: var(--good-ink); --tone-soft: var(--good-soft); }
.hero[data-tone="warn"] { --tone: var(--warn); --tone-ink: var(--warn-ink); --tone-soft: var(--warn-soft); border-color: color-mix(in oklab, var(--warn) 38%, var(--line)); }
.hero[data-tone="bad"] { --tone: var(--bad); --tone-ink: var(--bad-ink); --tone-soft: var(--bad-soft); border-color: color-mix(in oklab, var(--bad) 36%, var(--line)); }
.hero-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--bg); color: var(--tone-ink); box-shadow: 0 0 0 1px color-mix(in oklab, var(--tone) 30%, var(--line)), var(--shadow-sm); }
.hero-ic .icon { width: 26px; height: 26px; }
.hero-body { display: grid; gap: 12px; min-width: 0; }
.hero-extras { display: contents; }

.hero-eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--muted); font-size: 14px; font-weight: 500; line-height: 1.6; }
.hero[data-tone="warn"] .hero-eyebrow, .hero[data-tone="bad"] .hero-eyebrow { color: var(--ink-2); }
.hero-seats { display: flex; margin-bottom: 4px; font-variant-numeric: tabular-nums; }   /* 号池 45/50 (caps design 5.2) */
.eb-read { display: inline-flex; align-items: center; gap: 4px; }
.eb-read::before { content: "·"; margin-right: 4px; }
.eb-run[hidden] + .eb-read::before { content: none; }   /* nothing before it to be set apart from */
.eb-read .icon { width: 14px; height: 14px; }
.eb-host { min-width: 0; overflow-wrap: anywhere; }
.hero-eyebrow .text-btn { margin-left: 8px; }

.hero h1 { font-size: 30px; line-height: 1.28; font-weight: 650; letter-spacing: -.022em; text-wrap: balance; overflow-wrap: anywhere; }
.hero-text { max-width: 46em; color: var(--ink-2); font-size: 16px; line-height: 1.7; overflow-wrap: anywhere; }
.hero-more { max-width: 46em; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); color: var(--ink-2); line-height: 1.7; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 8px; }
.hero-act { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; }
.hero-reason { color: var(--ink-2); font-size: 14px; }
/* The connection form of "连接你的 Sub2API 实例": two fields and the one primary button. */
.setup { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 12px; max-width: 780px; margin-top: 8px; }
.setup input { height: 46px; }

/* A block: a card with a head (the title, a grey remark and an optional link or button on the right) and its content. */
.blk { display: grid; align-content: start; gap: 16px; min-width: 0; padding: 22px 24px 24px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg); box-shadow: var(--shadow-card); }
.blk[data-stale] :is(.conds, .accs, .others) { opacity: .5; }
.blk-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.blk-head .meta { color: var(--muted); font-size: 14px; }
.blk-head .end { align-self: center; margin-left: auto; }
.blk-acts { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }

/* Replenish conditions: three readings, each a panel with its state, a big number, a gauge with its line, and its rule.
   .cond[data-tone=good|warn|bad] is 正常 / 接近触发 / 已触发 (no tone: the reading is not judged). Green stays small:
   the dot, the word and the bar; a reading near or past its line takes the colour in its number and on its panel.
   Set by the script, 0 to 1: the gauge length (--v), the tick (--t), and on .gauge the zone where the rule fires
   (--z0 to --z1), tinted in the track so the bad end of every bar shows without reading the rule. */
.conds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.cond {
  display: grid; align-content: start; gap: 8px; min-width: 0; --tone: var(--muted); --tone-ink: var(--ink);
  --panel: var(--bg-2);
  /* The projected load's colour: the tone of the reading, lighter (.gauge > em and the swatch of its note). */
  --proj: color-mix(in oklab, var(--tone) 40%, var(--bg-3));
  padding: 18px 20px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel);
}
.cond[data-tone="good"] { --tone: var(--good); --tone-ink: var(--good-ink); }
.cond[data-tone="warn"] { --tone: var(--warn); --tone-ink: var(--warn-ink); --panel: color-mix(in oklab, var(--warn-soft) 60%, var(--bg)); border-color: color-mix(in oklab, var(--warn) 36%, var(--line)); }
.cond[data-tone="bad"] { --tone: var(--bad); --tone-ink: var(--bad-ink); --panel: color-mix(in oklab, var(--bad-soft) 60%, var(--bg)); border-color: color-mix(in oklab, var(--bad) 34%, var(--line)); }
.cond-label { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 14px; font-weight: 500; }
.cond-state { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; color: var(--tone-ink); white-space: nowrap; }
.cond-state::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 3px color-mix(in oklab, var(--tone) 20%, transparent); }
.cond-value { font-size: 36px; font-weight: 650; line-height: 1.1; letter-spacing: -.025em; }
.cond:is([data-tone="warn"], [data-tone="bad"]) .cond-value .n { color: var(--tone-ink); }
.cond-value small { margin-left: 4px; color: var(--muted); font-size: 16px; font-weight: 500; letter-spacing: 0; }
.cond-value .pct { margin-left: 1px; }
.cond-value .na { color: var(--muted); font-size: inherit; }
.gauge {
  --zone: color-mix(in oklab, var(--bad) 26%, transparent);
  position: relative; height: 8px; margin-top: 24px; border-radius: 999px;
  background: linear-gradient(to right, var(--track) calc(var(--z0, 0) * 100%), var(--zone) 0 calc(var(--z1, 0) * 100%), var(--track) 0);
}
.gauge > i { position: absolute; inset: 0 auto 0 0; width: calc(var(--v, 0) * 100%); border-radius: inherit; background: var(--tone); }
/* The projected load: a lighter stretch from the start of the bar to where the load will be once the leaving accounts are
   gone. It lies under the fill (first in the bar), so only the part past the load shows, like a buffered stretch. */
.gauge > em { position: absolute; inset: 0 auto 0 0; width: calc(var(--p, 0) * 100%); border-radius: inherit; background: var(--proj); }
.gauge > b { position: absolute; top: -4px; bottom: -4px; left: calc(var(--t, 0) * 100%); width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink); box-shadow: 0 0 0 2px var(--panel); }
.gauge > b::after { content: attr(data-label); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); color: var(--ink-2); font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.gauge > b[data-edge="start"]::after { left: 0; transform: none; }
.gauge > b[data-edge="end"]::after { right: 0; left: auto; transform: none; }
.cond-rule { color: var(--muted); font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
/* The note that gives the projected load starts with a swatch of its stretch in the bar. */
.cond-note.proj::before { content: ""; display: inline-block; width: 14px; height: 6px; margin-right: 8px; border-radius: 999px; background: var(--proj); vertical-align: .15em; }
/* What bounds the pushes, as label and value pairs; a value that is a problem takes its colour ([data-tone]). */
.cond-facts { display: flex; flex-wrap: wrap; gap: 8px 32px; font-size: 14px; }
.cond-facts li { display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; }
.cond-facts span { color: var(--muted); }
.cond-facts b { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.cond-facts [data-tone="warn"] b { color: var(--warn-ink); }
.cond-facts [data-tone="bad"] b { color: var(--bad-ink); }
.rehearsal { display: flex; align-items: flex-start; gap: 8px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-2); color: var(--ink-2); line-height: 1.6; overflow-wrap: anywhere; }
.rehearsal .icon { width: 16px; height: 16px; margin-top: 4px; color: var(--accent); }

/* The schedulable accounts: one row each (a button that opens the account), most quota left first, under grey column
   names. Over six of them, wide screens show two columns read top to bottom (--rows, set by the script, is the number of
   rows). Under the list, one line sums up the accounts that cannot be scheduled, each group a link to its filter, with the
   swatch of its colour (.sw). */
.acc-heads, .accs { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 40px; }
.acc-head, .acc { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) 64px; align-items: center; gap: 16px; }
.acc-head { padding: 0 10px 8px; color: var(--muted); font-size: 13px; font-weight: 500; }
.acc-head > :last-child { text-align: right; }
.acc-head-2 { display: none; }
.acc {
  width: 100%;
  min-height: 46px;
  padding: 9px 10px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
  color: var(--ink);
  text-align: left;
  transition: background-color 120ms var(--ease);
}
.acc:focus-visible { outline-offset: -2px; background: var(--bg-2); }
@media (hover: hover) and (pointer: fine) {
  .acc:hover { background: var(--bg-2); }
}
.acc-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
/* The name on a line of its own, the id and the flags under it, whatever the length of the name. */
.acc-who b { flex-basis: 100%; min-width: 0; max-width: 100%; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.acc-who small { color: var(--muted); font-size: 14px; }
.acc-q { min-width: 0; }
.acc-load { color: var(--ink-2); text-align: right; white-space: nowrap; }
.acc-none { color: var(--bad-ink); font-weight: 500; }
.others { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.others .text-btn { gap: 8px; }
@media (min-width: 1100px) {
  :is(.acc-heads, .accs)[data-cols="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .accs[data-cols="2"] { grid-template-rows: repeat(var(--rows), auto); grid-auto-flow: column; }
  .acc-heads[data-cols="2"] .acc-head-2 { display: grid; }
}
.sw { flex: none; width: 8px; height: 16px; border-radius: 3px; }
.sw[data-k="limited"] { background: var(--warn-soft); outline: 1.5px solid var(--warn); outline-offset: -1.5px; }
.sw[data-k="paused"] { background: repeating-linear-gradient(135deg, var(--line-2) 0 2px, transparent 2px 4px); outline: 1px solid var(--line-2); outline-offset: -1px; }
.sw[data-k="problem"] { background: var(--bad-soft); outline: 1.5px solid var(--bad); outline-offset: -1.5px; }
.sw[data-k="shadow"] { background: transparent; outline: 1px solid var(--line-2); outline-offset: -1px; }

/* Things to look at (each one a button) beside the recent activity, two cards of one height; stacked under 1000px. */
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: var(--block-gap); }
.duo.solo { grid-template-columns: minmax(0, 1fr); }
.todo { display: grid; }
.todo button { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: start; gap: 12px; width: 100%; padding: 12px 0; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); text-align: left; }
.todo li:first-child button { padding-top: 4px; border-top: 0; }
.todo .icon { margin-top: 2px; }
.todo [data-tone="bad"] > .icon:first-child { color: var(--bad-ink); }
.todo [data-tone="warn"] > .icon:first-child { color: var(--warn-ink); }
.todo [data-tone="info"] > .icon:first-child { color: var(--accent); }
.todo .tx { display: grid; min-width: 0; overflow-wrap: anywhere; }
.todo .t { font-weight: 500; }
.todo .s { color: var(--muted); font-size: 14px; }
.todo .go { color: var(--faint); transition: transform 150ms var(--ease), color 150ms var(--ease); }
@media (hover: hover) and (pointer: fine) {
  .todo button:hover .go { transform: translateX(3px); color: var(--accent); }
  .todo button:hover .t { text-decoration: underline; text-underline-offset: 3px; }
}
/* A thing to look at with nowhere to go in the console: said like the others, without the arrow. */
.todo .todo-say { display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); color: var(--ink); }
.todo li:first-child .todo-say { padding-top: 4px; border-top: 0; }
/* The things to look at of several instances end, past the fifth, with how many more there are. */
.todo-more { padding: 12px 0 0 32px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.calm { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.calm .icon { color: var(--good-ink); }
.feed { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 16px; }
.feed li { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; padding: 8px 0; border-top: 1px solid var(--line); color: var(--ink-2); }
.feed li:first-child { padding-top: 4px; border-top: 0; }
.feed li > span { min-width: 0; overflow-wrap: anywhere; }
.feed li[data-level="error"] > span { color: var(--bad-ink); }
.feed time { color: var(--muted); font-size: 14px; }
.feed em { color: var(--muted); font-style: normal; }

/* Several instances (design 5.8): a card for each (.inst-card, in the order of the settings), three to a row, more wrap;
   two under 1000px, one on a phone. The name (.ic-pick) is a button whose hit area covers its card, so a click anywhere on
   it shows that instance below; the card's own buttons (.ic-acts) and the link of its plain HTTP note sit above that area.
   The instance shown has aria-current="true" on its name's button and data-shown on the card: a ring of the brand colour.
   State words take the tone of their instance as everywhere: amber the system settles, red needs someone, grey is off. */
.inst-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.inst-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg);
  box-shadow: var(--shadow-card);
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.inst-card[data-shown] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--ring), var(--shadow-card); }
.ic-pick { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; min-width: 0; padding: 0; border: 0; background: none; color: var(--ink); text-align: left; }
.ic-pick::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-lg); }
.ic-pick:focus-visible { outline: none; }
.ic-pick:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 3px; }
.ic-name { min-width: 0; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.ic-host { min-width: 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.ic-about { display: grid; gap: 6px; min-width: 0; }
.ic-state { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; overflow-wrap: anywhere; }
.ic-state .dot { margin-top: 8px; }
.ic-state[data-tone="warn"] .ic-title { color: var(--warn-ink); }
.ic-state[data-tone="bad"] .ic-title { color: var(--bad-ink); }
.ic-run { color: var(--muted); white-space: nowrap; }
.ic-run::before { content: "·"; margin: 0 6px; }
.ic-readings { display: flex; flex-wrap: wrap; gap: 0 16px; color: var(--ink-2); font-size: 14px; }
.ic-readings [data-tone="warn"] { color: var(--warn-ink); }
.ic-readings [data-tone="bad"] { color: var(--bad-ink); }
.ic-next { color: var(--muted); font-size: 14px; }
.ic-next[data-tone="warn"] { color: var(--warn-ink); }
/* The plain HTTP note, a small .tone-box. */
.ic-exposure { align-items: flex-start; overflow-wrap: anywhere; }
.ic-exposure .icon { margin-top: 3px; }
.ic-exposure a { position: relative; z-index: 1; color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
/* Only the buttons take the pointer: a click between them still shows the instance. */
.ic-acts { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; pointer-events: none; }
.ic-acts > * { pointer-events: auto; }
@media (hover: hover) and (pointer: fine) {
  .inst-card:not([data-shown]):hover { border-color: var(--faint); box-shadow: var(--shadow-pop); }
}

@media (max-width: 999px) {
  .duo { grid-template-columns: minmax(0, 1fr); }
  .inst-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 719px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 22px 20px 24px; }
  .hero-ic { width: 44px; height: 44px; border-radius: 14px; }
  .hero-ic .icon { width: 22px; height: 22px; }
  .hero h1 { font-size: 24px; }
  .hero-text { font-size: 15px; }
  .hero-eyebrow .text-btn { order: 2; margin-left: 8px; }
  .eb-read { order: 3; flex-basis: 100%; }
  .eb-read::before { display: none; }
  /* With no run state before it, the time of the last read and the button share the line. */
  .eb-run[hidden] ~ .eb-read { order: 1; flex-basis: auto; }
  .eb-run[hidden] ~ .text-btn { margin-left: 4px; }
  .eb-host { order: 4; flex-basis: 100%; }
  .hero-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .hero-actions .btn { width: 100%; }
  .hero-actions .text-btn { justify-self: start; }
  .hero-act { display: grid; }
  .setup { grid-template-columns: minmax(0, 1fr); }
  .blk { padding: 18px 16px 20px; }
  .conds { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .cond { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: 12px; padding: 16px; }
  .cond-label { grid-column: 1; grid-row: 1; }
  .cond-value { grid-column: 2; grid-row: 1; font-size: 28px; }
  .cond-state { margin-left: 0; }
  .cond .gauge, .cond-rule { grid-column: 1 / -1; }
  .cond-facts { gap: 4px 24px; }
  .acc-heads { display: none; }
  .acc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 0; }
  .accs > .acc:first-child { border-top: 0; padding-top: 0; }
  .acc-who { flex: 1 1 60%; }
  .acc-who b { flex-basis: auto; white-space: normal; overflow-wrap: anywhere; }
  .acc-load { flex: none; order: 1; margin-left: auto; }   /* on the line of the name */
  .acc-q { order: 2; }   /* under the name, each window as on the pool page (its quota cells, below) */
  .inst-cards { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}

@media (forced-colors: active) {
  .sw { forced-color-adjust: none; }
  .acc:focus-visible { outline: 2px solid Highlight; }
  .gauge { border: 1px solid CanvasText; }
  .gauge > i, .gauge > b, .cond-state::before { forced-color-adjust: none; background: CanvasText; box-shadow: none; }
  .gauge > em, .cond-note.proj::before { forced-color-adjust: none; background: GrayText; }
  .inst-card[data-shown] { outline: 2px solid Highlight; outline-offset: -2px; }
}

/* ===== 对话框：手动推送、账号详情（总览、号池、库存共用）===== */
/* With several instances the push dialog asks where first: one row per instance, one that cannot take the push greyed with
   its reason. The row chosen takes the brand colour. */
.push-to { display: grid; gap: 8px; }
.push-to legend { margin-bottom: 8px; padding: 0; color: var(--ink-2); font-size: 14px; font-weight: 500; }
.push-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-height: 42px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); cursor: pointer; transition: border-color 150ms var(--ease), background-color 150ms var(--ease); }
.push-pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.push-pick[data-off] { border-color: var(--line); background: var(--bg-2); color: var(--muted); cursor: not-allowed; }
.push-name { min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.push-why { color: var(--ink-2); }
/* Manual push: a stepper (.step buttons around a number input), or the list of chosen accounts. */
.stepper { display: inline-grid; grid-template-columns: 40px 72px 40px; width: fit-content; overflow: hidden; border: 1px solid var(--line-2); border-radius: var(--r-sm); box-shadow: var(--shadow-xs); }
.stepper:focus-within { border-color: var(--accent); outline: 3px solid var(--ring); outline-offset: 0; }
.stepper .step { display: grid; place-items: center; height: 40px; padding: 0; border: 0; background: var(--bg-2); color: var(--ink-2); }
.stepper input { height: 40px; padding: 0; border: 0; border-inline: 1px solid var(--line-2); border-radius: 0; box-shadow: none; text-align: center; font-size: 17px; font-weight: 600; appearance: textfield; -moz-appearance: textfield; }
.stepper input:focus-visible { border-color: var(--line-2); outline: none; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
.stepper .step:disabled { opacity: .45; }
@media (hover: hover) and (pointer: fine) {
  .stepper .step:not(:disabled):hover { background: var(--bg-3); color: var(--ink); }
  .stepper input:not(:disabled):not(:focus-visible):hover { border-color: var(--line-2); }
  .push-pick:not([data-off]):not(:has(input:checked)):hover { border-color: var(--faint); }
}
@media (pointer: coarse) {
  .push-pick { min-height: 44px; }
  .stepper { grid-template-columns: 44px 72px 44px; }
  .stepper .step, .stepper input { height: 44px; }
}
.ref-list { display: grid; gap: 4px; padding: 10px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-2); }
.ref-list li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-list .more { color: var(--muted); }

/* Account drawer: head with the id and the name, the state in one line, a key-value list, a read-only note. */
dialog.drawer[open] { display: flex; flex-direction: column; }
.dr-head { position: sticky; top: 0; z-index: 1; display: flex; flex: none; align-items: flex-start; gap: 12px; padding: 24px 16px 18px 24px; border-bottom: 1px solid var(--line); background: var(--bg); }
.dr-head > div { display: grid; flex: 1; gap: 4px; min-width: 0; }
.dr-head small { color: var(--muted); }
.dr-body { display: grid; flex: 1 0 auto; align-content: start; gap: 24px; padding: 24px; }
/* The state line is the badge of the pool list (.pill), and beside it the one fact that explains it. */
.dr-state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; color: var(--ink-2); }
.kv { display: grid; }
.kv > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.kv > div:first-child { padding-top: 0; border-top: 0; }
.kv dt { color: var(--muted); font-size: 14px; font-weight: 500; }
.kv dd { overflow-wrap: anywhere; }
.dr-note { padding: 12px 14px; border-radius: var(--r-sm); background: var(--bg-2); color: var(--muted); font-size: 14px; }
/* 状态记录: when the account took on each state, newest first; what was noted with it on a line of its own. */
.dr-hist { display: grid; gap: 8px; margin-top: 24px; }
.dr-hist h3 { font-size: 15px; font-weight: 600; }
.dr-states li { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: baseline; gap: 2px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.dr-states li:first-child { padding-top: 0; border-top: 0; }
.dr-states time { color: var(--muted); font-size: 14px; }
.dr-states small { grid-column: 2; color: var(--muted); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }

/* ===== 号池 ===== */
/* A page head (.ph: title with a grey line, buttons at the end), an optional note line with its long text (.more),
   the filter chips with the search and the sort, the account table (.list.pool) in its card and the pager. The page head,
   the chips, the table (grey sticky head, rows divided by lines, the state badge .pill) and the pager are written to be
   reused by the stock page. Under 720px a row of the table is a card of two lines. */
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.stack > * { min-width: 0; }
.ph { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-bottom: 4px; }
.ph > div:first-child { min-width: 0; }
.ph .meta { margin-top: 4px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
/* A count in the head that is a problem takes its colour (the stock page's pushable count, as on the overview). */
.ph .meta-n:is([data-tone="warn"], [data-tone="bad"]) { font-weight: 500; }
.ph .end { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
/* With several instances a strip of tabs under the title chooses the instance (.tab-strip, under the controls). It scrolls
   sideways inside itself when they do not fit, on a phone edge to edge like the filter chips. */
.pool-tabs { gap: 4px; overflow-x: auto; scrollbar-width: none; scroll-padding-inline: 8px; box-shadow: inset 0 -1px 0 var(--line); }
.pool-tab { max-width: 16em; min-height: 40px; padding: 0 14px; overflow: hidden; text-overflow: ellipsis; }

/* A line of remark on the page: a strip of surface with the brand's info mark. */
.note-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); color: var(--ink-2); box-shadow: var(--shadow-xs); }
.note-line > .icon { width: 16px; height: 16px; color: var(--accent); }
.note-line > span { flex: 1 1 20em; min-width: 0; overflow-wrap: anywhere; }
.more { display: grid; gap: 12px; padding: 4px 0 4px 16px; border-left: 2px solid var(--accent-line); color: var(--ink-2); line-height: 1.7; overflow-wrap: anywhere; }
.more b { display: block; color: var(--ink); }

/* The filters: a pill each, on the page; the one in use takes the brand's soft colour and its edge. */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease);
}
.chip .n { color: var(--muted); font-size: 13px; font-weight: 500; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); box-shadow: none; }
.chip[aria-pressed="true"] .n { color: color-mix(in oklab, var(--accent-ink) 78%, transparent); }
@media (hover: hover) and (pointer: fine) {
  .chip:not([aria-pressed="true"]):hover { border-color: var(--faint); color: var(--ink); }
}
.tools-end { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.search { position: relative; width: 260px; }
.search > .icon { position: absolute; top: 50%; left: 12px; width: 16px; height: 16px; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.search input[type="search"] { padding-left: 36px; }
.tools-end select { width: auto; min-width: 180px; }

/* The card a list sits in (the pool, the stock, the pushes, the run log). It clips its corners without becoming a
   scroll container, so that the head of its table still sticks under the top bar. */
.pool-list, .stock-list, .hist, .log-list { min-width: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg); box-shadow: var(--shadow-card); overflow: clip; }

/* The account table. Fixed layout: a long name is cut with an ellipsis, never pushes the page wider. Separate borders, so
   that the grey head keeps its line while it sticks under the top bar (desktop only). */
.list { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.list th { height: 42px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--bg-2); color: var(--muted); font-size: 13px; font-weight: 500; text-align: left; white-space: nowrap; }
.list td { min-width: 0; padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
/* The last row needs no line: the edge of its card is there. */
.list > tbody:last-child > tr:last-child > :is(td, th) { border-bottom: 0; }
/* A table row's height is its minimum. A row brought into view by the keyboard clears the sticky head. */
.list tbody tr { height: 56px; scroll-margin-top: 44px; cursor: pointer; transition: background-color 120ms var(--ease); }
.list tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--bg-2); }
@media (hover: hover) and (pointer: fine) {
  .list tbody tr:hover { background: var(--bg-2); }
}
.list tbody tr:active { background: var(--bg-2); }
/* A table that is read, not clicked (the pushes, the batches): no pointer, and no row lights up under it or a tap. */
.list.read tbody tr { cursor: default; }
.list.read tbody tr:is(:hover, :active) { background: none; }
@media (min-width: 720px) {
  .list thead th { position: sticky; top: var(--bar-h); z-index: 2; }
}
/* A browser without overflow: clip rounds the card with overflow: hidden, in which a head cannot stick: it stays put. */
@supports not (overflow: clip) {
  .pool-list, .stock-list, .hist, .log-list { overflow: hidden; }
  .list thead th { position: static; }
}
/* A head that sorts is a button filling the cell; the arrow shows on the column in use, turned down when it runs from
   high to low (design 5.15). */
.th-sort { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.th-sort .th-arrow { display: none; width: 14px; height: 14px; color: var(--accent); }
th[aria-sort="ascending"] .th-sort, th[aria-sort="descending"] .th-sort { color: var(--ink); }
th[aria-sort="ascending"] .th-arrow, th[aria-sort="descending"] .th-arrow { display: block; }
th[aria-sort="descending"] .th-arrow { transform: rotate(180deg); }
@media (hover: hover) and (pointer: fine) {
  .th-sort:hover { color: var(--ink); }
}
/* The select of the sorts with the button that turns the order over. */
.sort { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sort select { flex: 1 1 auto; }
.list.pool .k-who { width: 26%; }
.list.pool .k-st { width: 18%; }
.list.pool .k-q { width: 16%; }
.list.pool .k-load { width: 10%; }
.list.pool .k-upd { width: 14%; }
@media (max-width: 1099px) {
  /* The name and the state give the two quota windows room for their reset time on one line. */
  .list.pool .k-who { width: 23%; }
  .list.pool .k-st { width: 16%; }
  .list.pool .k-q { width: 18%; }
}
@media (max-width: 959px) {
  .list th, .list td { padding-inline: 10px; }
  /* Room for a concurrency like "28 / 60" at 15px. */
  .list.pool .k-who { width: 24%; }
  .list.pool .k-load { width: 12%; }
}

/* The name, and under it the id, the priority and the groups. */
.who { display: grid; gap: 2px; min-width: 0; }
.who b { min-width: 0; overflow: hidden; color: var(--ink); font-size: 15px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.who-meta { color: var(--muted); font-size: 14px; line-height: 1.5; }
/* The state badge (also in the stock table): grey with a light dot; the dot alone marks an available account (ok, green)
   and a record that can be pushed (ready, the brand colour); an exception colours the whole badge (good, warn, bad), with a
   hairline of its colour round it. */
.pill { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 24px; padding: 0 10px 0 8px; border-radius: 999px; background: var(--bg-3); color: var(--ink-2); font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap; }
.pill::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.pill[data-tone="ok"]::before { background: var(--good); }
.pill[data-tone="ready"]::before { background: var(--accent); }
.pill[data-tone="good"] { background: var(--good-soft); color: var(--good-ink); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--good) 24%, transparent); }
.pill[data-tone="good"]::before { background: var(--good); }
.pill[data-tone="warn"] { background: var(--warn-soft); color: var(--warn-ink); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--warn) 30%, transparent); }
.pill[data-tone="warn"]::before { background: var(--warn); }
.pill[data-tone="bad"] { background: var(--bad-soft); color: var(--bad-ink); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--bad) 24%, transparent); }
.pill[data-tone="bad"]::before { background: var(--bad); }
/* The badge, and under it the recovery time, the reason and the notes. */
.st { display: grid; justify-items: start; gap: 4px; min-width: 0; }
.st-sub { color: var(--muted); font-size: 14px; line-height: 1.5; }
/* A grey word that only an exception colours (the records page uses it). */
/* A state written inline: a dot and the word, like the readings of the overview and the connection line of the settings;
   badges (.pill) are for the state column of a table. */
.st-word { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; font-weight: 500; }
.st-word::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.st-word[data-tone="good"]::before { background: var(--good); }
.st-word[data-tone="warn"]::before { background: var(--warn); }
.st-word[data-tone="bad"]::before { background: var(--bad); }
/* Words and figures in the colour of their state ([data-tone]): the account drawer's values, the stock page's count,
   inline state words, the survival rates of the 统计 tab, and the counts of the top bar and the dock (no schedulable
   account, the stock low or out). One rule set, so a colour changes in one place. */
:is(.kv dd, .ph .meta-n, .st-word, .rate, .h-fate, .tab .n, .dock .n)[data-tone="good"] { color: var(--good-ink); }
:is(.kv dd, .ph .meta-n, .st-word, .rate, .h-fate, .tab .n, .dock .n)[data-tone="warn"] { color: var(--warn-ink); }
:is(.kv dd, .ph .meta-n, .st-word, .rate, .h-fate, .tab .n, .dock .n)[data-tone="bad"] { color: var(--bad-ink); }
/* A quota reading: a bar of at most 120 x 6 and the figure, the reset time under them. The bar is the brand's quiet
   colour, amber at or under the threshold and at 0, where the figure is amber too: a spent window resets by itself, so
   it is held back (amber, like its 受限 badge and on the overview), not a problem (red). The list colours only the
   exceptions; the green of a sound account is the dot of its badge. */
.q { display: grid; grid-template-columns: minmax(0, 120px) 3em; justify-content: start; align-items: center; gap: 2px 10px; min-width: 0; }
.mini { position: relative; height: 6px; overflow: hidden; border-radius: 999px; background: var(--track); }
.mini > i { position: absolute; inset: 0 auto 0 0; width: calc(var(--v, 0) * 100%); border-radius: inherit; background: var(--bar-fill); }
.q[data-lv="low"] .mini > i { background: var(--warn); }
.q[data-lv="zero"] .mini > i { background: var(--warn); }
.q b { color: var(--ink); font-size: 15px; font-weight: 600; text-align: right; white-space: nowrap; }
.q[data-lv="zero"] b { color: var(--warn-ink); }
.q-reset { grid-column: 1 / -1; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
/* In the pool table a window with quota to spare says its bar and its figure; when it resets matters once it is low or
   spent, and is shown only then (the cell's tooltip and the drawer have it for every window). */
.list.pool .q[data-lv="ok"] .q-reset { display: none; }
/* In a row where the other window does show its reset time, this one keeps an empty line of the same height, so that the
   two bars stay level. */
.list.pool tr:has(.q[data-lv="low"], .q[data-lv="zero"]) .q[data-lv="ok"]::after { content: "\00a0"; grid-column: 1 / -1; font-size: 13.5px; line-height: 1.45; }
.na { color: var(--muted); font-size: 14px; }
.c-load { color: var(--ink-2); font-size: 15px; white-space: nowrap; }
.c-upd { color: var(--ink-2); font-size: 14px; white-space: nowrap; }
.upd-stale { display: block; color: var(--warn-ink); font-size: 13.5px; line-height: 1.45; }

.pool-list { transition: opacity 150ms var(--ease); }
.pool-list[data-loading] { opacity: .6; }
.empty { display: grid; justify-items: center; gap: 8px; padding: 56px 16px; color: var(--muted); text-align: center; }
.empty b { color: var(--ink); font-size: 16px; font-weight: 600; }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.pager small { color: var(--muted); }
.pager-nav { display: flex; align-items: center; gap: 8px; }
.pager-nav span { min-width: 56px; color: var(--ink-2); font-size: 14px; text-align: center; white-space: nowrap; }
.btn-icon { width: 40px; padding: 0; }

@media (max-width: 719px) {
  .ph .end { width: 100%; margin-left: 0; }
  .ph .end .btn { flex: 1; }
  /* The chips scroll sideways, edge to edge. */
  .chips { flex-wrap: nowrap; margin-inline: calc(-1 * var(--gutter)); padding: 2px var(--gutter); overflow-x: auto; scroll-padding-inline: var(--gutter); scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .pool-tabs { margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter); }
  /* A remark keeps its mark beside its first line; only its link or button may go under it. */
  .note-line { align-items: flex-start; }
  .note-line > .icon { margin-top: 4px; }
  .note-line > span { flex-basis: 12em; }
  .toolbar { gap: 12px; }
  .tools-end { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: 100%; margin-left: 0; }
  .search { width: auto; }
  .tools-end select { min-width: 0; }
  /* A row is a card. Here three lines: the whole name (broken where it must be) with the id under it and the state badge on
     the right, the explanation of the state across the whole width, then the 5 hour and the 7 day reading under small
     labels; the reset times, the concurrency and the update time are in the drawer. Flex rather than grid, so that the
     name takes what the badge leaves; the state cell and its box give their badge and explanation to the card itself. */
  .list, .list tbody { display: block; }
  .list colgroup, .list.pool thead { display: none; }
  .list tbody tr { height: auto; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .list > tbody:last-child > tr:last-child { border-bottom: 0; }
  .list td { padding: 0; border: 0; }
  .list.pool tbody tr { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 12px; }
  .list.pool .c-who { flex: 1 1 50%; }
  .list.pool :is(.c-st, .c-st .st) { display: contents; }
  .list.pool .c-st .st-sub { flex-basis: 100%; }
  /* A quota window, here and in the overview's list (.acc-q): its name, then the bar and the figure. */
  .list.pool .c-q5, .list.pool .c-q7, .acc-q { display: flex; flex: 1 1 calc(50% - 6px); align-items: center; gap: 8px; }
  .list.pool .c-q5 > .q, .list.pool .c-q7 > .q, .acc-q > .q { flex: 1; }
  .list:is(.pool, .stats) td[data-label]::before, .acc-q::before { content: attr(data-label); flex: none; color: var(--muted); font-size: 14px; }
  .list.pool .c-load, .list.pool .c-upd, .list.pool .q-reset { display: none; }
  .who b { overflow: visible; white-space: normal; overflow-wrap: anywhere; }
  .pager small { flex: 1 1 100%; }
  .pager { justify-content: flex-end; }
}
@media (max-width: 719px) {
  /* A third control (the stock page's sort, after its select of states and the search) takes a line of its own. */
  .tools-end > :nth-child(3) { grid-column: 1 / -1; }
}
@media (max-width: 479px) {
  .tools-end { grid-template-columns: minmax(0, 1fr); }
}
@media (pointer: coarse) {
  .chip { min-height: 44px; }
  .btn-icon { min-width: 44px; }
}
@media (forced-colors: active) {
  .mini { border: 1px solid CanvasText; }
  .mini > i { forced-color-adjust: none; background: CanvasText; }
  .chip[aria-pressed="true"] { forced-color-adjust: none; background: Highlight; color: HighlightText; }
  .pill { border: 1px solid CanvasText; }
  .pill::before { forced-color-adjust: none; background: CanvasText; }
  .pool-tab[aria-selected="true"] { forced-color-adjust: none; color: Highlight; box-shadow: inset 0 -2px 0 Highlight; }
}

/* ===== 库存 ===== */
/* The stock page reuses the page head, note line, chips, search, table, state badge and pager of the pool page. Here: the
   select of other states, the eight columns of the table (box, account, state, source file, the pool's account with the
   same identity, expiry, record time, actions), the bulk bar, the big drop zone of an empty stock and the veil that covers
   the page while a file is dragged over it. Under 1200px the record time is left out; under 720px a row is a card, and its
   expiry goes under the name. */
.tools-end select[data-active="true"] { border-color: var(--accent); background-color: var(--accent-soft); color: var(--accent-ink); }

/* The box and the actions keep their width; the other columns share what is left in these proportions. */
.list.stock .k-chk { width: 48px; }
.list.stock .k-who { width: 24%; }
.list.stock .k-st { width: 13%; }
.list.stock .k-file { width: 17%; }
.list.stock .k-pool { width: 14%; }
.list.stock .k-exp { width: 15%; }   /* room for "11-29 10:58 到期" on one line */
.list.stock .k-time { width: 9%; }
.list.stock .k-act { width: 236px; }
.list.stock tbody tr { cursor: default; }
/* A stock row is not itself a focus target: its box, 推送 and icon are. Brought into view from above by Shift+Tab, each
   stops below the 44px sticky head (the row rule of the pool table does not reach them). Phones have no sticky head. */
@media (min-width: 720px) {
  .list.stock tbody :is(input, button, a) { scroll-margin-top: 44px; }
}
.list.stock tbody tr[data-sel="true"] { background: var(--accent-soft); }
.list.stock .c-chk { padding-inline: 16px 8px; }
.list.stock .c-act { padding-inline: 8px 12px; }
.chk { position: relative; display: inline-grid; place-items: center; width: 24px; height: 24px; vertical-align: middle; }
.chk input { cursor: pointer; }
.chk input:disabled { cursor: not-allowed; }

/* The name, and under it why the record cannot be pushed; the file and the record's place in it; the pool's account
   with its id and the quota left. */
.s-who, .s-file, .s-pool { display: grid; justify-items: start; gap: 2px; min-width: 0; }
.s-pool { gap: 4px; }
.s-who b { max-width: 100%; overflow: hidden; color: var(--ink); font-size: 15px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.s-sub { color: var(--muted); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.f-name { max-width: 100%; overflow: hidden; color: var(--ink-2); text-overflow: ellipsis; white-space: nowrap; }
.f-idx, .s-pool small { color: var(--muted); font-size: 14px; line-height: 1.5; }
/* The record's place in its file is the file name's tooltip; its place in the push order is the order of the rows while
   the list is sorted by it, and is written out only under another sort. */
.f-idx { display: none; }
.list.stock:has(th.c-st[aria-sort="ascending"] .th-sort[data-sort="queue"]) .s-place { display: none; }
.c-time { color: var(--ink-2); font-size: 14px; }
/* The expiry of a record (design 5.4), amber within a day; in the account cell on a phone only. */
.c-exp .exp, .s-exp { color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.c-exp .exp { display: grid; justify-items: start; }
.c-exp .exp > span:not(.sr-only) ~ span:not(.sr-only) { display: none; }   /* how long is left: the tooltip says it */
@media (min-width: 960px) {
  .c-exp .exp > span { white-space: nowrap; }
}
:is(.exp, .s-exp)[data-tone="warn"] { color: var(--warn-ink); font-weight: 500; }
.s-exp { display: none; }
/* 推送 for a record that can be pushed, the icons that change the push order, then the icon that moves it to the recycle
   bin or back; in the bin, the icon that deletes it for good, red under the pointer. The icons line up. */
.row-acts { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
@media (hover: hover) and (pointer: fine) {
  .row-purge:not(:disabled):hover { background: var(--bad-soft); color: var(--bad-ink); }
}
/* The name with the small tag, in the brand colour, of the record pushed next; its place in the push order under the badge. */
.s-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; max-width: 100%; }
.s-name b { min-width: 0; max-width: 100%; overflow: hidden; color: var(--ink); font-size: 15px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.next-tag { display: inline-flex; flex: none; align-items: center; height: 22px; padding: 0 8px; border: 1px solid var(--accent-line); border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; font-weight: 500; white-space: nowrap; }
.order-line { color: var(--muted); font-size: 14px; }

.stock-list { transition: opacity 150ms var(--ease); }
.stock-list[data-loading] { opacity: .6; }
.empty .small { font-size: 14px; }
.empty .text-btn.link { display: inline; height: auto; font-size: inherit; background-position: 0 100%; background-size: 100% 1px; }
/* No record at all, or none to push: one big dashed drop zone, inside the card of the list. */
.empty.drop { gap: 12px; margin: 16px; padding: 56px 24px; border: 1.5px dashed var(--line-2); border-radius: var(--r-md); background: var(--bg-2); }
.empty.drop > .icon { width: 30px; height: 30px; color: var(--accent); }

/* The bulk bar floats above the slot of the toast. It is the same bar as the save bar of the settings (.savebar): a
   surface with a line round it, lifted off the page, the primary button of the page in it, and what is given up a text
   button. */
.selbar {
  position: sticky;
  bottom: 80px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-self: center;
  gap: 12px;
  max-width: 100%;
  padding: 8px 8px 8px 18px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  animation: rise 180ms var(--ease);
}
.selbar .sel-count { font-weight: 600; white-space: nowrap; }
.sel-acts { display: flex; gap: 8px; margin-left: auto; }   /* the two buttons wrap together on a narrow screen */

/* Over the whole page while a file is dragged over it; the pointer goes through it to the page below. */
.drop-veil { position: fixed; inset: 0; z-index: 50; display: grid; padding: 16px; background: color-mix(in oklab, var(--canvas) 88%, transparent); pointer-events: none; animation: fade-in 180ms var(--ease); }
.drop-veil > div { display: grid; place-content: center; justify-items: center; gap: 12px; border: 2px dashed var(--accent); border-radius: var(--r-xl); background: color-mix(in oklab, var(--accent-soft) 60%, transparent); color: var(--ink); text-align: center; }
.drop-veil .icon { width: 32px; height: 32px; color: var(--accent); }
.drop-veil b { font-size: 18px; font-weight: 600; }

@media (max-width: 1099px) {
  /* The tray covers the bottom right corner: the bulk bar rises above it while it shows. */
  .selbar { bottom: max(80px, calc(var(--tray-h) + 32px)); }
}
@media (max-width: 1199px) {
  .list.stock .k-time, .list.stock .c-time { display: none; }
  /* The file and the pool's account give the expiry some of their room, and the actions close up. */
  .list.stock .k-st { width: 14%; }
  .list.stock .k-file { width: 16%; }
  .list.stock .k-pool { width: 13%; }
  .list.stock .k-exp { width: 18%; }
  .list.stock .k-act { width: 216px; }
}
@media (max-width: 959px) {
  /* The state badge needs about 90px; the account and the file give some of theirs. */
  .list.stock .k-who { width: 24%; }
  .list.stock .k-st { width: 16%; }
  .list.stock .k-file { width: 14%; }
  .list.stock .k-pool { width: 16%; }
  .list.stock .k-exp { width: 18%; }
}
@media (max-width: 719px) {
  /* A row is a card: the box, the whole name (broken where it must be) and the state badge; then the file and the record's
     place in it; the pool's account, when there is one; the actions, from the left. The head keeps the box that ticks
     the page. */
  .list.stock thead { display: block; }
  .list.stock thead tr { display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: center; gap: 12px; height: auto; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
  .list.stock th { height: auto; padding: 0; border: 0; background: none; }
  .list.stock th:not(.c-chk):not(.c-who) { display: none; }
  .list.stock tbody tr { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: start; gap: 6px 12px; }
  .list.stock .c-chk, .list.stock .c-act { padding: 0; }
  .list.stock .c-chk { grid-column: 1; grid-row: 1; }
  .list.stock .c-who { grid-column: 2; grid-row: 1; }
  .list.stock .c-st { grid-column: 3; grid-row: 1; }
  .list.stock :is(.c-file, .c-pool, .c-act) { grid-column: 2 / -1; }
  .list.stock .c-pool[data-none], .list.stock .c-exp { display: none; }
  .s-exp { display: block; }
  .s-who b, .s-name b, .f-name { overflow: visible; white-space: normal; overflow-wrap: anywhere; }
  .list.stock .c-st .st { justify-items: end; text-align: right; }
  .s-file { display: flex; flex-wrap: wrap; column-gap: 6px; }
  .s-pool { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
  .row-acts { flex-wrap: wrap; justify-content: flex-start; gap: 8px; margin-top: 2px; }  /* a record put first has five actions */
  .selbar { flex-wrap: wrap; row-gap: 8px; }   /* the count and 取消选择, then the two buttons, on a narrow screen */
  .selbar { bottom: max(calc(var(--dock-h) + 72px + env(safe-area-inset-bottom, 0px)), calc(var(--dock-h) + var(--tray-h) + 32px + env(safe-area-inset-bottom, 0px))); }
  .empty.drop { margin: 12px; padding: 44px 16px; }
}
@media (pointer: coarse) {
  .chk::after { content: ""; position: absolute; inset: -10px; }
}
@media (forced-colors: active) {
  .selbar { border: 1px solid CanvasText; }
  .list.stock tbody tr[data-sel="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
}

/* ===== 记录 ===== */
/* The records page reuses the page head, the chips, the search, the pager and the empty state. Its three tabs are the strip
   of tabs of the instances (.tab-strip, .pool-tabs, .strip-tab), as toggle buttons with aria-pressed, so that they are not
   taken for the chips of the filters under them; their line runs on to the time range of the push and stats tabs (.range, a
   .seg), and the bar is as high as the range, so that it does not jump when the range is hidden. The push tab is a table
   in the list style with its column names, sticky under the top bar: time, account (and where it stands in the pool now),
   source, the way and why, the result (a badge) and its note, the online check, the id, and the instance when there is
   more than one. Each day is a body that opens with its date; rows are read, not clicked. The run log is a list of dot,
   time and message. Under 720px a push is three or four lines. The 统计 tab follows the run log below. */

.rec-bar { justify-content: space-between; min-height: 40px; }
.rec-bar .tab-strip { flex: 1 1 280px; }
.list.h-table tbody tr { height: auto; }
.list.h-table td { padding-block: 12px; }   /* a phone's card has none of it (the media query below) */
/* A day opens with its date on a quiet band of its own. */
.list.h-table .day-row th { height: auto; padding: 14px 16px 6px; border-bottom: 0; background: none; color: var(--ink-2); font-size: 13px; font-weight: 600; line-height: 1.6; }
.list.h-table th[data-col="h-id"] { text-align: right; }
.list.h-table .k-time { width: 72px; }
.list.h-table .k-who { width: 22%; }
.list.h-table .k-src { width: 18%; }
.list.h-table .k-way { width: 14%; }
.list.h-table .k-res { width: 18%; }
.list.h-table .k-health { width: 136px; }   /* 推送后不可用 and its dot on one line */
.list.h-table .k-id { width: 128px; }
/* With the instance column the others give some of their room; the way keeps enough for its reason. The instance column
   holds a name, and for an address that is gone its host and a note under it (.h-gone). */
.hist[data-hosts="true"] .list.h-table :is(.k-who, .k-res) { width: 16%; }
.hist[data-hosts="true"] .list.h-table :is(.k-src, .k-way) { width: 13%; }
.hist[data-hosts="true"] .list.h-table .k-host { width: 15%; }
.h-src, .h-host { color: var(--ink-2); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.h-host { color: var(--muted); }
.h-gone { display: block; margin-top: 2px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.h-way small, .h-res small { display: block; color: var(--muted); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.h-way small { margin-top: 2px; }
.h-res small { text-wrap: pretty; }   /* no orphan word in the narrow column of the result */
/* The note of a result (why it was refused) keeps to two lines; its tooltip has the whole of it. */
.h-res .h-note { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
/* A push waiting for review is settled on its row: 确认已导入 and 永久跳过 under its result. */
.h-resolve { display: flex; flex-wrap: wrap; gap: 0 16px; }
.h-health { white-space: nowrap; }
@media (min-width: 720px) {
  .search.wide { width: 320px; }
}
/* The run log's tools: the levels with their counts, 清空日志 at the end. */
.log-end { margin-left: auto; }
.h-time { color: var(--muted); font-size: 14px; }
.h-who b { display: block; min-width: 0; overflow: hidden; color: var(--ink); font-size: 15px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.h-who small { display: block; margin-top: 2px; color: var(--muted); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.tag { display: inline-flex; align-items: center; justify-content: center; justify-self: start; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--bg-3); color: var(--ink-2); font-size: 13px; font-weight: 500; white-space: nowrap; }
.h-id { color: var(--muted); font-family: var(--mono); font-size: 13px; text-align: right; white-space: nowrap; }

/* The run log, in its card. The dot is red for an error, the brand colour for a push and light grey for the rest. */
.log { display: grid; grid-template-columns: 8px max-content minmax(0, 1fr); column-gap: 16px; padding: 6px 20px; }
.log li { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--line); color: var(--ink-2); }
.log li:first-child { border-top: 0; }
.log .lv { align-self: start; width: 8px; height: 8px; margin-top: 8px; border-radius: 50%; background: var(--faint); }
.log li[data-level="error"] .lv { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in oklab, var(--bad) 20%, transparent); }
.log li[data-level="push"] .lv { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 20%, transparent); }
.log time { color: var(--muted); font-size: 14px; white-space: nowrap; }
.log .what { min-width: 0; overflow-wrap: anywhere; }
.log li[data-level="error"] .msg { color: var(--bad-ink); }
.log em { margin-left: 8px; color: var(--muted); font-style: normal; white-space: nowrap; }

@media (max-width: 719px) {
  .list.h-table thead { display: none; }
  .list.h-table td { padding: 0; }
  .list.h-table .day-row { display: block; height: auto; margin: 0; padding: 14px 16px 4px; border-bottom: 0; }
  .list.h-table .day-row th { display: block; padding: 0; border: 0; }
  /* Line one: the account and the result; then the source; then the time, the way, the online check and the id; the
     instance last, when there is one. */
  .list.h-table tr.h-row {
    display: grid;
    grid-template-columns: auto auto auto minmax(0, 1fr) auto;
    grid-template-areas: "who who who who res" "src src src src src" "time way health . id" "why why why why why" "host host host host host";
    align-items: start;
    gap: 4px 12px;
    padding: 12px 16px;
  }
  .h-who { grid-area: who; }
  .h-res { grid-area: res; text-align: right; }
  .h-res .st { justify-items: end; }
  .h-src { grid-area: src; }
  .h-time { grid-area: time; }
  /* The way's tag joins the line of the time; why it was pushed gets a line of its own. */
  .h-way { display: contents; }
  .h-way .tag { grid-area: way; align-self: center; }
  .h-way small { grid-area: why; margin-top: 0; }
  .h-health { grid-area: health; }
  .h-id { grid-area: id; }
  .h-host { grid-area: host; }
  .h-time, .h-health, .h-id { align-self: center; }
  /* A phone has no room to spare for an ellipsis: the whole name is shown, broken where it must be. */
  .h-who b { overflow: visible; white-space: normal; overflow-wrap: anywhere; }
  .log { column-gap: 12px; padding: 4px 16px; }
  /* 确认已导入 and 永久跳过 in the narrow column of the result, one under the other, at its right edge. */
  .h-resolve { flex-direction: column; align-items: flex-end; }
}
@media (pointer: coarse) {
  .h-resolve .text-btn { min-height: 44px; }
}
@media (forced-colors: active) {
  .log .lv, .st-word::before { forced-color-adjust: none; background: CanvasText; box-shadow: none; }
  .rec-bar .strip-tab[aria-pressed="true"] { forced-color-adjust: none; color: Highlight; box-shadow: inset 0 -2px 0 Highlight; }
}

/* 统计: three blocks, each a card. 概况: one sentence for the range, one bar of how its confirmed imports ended (.fate:
   已上线 green, 待确认 grey, 推送后不可用 red, each segment as wide as its share, a 2px gap between them), its legend and
   the facts. 补号原因: a bar per cause, of its share of the pushes (a distribution, not a state). 批次质量: a table in the
   list style that is read, not clicked; each batch has its own bar, and 存活率 in the colour of what it means
   (.rate[data-tone=good|warn|bad]). Under 720px a batch is a card: the file and its 存活率, the bar, the counts. */
.stats-page { gap: var(--block-gap); }
.stats-lead { max-width: 44em; color: var(--ink); font-size: 18px; font-weight: 500; line-height: 1.6; }
.fate { display: flex; gap: 2px; height: 10px; overflow: hidden; border-radius: 999px; background: var(--track); }
.fate:not(.sm) { max-width: 880px; }   /* as wide as the bars of 补号原因 under it */
.fate.sm { height: 8px; }
.fate > i { flex: var(--v, 0) 1 0; min-width: 4px; background: var(--faint); }
.fate-legend { display: flex; flex-wrap: wrap; gap: 8px 24px; color: var(--muted); font-size: 14px; }
.fate-legend li { display: inline-flex; align-items: center; gap: 8px; }
.fate-legend b { color: var(--ink); font-weight: 600; }
.fate-sw { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--faint); }
:is(.fate > i, .fate-sw)[data-k="live"] { background: var(--good); }
:is(.fate > i, .fate-sw)[data-k="dead"] { background: var(--bad); }
.causes { display: grid; max-width: 880px; }
.cause-row { display: grid; grid-template-columns: minmax(8em, 14em) minmax(0, 1fr) 4em 3.5em; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.cause-row:first-child { padding-top: 4px; border-top: 0; }
.cause-row .c-label { min-width: 0; color: var(--ink); overflow-wrap: anywhere; }
.cause-row .mini { height: 8px; }
.cause-row b { color: var(--ink); font-weight: 500; text-align: right; }
.cause-row small { color: var(--muted); text-align: right; }
/* The table of the batches sits in its block's card, not in a card of its own: its head is a rounded band. */
.list.stats thead th { height: auto; min-height: 44px; padding-block: 11px; border-bottom: 0; line-height: 1.5; white-space: normal; }
.list.stats thead th:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.list.stats thead th:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.list.stats tbody tr { height: 52px; }
.list.stats tbody th { height: auto; padding: 12px 16px; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.list.stats td { padding-block: 12px; }
.list.stats .c-n, .list.stats .c-rate { color: var(--ink-2); font-size: 15px; text-align: right; white-space: nowrap; }
.list.batches .k-file { width: 26%; }
.list.batches .k-fate { width: 30%; }
.list.batches .k-life { width: 16%; }
.list.batches tbody .c-file { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The counts, in the words of the legend, break only between one count and the next, never inside a word. */
.c-fate .fate-n { display: block; margin-top: 6px; color: var(--muted); font-size: 13.5px; line-height: 1.45; word-break: keep-all; }
.rate { font-weight: 600; }
/* With several instances the stats have a select of the instance of their own. */
.stats-tools select { width: auto; min-width: 200px; max-width: 100%; }
@media (max-width: 959px) {
  .list.stats tbody th { padding-inline: 10px; }
}
@media (max-width: 719px) {
  .stats-lead { font-size: 16px; }
  /* 补号原因: the cause, its count and share on one line, the bar under them. */
  .cause-row { grid-template-columns: minmax(0, 1fr) auto auto; row-gap: 8px; }
  .cause-row .mini { grid-column: 1 / -1; grid-row: 2; }
  .list.stats thead { display: none; }
  .list.stats tbody tr { height: auto; padding-inline: 0; }
  .list.stats tbody th, .list.stats td { padding: 0; border: 0; }
  /* 批次质量: the file and its 存活率 on one line, the bar and its counts under them, then the other figures. */
  .list.batches tbody tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; }
  .list.batches tbody .c-file { flex: 1 1 0; min-width: 0; overflow: visible; white-space: normal; }
  .list.batches .c-rate { display: inline-flex; flex: none; gap: 6px; order: 1; }
  .list.batches .c-fate { flex: 1 1 100%; order: 2; }
  .list.batches .c-n { display: inline-flex; gap: 6px; order: 3; font-size: 14px; }
}
@media (forced-colors: active) {
  .fate > i, .fate-sw { forced-color-adjust: none; border: 1px solid CanvasText; }
}

/* ===== 设置 ===== */
/* One column, 800px at most, a card for each section: the connection, when to top up, how fast to push, what to push
   with, and the advanced switches. The rules are sentences with their number boxes in the text. The save bar floats above
   the toast's slot, like the bulk bar of the stock page, and is there only while something is unsaved. */
.set-page { width: 100%; max-width: 800px; justify-self: center; }
/* The amber notice of the connection while its address and key cannot be edited (a .tone-box). */
.inline-alert { flex-wrap: wrap; align-items: center; gap: 8px 12px; font-weight: 500; }
.inline-alert > span { flex: 1 1 16em; min-width: 0; overflow-wrap: anywhere; }

.settings #inputs { min-width: 0; transition: opacity 150ms var(--ease); }
.settings fieldset.dim { opacity: .6; }
.inst-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.set-sec { display: grid; gap: 16px; min-width: 0; padding: 22px 24px 24px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg); box-shadow: var(--shadow-card); }
.set-sec > .btn { justify-self: start; }   /* a button of its own keeps its width, not the card's */
.set-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; min-height: 30px; }
/* The dot sits level with the first line of the text when it wraps, as on the instance card (.ic-state): 14px at 1.6 is a
   22.4px line, and the dot is 8px. */
.conn { display: inline-flex; align-items: flex-start; gap: 10px; min-width: 0; color: var(--muted); font-size: 14px; font-weight: 500; }
.conn .dot { margin-top: 7px; }
.conn-text { min-width: 0; overflow-wrap: anywhere; }

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
.fields .wide { grid-column: 1 / -1; }
.field .lab { color: var(--ink-2); font-size: 14px; font-weight: 500; }

/* A rule is a sentence; its boxes are part of the text and wrap with it. */
.rule-row { display: grid; gap: 4px; min-width: 0; }
.rule { color: var(--ink); font-size: 16px; line-height: 40px; overflow-wrap: anywhere; }
.rule .muted { font-size: 14px; white-space: nowrap; }   /* a note in brackets wraps as a whole, not inside a word */
.rule .num-in { display: inline-block; width: 80px; height: 36px; margin-inline: 4px; padding: 0 8px; vertical-align: middle; color: var(--accent-ink); font-weight: 600; text-align: center; }
.rule .num-in:disabled { color: var(--muted); }
.settings input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.settings input[type="number"]::-webkit-inner-spin-button, .settings input[type="number"]::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; appearance: none; }
.rules { display: grid; gap: 4px; }
/* The push priority (caps design 5.3): its three choices sit in the sentence, and its long note may wrap. */
.rule.prio { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.rule.prio .muted { white-space: normal; line-height: 1.5; }

/* One line of help, with the long text behind a toggle that opens in place. */
.hint { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding-block: 3px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.hint p { min-width: 0; overflow-wrap: anywhere; }
.tip { flex: 0 1 auto; max-width: 100%; }
.tip[open] { flex-basis: 100%; }
.tip > summary {
  width: fit-content;
  color: var(--accent-ink);
  font-weight: 500;
  list-style: none;
  cursor: pointer;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 calc(100% - 4px);
  background-size: 0 1px;
  transition: background-size 150ms var(--ease), color 150ms var(--ease);
}
.tip > summary::-webkit-details-marker { display: none; }
.tip .more { margin: 4px 0 8px; font-size: 15px; }
@media (hover: hover) and (pointer: fine) {
  .tip > summary:hover { background-size: 100% 1px; }
}

/* A switch, its title, one line and the long text. */
.sw-row { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; align-items: start; }
.sw-text { display: grid; min-width: 0; }
.sw-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 12px; min-height: 24px; line-height: 24px; }
.sw-title { font-weight: 500; }
/* The toggle to a switch's explanation sits beside its title; opened, the text takes the line under them. */
.sw-head > .tip > summary { font-size: 14px; }
.sw-head > .tip .more { line-height: 1.7; }
.dep-note { color: var(--warn-ink); font-size: 14px; font-weight: 500; }
/* Under the scheduling switch: what the tool keeps closed, and 全部打开. */
.holds { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; }
.holds > p { flex: 1 1 16em; min-width: 0; color: var(--ink-2); overflow-wrap: anywhere; }

.policy { display: grid; gap: 16px; }
.groups { display: flex; flex-wrap: wrap; gap: 8px; min-height: 34px; }
.pick { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; height: 34px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg); color: var(--ink-2); font-size: 14px; font-weight: 500; cursor: pointer; transition: border-color 150ms var(--ease), background-color 150ms var(--ease), color 150ms var(--ease); }
.pick span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.groups-empty { align-self: center; color: var(--muted); font-size: 14px; }
.catalog-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.catalog-status { min-width: 0; color: var(--muted); overflow-wrap: anywhere; }

/* 高级: closed on entry. A card whose head opens it. */
.adv { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg); box-shadow: var(--shadow-card); }
.adv > summary { display: flex; align-items: center; gap: 8px; min-height: 28px; padding: 18px 24px; border-radius: var(--r-lg); list-style: none; cursor: pointer; }
.adv > summary::-webkit-details-marker { display: none; }
.adv > summary .icon { width: 16px; height: 16px; color: var(--muted); transition: transform 150ms var(--ease); }
.adv[open] > summary .icon { transform: rotate(90deg); }
.adv-body { display: grid; gap: 24px; padding: 4px 24px 24px; }

/* The foot of the page: the appearance of this browser (theme.js) at its start; the logout keeps its end. */
.foot-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 16px; margin-top: 16px; padding: 14px 24px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg); box-shadow: var(--shadow-card); color: var(--muted); font-size: 14px; }
.appearance { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-right: auto; }

.savebar {
  position: sticky;
  bottom: 80px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  width: fit-content;
  max-width: 100%;
  margin: 16px auto 0;
  padding: 8px 8px 8px 18px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  animation: rise 180ms var(--ease);
}
.bar-text { color: var(--warn-ink); font-weight: 500; }

/* Several instances (design 5.8): a strip of tabs (.tab-strip, under the controls) with 添加实例 at its end; under it the
   chosen instance's settings, ending with 删除实例, then the part every instance shares. On a phone the strip scrolls
   inside itself, never the page. With one instance only 添加实例 (at the end of the connection's head) and the plain http
   note are new. */
.set-head .add-inst { margin-left: auto; }
.ph .end .add-inst { align-self: center; }
.ph .end:empty { display: none; }   /* the settings' title row has nothing at its end while there is one instance */

/* Under the connection while the instance is reached over plain http, a .tone-box: red on a public address, amber on a
   private one. */
.exposure { align-items: flex-start; }
.exposure > .icon { margin-top: 4px; }
.exposure-body { display: grid; gap: 4px; min-width: 0; }
.exposure-body p, .exposure-body li { overflow-wrap: anywhere; }
.exposure-title { font-weight: 500; }
.exposure-body ul { display: grid; gap: 4px; padding-left: 1.25em; list-style: disc; color: var(--ink-2); }

/* 删除实例, at the foot of the instance's settings: set apart by a dashed edge, not a card. */
.remove-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 16px 24px; border: 1px dashed var(--line-2); border-radius: var(--r-lg); }
.remove-row small { flex: 1 1 16em; min-width: 0; color: var(--muted); overflow-wrap: anywhere; }

/* The global part: a card of its own after the instance's, its parts divided by lines. */
.set-global { margin-top: 16px; }
.set-note { padding: 2px 10px; border-radius: 999px; background: var(--bg-3); color: var(--muted); font-size: 13px; font-weight: 500; }
.set-part { display: grid; gap: 16px; }
.set-part + .set-part { padding-top: 20px; border-top: 1px solid var(--line); }
.set-part > h3 { color: var(--ink-2); }

/* Existing-account recovery keeps its configuration separate from instance settings. */
.reauth { gap: 24px; }
.reauth-form, .reauth-part { display: grid; gap: 16px; min-width: 0; }
.reauth-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.reauth-check { display: inline-flex; align-items: center; gap: 8px; }
.reauth-list { display: grid; gap: 12px; }
.reauth-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; padding: 16px 0; border-top: 1px solid var(--line); }
.reauth-detail { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }

/* The add form: the connection only, with its two buttons at the end. */
.add-form { min-width: 0; }
.add-set { display: grid; gap: 16px; }
.add-note { color: var(--muted); overflow-wrap: anywhere; }
.add-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 12px; }

@media (max-width: 1099px) {
  .savebar { bottom: max(80px, calc(var(--tray-h) + 32px)); }
}
@media (max-width: 719px) {
  .set-sec { padding: 18px 16px 20px; }
  .adv > summary { padding: 16px; }
  .adv-body { padding: 4px 16px 20px; }
  .foot-row, .remove-row { padding: 14px 16px; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .savebar { bottom: max(calc(var(--dock-h) + 72px + env(safe-area-inset-bottom, 0px)), calc(var(--dock-h) + var(--tray-h) + 32px + env(safe-area-inset-bottom, 0px))); }
  .add-actions .btn { flex: 1; }
}
@media (pointer: coarse) {
  .pick { min-height: 44px; }
  .tip > summary { position: relative; }
  .tip > summary::after { content: ""; position: absolute; inset: -8px -4px; }
  .adv > summary { min-height: 44px; }
}
@media (forced-colors: active) {
  .pick.on { outline: 2px solid Highlight; outline-offset: -2px; }
  .savebar { border: 1px solid CanvasText; }
}

/* The pool page's switch between the groups of the instance, beside the title. */
.ph .end .pool-groups { width: auto; min-width: 150px; max-width: min(46vw, 280px); }
.ph .end .pool-groups[data-active="true"] { border-color: var(--accent); background-color: var(--accent-soft); color: var(--accent-ink); }
