/* 乾启算力看板 · base.css — reset, typography, tone mapping, app shell, shared components, overlays.
   Owner: foundation. No hex values here (tokens.css only). */

/* ───────────────────────────── reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + var(--filter-h) + 16px); }
html.is-locked { overflow: hidden; padding-right: var(--sb-comp, 0px); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--bg); color: var(--text);
  font-family: var(--font-sans); font-size: var(--fs-body); line-height: var(--lh-body); font-weight: var(--fw-regular);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  font-synthesis-weight: none;
}
h1, h2, h3, h4, p, dl, dd, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
h1 { font-size: var(--fs-h1); line-height: 1.25; font-weight: var(--fw-semibold); letter-spacing: -0.005em; }
h2 { font-size: var(--fs-h2); line-height: var(--lh-snug); font-weight: var(--fw-semibold); }
h3 { font-size: var(--fs-h3); line-height: 1.4; font-weight: var(--fw-semibold); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
button:disabled { cursor: default; }
/* no grey/blue tap rectangle from mobile browsers: every control draws its own pressed and focus states */
a, button, [role="button"], summary { -webkit-tap-highlight-color: transparent; }
img, svg, canvas, video { display: block; max-width: 100%; }
svg { overflow: visible; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }
::selection { background: color-mix(in oklab, var(--text) 18%, transparent); }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

/* ───────────────────────────── typography utilities */
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.u { font-size: .8em; color: var(--text-3); margin-left: .12em; font-weight: var(--fw-regular); letter-spacing: 0; }
.mono { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0; }
.eyebrow { font-size: var(--fs-caption); line-height: 1.5; letter-spacing: var(--track-eyebrow); color: var(--text-3); }
.eyebrow b { color: var(--text); font-weight: var(--fw-semibold); }
.micro { font-size: var(--fs-micro); font-weight: var(--fw-medium); font-stretch: 112%; letter-spacing: var(--track-brand-en); text-transform: uppercase; }
.caption { font-size: var(--fs-caption); line-height: 1.5; color: var(--text-3); }
.small { font-size: var(--fs-small); line-height: 1.55; }
.muted { color: var(--text-3); }
.t2 { color: var(--text-2); }
.prose { font-size: 15px; line-height: var(--lh-prose); color: var(--text-2); }
.figure-l { font-size: var(--fs-num-l); font-weight: var(--fw-light); letter-spacing: var(--track-num); line-height: 1; font-variant-numeric: tabular-nums; }
.figure-m { font-size: var(--fs-num-m); font-weight: var(--fw-light); letter-spacing: var(--track-num); line-height: 1; font-variant-numeric: tabular-nums; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.wrap-any { overflow-wrap: anywhere; }
.tone { color: var(--tone); }

.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important;
           overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; }
.skip { position: fixed; left: 16px; top: -48px; z-index: calc(var(--z-tip) + 1); padding: 8px 14px; border-radius: var(--r-pill);
        background: var(--text); color: var(--bg); font-weight: 600; transition: top var(--dur-1) var(--ease-out); }
.skip:focus { top: 12px; }

.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--page-pad); }

/* ───────────────────────────── tone mapping (§2.2) */
[data-state="free"]   { --tone: var(--free);  --tone-soft: var(--free-soft); }
[data-state="busy"]   { --tone: var(--busy);  --tone-soft: var(--bg-sunken); }
[data-state="held"]   { --tone: var(--held);  --tone-soft: var(--held-soft); }
[data-state="orphan"], [data-state="hot"], [data-state="missing"] { --tone: var(--fault); --tone-soft: var(--fault-soft); }
[data-state="offline"], [data-state="unknown"]{ --tone: var(--offline); --tone-soft: var(--offline-soft); }
[data-state="attention"] { --tone: var(--fault); --tone-soft: var(--fault-soft); }
[data-level="crit"] { --tone: var(--fault); --tone-soft: var(--fault-soft); }
[data-level="warn"] { --tone: var(--held);  --tone-soft: var(--held-soft); }
[data-level="ok"]   { --tone: var(--free);  --tone-soft: var(--free-soft); }
[data-tone="free"]  { --tone: var(--free); }
[data-tone="held"]  { --tone: var(--held); }
[data-tone="fault"] { --tone: var(--fault); }
[data-tone="muted"] { --tone: var(--text-3); }
[data-tone="ink"]   { --tone: var(--text); }

