/* Sandbox 管理台样式。
   约定：颜色、圆角、间距、阴影、动效时长全部是变量；业务样式只引用变量。
   深浅色跟随系统，不提供切换。 */

:root {
  color-scheme: light dark;

  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #f2f2f4;
  --overlay: #ffffff;
  --border: #e4e4e7;
  --border-strong: #d1d1d6;
  --text: #18181b;
  --text-2: #52525b;
  --text-3: #8b8b94;
  --accent: #0f766e;
  --accent-hover: #0c5f59;
  --accent-soft: #e3f3f1;
  --accent-text: #ffffff;
  --ok: #15803d;      --ok-soft: #e6f4ea;
  --warn: #a16207;    --warn-soft: #fbf1d7;
  --danger: #b91c1c;  --danger-soft: #fbe9e9;  --danger-hover: #991b1b;
  --info: #1d4ed8;    --info-soft: #e7edfd;
  --mute-soft: #ececef;
  --scrim: rgba(24, 24, 27, 0.38);
  --flash: #fff6d6;

  --r-s: 6px;
  --r-m: 8px;
  --r-l: 12px;
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --shadow-float: 0 8px 28px rgba(24, 24, 27, 0.14), 0 1px 3px rgba(24, 24, 27, 0.08);
  --t-fast: 120ms;
  --t-base: 180ms;
  --t-slow: 260ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  --side-w: 216px;
  --side-w-mini: 56px;
  --top-h: 52px;
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f11;
    --surface: #16171a;
    --surface-2: #1d1f23;
    --overlay: #212328;
    --border: #2a2c31;
    --border-strong: #3a3d44;
    --text: #e9e9ec;
    --text-2: #a9abb3;
    --text-3: #7c7f88;
    --accent: #2ab5a8;
    --accent-hover: #46c7bb;
    --accent-soft: #12332f;
    --accent-text: #06201d;
    --ok: #4ade80;      --ok-soft: #12301d;
    --warn: #eab54a;    --warn-soft: #33290f;
    --danger: #f87171;  --danger-soft: #3a1717;  --danger-hover: #fca5a5;
    --info: #7aa2ff;    --info-soft: #162444;
    --mute-soft: #26282d;
    --scrim: rgba(0, 0, 0, 0.55);
    --flash: #2f2a12;
    --shadow-float: 0 0 0 1px var(--border-strong);
  }
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; margin: 0; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
table { border-collapse: collapse; border-spacing: 0; width: 100%; }
th { text-align: left; font-weight: 500; }
svg { display: block; flex: none; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-s); }
::selection { background: var(--accent-soft); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
input:-webkit-autofill, input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 100px var(--surface) inset;
  caret-color: var(--text);
}
.noscript { padding: var(--s-5); }

/* ---------- boot / login ---------- */
.boot { height: 100dvh; display: grid; place-items: center; }
.boot-mark { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border-strong);
  border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login { height: 100dvh; display: grid; place-items: center; padding: var(--s-4);
  padding-bottom: max(var(--s-4), env(safe-area-inset-bottom)); overflow: auto; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-l); padding: var(--s-6) var(--s-5) var(--s-5); animation: rise var(--t-slow) var(--ease); }
.login-brand { display: flex; align-items: center; gap: var(--s-2); font-weight: 600; font-size: 15px; margin-bottom: var(--s-5); }
.brand-dot { width: 18px; height: 18px; border-radius: 5px; background: var(--accent); position: relative; }
.brand-dot::after { content: ""; position: absolute; inset: 5px; border-radius: 2px; background: var(--surface); }
.login h1 { font-size: 20px; font-weight: 600; margin-bottom: var(--s-1); }
.login-sub { color: var(--text-2); margin-bottom: var(--s-5); }
.code-input { font-family: var(--mono); font-size: 24px !important; letter-spacing: 0.42em; text-align: center;
  height: 52px !important; padding-left: 0.42em !important; }
.login .btn { width: 100%; margin-top: var(--s-4); height: 40px; }
.login-foot { margin-top: var(--s-4); color: var(--text-3); font-size: 12px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* ---------- shell ---------- */
.shell { height: 100dvh; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr);
  transition: grid-template-columns var(--t-base) var(--ease); }
