/* Sub2API 账号池 — one visual system for the login page and the console (design spec 5.10).
   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;
  --bg: #ffffff;
  --bg-2: #f6f7f8;
  --bg-3: #eceef1;
  --line: #e5e7eb;
  --line-2: #d4d8de;
  --ink: #111318;
  --ink-2: #3c414a;
  --muted: #666d78;
  --faint: #a0a6af;
  --accent: #2b5bd7;
  --good: #17a06b;
  --good-ink: #0d7a4f;
  --good-soft: #e4f5ec;
  --warn: #e39410;
  --warn-ink: #a35d00;   /* 5.1:1 on --bg, 4.6:1 on --warn-soft; the old #8a5200 read as brown-black in small text */
  --warn-soft: #fcf2de;
  --bad: #df434a;
  --bad-ink: #b0242c;
  --bad-soft: #fbe9ea;
  /* Derived. The primary button is ink with page-coloured text: white text in light, black text in dark. */
  --accent-soft: #e9effc;
  --btn: var(--ink);
  --btn-ink: var(--bg);
  --btn-hover: #30353e;
  --overlay: rgb(17 19 24 / .36);
  --shadow: 0 1px 2px rgb(17 19 24 / .05), 0 12px 32px rgb(17 19 24 / .07);
  --shadow-lg: 0 24px 64px rgb(17 19 24 / .2), 0 2px 8px rgb(17 19 24 / .08);
  /* What stands out of a --bg-2 surface (the chosen item of a segmented control, the hero's icon and its notes and buttons):
     white on light grey in the light scheme, a step lighter than the surface in the dark ones, where --bg is the darkest.
     Its shadow is a list item (a box-shadow of several), so the dark schemes make it an invisible one rather than none. */
  --raised: var(--bg);
  --shadow-sm: 0 1px 2px rgb(17 19 24 / .08);

  --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);

  --wide: 1280px;     /* the main column, gutters included */
  --gutter: 24px;     /* page side margin; 16px on phones */
  --block-gap: 44px;  /* between the blocks of a view; 32px 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;
    --bg: #0b0d10;
    --bg-2: #13161a;
    --bg-3: #1c2026;
    --line: #22262d;
    --line-2: #323842;
    --ink: #eceef1;
    --ink-2: #c3c8cf;
    --muted: #8f96a0;
    --faint: #5d646e;
    --accent: #7c9cff;
    --good: #2fbf84;
    --good-ink: #5ed6a2;
    --good-soft: #0f2a1f;
    --warn: #f0ab37;
    --warn-ink: #f6c56d;
    --warn-soft: #2c2110;
    --bad: #ef5f65;
    --bad-ink: #ff8f94;
    --bad-soft: #321518;
    --accent-soft: #19223b;
    --btn-hover: #d3d7dd;
    --overlay: rgb(0 0 0 / .55);
    --shadow: 0 1px 2px rgb(0 0 0 / .5), 0 12px 32px rgb(0 0 0 / .35);
    --shadow-lg: 0 24px 64px rgb(0 0 0 / .6), 0 2px 8px rgb(0 0 0 / .4);
    --raised: var(--bg-3);
    --shadow-sm: 0 0 transparent;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d10;
  --bg-2: #13161a;
  --bg-3: #1c2026;
  --line: #22262d;
  --line-2: #323842;
  --ink: #eceef1;
  --ink-2: #c3c8cf;
  --muted: #8f96a0;
  --faint: #5d646e;
  --accent: #7c9cff;
  --good: #2fbf84;
  --good-ink: #5ed6a2;
  --good-soft: #0f2a1f;
  --warn: #f0ab37;
  --warn-ink: #f6c56d;
  --warn-soft: #2c2110;
  --bad: #ef5f65;
  --bad-ink: #ff8f94;
  --bad-soft: #321518;
  --accent-soft: #19223b;
  --btn-hover: #d3d7dd;
  --overlay: rgb(0 0 0 / .55);
  --shadow: 0 1px 2px rgb(0 0 0 / .5), 0 12px 32px rgb(0 0 0 / .35);
  --shadow-lg: 0 24px 64px rgb(0 0 0 / .6), 0 2px 8px rgb(0 0 0 / .4);
  --raised: var(--bg-3);
  --shadow-sm: 0 0 transparent;
}

/* ---------- 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; 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);
  background: var(--bg);
  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 28/650, dialog title 18/600, block title 17/600, body 15/400, labels, sub-lines and times 14/500.
   Nothing smaller than 14px, except the counts inside the filter chips and the time notes under a figure in a list (13.5px). */