/* ───────────────────────────── layout skeleton */
#main { display: block; min-height: calc(100vh - var(--header-h) - 120px); outline: none; }
#view { display: block; }
#view > section { display: block; }
.view-in { padding-top: var(--sp-6); padding-bottom: var(--sp-8); }

/* ───────────────────────────── header */
.hdr {
  position: sticky; top: 0; z-index: var(--z-header); height: var(--header-h);
  background: color-mix(in oklab, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.1); backdrop-filter: blur(14px) saturate(1.1);
  border-bottom: 1px solid transparent; transition: border-color var(--dur-2) var(--ease-out);
}
.hdr.is-scrolled { border-bottom-color: var(--line); }
.hdr-in { height: 100%; display: flex; align-items: center; gap: var(--sp-4); }

.lockup { display: inline-flex; align-items: center; gap: 12px; flex: none; border-radius: var(--r-sm); color: var(--brand-ink); }
.lockup .q-mark { width: 26px; height: 26px; flex: none; }
/* the client lockup (DESIGN_BRIEF.md) scaled down: QIANQI TECHNOLOGY on top, 乾启科技 below at 0.9× with its wide 0.58em
   tracking — the official proportions, so the two measures differ exactly as they do in the logo */
.lockup-text { display: inline-flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 5px; line-height: 1; }
.lockup-en { font-size: 13px; font-weight: var(--fw-medium); letter-spacing: .05em; color: var(--text); line-height: 1; white-space: nowrap; }
.lockup-cn { font-size: 12px; font-weight: var(--fw-semibold); letter-spacing: .58em; margin-right: -.58em; color: var(--text); line-height: 1; white-space: nowrap; }
.lockup-div { width: 1px; height: 20px; background: var(--line-strong); margin-inline: 6px 2px; }
.lockup-prod { font-size: 15px; font-weight: var(--fw-medium); color: var(--text); letter-spacing: .02em; white-space: nowrap; }

.nav { display: flex; align-items: stretch; gap: 4px; margin-left: 36px; height: 100%; }
.nav-i {
  position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; height: 100%;
  font-size: 14px; font-weight: var(--fw-medium); color: var(--text-2); white-space: nowrap;
  transition: color var(--dur-1) var(--ease-out);
}
.nav-i:hover { color: var(--text); }
.nav-i::after {
  content: ""; position: absolute; left: 50%; top: calc(50% + 15px); width: 4px; height: 4px; margin-left: -2px; border-radius: 50%;
  background: var(--text); transform: scale(0); transition: transform var(--dur-2) var(--ease-pop);
}
.nav-i[aria-current="page"] { color: var(--text); }
.nav-i[aria-current="page"]::after { transform: scale(1); }
.nav-i:focus-visible { outline-offset: -8px; border-radius: var(--r-sm); }
.nav-count { font-size: 13px; font-weight: var(--fw-semibold); color: var(--tone, var(--text-3)); font-variant-numeric: tabular-nums; }

.hdr-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px 0 12px; border-radius: var(--r-pill);
  border: 1px solid var(--line); color: var(--text-2); font-size: 13px; white-space: nowrap;
  transition: border-color var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out), color var(--dur-1);
}
.search-btn:hover { border-color: var(--line-strong); color: var(--text); background: var(--bg-raised); }
.search-btn kbd { margin-left: 10px; }

.live {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: var(--r-pill);
  font-size: 13px; color: var(--text-2); white-space: nowrap; transition: background-color var(--dur-1) var(--ease-out);
}
.live:hover { background: var(--bg-sunken); color: var(--text); }
.live-t { font-variant-numeric: tabular-nums; }
.live[data-status="stale"] { color: var(--held); }
.live[data-status="error"] { color: var(--fault); }
.live-dot { display: none; width: 8px; height: 8px; border-radius: 50%; background: var(--free); }
.live[data-status="stale"] .live-dot { background: var(--held); }
.live[data-status="error"] .live-dot { background: var(--fault); }
.live[data-status="loading"] .live-dot { background: var(--offline); }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-pill); color: var(--text-2); flex: none;
  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.icon-btn:hover { background: var(--bg-sunken); color: var(--text); }