.shell.mini { grid-template-columns: var(--side-w-mini) minmax(0, 1fr); }
.side { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column;
  min-width: 0; overflow: hidden; }
.side-head { height: var(--top-h); display: flex; align-items: center; gap: var(--s-2); padding: 0 var(--s-4);
  font-weight: 600; white-space: nowrap; flex: none; }
.nav { flex: 1; overflow-y: auto; padding: var(--s-2); display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: var(--s-3); height: 36px; padding: 0 10px; border-radius: var(--r-s);
  color: var(--text-2); white-space: nowrap; transition: background var(--t-fast), color var(--t-fast); }
.nav a svg { width: 18px; height: 18px; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.nav a:active { transform: scale(0.98); }
.nav-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 11px;
  line-height: 18px; text-align: center; background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.side-foot { padding: var(--s-2); border-top: 1px solid var(--border); flex: none; }
.shell.mini .label, .shell.mini .nav-badge { display: none; }
.shell.mini .side-head { padding: 0; justify-content: center; }
.shell.mini .nav a { justify-content: center; padding: 0; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top { height: var(--top-h); flex: none; display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--s-5);
  border-bottom: 1px solid var(--border); background: var(--surface); }
.top h1 { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.top-spacer { flex: 1; }
.who { color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.content { flex: 1; min-height: 0; overflow-y: auto; padding: var(--s-5); container-type: inline-size;
  padding-bottom: max(var(--s-5), env(safe-area-inset-bottom)); }
.page { display: flex; flex-direction: column; gap: var(--s-5); animation: fade var(--t-base) ease-out; }
@keyframes fade { from { opacity: 0; } }
.btn.menu-btn { display: none; }
.drawer-scrim { display: none; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: var(--r-s); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 500; white-space: nowrap; user-select: none; position: relative;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast), opacity var(--t-fast); }
.btn:active:not(:disabled) { transform: scale(0.97); background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:active:not(:disabled) { background: var(--accent-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:active:not(:disabled) { background: var(--danger-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.text-danger { color: var(--danger); }
.btn.small { height: 28px; padding: 0 8px; font-size: 13px; }
.btn.icon { width: 32px; padding: 0; }
.btn.icon.small { width: 28px; }
.btn svg { width: 16px; height: 16px; }
.btn.busy { color: transparent !important; pointer-events: none; }
.btn.busy::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--text-3); border-top-color: transparent; animation: spin 0.7s linear infinite; }
.btn.primary.busy::after, .btn.danger.busy::after { border-color: rgba(255, 255, 255, 0.85); border-top-color: transparent; }
.btn.done { color: var(--ok); border-color: var(--ok); }
@media (hover: hover) {
  .btn:hover:not(:disabled) { background: var(--surface-2); }
  .btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
  .btn.danger:hover:not(:disabled) { background: var(--danger-hover); border-color: var(--danger-hover); }
  .btn.ghost:hover:not(:disabled) { background: var(--mute-soft); color: var(--text); }
  .nav a:hover { background: var(--surface-2); color: var(--text); }
  .nav a[aria-current="page"]:hover { background: var(--accent-soft); color: var(--accent); }
  .row-click:hover > td { background: var(--surface-2); }
  .card-item.row-click:hover { border-color: var(--border-strong); }
  .opt:hover { background: var(--surface-2); }
}

/* ---------- form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label-row { font-size: 13px; font-weight: 500; color: var(--text); }
.label-row { display: flex; align-items: center; gap: 6px; }
.hint { font-size: 12px; color: var(--text-3); line-height: 1.45; }
.field-error { font-size: 12px; color: var(--danger); }
.input, .select-btn, textarea.input { width: 100%; height: 34px; padding: 0 10px; border-radius: var(--r-s);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast); }
textarea.input { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; }
.input::placeholder { color: var(--text-3); }
.input:focus, .select-btn:focus-visible, .select-btn[aria-expanded="true"] { border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.input.invalid { border-color: var(--danger); }
.input:disabled { background: var(--surface-2); color: var(--text-3); }
.input-unit { position: relative; }
.input-unit .input { padding-right: 52px; }
.input-unit span { position: absolute; right: 10px; top: 0; height: 34px; display: flex; align-items: center;
  color: var(--text-3); font-size: 12px; pointer-events: none; }
.select-btn { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); text-align: left; cursor: pointer; }
.select-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.select-btn svg { width: 14px; height: 14px; color: var(--text-3); transition: transform var(--t-fast); }
.select-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.select-btn.compact { width: auto; min-width: 120px; height: 32px; }
.pop { position: fixed; z-index: 60; min-width: 160px; max-height: 300px; overflow-y: auto; padding: 4px;
  background: var(--overlay); border: 1px solid var(--border); border-radius: var(--r-m); box-shadow: var(--shadow-float);
  animation: pop-in var(--t-fast) var(--ease); transform-origin: top; }
.pop.leaving { animation: pop-out var(--t-fast) ease-in forwards; }
@keyframes pop-in { from { opacity: 0; transform: scale(0.97) translateY(-3px); } }
@keyframes pop-out { to { opacity: 0; transform: scale(0.98); } }
.opt { display: flex; align-items: center; gap: var(--s-2); width: 100%; min-height: 32px; padding: 6px 10px;
  border-radius: var(--r-s); text-align: left; color: var(--text); }
.opt[aria-selected="true"] { color: var(--accent); font-weight: 500; }
.opt.active { background: var(--surface-2); }
.opt.danger { color: var(--danger); }
.opt .tick { margin-left: auto; width: 14px; height: 14px; }
.opt-sub { color: var(--text-3); font-size: 12px; }

.check { display: inline-flex; align-items: flex-start; gap: var(--s-2); cursor: pointer; line-height: 20px; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check .box { flex: none; width: 16px; height: 16px; margin-top: 2px; border-radius: 4px; border: 1px solid var(--border-strong);
  background: var(--surface); display: grid; place-items: center; transition: background var(--t-fast), border-color var(--t-fast); }
.check .box svg { width: 11px; height: 11px; color: var(--accent-text); opacity: 0; transform: scale(0.6);
  transition: opacity var(--t-fast), transform var(--t-fast); }
.check input:checked + .box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .box svg { opacity: 1; transform: none; }
.check input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }

.switch { position: relative; display: inline-flex; flex: none; width: 34px; height: 20px; border-radius: 10px;
  background: var(--border-strong); transition: background var(--t-base); cursor: pointer; vertical-align: middle; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform var(--t-base) var(--ease); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(14px); }
.switch:active::after { width: 19px; }
.switch[aria-checked="true"]:active::after { transform: translateX(11px); }
.switch:disabled { opacity: 0.5; cursor: not-allowed; }
.switch-row { display: flex; align-items: flex-start; gap: var(--s-3); }
.switch-row > div { min-width: 0; }

.seg { display: inline-flex; padding: 2px; background: var(--mute-soft); border-radius: var(--r-s); gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button { height: 28px; padding: 0 10px; border-radius: 5px; color: var(--text-2); white-space: nowrap; font-size: 13px;
  transition: background var(--t-fast), color var(--t-fast); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 500;
  box-shadow: 0 0 0 1px var(--border); }

/* ---------- panels, tables ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-l); min-width: 0; }
.panel-head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); min-height: 48px; }
.panel-head h2 { font-size: 14px; font-weight: 600; white-space: nowrap; }
.panel-head .sub { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.panel-body { padding: var(--s-4); }
.toolbar { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; position: sticky; top: calc(-1 * var(--s-5));
  z-index: 5; background: var(--bg); padding: var(--s-2) 0; margin: calc(-1 * var(--s-2)) 0; }
.toolbar .grow { flex: 1; min-width: 0; }
.search { position: relative; flex: 1; min-width: 160px; max-width: 320px; }
.search .input { padding-left: 32px; }
.search svg { position: absolute; left: 10px; top: 9px; width: 16px; height: 16px; color: var(--text-3); }
.only-narrow { display: none; }

.table-wrap { overflow-x: auto; border-radius: var(--r-l); }
.table th { position: sticky; top: 0; z-index: 1; background: var(--surface); color: var(--text-3); font-size: 12px;
  height: 36px; padding: 0 var(--s-3); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { height: 44px; padding: 6px var(--s-3); border-bottom: 1px solid var(--border); vertical-align: middle;
  max-width: 320px; transition: background var(--t-fast); }
.table tr:last-child td { border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-left: var(--s-4); }
.table th:last-child, .table td:last-child { padding-right: var(--s-4); }
.table .num { text-align: right; white-space: nowrap; }
.table .act { text-align: right; white-space: nowrap; width: 1%; }
.act-row { display: inline-flex; gap: 2px; align-items: center; justify-content: flex-end; }
.row-click { cursor: pointer; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ell2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.muted { color: var(--text-3); }
.dim { color: var(--text-2); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.idcell { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; min-width: 0; }
.idcell .mono { white-space: nowrap; }
.copy { width: 24px; height: 24px; display: inline-grid; place-items: center; border-radius: var(--r-s); color: var(--text-3); flex: none;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast); }
.copy svg { width: 13px; height: 13px; }
.copy:active { transform: scale(0.9); }
.copy.ok { color: var(--ok); }
@media (hover: hover) { .copy:hover { background: var(--mute-soft); color: var(--text); } }
.flash > td, .card-item.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--flash); } }
.stale { opacity: 0.55; transition: opacity var(--t-base); }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px;
  font-weight: 500; white-space: nowrap; background: var(--mute-soft); color: var(--text-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.plain::before { display: none; }
.badge.spin::before { background: none; border: 1.5px solid currentColor; border-top-color: transparent; width: 8px; height: 8px; animation: spin 0.8s linear infinite; }

.cards { display: none; flex-direction: column; gap: var(--s-2); padding: var(--s-2); }
.card-item { border: 1px solid var(--border); border-radius: var(--r-m); padding: var(--s-3); background: var(--surface);
  display: flex; flex-direction: column; gap: 4px; min-width: 0; transition: border-color var(--t-fast), transform var(--t-fast); }
.card-item.row-click:active { transform: scale(0.99); }
.card-top { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.card-top .title { flex: 1; min-width: 0; font-weight: 500; }
.card-line { color: var(--text-2); font-size: 13px; min-width: 0; }

@container (max-width: 860px) { .hide-m { display: none; } }
@container (max-width: 620px) {
  .table-wrap.to-cards .table { display: none; }
  .table-wrap.to-cards + .cards, .cards.always { display: flex; }
  .only-narrow { display: inline-flex; }
  .hide-narrow { display: none !important; }
}

.empty { padding: var(--s-6) var(--s-4); text-align: center; color: var(--text-2); display: flex; flex-direction: column;
  align-items: center; gap: var(--s-2); }
.empty strong { color: var(--text); font-weight: 500; }
.empty .btn { margin-top: var(--s-2); }
.skel { padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); }
.skel i { display: block; height: 14px; border-radius: 4px; background: var(--mute-soft); animation: pulse 1.2s ease-in-out infinite; }
.skel i:nth-child(2) { width: 82%; } .skel i:nth-child(3) { width: 64%; } .skel i:nth-child(4) { width: 76%; }
@keyframes pulse { 50% { opacity: 0.45; } }

/* ---------- overview ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s-3); }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-l); padding: var(--s-4); min-width: 0; }
.tile .k { color: var(--text-2); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.tile .v { font-size: 26px; font-weight: 600; line-height: 1.25; margin-top: 4px; letter-spacing: -0.01em; }
.tile .v small { font-size: 13px; font-weight: 400; color: var(--text-3); margin-left: 4px; letter-spacing: 0; }
.tile .d { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.alerts { display: flex; flex-direction: column; gap: var(--s-2); }
.alert { display: flex; gap: var(--s-2); align-items: flex-start; padding: 10px var(--s-3); border-radius: var(--r-m);
  background: var(--info-soft); color: var(--info); font-size: 13px; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert svg { width: 16px; height: 16px; margin-top: 2px; }
.alert span { color: var(--text); }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5); }
@container (max-width: 900px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.meter { height: 6px; border-radius: 3px; background: var(--mute-soft); overflow: hidden; min-width: 60px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transform-origin: left; transition: transform var(--t-slow) var(--ease); }
.meter.over i { background: var(--danger); }
.evt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s-3); align-items: start; padding: 10px var(--s-4);
  border-bottom: 1px solid var(--border); }
.evt:last-child { border-bottom: 0; }
.evt .msg { min-width: 0; }
.evt .meta { color: var(--text-3); font-size: 12px; margin-top: 2px; display: flex; gap: var(--s-2); flex-wrap: wrap; }
.evt time { color: var(--text-3); font-size: 12px; white-space: nowrap; }

/* ---------- settings ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s-4) var(--s-5); }
.form-col { display: flex; flex-direction: column; gap: var(--s-4); max-width: 560px; }
.form-foot { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-top: 1px solid var(--border); }
.form-foot .note { color: var(--text-3); font-size: 12px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px var(--s-4); font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { min-width: 0; overflow-wrap: anywhere; }
.info-btn { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--text-3); }
.info-btn svg { width: 14px; height: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- overlays ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); display: grid; place-items: center; padding: var(--s-4);
  animation: fade var(--t-base) ease-out; }
.scrim.modal { z-index: 45; }   /* 对话框要盖在抽屉（41）之上 */
.scrim.leaving { animation: fade-out var(--t-fast) ease-in forwards; }
@keyframes fade-out { to { opacity: 0; } }
.dialog { width: 100%; max-width: 480px; max-height: min(86dvh, 720px); display: flex; flex-direction: column; background: var(--overlay);
  border: 1px solid var(--border); border-radius: var(--r-l); box-shadow: var(--shadow-float); animation: dialog-in var(--t-base) var(--ease); }
.dialog.wide { max-width: 620px; }
.scrim.leaving .dialog { animation: dialog-out var(--t-fast) ease-in forwards; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes dialog-out { to { opacity: 0; transform: scale(0.98); } }
.dialog-head { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-4) var(--s-4) var(--s-2) var(--s-5); }
.dialog-head h2 { flex: 1; font-size: 16px; font-weight: 600; min-width: 0; }
.dialog-body { padding: var(--s-2) var(--s-5) var(--s-4); overflow-y: auto; display: flex; flex-direction: column; gap: var(--s-4); }
.dialog-body p { color: var(--text-2); }
.dialog-foot { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-3) var(--s-5) var(--s-4); flex-wrap: wrap; }
.dialog-error { color: var(--danger); font-size: 13px; margin-right: auto; align-self: center; min-width: 0; flex: 1 1 200px; }
.secret-box { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-3); border-radius: var(--r-m); background: var(--surface-2);
  border: 1px solid var(--border); }
.secret-box code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }

.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 41; width: min(560px, 100vw); background: var(--overlay);
  border-left: 1px solid var(--border); box-shadow: var(--shadow-float); display: flex; flex-direction: column;
  animation: drawer-in var(--t-slow) var(--ease); }
.drawer.leaving { animation: drawer-out var(--t-base) ease-in forwards; }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } }
@keyframes drawer-out { to { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: var(--s-2); height: var(--top-h); padding: 0 var(--s-3) 0 var(--s-5);
  border-bottom: 1px solid var(--border); flex: none; }
.drawer-head h2 { flex: 1; font-size: 15px; font-weight: 600; min-width: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-5);
  padding-bottom: max(var(--s-5), env(safe-area-inset-bottom)); container-type: inline-size; }