h1 { font-size: 28px; line-height: 1.25; font-weight: 650; letter-spacing: -.02em; }
h2 { font-size: 17px; line-height: 1.45; font-weight: 600; }
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); 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; }
: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>). */
.icon.mark { width: 24px; height: 24px; color: var(--ink); fill: var(--bg); stroke: none; }
.spin { animation: spin 900ms linear infinite; }

/* ---------- Buttons: primary (ink), 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: 8px;
  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);
}
.btn-lg { height: 46px; padding: 0 24px; font-size: 16px; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 14px; }
.btn-sm .icon { width: 16px; height: 16px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--btn); color: var(--btn-ink); }
.btn-secondary { background: var(--bg); color: var(--ink); border-color: var(--line-2); }
.btn-danger { background: var(--bg); color: var(--bad-ink); border-color: var(--bad); }
.btn:disabled { opacity: .45; }
@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled):hover { transform: translateY(-1px); }
  .btn-primary:not(:disabled):hover { background: var(--btn-hover); }
  .btn-secondary:not(:disabled):hover { background: var(--bg-2); border-color: var(--faint); }
  .btn-danger:not(:disabled):hover { background: var(--bad-soft); border-color: var(--bad); }
}
.btn:not(:disabled):active { transform: translateY(1px) scale(.985); transition-duration: 90ms; }

/* A text button: its underline is 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(--ink-2);
  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 { opacity: .45; }
@media (hover: hover) and (pointer: fine) {
  .text-btn:not(:disabled):hover { color: var(--ink); 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: 8px;
  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(--bg-3); color: var(--ink); }
.icon-btn:disabled { opacity: .45; }
@media (hover: hover) and (pointer: fine) {
  .icon-btn:not(:disabled):hover { background: var(--bg-3); color: var(--ink); }
}

/* ---------- Fields ---------- */
.field { display: grid; gap: 8px; 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: 8px;
  background-color: var(--bg);
  color: var(--ink);
}
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); 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(--ink); }
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: outlined track; on: green track. Both keep 3:1. */
.switch {
  position: relative;
  flex: none;
  width: 38px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--muted);
  border-radius: 999px;
  background: var(--bg-3);
  transition: background-color 180ms var(--ease), border-color 180ms var(--ease);
}
.switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 180ms var(--ease), background-color 180ms var(--ease);
}
.switch[aria-checked="true"] { background: var(--good); border-color: var(--good); }
.switch[aria-checked="true"]::before { transform: translateX(14px); background: var(--bg); }
.switch:disabled { opacity: .45; }

/* .seg holds <button aria-pressed> items, or <label><input type="radio"><span>…</span></label> items. */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; width: fit-content; max-width: 100%; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); }
.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: 7px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.seg button[aria-pressed="true"], .seg input:checked + span { background: var(--raised); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line-2); }
.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 { background: var(--bg-3); color: var(--ink); }
}

.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.dot[data-tone="good"] { background: var(--good); }
.dot[data-tone="warn"] { background: var(--warn); }
.dot[data-tone="bad"] { background: var(--bad); }