.icon-btn:focus-visible { outline-offset: 0; }
.icon-btn[aria-expanded="true"] { background: var(--bg-sunken); color: var(--text); }
.user-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px 0 10px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: var(--fw-medium); color: var(--text-2); white-space: nowrap; max-width: 160px;
  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1);
}
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--bg-sunken); color: var(--text); }
.user-btn .user-name { overflow: hidden; text-overflow: ellipsis; }
.m-only { display: none; }

/* ───────────────────────────── banner */
#banner { position: sticky; top: var(--header-h); z-index: calc(var(--z-header) - 1); background: var(--fault-soft); color: var(--text); }
.banner-in { min-height: 36px; display: flex; align-items: center; gap: 10px; font-size: 13px; padding-block: 6px; }
.banner-in .node { width: 8px; height: 8px; border-radius: 50%; background: var(--fault); flex: none; }
.banner-in > span { min-width: 0; flex: 1 1 auto; }
.banner-in .btn-text { margin-left: auto; font-weight: var(--fw-semibold); white-space: nowrap; flex: none; }

/* ───────────────────────────── footer */
#ftr { margin-top: var(--sp-8); }
.ftr-in { border-top: 1px solid var(--line); padding-block: 20px 28px; display: flex; align-items: center; gap: 10px;
          font-size: var(--fs-caption); color: var(--text-3); flex-wrap: wrap; }
.ftr-in .q-mark { width: 14px; height: 14px; color: var(--text-3); }
.ftr-in kbd { font-size: 11px; }
@media (pointer: coarse), (max-width: 639px) { .ftr-keys { display: none; } }

/* ───────────────────────────── mobile tab bar */
#tabbar { display: none; }

/* ───────────────────────────── buttons & small controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 32px; padding: 0 14px; border-radius: var(--r-pill);
  border: 1px solid var(--line-strong); font-size: 13px; font-weight: var(--fw-medium); color: var(--text); white-space: nowrap;
  transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out);
}
.btn:hover { background: var(--bg-sunken); }
.btn-ink { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-ink:hover { background: color-mix(in oklab, var(--text) 88%, var(--bg)); }
.btn-text {
  display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: var(--fw-medium); color: var(--text);
  border-radius: var(--r-xs); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; text-decoration-thickness: 1px;
  transition: text-decoration-color var(--dur-1) var(--ease-out);
}
.btn-text:hover { text-decoration-color: currentColor; }
.link-arrow { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: var(--fw-medium); color: var(--text); white-space: nowrap; }
.link-arrow .ic { transition: transform var(--dur-1) var(--ease-out); }
.link-arrow:hover .ic { transform: translateX(2px); }

kbd, .kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--r-xs);
  border: 1px solid var(--line); background: var(--bg-raised); color: var(--text-3);
  font-family: var(--font-sans); font-size: 11px; font-weight: var(--fw-medium); font-stretch: 105%; line-height: 1; letter-spacing: .02em; white-space: nowrap;
}

/* state node (generic 8px dot coloured by --tone) */
.node { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--tone, var(--text)); flex: none; }
.node.is-hollow { background: transparent; box-shadow: inset 0 0 0 1.5px var(--tone, var(--text)); }