.drawer-foot { display: flex; gap: var(--s-2); padding: var(--s-3) var(--s-5); border-top: 1px solid var(--border); flex: none;
  padding-bottom: max(var(--s-3), env(safe-area-inset-bottom)); }
.sect h3 { font-size: 13px; font-weight: 600; margin-bottom: var(--s-3); }
.timeline { display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: var(--s-3); padding: 7px 0; border-bottom: 1px solid var(--border);
  font-size: 13px; align-items: center; }
.timeline li:last-child { border-bottom: 0; }

#toasts { position: fixed; z-index: 80; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; flex-direction: column; gap: var(--s-2); align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--s-3); padding: 9px 14px; border-radius: var(--r-m);
  background: var(--text); color: var(--bg); font-size: 13px; box-shadow: var(--shadow-float); max-width: 100%;
  animation: toast-in var(--t-base) var(--ease); }
.toast.leaving { animation: toast-out var(--t-fast) ease-in forwards; }
.toast.error { background: var(--danger); color: #fff; }
.toast button { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(4px); } }

/* ---------- tablet：侧栏收成图标栏 ---------- */
@media (max-width: 1023px) and (min-width: 721px) {
  .shell { grid-template-columns: var(--side-w-mini) minmax(0, 1fr); }
  .shell .label, .shell .nav-badge { display: none; }
  .shell .side-head { padding: 0; justify-content: center; }
  .shell .nav a { justify-content: center; padding: 0; }
  .btn.collapse-btn { display: none; }
}