/* 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-radius: 8px; background: var(--bg-2); }
.facts > div { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: baseline; padding: 8px 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-radius: 8px; background: var(--warn-soft); color: var(--warn-ink); }
.tone-box[data-tone="bad"] { background: var(--bad-soft); color: var(--bad-ink); }
.tone-box > .icon { width: 16px; height: 16px; }
.tone-box.sm { gap: 8px; padding: 8px 12px; 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 an ink line 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); box-shadow: inset 0 -2px 0 var(--ink); }
.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); }
}

/* ---------- 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: 8px;
  background: var(--btn);
  color: var(--btn-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); }

.bar { position: sticky; top: 0; z-index: 20; flex: none; background: var(--bg); border-bottom: 1px solid var(--line); }
.bar-in { display: flex; align-items: center; gap: 24px; height: var(--bar-h); max-width: var(--wide); margin-inline: auto; padding-inline: var(--gutter); }
.logo { display: inline-flex; align-items: center; gap: 8px; flex: none; min-height: 44px; color: var(--ink); font-size: 16px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.tabs { display: flex; align-self: stretch; gap: 4px; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: inset 0 -2px 0 transparent;
  transition: color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.tab .n { font-size: 14px; color: var(--muted); }
.tab[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }
@media (hover: hover) and (pointer: fine) {
  .tab:hover { color: var(--ink); }
}
.bar-end { display: flex; align-items: center; gap: 8px; 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: 8px; padding: 0 6px 0 12px; border: 1px solid var(--line); border-radius: 999px; }
.run-label { 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);
  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-2); 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-2);
  color: var(--ink-2);
  font-weight: 500;
  overflow-wrap: anywhere;
}
.banner[data-tone="warn"] { background: var(--warn-soft); color: var(--warn-ink); }
.banner[data-tone="bad"] { 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: 32px var(--gutter) 64px; }
.main:focus { outline: none; }
.view { display: grid; gap: var(--block-gap); align-content: start; min-width: 0; }
.view > * { min-width: 0; }
.view.entering { animation: fade-in 200ms var(--ease); }

.dock { display: none; }

/* ---------- Login: one centred column, no card ---------- */
.login { flex: 1 0 auto; display: grid; place-items: center; padding: 48px 16px; }
.login-form { display: grid; width: min(100%, 360px); }
.login-form .logo { justify-self: start; margin-bottom: 32px; }
.login-form h1 { margin-bottom: 24px; }
.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(460px, calc(100% - 32px));
  max-width: calc(100% - 32px);
  max-height: calc(100% - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: auto;
  overscroll-behavior: contain;
}
dialog::backdrop { background: var(--overlay, rgb(17 19 24 / .36)); }
dialog[open] { animation: rise 180ms var(--ease); }
dialog[open]::backdrop { animation: fade-in 180ms var(--ease); }
dialog:focus { outline: none; }
dialog h2 { font-size: 18px; line-height: 1.4; font-weight: 600; overflow-wrap: anywhere; }
dialog p { color: var(--ink-2); }
.dialog-body { display: grid; gap: 16px; padding: 24px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 0 24px 24px; }

/* A full-height sheet on the right, sliding in. */
dialog.drawer {
  inset: 0 0 0 auto;
  width: min(420px, 100%);
  max-width: 100%;
  height: auto;
  max-height: none;
  margin: 0;
  border-width: 0 0 0 1px;
  border-radius: 14px 0 0 14px;
}
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: 14px;
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  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(--muted); }
.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: 4px; overflow: hidden; border-radius: 999px; background: var(--bg-3); }
.meter > i { display: block; width: calc(var(--v, 0) * 100%); height: 100%; border-radius: inherit; background: var(--ink); 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: 12px;
  background: var(--btn);
  color: var(--btn-ink);
  box-shadow: var(--shadow-lg);
  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 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: 959px) {
  .bar-in { gap: 16px; }
  .tab { padding: 0 8px; }
  .run { margin-right: 0; }
}

/* ---------- Phones (viewport under 720px): logo, switch and settings on top, four tabs in a dock at the bottom ---------- */
@media (max-width: 719px) {
  :root { --gutter: 16px; --block-gap: 32px; }
  /* 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; }
  .main { padding: 24px 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(4, 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(--bg);
  }
  .dock a { display: grid; justify-items: center; align-content: center; gap: 2px; min-width: 0; color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: none; }
  .dock a[aria-current="page"] { color: var(--ink); font-weight: 600; }
  .dock .icon { width: 20px; height: 20px; }
  /* The label and its count on one line, as in the top bar. */
  .dock a > span { white-space: nowrap; }
  .dock .n { font-weight: 500; }
  .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; }
}

/* ---------- 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 { 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; }
}

/* ---------- Forced colours: keep the dots, the switch, the meters and the current page visible ---------- */
@media (forced-colors: active) {
  .dot { forced-color-adjust: none; }
  .switch { border-color: ButtonText; }
  .switch::before { forced-color-adjust: none; background: ButtonText; }
  .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 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; }
  .meter > i { forced-color-adjust: none; background: CanvasText; }
  .tone-box { border: 1px solid CanvasText; }
}