/* ───────────────────────────── section head (components.sectionHead) */
.sh { border-top: 2px solid var(--rule); padding-top: 14px; margin-bottom: 16px; }
.sh-row { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; min-width: 0; }
.sh-title { font-size: var(--fs-h2); line-height: var(--lh-snug); font-weight: var(--fw-semibold); min-width: 0; }
.sh h3.sh-title { font-size: var(--fs-h3); }
.sh-meta { font-size: 13px; color: var(--text-3); display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.sh-meta .node { margin-right: 2px; }
.sh-right { margin-left: auto; display: inline-flex; align-items: center; gap: 12px; }
.sh.is-flash { animation: qq-flash 1.2s var(--ease-out); }
/* a number and its unit (or a date and its time) never split across lines */
.nw { white-space: nowrap; }
/* headings that receive focus on a view change are not controls: no ring */
h1[tabindex="-1"]:focus, #main[tabindex="-1"]:focus { outline: none; }
@keyframes qq-flash { from { background: var(--bg-sunken); } to { background: transparent; } }

/* ───────────────────────────── chips (components.chip) */
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 13px; font-weight: var(--fw-medium); white-space: nowrap;
  transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out), color var(--dur-1);
  user-select: none;
}
.chip:hover { background: var(--bg-sunken); border-color: var(--line-strong); }
.chip .chip-n { color: var(--text-3); font-variant-numeric: tabular-nums; font-weight: var(--fw-regular); }
.chip .viz-dot, .chip .viz-dots { flex: none; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip[aria-pressed="true"] .chip-n { color: color-mix(in oklab, var(--bg) 70%, var(--text)); }
.chip[aria-pressed="true"] circle.is-fill { stroke: var(--bg); stroke-width: 1.5px; }
.chip[aria-pressed="true"] circle.is-ring { fill: var(--bg); }
.chip[aria-pressed="true"] circle.is-fill[fill="var(--busy)"] { fill: var(--bg); stroke: none; }   /* ink dot on an ink chip → paper dot */
/* partly pressed: a narrower filter inside this chip's group is on (e.g. 失联 inside 需要处理) — ink outline, not inverted */
.chip[aria-pressed="mixed"] { color: var(--text); border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.chip[aria-pressed="mixed"] .chip-n { color: var(--text-2); }
@media (pointer: coarse) { .chip { height: 36px; } }

/* ───────────────────────────── segmented (components.segmented) */
.seg { display: inline-flex; align-items: center; height: 32px; padding: 2px; gap: 2px; border-radius: var(--r-pill); border: 1px solid var(--line); flex: none; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg-o {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  height: 26px; padding: 0 12px; border-radius: var(--r-pill); font-size: 13px; font-weight: var(--fw-medium); color: var(--text-2); white-space: nowrap;
  font-variant-numeric: tabular-nums; transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.seg-o:hover { color: var(--text); background: var(--bg-sunken); }
.seg-o[aria-checked="true"] { background: var(--text); color: var(--bg); }
.seg-o:focus-visible { outline-offset: 0; }
@media (pointer: coarse) { .seg { height: 40px; } .seg-o { height: 34px; padding: 0 14px; } }

.select {
  height: 32px; padding: 0 30px 0 14px; border-radius: var(--r-pill); border: 1px solid var(--line); background: transparent; color: var(--text);
  font-size: 13px; font-weight: var(--fw-medium); appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
@media (pointer: coarse) { .select { height: 40px; } }
/* iOS Safari zooms the page on focus of any field under 16px: phones and touch screens get 16px text in fields */
@media (max-width: 639px), (pointer: coarse) { .select, input[type="text"], input[type="password"], input[type="search"] { font-size: 16px; } }

/* ───────────────────────────── empty state (components.emptyState) */
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 56px 0; max-width: 520px; }
.empty .q-mark { width: 72px; height: 72px; color: var(--track); margin-bottom: 14px; }
.empty .q-mark.is-ghost { color: var(--line-strong); }
.empty h2 { font-size: var(--fs-h2); }
.empty p { color: var(--text-2); font-size: 14px; }
.empty .btn { margin-top: 8px; }
.empty.is-center { align-items: center; text-align: center; margin-inline: auto; }

/* ───────────────────────────── kv list (components.kvList) */
.kv { display: grid; grid-template-columns: minmax(0, 1fr); }
.kv-row { display: grid; grid-template-columns: minmax(120px, 40%) minmax(0, 1fr); gap: 16px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv-row dt { color: var(--text-2); display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.kv-row dd { color: var(--text); text-align: right; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.kv-row dt .node { background: var(--tone, var(--line-strong)); }
.kv-row:not([data-level]) dt .node { background: var(--line-strong); transform: scale(.75); }   /* no issue: a quiet solid node */
.kv-row[data-level] dd { color: var(--tone); font-weight: var(--fw-medium); }

/* ───────────────────────────── table (components.table) */
.tbl-wrap { width: 100%; overflow-x: auto; }
.tbl { width: 100%; font-size: 13px; }
.tbl th { height: 36px; padding: 0 12px; text-align: left; font-size: 12px; font-weight: var(--fw-regular); color: var(--text-3); white-space: nowrap; border-bottom: 1px solid var(--line-strong); }
.tbl th:first-child, .tbl td:first-child { padding-left: 0; }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; }
.tbl td { height: 44px; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .is-center { text-align: center; }
.tbl th.is-num .th-sort { flex-direction: row-reverse; }
.th-sort { display: inline-flex; align-items: center; gap: 4px; color: inherit; font-size: inherit; height: 28px; border-radius: var(--r-xs); }
.th-sort:hover { color: var(--text); }
.th-sort .ic { opacity: 0; transition: opacity var(--dur-1), transform var(--dur-1); }
th[aria-sort="ascending"] .th-sort, th[aria-sort="descending"] .th-sort { color: var(--text); }
th[aria-sort="ascending"] .th-sort .ic { opacity: 1; transform: rotate(180deg); }
th[aria-sort="descending"] .th-sort .ic { opacity: 1; }
.tbl tbody tr { transition: background-color var(--dur-1) var(--ease-out); }
.tbl tbody tr:hover { background: color-mix(in oklab, var(--bg-sunken) 60%, transparent); }

/* ───────────────────────────── generic text-link entity (lede / sentences) */
.ent { color: var(--text); font-weight: var(--fw-medium); text-decoration: underline; text-decoration-color: var(--tone, var(--line-strong));
       text-decoration-thickness: 1.5px; text-underline-offset: 4px; cursor: pointer; border-radius: 2px; }
.ent:hover { text-decoration-color: var(--text); }

/* ───────────────────────────── tooltip (#tip) */
#tip {
  position: fixed; left: 0; top: 0; z-index: var(--z-tip); max-width: 300px; padding: 10px 12px;
  background: var(--bg-raised); color: var(--text); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop);
  font-size: 13px; line-height: 1.5; pointer-events: none; white-space: normal; overflow-wrap: anywhere;
}
#tip .tip-t { font-weight: var(--fw-semibold); }
#tip .tip-m { color: var(--text-3); font-size: 12px; }
#tip .tip-row { display: flex; align-items: center; gap: 8px; }
#tip .tip-row + .tip-row { margin-top: 2px; }
#tip .tip-k { color: var(--text-3); }
#tip .tip-v { margin-left: auto; padding-left: 16px; font-variant-numeric: tabular-nums; font-weight: var(--fw-medium); }
#tip .tip-sep { height: 1px; background: var(--line); margin: 8px 0; }
#tip .num { font-variant-numeric: tabular-nums; }

/* ───────────────────────────── overlays: scrim, menus, sheets, palette */
.scrim { position: fixed; inset: 0; z-index: var(--z-scrim); background: var(--scrim); opacity: 0; transition: opacity var(--dur-2) var(--ease-out); }
.scrim.is-in { opacity: 1; }

.menu {
  position: fixed; z-index: var(--z-palette); min-width: 200px; padding: 6px; border-radius: var(--r-md);
  background: var(--bg-raised); border: 1px solid var(--line); box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(-4px); transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}
.menu.is-in { opacity: 1; transform: none; }
.menu-h { padding: 8px 10px 6px; font-size: 12px; color: var(--text-3); }
.menu-i {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px; border-radius: var(--r-sm);
  font-size: 14px; color: var(--text); text-align: left;
}
.menu-i:hover, .menu-i:focus-visible { background: var(--bg-sunken); }
/* the tint alone is ~1.1:1 — keyboard focus also gets the 2px ring, inset so it never spills out of the menu */
.menu-i:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
/* keyboard shortcuts mean nothing on a touch-only device */
@media (hover: none) and (pointer: coarse) { .menu-i:is([data-action="shortcuts"], [data-action="keys-toggle"]) { display: none; } }
.menu-i .ic { color: var(--text-2); }
.menu-i[aria-checked="true"] .menu-check { opacity: 1; }
.menu-check { margin-left: auto; opacity: 0; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-user { display: flex; align-items: center; gap: 10px; padding: 10px; font-size: 14px; }
.menu-user .ic { color: var(--text-3); }
@media (pointer: coarse) { .menu-i { min-height: 44px; } }

.sheet {
  position: fixed; z-index: var(--z-palette); left: 50%; top: 12vh; width: min(560px, calc(100vw - 32px)); max-height: 76vh; overflow: auto;
  background: var(--bg-raised); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); border: 1px solid var(--line);
  opacity: 0; transform: translate(-50%, 8px); transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}
.sheet.is-in { opacity: 1; transform: translate(-50%, 0); }
.sheet-h { display: flex; align-items: center; gap: 12px; padding: 18px 16px 10px 24px; }
.sheet-h h2 { font-size: 18px; }
.sheet-h .icon-btn { margin-left: auto; }
.sheet-b { padding: 4px 24px 24px; }
.keys { display: grid; grid-template-columns: minmax(0, 1fr); }
.keys-row { display: flex; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.keys-row:last-child { border-bottom: 0; }
.keys-k { display: inline-flex; gap: 4px; flex-wrap: wrap; align-items: center; min-width: 150px; color: var(--text-3); font-size: 12px; }
.keys-a { color: var(--text); }
/* 单键快捷键 on / off (WCAG 2.1.4): a switch row above the list; while off, the single-key rows read as unavailable */
.keys-pref { display: flex; align-items: center; gap: 16px; padding: 4px 0 14px; border-bottom: 1px solid var(--line); }
.keys-pref-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 14px; }
.keys-pref-t small { font-size: 12px; color: var(--text-3); }
.kswitch { position: relative; flex: none; margin-left: auto; width: 40px; height: 24px; border-radius: var(--r-pill); background: var(--line-strong);
  transition: background-color var(--dur-1) var(--ease-out); }
.kswitch::before { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--bg-raised);
  box-shadow: 0 0 0 1px var(--line); transition: transform var(--dur-2) var(--ease-out); }
.kswitch[aria-pressed="true"] { background: var(--text); }
.kswitch[aria-pressed="true"]::before { transform: translateX(16px); }
.keys.is-off .keys-row.is-single { opacity: .45; }

/* palette */
.pal {
  position: fixed; z-index: var(--z-palette); left: 50%; top: 12vh; width: min(640px, calc(100vw - 32px));
  background: var(--bg-raised); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); border: 1px solid var(--line); overflow: hidden;
  opacity: 0; transform: translate(-50%, 8px) scale(.99); transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
  display: flex; flex-direction: column; max-height: min(620px, 76vh);
}
.pal.is-in { opacity: 1; transform: translate(-50%, 0) scale(1); }
.pal-in { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 14px 0 18px; border-bottom: 1px solid var(--line); flex: none; }
.pal-in .ic { color: var(--text-3); flex: none; }
.pal-in input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; font-size: 17px; color: var(--text); outline: none; }
.pal-in input::placeholder { color: var(--text-3); }
.pal-list { overflow-y: auto; padding: 6px; overscroll-behavior: contain; }
.pal-gh { padding: 10px 10px 4px; font-size: 12px; color: var(--text-3); letter-spacing: var(--track-eyebrow); }
.pal-row {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 44px; padding: 0 10px;
  border-radius: var(--r-sm); cursor: pointer; font-size: 14px;
}
.pal-row[aria-selected="true"] { background: var(--bg-sunken); box-shadow: inset 2px 0 0 var(--text); }   /* the tint alone is ~1.1:1 */
.pal-lead { display: grid; place-items: center; width: 24px; height: 24px; color: var(--text-2); }
.pal-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-title mark, .pal-meta mark { background: none; color: var(--text); font-weight: var(--fw-semibold); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.pal-meta { font-size: 12px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
.pal-meta .tone { color: var(--tone); }
.pal-empty { padding: 28px 16px; text-align: center; color: var(--text-3); font-size: 14px; }
.pal-empty-t { color: var(--text-2); }
.pal-empty-s { margin-top: 6px; font-size: 13px; }
.pal-empty-s b { color: var(--text); font-weight: var(--fw-medium); }
.pal-foot { display: flex; gap: 16px; align-items: center; padding: 10px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); flex: none; }
.pal-foot span { display: inline-flex; align-items: center; gap: 6px; }

/* ───────────────────────────── loading ghost (track-only mark with a slow sweep) */
.ghost-sweep { animation: qq-ghost 1.6s var(--ease-in-out) infinite; }
@keyframes qq-ghost { 0% { stroke-dashoffset: 100; } 60% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -100; } }
.skel-line { height: 1px; background: var(--line); }
.skel-bar { display: inline-block; height: 12px; border-radius: var(--r-xs); background: var(--track); vertical-align: middle; }

/* ───────────────────────────── shared small patterns (overview · server · alerts) */
/* all-clear row: a --free node + quiet copy */
.allclear { display: flex; align-items: center; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); color: var(--text-2); font-size: 14px; }
/* level count in section metas: "● 严重 2  ○ 警告 8" */
.lvl { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.lvl .node { width: 8px; height: 8px; }
.lvl b { font-weight: var(--fw-semibold); color: var(--tone); }
.lvl .node.is-hollow { background: var(--tone); box-shadow: none; }   /* level marks are solid (hollow = free only) */
/* "正在看:linchen 的卡(2 张) · 清除" — in flow under a filter, never over content */
.watch-in { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 6px 0 14px; max-width: 100%;
  border-radius: var(--r-pill); background: var(--bg-sunken); color: var(--text-2); font-size: 13px; animation: qq-pop var(--dur-2) var(--ease-out); }
.watch-in b { font-weight: var(--fw-semibold); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-sep { color: var(--text-3); margin: 0 4px; }
.watch-in .btn-text { padding: 0 8px; height: 26px; border-radius: var(--r-pill); }
@keyframes qq-pop { from { opacity: 0; transform: translateY(-4px); } }
.placeholder { padding: 72px 0; }

/* ───────────────────────────── tablet & phone shell */
@media (max-width: 1199px) {
  .search-btn kbd { display: none; }
  .nav { margin-left: 20px; }
}
@media (max-width: 899px) {
  .lockup-text, .lockup-div { display: none; }
  .search-btn .search-label { display: none; }
  .search-btn { width: 32px; padding: 0; justify-content: center; }
  .live .live-t { display: none; }
}
@media (max-width: 639px) {
  .hdr-in { gap: 6px; }
  .lockup { gap: 10px; }
  .lockup .q-mark { width: 22px; height: 22px; }
  .lockup-prod { font-size: 16px; font-weight: var(--fw-semibold); }
  .nav, .search-btn, .user-btn, .hdr-tools > .js-theme { display: none; }
  .m-only { display: inline-grid; }
  .hdr-tools { gap: 0; margin-right: -10px; }
  .hdr-tools .icon-btn { width: 44px; height: 44px; }
  .live { width: 44px; height: 44px; padding: 0; justify-content: center; border-radius: 50%; }
  .live .viz-live { display: none; }
  .live .live-dot { display: block; }

  #tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-tabbar);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in oklab, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(1.1); backdrop-filter: blur(14px) saturate(1.1);
    border-top: 1px solid var(--line);
  }
  .tab {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 44px;
    color: var(--text-3); font-size: 12px; font-weight: var(--fw-medium); letter-spacing: .04em;
  }
  .tab .ic { width: 22px; height: 22px; }
  .tab[aria-current="page"] { color: var(--text); }
  .tab::before { content: ""; position: absolute; top: 4px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--text); transform: scale(0); transition: transform var(--dur-2) var(--ease-pop); }
  .tab[aria-current="page"]::before { transform: scale(1); }
  .tab-ic { position: relative; }
  .tab-n { position: absolute; left: calc(100% + 1px); top: -4px; font-size: var(--fs-micro); font-weight: var(--fw-bold); color: var(--tone, var(--text-3)); font-variant-numeric: tabular-nums; line-height: 1; }
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  #main { padding-bottom: 24px; }
  .ftr-in { padding-bottom: 16px; }
  .sheet { top: auto; bottom: 0; left: 0; width: 100%; max-height: 88dvh; transform: translateY(16px); border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .sheet.is-in { transform: none; }
  .pal { top: 8px; max-height: calc(100dvh - 16px); }
  .pal-in input { font-size: 16px; }
  .pal-foot { display: none; }
  .sh-right { margin-left: 0; width: 100%; }
  .sh-row { row-gap: 6px; }
  /* keyboard focus (Tab, j / k) never lands under the fixed tab bar (WCAG 2.4.11): scrollIntoView honours this */
  html { scroll-padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); }
}
@media (min-width: 640px) {
  .hdr .m-only { display: none; }
}

/* ───────────────────────────── phones: every control gets a ≥44px hit box (drawn size unchanged; ::after extends it) */
@media (max-width: 639px), (pointer: coarse) {
  .seg-o, .chip, .th-sort, .srv-step, .link-arrow, .btn-text, .icon-btn, .ov-fchip, .qleg-i, .search-btn, .live, .user-btn { position: relative; }
  .chip::after, .th-sort::after, .qleg-i::after, .search-btn::after, .live::after, .user-btn::after {
    content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }
  .select { height: 44px; }
  /* segmented: the pill itself is 44px tall; the hit box fills it (a taller ::after would make the scrolling .seg overflow) */
  .seg { height: 44px; }
  .seg-o::after { content: ""; position: absolute; left: 0; right: 0; top: -2px; bottom: -2px; }
  .link-arrow::after, .btn-text::after { content: ""; position: absolute; left: -6px; right: -6px; top: 50%; height: 44px; transform: translateY(-50%); }
  .srv-step::after, .icon-btn::after { content: ""; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); }
  /* inline text links: padding grows the hit area of an inline box without moving the line */
  .ent, .ov-free-srv, .srv-fi, .srv-name a, .al-srv-name a, .ov-more, .u-srv, .al-fig-a { padding-block: 12px; }
  /* small inline links and labels that are the only way somewhere: a ≥ 44px box around the drawn text */
  .srv-alerts, .lockup { position: relative; }
  .srv-alerts::after, .lockup::after { content: ""; position: absolute; left: -8px; right: -8px; top: 50%; height: 44px; min-height: 100%; transform: translateY(-50%); }
  /* (these two sit in overflow-clipped boxes, so they grow their own padding box instead of a pseudo-element) */
  .srv-crumb-l { overflow: visible; }
  .srv-crumb-l a { display: inline-block; padding: 14px 10px; margin: -14px -10px; }
  :is(.v-history, .v-server) .hs-sm-name { padding-block: 12px; margin-block: -12px; }
  .seg-o { height: 38px; }
  /* the server orbit's 10px card nodes are not touch targets (the cards below are); nor are the hero's beads (18–33px
     apart on a phone — a tap opened the wrong drawer): a tap on the ring filters its group, as qLegend does */
  .viz-orbit .orbit-hit, .viz-orbit .orbit-n, .viz-qi .in-bd { pointer-events: none; }
}

/* ───────────────────────────── short viewports (landscape phones, 400% zoom): nothing sticks, so content gets the room */
@media (max-height: 500px) {
  .hdr { position: static; }
  #banner { top: 0; }
  html { scroll-padding-top: 16px; scroll-padding-bottom: 0; }
  /* the tab bar sits after the footer in the DOM: let it end the page instead of covering it */
  #tabbar { position: static; }
  body { padding-bottom: 0; }
}

/* ───────────────────────────── forced colours (Windows contrast themes): keep the meaning that colour carried */
@media (forced-colors: active) {
  .node { forced-color-adjust: none; }
  .chip[aria-pressed="true"], .seg-o[aria-checked="true"], .qleg-i[aria-pressed="true"], .ledger-item[aria-pressed="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
  .menu-i:focus-visible, .pal-row[aria-selected="true"] { outline: 2px solid Highlight; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 0ms !important; scroll-behavior: auto !important; }
}