/* ---------- 手机：单列，导航进抽屉，弹窗变底部面板 ---------- */
@media (max-width: 720px) {
  :root { --top-h: 48px; }
  .shell, .shell.mini { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; width: min(280px, 82vw); transform: translateX(-102%);
    transition: transform var(--t-slow) var(--ease); border-right: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
  .shell.nav-open .side { transform: none; box-shadow: var(--shadow-float); }
  .shell.mini .label { display: inline; }
  .shell.mini .nav-badge { display: block; }
  .shell.mini .side-head { padding: 0 var(--s-4); justify-content: flex-start; }
  .shell.mini .nav a { justify-content: flex-start; padding: 0 10px; }
  .nav a { height: 44px; }
  .drawer-scrim { display: block; position: fixed; inset: 0; z-index: 49; background: var(--scrim); opacity: 0; pointer-events: none;
    transition: opacity var(--t-base); }
  .shell.nav-open .drawer-scrim { opacity: 1; pointer-events: auto; }
  .btn.menu-btn { display: inline-flex; }
  .btn.collapse-btn { display: none; }
  .top { padding: 0 var(--s-3); padding-top: env(safe-area-inset-top); height: calc(var(--top-h) + env(safe-area-inset-top)); }
  .content { padding: var(--s-3); padding-bottom: max(var(--s-4), env(safe-area-inset-bottom)); }
  .page { gap: var(--s-4); }
  .toolbar { top: calc(-1 * var(--s-3)); }
  .who { display: none; }
  .input, .select-btn, textarea.input, .seg button { font-size: 16px; }
  .input, .select-btn { height: 40px; }
  .input-unit span { height: 40px; }
  .btn { height: 38px; }
  .btn.small { height: 34px; }
  .btn.icon { width: 38px; }
  .btn.icon.small { width: 34px; }
  .copy { width: 32px; height: 32px; }
  .scrim { place-items: end center; padding: 0; }
  .dialog, .dialog.wide { max-width: none; max-height: 92dvh; border-radius: var(--r-l) var(--r-l) 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom); animation-name: sheet-in; animation-duration: var(--t-slow); }
  .scrim.leaving .dialog { animation-name: sheet-out; }
  .dialog-foot .btn { flex: 1; }
  .drawer { width: 100vw; border-left: 0; animation-name: sheet-in; }
  .drawer.leaving { animation-name: sheet-out; }
  .pop.sheet { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: auto !important; max-height: 70dvh;
    border-radius: var(--r-l) var(--r-l) 0 0; padding: var(--s-2) var(--s-2) max(var(--s-2), env(safe-area-inset-bottom));
    animation-name: sheet-in; animation-duration: var(--t-slow); }
  .pop.sheet.leaving { animation-name: sheet-out; }
  .pop.sheet .opt { min-height: 46px; font-size: 16px; padding: 10px 14px; }
  .sheet-title { padding: 10px 14px 6px; color: var(--text-3); font-size: 13px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile .v { font-size: 22px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .timeline li { grid-template-columns: 64px minmax(0, 1fr) auto; }
}
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }
.sheet-title { display: none; }
@media (max-width: 720px) { .pop.sheet .sheet-title { display: block; } }

/* 系统开启“减少动态效果”：去掉位移和缩放，只保留淡入淡出。 */
@media (prefers-reduced-motion: reduce) {
  .login-card, .page, .pop, .pop.sheet, .dialog, .dialog.wide, .drawer, .toast { animation-name: fade !important; }
  .leaving, .scrim.leaving .dialog, .pop.sheet.leaving, .drawer.leaving { animation-name: fade-out !important; }
  .btn:active:not(:disabled), .nav a:active, .copy:active, .card-item.row-click:active { transform: none; }
  .shell, .side, .meter i, .switch::after, .select-btn svg { transition: none; }
}