/* ---------- 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: conditions,
   schedulable accounts, and .duo with the things to look at and the recent activity. */
.hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; padding: 32px; border-radius: 14px; background: var(--bg-2); }
.hero[data-tone="warn"] { background: var(--warn-soft); }
.hero[data-tone="bad"] { background: var(--bad-soft); }
.hero-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--raised); color: var(--muted); box-shadow: 0 0 0 1px var(--line); }
.hero-ic .icon { width: 24px; height: 24px; }
.hero[data-tone="good"] .hero-ic { color: var(--good-ink); }
.hero[data-tone="warn"] .hero-ic { color: var(--warn-ink); box-shadow: none; }
.hero[data-tone="bad"] .hero-ic { color: var(--bad-ink); box-shadow: none; }
.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-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: 32px; line-height: 1.28; font-weight: 650; letter-spacing: -.02em; text-wrap: balance; overflow-wrap: anywhere; }
.hero-text { max-width: 44em; color: var(--ink-2); font-size: 16px; line-height: 1.7; overflow-wrap: anywhere; }
.hero-more { max-width: 44em; padding: 12px 16px; border-radius: 8px; background: var(--raised); 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; }
.hero .btn-secondary { background: var(--raised); }
.hero[data-tone="warn"] .btn-secondary, .hero[data-tone="bad"] .btn-secondary { background: transparent; border-color: color-mix(in oklab, currentColor 30%, transparent); }
@media (hover: hover) and (pointer: fine) {
  .hero[data-tone="warn"] .btn-secondary:not(:disabled):hover, .hero[data-tone="bad"] .btn-secondary:not(:disabled):hover { background: color-mix(in oklab, currentColor 8%, transparent); border-color: color-mix(in oklab, currentColor 50%, transparent); }
}
/* 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: 760px; margin-top: 8px; }
.setup input { height: 46px; }

/* A block: a head with the title, a grey remark and an optional link or button on the right. */
.blk { display: grid; align-content: start; gap: 16px; min-width: 0; }
.blk[data-stale] :is(.conds, .accs, .others) { opacity: .5; }
.blk-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.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 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; the number takes the colour only when the reading is near or past its line.
   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: 48px; padding-block: 24px; border-block: 1px solid var(--line); }
.cond {
  display: grid; align-content: start; gap: 8px; min-width: 0; --tone: var(--muted); --tone-ink: var(--ink);
  /* 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));
}
.cond[data-tone="good"] { --tone: var(--good); --tone-ink: var(--good-ink); }
.cond[data-tone="warn"] { --tone: var(--warn); --tone-ink: var(--warn-ink); }
.cond[data-tone="bad"] { --tone: var(--bad); --tone-ink: var(--bad-ink); }
.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); }
.cond-value { font-size: 34px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; }
.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) 22%, var(--bg-3));
  position: relative; height: 6px; margin-top: 24px; border-radius: 999px;
  background: linear-gradient(to right, var(--bg-3) calc(var(--z0, 0) * 100%), var(--zone) 0 calc(var(--z1, 0) * 100%), var(--bg-3) 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(--bg); }
.gauge > b::after { content: attr(data-label); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); color: var(--ink-2); font-size: 14px; 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-radius: 8px; 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(--muted); }

/* 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: 48px; }
.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 8px 8px; color: var(--muted); font-size: 14px; font-weight: 500; }
.acc-head > :last-child { text-align: right; }
.acc-head-2 { display: none; }
.acc {
  width: 100%;
  min-height: 52px;
  padding: 10px 8px;
  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; 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: 2px; }
.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; stacked under 1000px. */
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 48px; }
.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(--muted); }
.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(--ink); }
  .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: an ink ring.
   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: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.inst-card[data-shown] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.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: 12px; }
.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: 8px; 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); }
}

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

@media (max-width: 719px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 24px; }
  .hero-ic { width: 40px; height: 40px; }
  .hero-ic .icon { width: 20px; height: 20px; }
  .hero h1 { font-size: 25px; }
  .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; }
  .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); }
  .conds { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .cond { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: 12px; }
  .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; }
  .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); }
}

@media (forced-colors: active) {
  .sw { forced-color-adjust: none; }
  .acc:focus-visible { outline: 2px solid Highlight; }
  .gauge > i, .gauge > b, .cond-state::before { forced-color-adjust: none; background: CanvasText; }
  .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. */
.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: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.push-pick[data-off] { 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: 8px; }
.stepper:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.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; text-align: center; font-size: 17px; font-weight: 600; appearance: textfield; -moz-appearance: textfield; }
.stepper input:focus-visible { 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); }
}
@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: 8px 16px; border-radius: 8px; 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 16px 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 { 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) 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: 8px; }
.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 16px; overflow: hidden; text-overflow: ellipsis; }

.note-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 12px 16px; border-radius: 8px; background: var(--bg-2); color: var(--ink-2); }
.note-line > .icon { width: 16px; height: 16px; color: var(--muted); }
.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(--line-2); color: var(--ink-2); line-height: 1.7; overflow-wrap: anywhere; }
.more b { display: block; color: var(--ink); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  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);
}
.chip .n { font-size: 13.5px; font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--btn); color: var(--btn-ink); }
.chip[aria-pressed="true"] .n { color: color-mix(in oklab, var(--btn-ink) 72%, transparent); }
@media (hover: hover) and (pointer: fine) {
  .chip:not([aria-pressed="true"]):hover { background: var(--bg-3); 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 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: 44px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--bg-2); color: var(--ink-2); font-size: 14px; font-weight: 500; text-align: left; white-space: nowrap; }
.list td { min-width: 0; padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
/* A table row's height is its minimum. A row brought into view by the keyboard clears the sticky head. */
.list tbody tr { height: 64px; 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 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; }
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: 959px) {
  .list th, .list td { padding-inline: 8px; }
  /* 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, blue); an exception colours the whole badge (good, warn, bad). */
.pill { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--bg-3); color: var(--ink-2); font-size: 14px; font-weight: 500; line-height: 1; white-space: nowrap; }
.pill::before { content: ""; flex: none; width: 7px; height: 7px; 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); }
.pill[data-tone="good"]::before { background: var(--good); }
.pill[data-tone="warn"] { background: var(--warn-soft); color: var(--warn-ink); }
.pill[data-tone="warn"]::before { background: var(--warn); }
.pill[data-tone="bad"] { background: var(--bad-soft); color: var(--bad-ink); }
.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 grey ink, 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(--line-2); }
.mini > i { position: absolute; inset: 0 auto 0 0; width: calc(var(--v, 0) * 100%); border-radius: inherit; background: var(--ink-2); }
.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; }
.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 { min-width: 0; transition: opacity 150ms var(--ease); }
.pool-list[data-loading] { opacity: .6; }
.empty { display: grid; justify-items: center; gap: 8px; padding: 48px 16px; color: var(--muted); text-align: center; }
.empty b { color: var(--ink); font-size: 17px; 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-inline: 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); }
  .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; margin-inline: -8px; padding: 14px 8px; border-bottom: 1px solid var(--line); }
  .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(--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: 25%; }
.list.stock .k-st { width: 13%; }
.list.stock .k-file { width: 18%; }
.list.stock .k-pool { width: 14%; }
.list.stock .k-exp { width: 13%; }
.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; }
.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; }
: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 ink-outlined tag 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: 24px; padding: 0 8px; border: 1px solid var(--ink); border-radius: 8px; color: var(--ink); font-size: 14px; font-weight: 500; white-space: nowrap; }
.order-line { color: var(--muted); font-size: 14px; }

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

/* The bulk bar floats above the slot of the toast. It is the same bar as the save bar of the settings (.savebar): the page
   colour with a line round it, 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 16px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  animation: rise 180ms var(--ease);
}
.selbar .sel-count { font-weight: 500; 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(--bg) 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: 14px; 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; }
}
@media (max-width: 959px) {
  /* The state badge needs about 90px; the account and the file give some of theirs. */
  .list.stock .k-who { width: 22%; }
  .list.stock .k-st { width: 18%; }
  .list.stock .k-file { width: 16%; }
  .list.stock .k-pool { width: 18%; }
  .list.stock .k-exp { width: 14%; }
  .list.stock .k-act { width: 216px; }
}
@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; margin-inline: -8px; padding: 0 8px 10px; border-bottom: 1px solid var(--line); }
  .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; }
  .f-idx::before { content: "· "; }
  .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 { padding: 48px 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; }
.hist { min-width: 0; }
.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) */
.list.h-table .day-row th { height: auto; padding: 20px 16px 8px; background: none; color: var(--muted); font-size: 14px; font-weight: 600; line-height: 1.6; }
.list.h-table .day:first-of-type .day-row th { padding-top: 12px; }
.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 */
/* 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: 24px; padding: 0 8px; border-radius: 8px; background: var(--bg-3); color: var(--ink-2); font-size: 14px; font-weight: 500; white-space: nowrap; }
.h-id { color: var(--muted); font-family: var(--mono); font-size: 14px; text-align: right; white-space: nowrap; }

/* The run log. The dot is red for an error, ink for a push and light grey for the rest. */
.log { display: grid; grid-template-columns: 8px max-content minmax(0, 1fr); column-gap: 16px; }
.log li { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: baseline; padding: 8px 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); }
.log li[data-level="push"] .lv { background: var(--ink); }
.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: 16px 0 6px; }
  .list.h-table .day:first-of-type .day-row { padding-top: 4px; }
  .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;
    margin-inline: 0;
    padding: 12px 0;
  }
  .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; }
  /* 确认已导入 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; }
  .rec-bar .strip-tab[aria-pressed="true"] { forced-color-adjust: none; color: Highlight; box-shadow: inset 0 -2px 0 Highlight; }
}

/* 统计: three blocks. 概况: 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 grey 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(--bg-3); }
.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 b { color: var(--ink); font-weight: 500; text-align: right; }
.cause-row small { color: var(--muted); text-align: right; }
.list.stats thead th { height: auto; min-height: 44px; padding-block: 11px; line-height: 1.5; white-space: normal; }
.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: 8px; }
}
@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; }
  .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, 760px at most, five sections divided by lines (no cards): 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 { max-width: 760px; }
/* 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; }
.set-sec { display: grid; gap: 16px; padding-block: 32px; border-top: 1px solid var(--line); }
.set-sec:first-child { padding-top: 8px; border-top: 0; }
.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: 8px; 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: 38px; 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; font-weight: 500; text-align: center; }
.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: 0 8px; color: var(--muted); font-size: 14px; line-height: 30px; }
.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(--ink-2);
  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[open] > summary { color: var(--ink); }
.tip .more { margin: 4px 0 8px; font-size: 15px; }
@media (hover: hover) and (pointer: fine) {
  .tip > summary:hover { color: var(--ink); 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: 12px; 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; }
.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: 8px; color: var(--ink-2); font-size: 14px; font-weight: 500; cursor: pointer; }
.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(--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. */
.adv { padding-block: 32px 0; border-top: 1px solid var(--line); }
.adv > summary { display: flex; align-items: center; gap: 8px; min-height: 28px; 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-top: 16px; }

.foot-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 16px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
/* The appearance of this browser (theme.js) at the start of the foot row; the logout keeps its end. */
.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 16px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  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; }
.inst-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; min-width: 0; border-bottom: 1px solid var(--line); }
.inst-tabs { flex-wrap: wrap; gap: 0 4px; min-width: 0; margin-bottom: -1px; }
.inst-tab { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; height: 40px; padding: 0 16px; }
.inst-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.inst-off { color: var(--muted); font-size: 14px; }
.inst-bar .add-inst { flex: none; }

/* 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); }

.remove-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.remove-row small { flex: 1 1 16em; min-width: 0; color: var(--muted); overflow-wrap: anywhere; }

/* The global part: a heavier line sets it off from the instance above it. */
.set-global { margin-top: 16px; border-top: 2px solid var(--line-2); }
.set-note { color: var(--muted); font-size: 14px; font-weight: 500; }
.set-part { display: grid; gap: 16px; }
.set-part + .set-part { padding-top: 8px; }
.set-part > h3 { color: var(--ink-2); }

/* 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) {
  .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))); }
  .inst-bar { flex-wrap: nowrap; }
  .inst-tabs { flex: 1 1 auto; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .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; }
  .inst-tab[aria-selected="true"] { text-decoration-line: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
}
