
:root {
  --bg: #fafaf8;
  --bg-rail: #f5f2ea;
  --panel: #ffffff;
  --panel-strong: #fafaf8;
  --ink: #1a1a1c;
  --ink-secondary: #3a3a3c;
  --muted: #8e8e93;
  --accent: #dca000;
  --accent-strong: #b8860b;
  --accent-soft: rgba(220, 160, 0, 0.10);
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);
  --good: #228b22;
  --good-soft: rgba(34,139,34,0.10);
  --warn: #c81e1e;
  --warn-soft: rgba(200,30,30,0.08);
  --water: #2d5f82;
  --water-soft: rgba(45,95,130,0.08);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.04);
  --shadow: 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.08);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 20px;
  --font-sans: "Source Han Sans SC", "PingFang SC", "Noto Sans SC", -apple-system, sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "Consolas", monospace;
  --transition: 180ms ease;
}

[data-theme=dark] {
  --bg: #0c0c0e;
  --bg-rail: #141416;
  --panel: #1c1c1e;
  --panel-strong: #242426;
  --ink: #f5f5f7;
  --ink-secondary: #c5c5c9;
  --muted: #98989d;
  --accent: #f7b500;
  --accent-strong: #ffcc33;
  --accent-soft: rgba(247, 181, 0, 0.12);
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.16);
  --good: #30d158;
  --good-soft: rgba(48,209,88,0.12);
  --warn: #ff453a;
  --warn-soft: rgba(255,69,58,0.12);
  --water: #6a9ec0;
  --water-soft: rgba(106,158,192,0.12);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.3);
  --shadow: 0 4px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.5);
}

[data-theme=dark] body { background: var(--bg); color: var(--ink); }
* { box-sizing: border-box; }
:where([hidden]) { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-sans);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body.admin-dashboard-ready { scroll-padding-top: 100px; }

/* ── Shell ── */
.admin-shell {
  width: 100%;
  padding: 8px 14px 20px;
}

/* ── Hero / Top Bar ── */
.hero, .panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.hero {
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  background: var(--panel);
  border-color: var(--line);
}
.hero h1 { margin: 0; font-size: 1.1rem; font-weight: 700; }
.hero p, .helper { color: var(--muted); font-size: 0.82rem; }
.eyebrow, .badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}
.badge.ok { background: var(--good-soft); color: var(--good); }
.badge.live { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.hero-actions, .section-head { display:flex; gap:10px; align-items:center; justify-content:space-between; }
.admin-home-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.84rem;
  transition: all var(--transition);
}
.admin-home-link:hover { border-color: var(--accent); background: var(--accent-soft); }
.admin-home-link::before { content: "←"; color: var(--accent); font-weight: 800; }

/* ── Login ── */
.login-panel { max-width: 420px; margin: 20px auto 0; padding: 28px; }

/* ── Dashboard ── */
.dashboard { margin-top: 8px; display: grid; gap: 10px; width: 100%; }
.dashboard.is-locked { position: relative; }
.admin-lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  place-content: center;
  gap: 12px;
  padding: 28px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.admin-lock-overlay strong { font-size: 1.08rem; line-height: 1.45; }
.admin-lock-overlay small { color: var(--muted); line-height: 1.6; }
.admin-lock-account {
  display: inline-flex;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink);
  font-weight: 700;
}
.dashboard.is-locked .admin-workspace-shell {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

/* ── Workspace Shell ── */
.admin-workspace-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  width: 100%;
}

/* ── Sidebar / Rail ── */
.admin-rail {
  min-width: 0;
  position: sticky;
  top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-rail);
  max-height: calc(100vh - 24px);
  overflow-y: auto;
}

/* ── Admin tabs (sidebar nav) ── */
.admin-tabs-shell { display: flex; flex-direction: column; gap: 12px; }
.admin-tabs { display: flex; flex-direction: column; gap: 2px; }

.tab-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  font-family: var(--font-sans);
  font-size: 0.82rem;
}
.tab-chip:hover { background: var(--panel); color: var(--ink); }
.tab-chip.active {
  background: var(--panel);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}
.tab-chip .tab-chip-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.tab-chip.active .tab-chip-index {
  background: var(--accent);
  color: #fff;
}
.tab-chip .tab-chip-copy { min-width: 0; }
.tab-chip .tab-chip-copy strong {
  display: block;
  font-size: 0.82rem;
  line-height: 1.3;
}
.tab-chip .tab-chip-copy small {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.3;
}

/* ── Sub-tabs ── */
.admin-subtabs { display: flex; flex-direction: column; gap: 1px; padding-left: 8px; border-left: 2px solid var(--line); margin-left: 12px; }
.subtab-chip {
  padding: 7px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.76rem;
  text-align: left;
  transition: all var(--transition);
}
.subtab-chip:hover { color: var(--ink); background: var(--panel); }
.subtab-chip.active { color: var(--accent); font-weight: 600; background: var(--accent-soft); }

/* ── Rail focus / context ── */
.admin-rail-focus {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.5;
}
.admin-rail-status { font-size: 0.7rem; color: var(--muted); }
.admin-context-bar { font-size: 0.72rem; color: var(--muted); }

.admin-mobile-rail-backdrop,
.admin-mobile-rail-top,
.admin-mobile-commandbar { display: none; }
.admin-mobile-commandbar { grid-area: mobilebar; }

/* Hide mobile toggle on desktop */
@media (min-width: 641px) {
  .admin-mobile-open-rail,
  .admin-mobile-commandbar { display: none !important; }
}

/* ── Workspace main area ── */
.admin-workspace {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "topbar"
    "content";
  gap: 8px;
}
.admin-workspace-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.admin-workspace-head h2 {
  margin: 0;
  font-size: 1.05rem;
  white-space: nowrap;
}
.admin-workspace-topbar {
  grid-area: topbar;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  min-height: 32px;
  padding: 4px 0;
}
.admin-workspace-topbar h2 {
  margin: 0;
  font-size: 1.05rem;
  white-space: nowrap;
}
.admin-workspace-intro h2 { margin: 0 0 2px; font-size: 1.1rem; }
.admin-workspace-note { color: var(--muted); font-size: 0.78rem; margin: 0; }
.admin-workspace-side { text-align: right; }
.admin-workspace-breadcrumb { font-size: 0.7rem; color: var(--muted); white-space: nowrap; }
.admin-workspace-summary { font-size: 0.7rem; color: var(--muted); }

.admin-workspace-statusbar { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.admin-workspace-controls { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.admin-workspace-switcher { display: none; }
.admin-workspace-guidance { display: none; }
.admin-workspace-outline { display: none; }
.admin-workspace-quickjump { display: none; }

/* ── Inspector (right sidebar) ── */
.admin-workspace-inspector {
  display: none;
}
@media(min-width: 1280px) {
  .admin-workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "topbar"
      "content";
  }
}

/* ── Cards & panels ── */
.workspace-inspector-card {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.workspace-inspector-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.workspace-inspector-card strong { font-size: 0.95rem; line-height: 1.4; }
.workspace-inspector-card small { color: var(--muted); line-height: 1.5; font-size: 0.78rem; }
.workspace-inspector-list { display: grid; gap: 8px; }
.workspace-inspector-list span {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}
.workspace-inspector-list em {
  display: inline-flex;
  min-width: 28px;
  font-style: normal;
  color: var(--accent);
  font-weight: 800;
  font-size: 0.75rem;
}

/* ── Workspace switcher / status bar ── */
.admin-workspace-statusbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  width: 100%;
}
.workspace-status-chip {
  display: grid;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 2px solid transparent;
  transition: border-color var(--transition);
  min-width: 0;
}
.workspace-status-chip:hover { border-bottom-color: var(--accent); }
.workspace-status-chip[data-workspace-status-active] {
  border-bottom-color: var(--accent);
}
.workspace-status-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.workspace-status-chip strong { font-size: 0.95rem; line-height: 1.3; }
.workspace-status-chip small { color: var(--muted); font-size: 0.76rem; line-height: 1.4; }

.admin-workspace-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 8px 0;
}
.admin-workspace-guidance {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  width: 100%;
}
.admin-workspace-outline {
  display: grid;
  gap: 12px;
  width: 100%;
}
.workspace-outline-head { display: grid; gap: 6px; }
.workspace-outline-head strong { font-size: 0.95rem; }
.workspace-outline-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.workspace-outline-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  width: 100%;
}
.workspace-outline-chip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
}
.workspace-outline-chip:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.workspace-outline-chip[data-outline-active="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.workspace-outline-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}
.workspace-outline-chip[data-outline-active="true"] .workspace-outline-index {
  background: var(--accent);
  color: #fff;
}
.workspace-outline-text { display: block; min-width: 0; font-weight: 600; line-height: 1.4; font-size: 0.82rem; }
.workspace-guidance-card {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.workspace-guidance-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.workspace-guidance-card strong { font-size: 0.95rem; }
.workspace-guidance-card small { color: var(--muted); line-height: 1.5; font-size: 0.78rem; }
.workspace-control-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.workspace-panel-status {
  min-width: min(100%, 240px);
  padding-inline: 14px;
  border-inline: 1px solid var(--line);
}
.workspace-panel-progress {
  display: block;
  overflow: hidden;
  width: min(100%, 260px);
  height: 4px;
  border-radius: 999px;
  background: var(--line);
}
.workspace-panel-progress i {
  display: block;
  height: 100%;
  min-width: 8px;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(220,160,0,.78), rgba(200,135,0,.58));
  transition: width .18s ease;
}
.workspace-control-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.workspace-control-meta strong {
  font-size: 1.02rem;
  letter-spacing: -.02em;
}
.workspace-control-meta small {
  color: var(--muted);
  line-height: 1.45;
}
.workspace-control-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}
.workspace-control-actions .ghost-btn[disabled] {
  opacity: .55;
  cursor: not-allowed;
}
.admin-tab-panel [data-admin-subpanel][data-active="true"] > .panel[data-workspace-panel-active] {
  position: relative;
  border-color: rgba(220,160,0,.24);
  box-shadow:
    0 20px 60px rgba(67,42,18,.12),
    0 0 0 3px rgba(220,160,0,.07);
}
.admin-tab-panel [data-admin-subpanel][data-active="true"] > .panel[data-workspace-panel-active]::before {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  top: 12px;
  height: 4px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(220,160,0,.74), rgba(200,135,0,.56)) 0 0 / var(--workspace-panel-progress, 0%) 100% no-repeat,
    var(--line);
  pointer-events: none;
}
.workspace-switch-chip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease;
}
.workspace-switch-chip:hover {
  border-color: rgba(220,160,0,0.22);
  background: var(--panel-strong);
}
.workspace-switch-chip.active {
  border-color: rgba(220,160,0,.26);
  background: rgba(220,160,0,0.08);
}
.workspace-switch-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 46px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
}
.workspace-switch-chip.active .workspace-switch-index {
  border-color: rgba(220,160,0,.2);
  background: rgba(255,248,244,.92);
}
.workspace-switch-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}
.workspace-switch-copy strong {
  font-size: .97rem;
  line-height: 1.18;
  letter-spacing: -.02em;
}
.workspace-switch-copy small {
  color: var(--muted);
  line-height: 1.45;
}
.admin-workspace-head {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: 18px;
  align-items: stretch;
}
.admin-quick-jump {
  grid-area: quickjump;
  display: grid;
  gap: 16px;
  width: 100%;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.9), rgba(247,240,231,.82)),
    var(--panel);
  box-shadow: 0 14px 34px var(--line);
}
.admin-quick-jump-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, .8fr);
  gap: 16px;
  align-items: start;
}
.admin-quick-jump-copy {
  display: grid;
  gap: 8px;
}
.admin-quick-jump-eyebrow {
  justify-self: start;
}
.admin-quick-jump-copy strong {
  font-size: 1.05rem;
  letter-spacing: -.02em;
}
.admin-quick-jump-copy small {
  color: var(--muted);
  line-height: 1.55;
}
.admin-quick-jump-summary {
  margin: 0;
  min-height: 0;
}
.admin-quick-jump-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
}
.admin-quick-jump-field {
  margin: 0;
}
.admin-quick-jump-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}
.admin-quick-jump-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.admin-quick-jump-chip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.86), rgba(247,240,231,.74)),
    rgba(255,255,255,.58);
  box-shadow: 0 10px 24px var(--line);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
.admin-quick-jump-chip:hover,
.admin-quick-jump-chip:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(220,160,0,0.22);
  box-shadow: 0 16px 32px var(--line);
  outline: none;
}
.admin-quick-jump-chip.active {
  border-color: rgba(220,160,0,0.28);
  background:
    linear-gradient(180deg, rgba(220,160,0,0.18), rgba(232,196,167,.24)),
    rgba(255,255,255,.62);
  box-shadow: 0 18px 36px var(--line);
}
.admin-quick-jump-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}
.admin-quick-jump-chip.active .admin-quick-jump-index {
  border-color: rgba(220,160,0,.2);
  background: rgba(255,248,244,.92);
}
.admin-quick-jump-copy {
  min-width: 0;
}
.admin-quick-jump-chip .admin-quick-jump-copy {
  display: grid;
  gap: 4px;
}
.admin-quick-jump-chip .admin-quick-jump-copy strong {
  font-size: .98rem;
  line-height: 1.45;
}
.admin-quick-jump-chip .admin-quick-jump-copy small {
  color: var(--muted);
  line-height: 1.5;
}
.admin-quick-jump-empty {
  display: grid;
  gap: 8px;
  padding: 18px 20px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.56);
}
.admin-quick-jump-empty strong {
  font-size: 1rem;
  letter-spacing: -.02em;
}
.admin-quick-jump-empty small {
  color: var(--muted);
  line-height: 1.55;
}
.admin-workspace-intro,
.admin-workspace-side {
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.9), rgba(248,241,233,.82)),
    var(--panel);
  box-shadow: 0 14px 34px var(--line);
  padding: 20px 22px;
}
.admin-workspace-intro {
  display: grid;
  gap: 10px;
  align-content: start;
}
.admin-workspace-intro h2 {
  margin: 0;
  font-size: clamp(1.5rem, 2vw, 2rem);
  line-height: 1.04;
  letter-spacing: -.03em;
}
.admin-workspace-eyebrow {
  justify-self: start;
}
.admin-workspace-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.62;
  max-width: 62ch;
}
.admin-workspace-side {
  display: grid;
  gap: 10px;
  align-content: start;
}
.admin-workspace-breadcrumb {
  margin: 0;
  min-height: 0;
}
.admin-workspace-summary {
  margin-top: 0;
  min-height: 0;
}
.admin-tabs-shell {
  display: grid;
  gap: 10px;
  width: 100%;
}
.admin-rail-header {
  display: grid;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.admin-rail-focus {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(180deg, var(--panel), rgba(244,235,225,.76)),
    rgba(255,255,255,.58);
  box-shadow: 0 12px 28px var(--line);
}
.admin-rail-focus-eyebrow {
  justify-self: start;
}
.admin-rail-focus strong {
  font-size: 1rem;
  letter-spacing: -.02em;
}
.admin-rail-focus-spot {
  display: inline-flex;
  justify-self: start;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}
.admin-rail-focus small {
  color: var(--muted);
  line-height: 1.5;
}
.admin-rail-status {
  gap: 8px;
}
.admin-status-note {
  padding: 0 2px;
  line-height: 1.5;
}
.admin-rail-header strong {
  font-size: 1.12rem;
  letter-spacing: -.02em;
}
.admin-rail-eyebrow {
  justify-self: start;
}
.grid.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
  width: 100%;
}
.grid.two[data-admin-subpanel="overview-services"],
.grid.two[data-admin-subpanel="ai-providers"],
.grid.two[data-admin-subpanel="users-list"],
.grid.two[data-admin-subpanel="settings-release"] {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 1fr);
}
.grid.two > section.panel:only-child {
  grid-column: 1 / -1;
}
.admin-tabs {
  display: grid;
  gap: 6px;
}
.admin-subtabs {
  display: grid;
  gap: 6px;
  margin-top: 0;
  padding: 0 0 0 8px;
  border-left: 2px solid var(--line);
  margin-left: 4px;
}
.admin-context-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  min-height: 36px;
  padding: 6px 0;
  color: var(--muted);
  font-size: 0.78rem;
}
.admin-context-bar > * {
  min-width: 0;
}
.admin-topline {
  display: grid;
  gap: 10px;
}

.tab-chip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  justify-content: flex-start;
}
.subtab-chip {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  justify-content: space-between;
  width: 100%;
}
.tab-chip-index,
.subtab-chip-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}
.tab-chip-copy,
.subtab-chip-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.tab-chip-copy strong,
.subtab-chip-label {
  font-weight: 700;
  color: var(--ink);
}
.tab-chip-copy small,
.subtab-chip-copy small {
  color: var(--muted);
  line-height: 1.4;
}
.subtab-chip-label {
  white-space: nowrap;
}
.subtab-dirty-indicator {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  line-height: 1;
  color: #9a3412;
  background: rgba(251, 191, 36, 0.18);
  border: 1px solid rgba(217, 119, 6, 0.18);
}
.tab-chip.active {
  background: linear-gradient(135deg, rgba(220,160,0,0.14), rgba(208,138,54,.18));
  border-color: rgba(220,160,0,.3);
  color: var(--accent);
  font-weight: 700;
}
.tab-chip.active .tab-chip-index,
.subtab-chip.active .subtab-chip-index {
  border-color: rgba(220,160,0,.2);
  background: rgba(255,248,244,.92);
}
.subtab-chip.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(220,160,0,.24);
  font-weight: 700;
}
.admin-tab-panel { display: grid; gap: 16px; width: 100%; }
.admin-tab-panel[hidden] { display: none !important; }
.admin-tab-panel[data-active="true"],
.admin-tab-panel:not([hidden]) {
  grid-area: content;
}
.admin-tab-panel [data-admin-subpanel][hidden] { display: none !important; }
.admin-tab-panel [data-admin-subpanel][data-active="true"] {
  display: grid;
  gap: 18px;
}
.panel {
  padding: 16px;
  width: 100%;
  min-width: 0;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  overflow: hidden;
}
.admin-workspace > .admin-tab-panel > [data-admin-subpanel] > .panel {
  min-height: 100%;
}
.admin-tab-panel[data-admin-panel="overview"] .panel,
.admin-tab-panel[data-admin-panel="requests"] .panel,
.admin-tab-panel[data-admin-panel="accuracy"] .panel,
.admin-tab-panel[data-admin-panel="ai"] .panel,
.admin-tab-panel[data-admin-panel="users"] .panel,
.admin-tab-panel[data-admin-panel="settings"] .panel {
  background: var(--panel);
}
.panel > .section-head:first-child {
  padding: 8px 8px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.panel > .section-head:first-child h2,
.panel > .section-head:first-child h3,
.panel > .section-head:first-child .section-head-title {
  line-height: 1.24;
}
.panel > .section-head:first-child .helper {
  margin: 4px 0 0;
  line-height: 1.45;
}
.panel > .section-head + .toolbar-row,
.panel > .section-head + .inline-actions,
.panel > .section-head + .admin-context-bar,
.panel > .section-head + .workspace-feedback,
.panel > .section-head + .helper,
.panel > .section-head + .priority-strip,
.panel > .section-head + .overview-grid,
.panel > .section-head + .table-list {
  margin-top: 12px;
}
.stack { display:grid; gap:14px; }
.field { display:grid; gap:8px; }
.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
input, textarea, button, select {
  font: inherit;
}
input, textarea, select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.submit-btn, .ghost-btn {
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: background var(--transition), border-color var(--transition);
}
.submit-btn {
  border: none;
  color: white;
  background: var(--accent);
}
.ghost-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}
.ghost-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.overview-grid, .table-list {
  display:grid;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
}
.overview-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.table-list {
  align-content: start;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
}

.ai-mode-summary-card {
  min-height: 112px;
  align-content: start;
}

.ai-mode-summary-card strong,
.ai-mode-preview-card strong {
  line-height: 1.45;
}

.ai-mode-settings-fieldset {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255,255,255,.56);
}

.ai-mode-preview-card {
  gap: 12px;
  align-content: start;
}

.ai-mode-preview-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-mode-preview-card.is-disabled {
  border-color: rgba(220,160,0,0.18);
  background: linear-gradient(135deg, rgba(255,255,255,.92), var(--panel));
}

.ai-mode-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-mode-preview-window {
  position: relative;
  min-height: 156px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(180deg, var(--panel), var(--panel));
  overflow: hidden;
}

.ai-mode-preview-window::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,.24), rgba(255,255,255,0)),
    radial-gradient(circle at 20% 18%, rgba(208,138,54,.16), transparent 36%);
}

.ai-mode-preview-window.is-disabled {
  background:
    linear-gradient(180deg, rgba(244,238,233,.94), rgba(236,231,226,.96));
}

.ai-mode-preview-window.is-disabled .ai-mode-preview-glass {
  position: absolute;
  inset: 0;
  backdrop-filter: blur(4px);
  background: rgba(255,255,255,.22);
}

.ai-mode-preview-center {
  position: relative;
  z-index: 1;
  min-height: 156px;
  display: grid;
  place-content: center;
  gap: 6px;
  text-align: center;
  padding: 20px;
}

.ai-mode-preview-center strong {
  font-size: 1rem;
}

.ai-mode-preview-center span {
  color: var(--muted);
  line-height: 1.6;
}

.ai-mode-preview-actions {
  justify-content: flex-start;
  margin-top: -2px;
}
.priority-strip {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.admin-quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.admin-quick-card {
  display: grid;
  gap: 6px;
  text-align: left;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(255,255,255,.9), rgba(249,241,231,.88));
  box-shadow: 0 10px 24px var(--line);
  cursor: pointer;
}

.admin-quick-card strong {
  line-height: 1.45;
}

.admin-quick-card small {
  color: var(--muted);
  line-height: 1.55;
}

.admin-quick-card:hover {
  transform: translateY(-1px);
}
.priority-card {
  border-radius: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(255,255,255,.92), rgba(246,239,230,.92));
  box-shadow: 0 10px 26px var(--line);
}
.priority-card strong {
  display: block;
  margin-bottom: 4px;
}
.priority-card small {
  display: block;
  line-height: 1.55;
  color: var(--muted);
}
.priority-card.ok {
  border-color: rgba(74, 121, 79, .2);
  background: linear-gradient(135deg, rgba(245,250,244,.96), rgba(232,244,234,.96));
}
.priority-card.warn {
  border-color: rgba(177,121,55,.24);
  background: linear-gradient(135deg, rgba(255,249,240,.96), rgba(250,239,220,.96));
}
.priority-card.live {
  border-color: rgba(52,93,141,.22);
  background: linear-gradient(135deg, rgba(240,247,255,.96), rgba(226,238,250,.96));
}
.priority-card.muted {
  border-color: var(--line);
  background: linear-gradient(135deg, rgba(252,250,247,.96), rgba(244,240,233,.96));
}
.overview-card, .row-card {
  border: none;
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--bg);
}

.accuracy-overview-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
  padding: 16px;
}

.accuracy-overview-card:hover {
  border-color: rgba(220,160,0,0.22);
}

.accuracy-overview-card.is-failed {
  border-color: rgba(220,160,0,.24);
}

/* 准确性卡片头部 */
.accuracy-card-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.accuracy-card-head strong {
  font-size: 1rem;
  color: var(--ink);
  font-family: var(--font-serif);
}
.accuracy-card-head .metric {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold-700);
  font-variant-numeric: tabular-nums;
}
.accuracy-card-head small {
  color: var(--muted);
  font-size: 0.7rem;
}

/* 准确性统计标签 */
.accuracy-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.accuracy-card-stats .stat {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--panel-soft, #f5f5f5);
  color: var(--muted);
}
.accuracy-card-stats .stat-warn {
  background: rgba(220,160,0,.12);
  color: var(--gold-700);
}
.accuracy-card-stats .stat-bad {
  background: rgba(196,48,28,.1);
  color: #c4301c;
}
.accuracy-card-stats .stat-good {
  background: rgba(34,197,94,.1);
  color: #16a34a;
}
.accuracy-card-priority {
  color: var(--gold-600);
  font-weight: 500;
  padding: 4px 0;
  border-top: 1px solid var(--line);
  margin-top: 2px;
}

/* 总览卡片改进 */
.overview-card strong {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 500;
}
.overview-card .metric {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.overview-card.is-warn .metric {
  color: #c4301c;
}

.row-card-active {
  border-color: rgba(220,160,0,.24);
  background: rgba(220,160,0,0.04);
}
.row-card.recent-error {
  border-left: 3px solid rgba(196,48,28,.48);
}

.accuracy-priority-card {
  margin-top: 10px;
  border-color: rgba(220,160,0,0.18);
  cursor: pointer;
}

.accuracy-priority-card strong {
  display: block;
  margin-bottom: 4px;
}

.accuracy-priority-card small + small {
  margin-top: 2px;
}

.accuracy-priority-card:hover,
.accuracy-priority-card:focus-visible {
  border-color: rgba(220,160,0,0.28);
  outline: none;
}
.accuracy-run-card.is-actionable {
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.accuracy-case-card.is-actionable {
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.accuracy-case-card.is-actionable:hover,
.accuracy-case-card.is-actionable:focus-visible,
.accuracy-run-card.is-actionable:hover,
.accuracy-run-card.is-actionable:focus-visible {
  border-color: rgba(220,160,0,.24);
  outline: none;
}
.accuracy-case-focused {
  scroll-margin-top: 24px;
}
.field-preview {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  align-content: start;
}
.field-preview .helper {
  margin: 0;
  line-height: 1.55;
}

.ai-image-preview-frame {
  margin-top: 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 12px;
  min-height: 320px;
  display: grid;
  place-items: center;
}

#ai-image-template-layout-hint {
  margin-top: 4px;
  color: var(--muted);
}

.ai-image-template-preview-image {
  display: block;
  width: min(100%, 360px);
  margin: 0 auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

#ai-image-template-preview-status {
  margin-top: 4px;
  min-height: 22px;
  padding: 0;
  font-weight: 700;
}

.admin-preview-status.ok {
  color: var(--good);
}

.admin-preview-status.warn {
  color: var(--warn);
}

#ai-image-template-mode-hint {
  margin-top: 4px;
  color: var(--muted);
}

#ai-image-template-dirty-hint {
  margin-top: 4px;
}

.ai-image-preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.ai-image-preview-action-bar {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.ai-image-preview-primary-actions,
.ai-image-preview-secondary-actions {
  margin-top: 0;
}

.ai-image-preview-diagnostics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

#ai-image-preview-page-indicator,
#ai-image-template-preview-note {
  margin: 0;
}

#ai-image-template-preview-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: .84rem;
}

.overview-card.detail span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.5;
}
#ai-job-stats {
  margin-top: 14px;
}
.row-card small + small {
  margin-top: 4px;
}
.row-card.service-row {
  border-color: rgba(220,160,0,0.18);
}
.row-card.service-banner.danger {
  border-color: rgba(220,160,0,.24);
  background: rgba(220,160,0,0.08);
}
.metric {
  font-size: 1.4rem;
  font-weight: 800;
}
.metric-card {
  border: none;
  border-radius: 6px;
  padding: 12px;
  background: var(--bg);
  display: grid;
  gap: 4px;
}
.metric-card .metric-label { color: var(--muted); font-size: 0.7rem; font-weight: 600; }
.metric-card strong { font-size: 1.1rem; }
.metric-card small { color: var(--muted); font-size: 0.72rem; }
.row-card strong { display:block; margin-bottom:4px; }
.row-card small { color: var(--muted); display:block; line-height:1.55; }
.inline-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.ai-job-quick-filters {
  margin-top: 0;
}

.ai-job-quick-filters .ghost-btn.active {
  border-color: rgba(220,160,0,.24);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.user-quick-filters,
.user-activity-quick-filters {
  margin-top: 0;
}

.user-quick-filters .ghost-btn.active,
.user-activity-quick-filters .ghost-btn.active {
  border-color: rgba(220,160,0,.24);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.inline-actions-secondary {
  margin-top: 8px;
}
.row-action-group {
  margin-top: 10px;
  border-top: 1px dashed var(--line);
  padding-top: 8px;
}
.row-action-group summary {
  cursor: pointer;
  list-style: none;
  color: var(--muted);
  font-size: .92rem;
  font-weight: 700;
}
.row-action-group summary::-webkit-details-marker {
  display: none;
}
.row-action-group summary::after {
  content: '展开';
  margin-left: 8px;
  color: var(--line);
  font-weight: 500;
}
.row-action-group[open] summary::after {
  content: '收起';
}
.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.toolbar-row:focus-within,
.inline-actions:focus-within,
.admin-workspace-controls:focus-within {
  /* flat */
}
.workspace-action-band {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(260px, .82fr);
  gap: 16px;
  margin-top: 14px;
}
.workspace-action-primary,
.workspace-action-secondary {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}
.workspace-action-stack {
  display: grid;
  gap: 10px;
  align-content: start;
}
.workspace-action-band .toolbar-row,
.workspace-action-band .inline-actions {
  margin-top: 0;
}
.accuracy-action-band {
  align-items: start;
}
.accuracy-control-toggles {
  justify-content: flex-start;
  align-items: stretch;
}
.desktop-workband {
  align-items: start;
}
.desktop-summary-rail {
  align-items: start;
}
.desktop-summary-grid {
  align-content: start;
}
.desktop-summary-grid .overview-grid,
.desktop-summary-grid .admin-context-bar {
  margin: 0;
}
.workspace-summary-rail {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(320px, .98fr);
  gap: 16px;
  width: 100%;
  margin-top: 14px;
}
.workspace-summary-primary {
  display: grid;
  gap: 14px;
  min-width: 0;
}
.workspace-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}
.accuracy-summary-rail .workspace-feedback,
.accuracy-summary-rail .row-card,
.accuracy-summary-rail .helper {
  margin: 0;
}

.invite-preset-row {
  align-items: center;
  padding: 8px 0;
  gap: 8px;
}

.invite-preset-row .badge {
  margin-right: 4px;
}

.user-bulk-toolbar {
  align-items: center;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px dashed var(--line);
  background: rgba(255,255,255,.56);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.42);
}

.user-bulk-toolbar .badge {
  margin-right: auto;
  overflow-wrap: anywhere;
}

.toolbar-row input,
.toolbar-row select {
  flex: 1 1 220px;
}
.toolbar-row > * {
  min-width: 0;
}
.provider-templates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 14px;
  margin-bottom: 14px;
}
.provider-template-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
  display: grid;
  gap: 12px;
}
.ai-provider-form textarea[name="apiKeySecret"] {
  min-height: 112px;
  font-family: 'SFMono-Regular', 'Cascadia Code', 'Fira Code', monospace;
  line-height: 1.5;
}
[data-provider-secret-state],
[data-provider-status] {
  min-height: 38px;
  display: block;
}
.provider-template-card small,
.admin-quick-card small,
.priority-card small,
.row-card small {
  overflow-wrap: anywhere;
}
.helper.ok {
  color: var(--good);
}
.helper.warn {
  color: var(--warn);
}
.admin-build-info {
  margin-top: -8px;
}
.section-head-compact {
  margin-top: 12px;
}
.section-head-title {
  margin: 0;
}
.workspace-feedback {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.workspace-feedback-persistent {
  display: block;
  min-height: 46px;
  padding-top: 12px;
  padding-bottom: 12px;
}
.workspace-feedback-subtle {
  background: rgba(255,255,255,.56);
  border-style: dashed;
  color: rgba(111, 99, 85, 0.92);
}
.workspace-feedback-subtle.is-actionable {
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.workspace-feedback-subtle.is-actionable:hover,
.workspace-feedback-subtle.is-actionable:focus-visible {
  border-color: rgba(220,160,0,.24);
  box-shadow: 0 10px 24px var(--line);
  transform: translateY(-1px);
  outline: none;
}

.accuracy-focus-state {
  border-left: 3px solid rgba(220,160,0,0.16);
  background: linear-gradient(135deg, var(--panel), rgba(252,248,242,.92));
}

.accuracy-focus-state strong {
  display: block;
}

.accuracy-focus-state small + small {
  margin-top: 4px;
}

.accuracy-focus-actions {
  margin-top: 8px;
  gap: 8px;
}

.accuracy-focus-run-list {
  margin-top: 8px;
  display: grid;
  gap: 4px;
}

.accuracy-focus-run-list small {
  display: block;
}

.accuracy-shortcuts-hint {
  margin-top: 8px;
  border-left: 3px solid rgba(45,95,130,.14);
  background: linear-gradient(135deg, rgba(255,255,255,.95), rgba(244,248,252,.92));
}

.accuracy-shortcuts-hint strong {
  display: block;
}

.accuracy-shortcuts-hint small + small {
  margin-top: 4px;
}

.accuracy-shortcuts-actions {
  margin-top: 8px;
}

.accuracy-focus-actions .ghost-btn[disabled] {
  opacity: .5;
  cursor: default;
}

.stream-status-shell {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  width: 100%;
}

.stream-diagnostics {
  min-height: 72px;
}

.stream-diagnostics strong {
  display: block;
}

.stream-diagnostics small {
  display: block;
}

.stream-diagnostics small + small {
  margin-top: 4px;
}

.stream-failure-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.stream-failure-links-label {
  font-size: 12px;
  color: var(--muted);
}

.stream-failure-chip {
  min-height: 30px;
  padding: 6px 10px;
}

.stream-delta-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.stream-delta-links-label {
  font-size: 12px;
  color: var(--muted);
}

.stream-delta-chip {
  min-height: 30px;
  padding: 6px 10px;
}

.stream-delta-chip-new {
  border-color: rgba(160, 68, 36, .22);
}

.stream-delta-chip-recovered {
  border-color: rgba(31, 110, 71, .22);
}

.stream-actions {
  margin-top: -2px;
}

.accuracy-run-scope {
  margin-top: 10px;
  border-left: 3px solid rgba(45,95,130,.16);
  background: linear-gradient(135deg, var(--panel), rgba(244,248,252,.92));
}

.accuracy-run-scope strong {
  display: block;
}

.accuracy-run-scope small + small {
  margin-top: 4px;
}

.accuracy-run-highlight {
  margin-top: 10px;
  border-left: 3px solid rgba(220,160,0,0.16);
  background: linear-gradient(135deg, var(--panel), rgba(251,244,238,.92));
}

.accuracy-run-highlight strong {
  display: block;
}

.accuracy-run-highlight small + small {
  margin-top: 4px;
}

.accuracy-active-filters {
  margin-top: 8px;
  align-items: center;
}

.accuracy-view-summary {
  margin-top: 10px;
  align-items: stretch;
}

.accuracy-view-summary .overview-card {
  min-width: 0;
}

.accuracy-export-actions {
  margin-top: 10px;
  flex-wrap: wrap;
}

.accuracy-view-summary-card {
  text-align: left;
  flex: 1 1 180px;
}

.accuracy-view-summary-card.is-active {
  border-color: rgba(220,160,0,.24);
  background: linear-gradient(135deg, rgba(255,255,255,.92), var(--panel));
  box-shadow: 0 10px 24px var(--line);
}

.accuracy-filter-prefix {
  color: var(--muted);
  font-size: 13px;
  padding-right: 2px;
}

.accuracy-filter-chip {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.74);
}

.accuracy-filter-reset-all {
  border-style: dashed;
  color: var(--warn);
  background: rgba(250,244,236,.92);
}

.accuracy-empty-state.is-actionable {
  cursor: pointer;
  border-style: dashed;
  background: linear-gradient(135deg, var(--panel), rgba(250,244,236,.9));
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.accuracy-empty-state.is-actionable:hover,
.accuracy-empty-state.is-actionable:focus-visible {
  border-color: rgba(220,160,0,.24);
  box-shadow: 0 10px 24px var(--line);
  transform: translateY(-1px);
  outline: none;
}

#admin-brand-easter-egg {
  margin-top: 14px;
}
.workspace-feedback.ok {
  border-color: rgba(46,111,87,.24);
  background: rgba(46,111,87,.08);
  color: var(--good);
}
.workspace-feedback.warn {
  border-color: rgba(220,160,0,.24);
  background: rgba(220,160,0,0.08);
  color: var(--warn);
}

#ai-prompt-editor-state.ok {
  color: var(--good);
}
.toolbar-row input,
.toolbar-row select {
  min-width: 180px;
}
.user-bulk-toolbar {
  align-items: center;
  padding: 10px 12px;
  border: 1px dashed rgba(220,160,0,0.22);
  border-radius: 16px;
  background: rgba(255,255,255,.62);
}
.user-row-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.user-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
.user-select input {
  width: 16px;
  height: 16px;
  padding: 0;
  margin: 0;
}
.row-card.selected {
  border-color: rgba(220,160,0,0.28);
  box-shadow: 0 0 0 2px rgba(220,160,0,0.08);
  background: linear-gradient(135deg, var(--panel), rgba(245,233,219,.86));
}
.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 14px;
}
.pagination-bar:empty {
  display: none;
}
.pagination-bar .ghost-btn[disabled] {
  opacity: .45;
  cursor: not-allowed;
}
.permission-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.permission-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  background: rgba(220,160,0,0.08);
  color: var(--accent);
  border: 1px solid var(--accent-soft);
}
.permission-chip.good {
  background: rgba(46,111,87,.08);
  color: var(--good);
  border-color: rgba(34,139,34,0.12);
}
.permission-chip.muted {
  background: rgba(111,99,85,.08);
  color: var(--muted);
  border-color: rgba(111,99,85,.12);
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
}
.status-pill.good {
  background: rgba(46,111,87,.08);
  border-color: rgba(46,111,87,.14);
  color: var(--good);
}
.status-pill.warn {
  background: rgba(220,160,0,0.08);
  border-color: rgba(220,160,0,0.14);
  color: var(--warn);
}
.status-pill.live {
  background: rgba(45,95,130,.08);
  border-color: rgba(45,95,130,.14);
  color: var(--water);
}
.collapse-shell {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.52);
  padding: 10px 12px;
}
.collapse-shell summary {
  cursor: pointer;
  font-weight: 700;
}
.ghost-btn.danger {
  border-color: rgba(220,160,0,0.28);
  color: var(--warn);
  background: rgba(220,160,0,0.08);
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
}

.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(32, 24, 19, 0.42);
}

.admin-modal-card {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 20px;
  background: rgba(255, 251, 247, 0.96);
  box-shadow: var(--shadow);
}
.admin-modal-card .section-head {
  align-items: flex-start;
}
.admin-modal-card .section-head h2 {
  margin: 0;
}
.admin-modal-card .helper {
  margin-top: 6px;
}
.admin-modal-open {
  overflow: hidden;
}

.table-list > .row-card + .row-card {
  margin-top: 2px;
}

.admin-tab-panel [data-admin-subpanel][data-active="true"] > .panel,
.table-list > .row-card,
.overview-grid > .overview-card,
.provider-template-card {
  scroll-margin-top: 126px;
}

.admin-tabs-shell,
.admin-workspace-inspector,
.admin-tab-panel[data-active="true"],
.table-list {
  scrollbar-gutter: stable;
}

@supports (content-visibility: auto) {
  @media (min-width: 641px) {
    .admin-tab-panel [data-admin-subpanel][data-active="true"] > .panel {
      content-visibility: auto;
      contain-intrinsic-size: 560px;
    }
  }
  .table-list > .row-card,
  .overview-grid > .overview-card,
  .provider-template-card {
    content-visibility: auto;
    contain-intrinsic-size: 156px;
  }
}

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

@media (min-width: 1181px) {
  .admin-tabs-shell,
  .admin-workspace-inspector {
    max-height: calc(100vh - 36px);
    overflow: auto;
    overscroll-behavior: contain;
  }
  .admin-tab-panel [data-admin-subpanel][data-active="true"] {
    align-items: start;
  }
  .admin-workspace-controls {
    scroll-margin-top: 18px;
  }
}

@media (min-width: 1280px) {
  body.admin-dashboard-ready {
    scroll-padding-top: 132px;
  }
  .admin-workspace-shell {
    grid-template-columns: minmax(280px, 336px) minmax(0, 1fr);
    gap: 28px;
  }
  .admin-workspace {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
    gap: 22px;
  }
  .admin-workspace-head {
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr);
  }
  .hero {
    padding: 28px 30px;
  }
  .dashboard,
  .admin-tab-panel,
  .grid.two {
    gap: 26px;
  }
  .admin-tab-panel[data-active="true"] {
    padding: 20px;
  }
  .admin-workspace-statusbar {
    grid-template-columns: repeat(4, minmax(160px, 1fr));
  }
  .workspace-status-chip {
    padding: 14px 16px;
  }
  .admin-tab-panel[data-admin-panel="overview"] [data-admin-subpanel="overview-services"].grid.two {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 1fr);
  }
  .admin-tab-panel[data-admin-panel="requests"] [data-admin-subpanel][data-active="true"],
  .admin-tab-panel[data-admin-panel="users"] [data-admin-subpanel][data-active="true"],
  .admin-tab-panel[data-admin-panel="settings"] [data-admin-subpanel][data-active="true"] {
    gap: 22px;
  }
  .admin-tab-panel[data-admin-panel="accuracy"] [data-admin-subpanel][data-active="true"] .panel,
  .admin-tab-panel[data-admin-panel="requests"] [data-admin-subpanel][data-active="true"] .panel {
    box-shadow: 0 18px 34px var(--line);
  }
  .admin-tab-panel[data-admin-panel="overview"] #overview-cards,
  .admin-tab-panel[data-admin-panel="overview"] #overview-accuracy-strip,
  .admin-tab-panel[data-admin-panel="overview"] #server-status-cards,
  .admin-tab-panel[data-admin-panel="overview"] #overview-metrics-detail {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
  .admin-tab-panel[data-admin-panel="requests"] #request-list,
  .admin-tab-panel[data-admin-panel="requests"] #verification-list,
  .admin-tab-panel[data-admin-panel="requests"] #request-anomaly-list,
  .admin-tab-panel[data-admin-panel="users"] #user-list,
  .admin-tab-panel[data-admin-panel="users"] #user-activity-list,
  .admin-tab-panel[data-admin-panel="users"] #wallet-list,
  .admin-tab-panel[data-admin-panel="users"] #billing-list {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    align-items: start;
  }
  .admin-tab-panel[data-admin-panel="accuracy"] .accuracy-view-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .admin-tab-panel[data-admin-panel="overview"] #service-status-list {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    align-items: start;
  }
  .admin-workspace > .admin-tab-panel[data-admin-panel="overview"] [data-admin-subpanel="overview-services"] > .panel:first-child {
    padding-right: 30px;
  }
  .admin-tab-panel[data-admin-panel="requests"] .panel,
  .admin-tab-panel[data-admin-panel="accuracy"] .panel,
  .admin-tab-panel[data-admin-panel="users"] .panel,
  .admin-tab-panel[data-admin-panel="settings"] .panel,
  .admin-tab-panel[data-admin-panel="ai"] .panel {
    padding: 24px 26px;
  }
  .admin-workspace-switcher {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
  .admin-workspace-guidance {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .workspace-outline-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (max-width: 1180px) {
  body.admin-dashboard-ready {
    scroll-padding-top: 80px;
  }
  .admin-workspace-shell {
    grid-template-columns: 1fr;
  }
  .admin-workspace {
    grid-template-areas:
      "topbar"
      "content";
  }
  .workspace-action-band {
    grid-template-columns: 1fr;
  }
  .workspace-summary-rail {
    grid-template-columns: 1fr;
  }
  .grid.two {
    grid-template-columns: 1fr;
  }
  .grid.two[data-admin-subpanel="overview-services"],
  .grid.two[data-admin-subpanel="ai-providers"],
  .grid.two[data-admin-subpanel="users-list"],
  .grid.two[data-admin-subpanel="settings-release"] {
    grid-template-columns: 1fr;
  }
}
  .tab-chip,
  .subtab-chip {
    width: auto;
    justify-content: flex-start;
  }
  .admin-tab-panel[data-active="true"] {
    padding: 14px;
  }
  .workspace-switch-chip {
    padding: 14px 16px;
    border-radius: 20px;
  }

@media (max-width: 900px) {
  body.admin-dashboard-ready {
    scroll-padding-top: 96px;
  }
  .hero, .grid.two, .hero-actions, .section-head {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }
  .grid.two { display: grid; }
  .admin-workspace-switcher {
    grid-template-columns: 1fr;
  }
  .admin-quick-jump {
    padding: 16px;
    border-radius: 20px;
  }
  .admin-quick-jump-results {
    grid-template-columns: 1fr;
  }
  .admin-workspace-statusbar {
    grid-template-columns: 1fr;
  }
  .workspace-guidance-card {
    border-radius: 18px;
  }
  .admin-rail-focus {
    border-radius: 18px;
  }
  .admin-workspace-controls {
    flex-direction: column;
    align-items: stretch;
    position: static;
  }
  .admin-workspace-outline {
    padding: 16px;
    border-radius: 20px;
  }
  .workspace-outline-list {
    grid-template-columns: 1fr;
  }
  .workspace-control-actions {
    justify-content: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }
  .workspace-panel-status {
    width: 100%;
    padding: 10px 0 0;
    border-inline: 0;
    border-top: 1px solid var(--line);
  }
  .workspace-panel-progress {
    width: 100%;
  }
  .workspace-action-band {
    padding: 14px;
    border-radius: 18px;
  }
  .workspace-summary-grid {
    grid-template-columns: 1fr;
  }
  .workspace-action-stack {
    grid-template-columns: 1fr;
  }
  .workspace-switch-chip {
    grid-template-columns: 42px minmax(0, 1fr);
  }
  .admin-quick-actions { grid-template-columns: 1fr; }
  .admin-context-bar,
  .admin-subtabs,
  .admin-tabs {
    align-items: stretch;
  }
  .admin-context-bar {
    gap: 8px;
    padding: 10px 12px;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .admin-tabs,
  .admin-subtabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }
  .toolbar-row {
    overflow: visible;
    flex-wrap: wrap;
    padding-bottom: 0;
    gap: 8px;
  }
  .inline-actions,
  .toolbar-row {
    padding: 10px;
  }
  .hero {
    align-items: stretch;
  }
  .hero > * {
    width: 100%;
  }
  .hero-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }
  .hero-actions > * {
    width: 100%;
  }
  .admin-tabs-shell,
  .admin-topline,
  .admin-context-bar,
  #admin-global-feedback {
    width: 100%;
  }
  .admin-tabs,
  .admin-subtabs {
    width: 100%;
  }
  .admin-tabs::-webkit-scrollbar,
  .admin-subtabs::-webkit-scrollbar,
  .toolbar-row::-webkit-scrollbar {
    display: none;
  }
  .tab-chip,
  .subtab-chip {
    flex: 0 0 max-content;
    width: auto;
  }
  .toolbar-row > * {
    min-width: 0;
  }
  .toolbar-row input,
  .toolbar-row select,
  .toolbar-row button,
  .toolbar-row .ghost-btn,
  .toolbar-row .submit-btn {
    min-height: 42px;
  }
  .ai-image-preview-frame {
    min-height: 260px;
    padding: 10px;
  }
  .ai-image-preview-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }
  .ai-image-preview-primary-actions,
  .ai-image-preview-secondary-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .ai-image-preview-diagnostics {
    grid-template-columns: 1fr;
  }
  .ai-image-template-preview-image {
    width: min(100%, 300px);
  }
}

@media (max-width: 640px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }
  body.admin-dashboard-ready {
    scroll-padding-top: 92px;
  }
  body.admin-mobile-rail-open {
    overflow: hidden;
  }
  .admin-shell {
    padding: 10px 8px calc(28px + env(safe-area-inset-bottom));
    max-width: 100%;
  }
  .dashboard {
    margin-top: 12px;
    gap: 12px;
  }
  .admin-workspace-shell {
    gap: 12px;
  }
  .admin-mobile-commandbar {
    position: sticky;
    top: 8px;
    z-index: 8;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-areas:
      "nav search title";
    gap: 8px;
    align-items: center;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    border: 1px solid var(--line);
  }
  .admin-mobile-commandbar::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 6px;
    height: 3px;
    border-radius: 999px;
    background:
      linear-gradient(90deg, rgba(220,160,0,0.72), rgba(200,135,0,.52)) 0 0 / var(--mobile-panel-progress, 0%) 100% no-repeat,
      var(--line);
  }
  .admin-mobile-commandbar-copy {
    grid-area: title;
    min-width: 0;
    display: grid;
    gap: 4px;
  }
  .admin-mobile-commandbar-copy .eyebrow {
    justify-self: start;
    padding: 4px 7px;
    font-size: 10px;
  }
  .admin-mobile-commandbar-copy strong,
  .admin-mobile-commandbar-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .admin-mobile-commandbar-copy strong {
    font-size: .95rem;
    line-height: 1.22;
    white-space: nowrap;
  }
  .admin-mobile-commandbar-copy small {
    color: var(--muted);
    font-size: .76rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
  }
  .admin-mobile-current-panel {
    justify-self: start;
    max-width: 100%;
    padding: 4px 7px;
    border: 1px solid rgba(220,160,0,0.14);
    border-radius: 999px;
    background: var(--panel);
    color: var(--accent);
    font-weight: 800;
    letter-spacing: .01em;
  }
  .admin-mobile-open-rail,
  .admin-mobile-focus-search {
    min-height: 38px;
    padding: 8px 9px;
    border-radius: 12px;
    white-space: nowrap;
    font-size: .82rem;
  }
  .admin-mobile-open-rail {
    grid-area: nav;
  }
  .admin-mobile-focus-search {
    grid-area: search;
  }
  .admin-mobile-rail-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: block;
    border: 0;
    background: rgba(40, 26, 15, .34);
  }
  .admin-mobile-rail-backdrop[hidden] {
    display: none !important;
  }
  .admin-mobile-rail-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
  }
  .admin-mobile-rail-top .ghost-btn {
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 12px;
  }
  .admin-rail {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    width: min(88vw, 360px);
    padding: 10px 8px calc(14px + env(safe-area-inset-bottom));
    transform: translateX(calc(-100% - 16px));
    transition: transform .22s ease;
    pointer-events: none;
  }
  .admin-rail.is-mobile-open {
    transform: translateX(0);
    pointer-events: auto;
  }
  .admin-tabs-shell {
    max-height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
    border-radius: 0 22px 22px 0;
    padding: 12px;
    box-shadow: 0 24px 56px rgba(36,22,12,.26);
    position: static;
  }
  .admin-rail-header small,
  .admin-status-note,
  .admin-build-info,
  .admin-context-bar small {
    display: none;
  }
  .admin-rail-header {
    padding-bottom: 8px;
  }
  .admin-tabs,
  .admin-subtabs {
    display: grid;
    overflow: visible;
    flex-wrap: initial;
    padding: 8px;
  }
  .tab-chip,
  .subtab-chip {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }
  .tab-chip-copy small,
  .subtab-chip-copy small {
    display: none;
  }
  .admin-rail-focus small,
  .admin-workspace-guidance,
  .admin-workspace-outline,
  .admin-workspace-inspector,
  .admin-quick-jump-head,
  .admin-quick-jump-results {
    display: none;
  }
  .admin-workspace {
    gap: 12px;
    grid-template-areas:
      "mobilebar"
      "quickjump"
      "switcher"
      "statusbar"
      "controls"
      "content";
  }
  .admin-workspace-head {
    display: none;
  }
  .admin-workspace-intro,
  .admin-workspace-side,
  .admin-workspace-statusbar {
    padding: 14px;
    border-radius: 18px;
  }
  .admin-workspace-intro {
    gap: 6px;
  }
  .admin-workspace-eyebrow {
    display: none;
  }
  .admin-workspace-note {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: .88rem;
  }
  .admin-workspace-side {
    display: none;
    gap: 8px;
  }
  .admin-workspace-side .admin-context-bar,
  .admin-workspace-summary {
    font-size: .82rem;
    line-height: 1.45;
  }
  .admin-workspace-switcher,
  .admin-workspace-statusbar,
  .overview-grid,
  .table-list,
  .provider-templates,
  .workspace-summary-grid,
  .accuracy-view-summary,
  .admin-quick-actions {
    display: flex;
    grid-template-columns: none;
    gap: 10px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 2px 2px 10px;
    margin-inline: -2px;
    touch-action: pan-x pan-y;
    scrollbar-width: none;
    mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 22px), transparent 100%);
  }
  .admin-workspace-switcher::-webkit-scrollbar,
  .admin-workspace-statusbar::-webkit-scrollbar,
  .overview-grid::-webkit-scrollbar,
  .table-list::-webkit-scrollbar,
  .provider-templates::-webkit-scrollbar,
  .workspace-summary-grid::-webkit-scrollbar,
  .accuracy-view-summary::-webkit-scrollbar,
  .admin-quick-actions::-webkit-scrollbar {
    display: none;
  }
  .workspace-switch-chip {
    flex: 0 0 min(74vw, 288px);
    width: auto;
    scroll-snap-align: start;
    padding: 12px 14px;
    border-radius: 17px;
    min-height: 92px;
  }
  .workspace-switch-index {
    min-width: 38px;
    height: 38px;
    border-radius: 13px;
  }
  .workspace-switch-copy small {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .admin-workspace-statusbar {
    display: flex;
    gap: 8px;
  }
  .workspace-status-chip {
    flex: 0 0 min(70vw, 268px);
    width: auto;
    scroll-snap-align: start;
    padding: 10px 12px;
    border-radius: 14px;
    min-height: 94px;
  }
  .workspace-status-chip::after {
    inset: auto 12px 8px;
    height: 2px;
  }
  .admin-workspace-statusbar::before {
    content: "状态 " attr(data-workspace-status-index) " / " attr(data-workspace-status-count);
    flex: 0 0 auto;
    align-self: stretch;
    display: grid;
    place-items: center;
    min-width: 58px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,.74);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
  }
  .workspace-status-chip small {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .hero,
  .panel,
  .login-panel {
    border-radius: 18px;
    padding: 16px;
  }
  .hero {
    gap: 12px;
  }
  .hero p {
    display: none;
  }
  .hero h1 {
    font-size: 1.52rem;
    line-height: 1.08;
  }
  .admin-workspace-intro h2 {
    font-size: 1.34rem;
  }
  .hero p {
    line-height: 1.5;
  }
  .admin-home-link,
  .hero-actions .ghost-btn {
    min-height: 44px;
    justify-content: center;
  }
  .hero-actions {
    grid-template-columns: 1fr;
  }
  .admin-context-bar {
    min-height: 0;
    padding: 10px 12px;
    gap: 8px;
  }
  .admin-tabs,
  .admin-subtabs {
    gap: 6px;
    padding: 8px 10px;
    border-radius: 16px;
    width: 100%;
  }
  .admin-rail-focus {
    padding: 12px 14px;
    border-radius: 16px;
  }
  .workspace-guidance-card {
    padding: 12px 14px;
    border-radius: 16px;
  }
  .admin-tab-panel[data-active="true"] {
    padding: 10px;
    border-radius: 22px;
  }
  .admin-tab-panel [data-admin-subpanel][data-active="true"] {
    display: flex;
    grid-template-columns: none;
    flex-direction: row;
    gap: 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    touch-action: pan-x pan-y;
    scrollbar-width: none;
    mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 22px), transparent 100%);
  }
  .admin-tab-panel [data-admin-subpanel][data-active="true"]::-webkit-scrollbar {
    display: none;
  }
  .admin-tab-panel [data-admin-subpanel][data-active="true"] > .panel {
    flex: 0 0 min(88vw, 430px);
    min-width: 0;
    max-height: calc(100vh - 128px);
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scroll-snap-align: start;
    scroll-margin-inline: 8px;
  }
  .admin-tab-panel [data-admin-subpanel][data-active="true"] > .panel:only-child {
    flex-basis: 100%;
  }
  .admin-tab-panel [data-admin-subpanel][data-active="true"] > .panel > .section-head {
    flex-direction: row;
    align-items: flex-start;
    top: 0;
    margin-inline: -4px;
    padding: 7px 4px 12px;
    border-radius: 14px 14px 12px 12px;
    box-shadow: 0 8px 18px var(--line);
  }
  .admin-tab-panel [data-admin-subpanel][data-active="true"] > .panel > .section-head .helper {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .admin-tabs-shell {
    gap: 8px;
  }
  .admin-topline {
    gap: 8px;
  }
  .admin-build-info {
    margin-top: 0;
    padding-inline: 2px;
  }
  .tab-chip {
    padding: 9px 12px;
  }
  .subtab-chip {
    padding: 7px 10px;
  }
  .tab-chip,
  .subtab-chip {
    gap: 8px;
  }
  .admin-quick-card {
    padding: 12px 14px;
    border-radius: 16px;
  }
  .admin-quick-jump {
    padding: 12px;
    border-radius: 18px;
    gap: 10px;
  }
  .admin-quick-jump-copy small,
  .admin-quick-jump-summary,
  .admin-quick-jump-actions {
    display: none;
  }
  .admin-quick-jump-body {
    display: block;
  }
  .inline-actions {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    padding: 8px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .inline-actions.mobile-action-group,
  .workspace-action-stack.mobile-action-group {
    display: grid;
    grid-template-columns: 1fr;
    overflow: visible;
    max-height: none;
    gap: 8px;
    scroll-snap-type: none;
    mask-image: none;
  }
  .mobile-action-group .mobile-action-toggle {
    order: -1;
    width: 100%;
    min-height: 42px;
    border-style: solid;
    border-color: rgba(220,160,0,0.22);
    background: linear-gradient(135deg, var(--accent-soft), rgba(208,138,54,.12));
    color: var(--accent);
    font-weight: 800;
  }
  .mobile-action-group > button:not(.mobile-action-toggle),
  .mobile-action-group > a[href],
  .mobile-action-group > [role="button"] {
    width: 100%;
    min-width: 0;
    scroll-snap-align: none;
  }
  .mobile-action-group:not(.is-mobile-expanded)::after {
    content: '已折叠同类操作，展开后可查看全部按钮';
    color: var(--muted);
    font-size: .78rem;
    line-height: 1.35;
    padding: 0 2px;
  }
  .toolbar-row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    padding: 8px;
    gap: 8px;
    scrollbar-width: none;
  }
  .inline-actions::-webkit-scrollbar,
  .toolbar-row::-webkit-scrollbar {
    display: none;
  }
  .toolbar-row input,
  .toolbar-row select,
  .toolbar-row button,
  .toolbar-row .ghost-btn,
  .toolbar-row .submit-btn {
    width: auto;
    flex: 0 0 min(78vw, 280px);
    scroll-snap-align: start;
  }
  .workspace-feedback-persistent {
    min-height: 56px;
  }
  .inline-actions > * {
    width: auto;
    flex: 0 0 auto;
    min-width: min(54vw, 188px);
    scroll-snap-align: start;
  }
  .user-bulk-toolbar {
    display: grid;
    gap: 8px;
  }
  .invite-preset-row,
  .user-bulk-toolbar {
    padding: 10px 12px;
    border-radius: 14px;
  }
  .user-bulk-toolbar .badge {
    margin-right: 0;
  }
  .priority-card,
  .row-card,
  .overview-card,
  .provider-template-card {
    flex: 0 0 min(82vw, 340px);
    width: auto;
    min-width: 0;
    scroll-snap-align: start;
    border-radius: 16px;
    padding: 12px 14px;
    min-height: 112px;
  }
  .row-card strong,
  .overview-card strong,
  .provider-template-card strong {
    line-height: 1.36;
  }
  .row-card strong,
  .overview-card strong {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .row-card small,
  .overview-card small,
  .provider-template-card small {
    line-height: 1.48;
  }
  .row-card small:nth-of-type(n+3),
  .overview-card small:nth-of-type(n+3),
  .provider-template-card small:nth-of-type(n+3) {
    display: none;
  }
  .row-card .permission-badges,
  .row-card .inline-actions {
    max-height: 168px;
    overflow: auto;
  }
  .table-list {
    padding: 8px;
    border-radius: 18px;
    gap: 8px;
  }
  .admin-context-bar,
  #admin-global-feedback {
    border-radius: 16px;
  }
  .collapse-shell {
    padding: 8px 10px;
    border-radius: 14px;
  }
  .collapse-shell summary {
    line-height: 1.45;
    font-size: 0.92rem;
  }
  .ai-image-preview-frame {
    min-height: 220px;
    border-radius: 16px;
  }
}

@media (max-width: 420px) {
  body.admin-dashboard-ready {
    scroll-padding-top: 112px;
  }
  .admin-shell {
    padding: 10px 8px 24px;
    max-width: 100%;
  }
  .admin-workspace-intro,
  .admin-workspace-side {
    padding: 14px;
    border-radius: 16px;
  }
  .admin-mobile-commandbar {
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-areas:
      "nav search title";
  }
  .admin-mobile-commandbar-copy .eyebrow,
  .admin-mobile-current-panel {
    font-size: 9px;
    padding: 3px 6px;
  }
  .admin-rail {
    width: min(92vw, 340px);
  }
  .hero,
  .panel,
  .login-panel {
    padding: 14px;
    border-radius: 16px;
  }
  .admin-tab-panel[data-active="true"] {
    padding: 8px;
    border-radius: 18px;
  }
  .hero h1 {
    font-size: 1.4rem;
  }
  .hero-actions,
  .section-head {
    gap: 8px;
  }
  .admin-home-link,
  .hero-actions .ghost-btn {
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 14px;
  }
  .admin-tabs,
  .admin-subtabs {
    padding-inline: 8px;
  }
  .admin-context-bar,
  #admin-global-feedback {
    padding: 9px 10px;
    border-radius: 14px;
  }
  .tab-chip,
  .subtab-chip {
    white-space: nowrap;
  }
  .tab-chip {
    padding: 8px 11px;
  }
  .subtab-chip {
    padding: 7px 9px;
  }
  .toolbar-row,
  .inline-actions {
    gap: 7px;
  }
  .invite-preset-row,
  .user-bulk-toolbar {
    padding: 9px 10px;
  }
  .admin-quick-actions {
    grid-template-columns: 1fr;
  }
  .provider-templates {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .ai-provider-form textarea[name="apiKeySecret"] {
    min-height: 132px;
    font-size: 0.96rem;
  }
}

/* ══════════════════════════════════════════════
   Admin Dark Mode — Comprehensive Coverage
   ══════════════════════════════════════════════ */

/* ── Shell & Layout ── */
[data-theme=dark] .admin-shell {
  background: var(--bg);
}
[data-theme=dark] .dashboard {
  color: var(--ink);
}

/* ── Hero ── */
[data-theme=dark] .hero {
  background: var(--panel);
  border-color: var(--line);
}
[data-theme=dark] .hero h1 { color: var(--ink); }
[data-theme=dark] .hero p { color: var(--muted); }

/* ── Panels ── */
[data-theme=dark] .panel {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}
[data-theme=dark] .panel h2,
[data-theme=dark] .panel h3,
[data-theme=dark] .panel strong { color: var(--ink); }
[data-theme=dark] .panel .helper { color: var(--muted); }
[data-theme=dark] .login-panel {
  background: var(--panel);
  border-color: var(--line);
}

/* ── Lock Overlay ── */
[data-theme=dark] .admin-lock-overlay {
  background: linear-gradient(180deg, rgba(28,30,37,.92), rgba(20,22,28,.88)), rgba(28,30,37,.84);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: 0 18px 36px rgba(0,0,0,.35);
}
[data-theme=dark] .admin-lock-overlay strong { color: var(--ink); }
[data-theme=dark] .admin-lock-overlay small { color: var(--muted); }
[data-theme=dark] .admin-lock-account {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}

/* ── Sidebar Rail ── */
[data-theme=dark] .admin-rail {
  background: rgba(10, 10, 12, 0.92);
  border-right-color: var(--line);
}
[data-theme=dark] .admin-tabs-shell {
  background: rgba(10,10,12,0.92);
  border-color: var(--line);
}
[data-theme=dark] .admin-rail-header strong { color: var(--ink); }
[data-theme=dark] .admin-rail-header small,
[data-theme=dark] .admin-rail-header .helper { color: var(--muted); }
[data-theme=dark] .admin-rail-eyebrow { background: var(--accent-soft); color: var(--accent); }
[data-theme=dark] .admin-rail-focus {
  background: var(--panel);
  border-color: var(--line);
}
[data-theme=dark] .admin-rail-focus strong { color: var(--ink); }
[data-theme=dark] .admin-rail-focus small { color: var(--muted); }
[data-theme=dark] .admin-rail-focus-eyebrow { color: var(--accent); }
[data-theme=dark] .admin-rail-focus-spot {
  background: var(--accent-soft);
  color: var(--accent);
}
[data-theme=dark] .admin-rail-status { color: var(--muted); }

/* ── Tabs ── */
[data-theme=dark] .admin-tabs .tab-chip:not(.active) {
  background: rgba(28, 30, 37, 0.5);
  border-color: var(--line);
  color: var(--ink);
}
[data-theme=dark] .admin-tabs .tab-chip:hover {
  background: var(--accent-soft);
}
[data-theme=dark] .admin-tabs .tab-chip.active {
  background: var(--accent);
  color: #000;
}

/* ── Workspace Shell ── */
[data-theme=dark] .admin-workspace-shell {
  color: var(--ink);
}
[data-theme=dark] .admin-workspace {
  color: var(--ink);
}
[data-theme=dark] .admin-workspace-head {
  background: var(--panel);
  border-color: var(--line);
}
[data-theme=dark] .admin-workspace-head strong { color: var(--ink); }
[data-theme=dark] .admin-workspace-head small { color: var(--muted); }
[data-theme=dark] .admin-workspace-statusbar {
  background: var(--panel);
  border-color: var(--line);
  color: var(--muted);
}
[data-theme=dark] .admin-workspace-statusbar::before {
  background: var(--accent-soft);
}
[data-theme=dark] .admin-workspace-switcher {
  background: var(--panel);
  border-color: var(--line);
}
[data-theme=dark] .admin-workspace-guidance {
  background: var(--panel);
  border-color: var(--line);
  color: var(--muted);
}
[data-theme=dark] .admin-workspace-outline {
  background: var(--panel);
  border-color: var(--line);
}
[data-theme=dark] .admin-workspace-inspector {
  background: var(--panel);
  border-color: var(--line);
}
[data-theme=dark] .admin-workspace-intro h2 { color: var(--ink); }
[data-theme=dark] .admin-workspace-intro p { color: var(--muted); }
[data-theme=dark] .admin-workspace-eyebrow { color: var(--accent); }
[data-theme=dark] .admin-workspace-note { color: var(--muted); }
[data-theme=dark] .admin-workspace-side {
  background: var(--panel);
  border-color: var(--line);
}
[data-theme=dark] .admin-workspace-breadcrumb { color: var(--muted); }
[data-theme=dark] .admin-workspace-summary {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}
[data-theme=dark] .admin-context-bar {
  background: var(--panel);
  border-color: var(--line);
}
[data-theme=dark] .admin-context-bar small { color: var(--muted); }

/* ── Tab Panels ── */
[data-theme=dark] .admin-tab-panel {
  background: var(--panel);
  border-color: var(--line);
}
[data-theme=dark] .admin-tab-panel[data-active="true"] {
  background: var(--panel);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
[data-theme=dark] .admin-tab-panel[data-admin-panel="overview"][data-active="true"],
[data-theme=dark] .admin-tab-panel[data-admin-panel="requests"][data-active="true"],
[data-theme=dark] .admin-tab-panel[data-admin-panel="accuracy"][data-active="true"],
[data-theme=dark] .admin-tab-panel[data-admin-panel="ai"][data-active="true"],
[data-theme=dark] .admin-tab-panel[data-admin-panel="users"][data-active="true"],
[data-theme=dark] .admin-tab-panel[data-admin-panel="settings"][data-active="true"] {
  background: var(--panel);
}

/* ── Forms & Inputs ── */
[data-theme=dark] input,
[data-theme=dark] select,
[data-theme=dark] textarea {
  background: rgba(28, 30, 37, 0.7);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}
[data-theme=dark] input:focus,
[data-theme=dark] select:focus,
[data-theme=dark] textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(247,181,0,0.15);
}
[data-theme=dark] input::placeholder,
[data-theme=dark] textarea::placeholder { color: rgba(255,255,255,0.25); }
[data-theme=dark] .field span,
[data-theme=dark] .field label { color: var(--muted); }

/* ── Buttons ── */
[data-theme=dark] .ghost-btn {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}
[data-theme=dark] .ghost-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
[data-theme=dark] .submit-btn {
  background: linear-gradient(135deg, #dca000, #c88700);
  color: #fff;
}
[data-theme=dark] .submit-btn:hover { opacity: 0.9; }

/* ── Home Link ── */
[data-theme=dark] .admin-home-link {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}
[data-theme=dark] .admin-home-link::before { color: var(--accent); }

/* ── Grid & Tables ── */
[data-theme=dark] .overview-grid,
[data-theme=dark] .table-list {
  border-color: var(--line);
}
[data-theme=dark] .table-list {
  background: var(--panel);
}
[data-theme=dark] .table-list > .row-card {
  background: var(--panel);
  border-color: var(--line);
}
[data-theme=dark] .table-list > .row-card:hover {
  background: rgba(247,181,0,0.04);
}

/* ── Overview Cards ── */
[data-theme=dark] .overview-grid .panel {
  background: var(--panel);
  border-color: var(--line);
}
[data-theme=dark] .overview-grid .panel strong { color: var(--ink); }
[data-theme=dark] .overview-grid .panel small,
[data-theme=dark] .overview-grid .panel .helper { color: var(--muted); }
[data-theme=dark] .overview-card {
  background: var(--panel);
  border-color: var(--line);
}
[data-theme=dark] .overview-card strong { color: var(--ink); }
[data-theme=dark] .overview-card small { color: var(--muted); }
[data-theme=dark] .overview-card .metric { color: var(--accent); }

/* ── Badges ── */
[data-theme=dark] .badge.ok { background: rgba(48,209,88,0.15); color: var(--good); }
[data-theme=dark] .badge.warn { background: rgba(255,69,58,0.15); color: var(--warn); }
[data-theme=dark] .badge.live { background: var(--accent-soft); color: var(--accent); }
[data-theme=dark] .eyebrow { background: var(--accent-soft); color: var(--accent); }

/* ── Status & Health Indicators ── */
[data-theme=dark] .status-badge.ok { background: rgba(48,209,88,0.15); color: var(--good); }
[data-theme=dark] .status-badge.warn { background: rgba(255,69,58,0.15); color: var(--warn); }
[data-theme=dark] .status-badge.neutral { background: rgba(142,142,147,0.15); color: var(--muted); }

/* ── Section Head ── */
[data-theme=dark] .section-head strong { color: var(--ink); }
[data-theme=dark] .section-head .helper { color: var(--muted); }

/* ── Modals ── */
[data-theme=dark] .admin-modal {
  background: var(--panel-strong);
  border-color: var(--line);
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
[data-theme=dark] .admin-modal h2,
[data-theme=dark] .admin-modal h3 { color: var(--ink); }
[data-theme=dark] .admin-modal p { color: var(--muted); }

/* ── Mobile Command Bar ── */
[data-theme=dark] .admin-mobile-commandbar {
  background: var(--panel);
  border-color: var(--line);
  box-shadow: 0 14px 34px rgba(0,0,0,.25);
}
[data-theme=dark] .admin-mobile-commandbar::after {
  background:
    linear-gradient(90deg, rgba(247,181,0,.72), rgba(220,160,0,.52)) 0 0 / var(--mobile-panel-progress, 0%) 100% no-repeat,
    rgba(255,255,255,.08);
}
[data-theme=dark] .admin-mobile-commandbar-copy strong { color: var(--ink); }
[data-theme=dark] .admin-mobile-commandbar-copy small { color: var(--muted); }
[data-theme=dark] .admin-mobile-current-panel {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
  color: var(--accent);
}
[data-theme=dark] .admin-mobile-open-rail,
[data-theme=dark] .admin-mobile-focus-search {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}
[data-theme=dark] .admin-mobile-rail-top {
  border-bottom-color: var(--line);
}
[data-theme=dark] .admin-mobile-rail-backdrop {
  background: rgba(0,0,0,0.55);
}

/* ── AI Mode Cards ── */
[data-theme=dark] .ai-mode-summary-card {
  background: var(--panel);
  border-color: var(--line);
}
[data-theme=dark] .ai-mode-summary-card strong { color: var(--ink); }
[data-theme=dark] .ai-mode-summary-card small { color: var(--muted); }
[data-theme=dark] .ai-mode-preview-card {
  background: var(--panel);
  border-color: var(--line);
}
[data-theme=dark] .ai-mode-preview-card.is-disabled {
  background: rgba(28,30,37,.5);
  border-color: rgba(255,255,255,.04);
}
[data-theme=dark] .ai-mode-preview-head strong { color: var(--ink); }
[data-theme=dark] .ai-mode-preview-window {
  background: var(--panel);
  border-color: var(--line);
}
[data-theme=dark] .ai-mode-settings-fieldset {
  background: var(--panel);
  border-color: var(--line);
}
[data-theme=dark] .ai-mode-preview-stats small { color: var(--muted); }

/* ── Permission Badges ── */
[data-theme=dark] .permission-badges {
  color: var(--muted);
}

/* ── AI Image Preview ── */
[data-theme=dark] .ai-image-preview-frame {
  background: var(--panel);
  border-color: var(--line);
}
[data-theme=dark] .admin-preview-status { color: var(--muted); }

/* ── Scrollbar ── */
[data-theme=dark] ::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
[data-theme=dark] ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }
[data-theme=dark] ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ── Separators & Dividers ── */
[data-theme=dark] hr,
[data-theme=dark] .divider { border-color: var(--line); }

/* ── Inline Actions ── */
[data-theme=dark] .inline-actions .ghost-btn {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}

/* ── Stack Layout ── */
[data-theme=dark] .stack { color: var(--ink); }

/* ── Warm tints → dark equivalents ── */
[data-theme=dark] .subtab-chip.active,
[data-theme=dark] .subtab-chip.active .subtab-chip-index {
  background: var(--accent-soft);
  border-color: rgba(247, 181, 0, 0.2);
}
[data-theme=dark] .invite-preset-row {
  background: var(--panel);
  border-color: var(--line);
}
[data-theme=dark] .provider-template-card {
  background: var(--panel);
}
[data-theme=dark] .field-preview {
  background: var(--panel);
}
[data-theme=dark] .priority-strip article {
  background: var(--panel);
  border-color: var(--line);
}
[data-theme=dark] .admin-quick-card {
  background: var(--panel);
}
[data-theme=dark] .workspace-switch-chip {
  background: var(--panel);
}
[data-theme=dark] .workspace-switch-chip.active {
  background: var(--accent-soft);
}
[data-theme=dark] .row-card.service-banner.danger {
  background: rgba(255,69,58,0.08);
  border-color: rgba(255,69,58,0.2);
}
[data-theme=dark] .accuracy-priority-card {
  background: var(--panel);
}
[data-theme=dark] .ai-image-preview-frame {
  background: var(--panel);
}
[data-theme=dark] .ai-image-preview-toolbar,
[data-theme=dark] .ai-image-preview-primary-actions,
[data-theme=dark] .ai-image-preview-secondary-actions {
  background: transparent;
}
/* Admin dashboard card-grid layout */
.admin-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.admin-stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  transition: all 160ms ease;
}
.admin-stat-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}
.admin-stat-card .stat-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}
.admin-stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}
.admin-stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}
.admin-stat-card .stat-trend {
  font-size: 0.75rem;
  margin-top: 8px;
}
.admin-stat-card .stat-trend.up { color: var(--good); }
.admin-stat-card .stat-trend.down { color: var(--warn); }

/* Admin table enhancements */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.admin-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.admin-table tbody tr:hover {
  background: var(--accent-soft);
}

/* Admin action bar */
.admin-action-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px 0;
}

/* Admin section cards */
.admin-section-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}
.admin-section-card h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

/* MingLi-Bench iframe panel */

/* ── AI 模型配置卡片 ── */
.models-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}
.model-config-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}
.model-config-card .model-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.model-config-card .model-name {
  font-weight: 600;
  font-size: 0.95rem;
}
.model-config-card .model-toggle-label {
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.model-config-card .model-toggle {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.model-config-card label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 10px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.model-config-card input[type="text"],
.model-config-card input[type="password"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--ink);
  font-size: 0.85rem;
  font-family: inherit;
}
.model-config-card input:focus,
.model-config-card textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.model-config-card textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--ink);
  font-size: 0.82rem;
  font-family: var(--font-mono, monospace);
  resize: vertical;
}
.model-config-card input::placeholder,
.model-config-card textarea::placeholder {
  color: var(--muted);
  opacity: 0.6;
}
@media (max-width: 768px) {
  .models-config-grid {
    grid-template-columns: 1fr;
  }
}

.bench-iframe {
  width: 100%;
  min-height: 900px;
  border: none;
  border-radius: 14px;
  background: var(--panel);
}
.admin-tab-panel[data-admin-panel="bench"][data-active="true"] {
  display: grid;
  gap: 16px;
  width: 100%;
}
@media (max-width: 700px) {
  
/* ── AI 模型配置卡片 ── */
.models-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}
.model-config-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}
.model-config-card .model-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.model-config-card .model-name {
  font-weight: 600;
  font-size: 0.95rem;
}
.model-config-card .model-toggle-label {
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.model-config-card .model-toggle {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.model-config-card label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 10px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.model-config-card input[type="text"],
.model-config-card input[type="password"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--ink);
  font-size: 0.85rem;
  font-family: inherit;
}
.model-config-card input:focus,
.model-config-card textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.model-config-card textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--ink);
  font-size: 0.82rem;
  font-family: var(--font-mono, monospace);
  resize: vertical;
}
.model-config-card input::placeholder,
.model-config-card textarea::placeholder {
  color: var(--muted);
  opacity: 0.6;
}
@media (max-width: 768px) {
  .models-config-grid {
    grid-template-columns: 1fr;
  }
}

.bench-iframe {
    min-height: 700px;
  }
}


/* ================================================================
   1. 统一设计令牌 (Design Tokens) — 与 iOS 端对齐
   ================================================================ */

:root {
  /* 主色调：金色系 — 八字/命理传统色 */
  --gold-50:  #fef9e7;
  --gold-100: #fdf0c7;
  --gold-200: #fbe394;
  --gold-300: #f9d561;
  --gold-400: #f7c73e;
  --gold-500: #dca000;
  --gold-600: #c88700;
  --gold-700: #a86e00;
  --gold-800: #885800;
  --gold-900: #6b4300;

  /* 中性色 */
  --gray-50:  #fafaf9;
  --gray-100: #f5f3f0;
  --gray-200: #e8e4dc;
  --gray-300: #d4cfc4;
  --gray-400: #a9a398;
  --gray-500: #8e8e93;
  --gray-600: #6b6b70;
  --gray-700: #4a4a50;
  --gray-800: #2a2a30;
  --gray-900: #121316;

  /* 功能色 */
  --success: #228b22;
  --success-soft: rgba(34,139,34,0.1);
  --warning: #c81e1e;
  --warning-soft: rgba(200,30,30,0.1);
  --info: #2d5f82;
  --info-soft: rgba(45,95,130,0.1);

  /* 间距系统 (4px base) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
  --space-3xl: 32px;

  /* 圆角系统 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 999px;

  /* 阴影系统 */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
  --shadow-xl: 0 18px 58px rgba(0,0,0,0.08);
  --shadow-accent: 0 4px 14px rgba(220,160,0,0.32);

  /* 字体系统 */
  --font-sans: "Source Han Sans SC", "PingFang SC", "Noto Sans SC", -apple-system, sans-serif;
  --font-serif: "Source Han Serif SC", "Songti SC", "Noto Serif SC", serif;
  --font-mono: "JetBrains Mono", "Sarasa Mono SC", "SFMono-Regular", monospace;

  /* 过渡 */
  --transition-fast: 120ms ease;
  --transition-normal: 180ms ease;
  --transition-slow: 280ms ease;
}

/* ================================================================
   2. 按钮系统标准化 — Web/iOS 统一交互
   ================================================================ */

/* 基础按钮重置 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* 尺寸变体 */
.btn-sm { padding: 7px 12px; font-size: 0.84rem; border-radius: var(--radius-sm); }
.btn-md { padding: 10px 18px; font-size: 0.92rem; }
.btn-lg { padding: 14px 24px; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-xl { padding: 16px 32px; font-size: 1.05rem; border-radius: var(--radius-xl); }

/* 主要按钮 — 金色渐变 (主CTA) */
.btn-primary {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  color: #fff;
  box-shadow: 0 4px 10px rgba(220,160,0,0.22), 0 12px 26px rgba(220,160,0,0.18);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-600), var(--gold-700));
  box-shadow: var(--shadow-accent);
  transform: translateY(-1px);
}
.btn-primary:active { box-shadow: 0 2px 6px rgba(220,160,0,0.25); }

/* 次要按钮 — 描边风格 */
.btn-secondary {
  border: 1.5px solid var(--line, rgba(0,0,0,0.1));
  background: var(--panel, rgba(255,255,255,0.8));
  color: var(--ink);
}
.btn-secondary:hover {
  border-color: var(--accent, #dca000);
  background: var(--accent-soft, rgba(220,160,0,0.08));
}
[data-theme=dark] .btn-secondary {
  border-color: rgba(255,255,255,0.12);
}
[data-theme=dark] .btn-secondary:hover {
  border-color: var(--accent, #f7b500);
}

/* 幽灵按钮 */
.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink);
}
.btn-ghost:hover {
  background: rgba(220,160,0,0.06);
  border-color: var(--line, rgba(0,0,0,0.1));
}

/* 危险按钮 */
.btn-danger {
  background: var(--warning);
  color: #fff;
  box-shadow: 0 4px 10px rgba(200,30,30,0.2);
}
.btn-danger:hover {
  background: #a51a1a;
  box-shadow: 0 4px 14px rgba(200,30,30,0.35);
}

/* 图标按钮 (圆形) */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-full);
  font-size: 1.1rem;
}
.btn-icon.btn-sm { width: 32px; height: 32px; font-size: 0.9rem; }
.btn-icon.btn-lg { width: 48px; height: 48px; font-size: 1.3rem; }

/* 按钮加载态 */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ================================================================
   3. 移动端触摸优化
   ================================================================ */

@media (max-width: 780px) {
  /* 增大触摸目标 */
  .btn, .mode-chip, .tab-chip, .ghost-btn, .tool-btn,
  input, select, textarea, .history-item {
    min-height: 44px; /* iOS HIG 推荐最小值 */
  }

  .btn-sm { min-height: 38px; }

  /* 输入框放大防缩放 */
  input, select, textarea {
    font-size: 16px !important; /* 防止 iOS Safari 自动缩放 */
  }

  /* 表单全宽 */
  .field-row {
    grid-template-columns: 1fr;
  }

  /* 模式选择横向滚动 */
  .mode-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .tab-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  /* 减少内边距 */
  .page { padding: 12px 8px 24px; }
  .hero, .panel, .result-panel { 
    border-radius: 18px; 
    padding: 16px; 
  }

  /* 底部安全距离 (iPhone notch) */
  .page { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

  .panel-title h2, .result-top h2 {
    font-size: 1.1rem;
  }
}

/* 平板 */
@media (min-width: 781px) and (max-width: 1120px) {
  .layout {
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 16px;
  }
  .tab-row { grid-template-columns: repeat(5, 1fr); }
}

/* 桌面大屏 */
@media (min-width: 1121px) {
  .layout {
    grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
  }
  .tab-row { grid-template-columns: repeat(5, 1fr); }
}

/* ================================================================
   4. 卡片与容器统一
   ================================================================ */

/* 统一卡片 */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel-strong, rgba(255,255,255,0.95));
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.card-header {
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  border-bottom: 1px solid var(--line);
}

.card-body {
  padding: var(--space-lg);
}

.card-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--line);
  background: rgba(0,0,0,0.02);
}

/* 手风琴展开区 */
.accordion-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border: none;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.accordion-toggle:hover { background: rgba(0,0,0,0.03); }
.accordion-toggle::after {
  content: "▾";
  font-size: 0.8rem;
  transition: transform var(--transition-normal);
}
.accordion-toggle[aria-expanded=true]::after {
  transform: rotate(180deg);
}
.accordion-panel {
  padding: 0 var(--space-lg) var(--space-lg);
  display: none;
}
.accordion-toggle[aria-expanded=true] + .accordion-panel {
  display: block;
}

/* ================================================================
   5. 状态徽章与标签
   ================================================================ */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: var(--radius-full);
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.good { background: var(--success-soft); color: var(--success); }
.status-pill.warn { background: var(--warning-soft); color: var(--warning); }
.status-pill.info { background: var(--info-soft); color: var(--info); }
.status-pill.water { background: rgba(220,160,0,0.1); color: var(--gold-600); }
.status-pill.accent { background: rgba(220,160,0,0.15); color: var(--gold-700); }
.status-pill.bad { background: rgba(200,30,30,0.08); color: var(--warning); }

/* ================================================================
   6. 表格 (Admin 后台增强)
   ================================================================ */

.data-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  line-height: 1.5;
}

.data-table th {
  position: sticky;
  top: 0;
  background: var(--panel-strong);
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
  z-index: 1;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: rgba(220,160,0,0.04);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table .cell-mono {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.data-table .cell-id {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ================================================================
   7. 页面加载与骨架屏
   ================================================================ */

.skeleton {
  background: linear-gradient(90deg, var(--line) 25%, rgba(0,0,0,0.04) 50%, var(--line) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ================================================================
   8. 暗色模式增强
   ================================================================ */

[data-theme=dark] .card {
  background: rgba(28,30,37,0.85);
  border-color: rgba(255,255,255,0.08);
}

[data-theme=dark] .data-table th {
  background: rgba(40,42,50,0.95);
  border-bottom-color: rgba(255,255,255,0.1);
}

[data-theme=dark] .data-table td {
  border-bottom-color: rgba(255,255,255,0.06);
}

[data-theme=dark] .data-table tbody tr:hover {
  background: rgba(247,181,0,0.06);
}

[data-theme=dark] input,
[data-theme=dark] textarea,
[data-theme=dark] select {
  background: rgba(255,255,255,0.06);
  color: var(--ink);
}

[data-theme=dark] input:focus,
[data-theme=dark] textarea:focus,
[data-theme=dark] select:focus {
  box-shadow: 0 0 0 3px rgba(247,181,0,0.18);
}

/* ================================================================
   9. AI 报告工作区增强
   ================================================================ */

.ai-report-reading {
  max-width: 100%;
  overflow-x: auto;
}

.ai-report-body {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.85;
  color: var(--ink);
}

.ai-report-body h1 { font-size: 1.5rem; margin: 1.2em 0 0.6em; }
.ai-report-body h2 { font-size: 1.25rem; margin: 1em 0 0.5em; }
.ai-report-body h3 { font-size: 1.1rem; margin: 0.8em 0 0.4em; }
.ai-report-body p { margin: 0.6em 0; }
.ai-report-body ul, .ai-report-body ol { padding-left: 1.5em; margin: 0.4em 0; }
.ai-report-body li { margin: 0.2em 0; }
.ai-report-body blockquote {
  border-left: 3px solid var(--gold-400);
  margin: 0.6em 0;
  padding: 0.4em 1em;
  background: rgba(220,160,0,0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.ai-report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 10px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.ai-report-meta-sep { color: var(--line); }

.ai-report-meta-warn {
  color: var(--warning);
  font-weight: 600;
}

/* Thinking 动画点 */
.thinking-dots::after {
  content: "";
  animation: thinking-dots 1.4s steps(1,end) infinite;
}
@keyframes thinking-dots {
  0%   { content: "."; }
  33%  { content: ".."; }
  66%  { content: "..."; }
  100% { content: "."; }
}

/* ================================================================
   10. 辅助工具类
   ================================================================ */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { align-items: center; justify-content: space-between; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 0.84rem; }
.text-xs { font-size: 0.76rem; }
.text-mono { font-family: var(--font-mono); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }

.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 780px) {
  .hide-mobile { display: none !important; }
}

@media (min-width: 781px) {
  .hide-desktop { display: none !important; }
}

/* ================================================================
   动画工具类 — 参考 anime.js 设计模式
   ================================================================ */

/* 性能优化：动画元素预声明 GPU 加速 */
.anim-gpu {
  will-change: transform, opacity;
  backface-visibility: hidden;
}
.anim-gpu-3d {
  will-change: transform;
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

/* 淡入动画 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(.94); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,160,0,.3); }
  50%      { box-shadow: 0 0 0 6px rgba(220,160,0,0); }
}

/* 交错入场 (stagger 模拟) */
.anim-stagger > * {
  opacity: 0;
  animation: fadeIn .4s ease forwards;
}
.anim-stagger > *:nth-child(1) { animation-delay: 0s; }
.anim-stagger > *:nth-child(2) { animation-delay: .06s; }
.anim-stagger > *:nth-child(3) { animation-delay: .12s; }
.anim-stagger > *:nth-child(4) { animation-delay: .18s; }
.anim-stagger > *:nth-child(5) { animation-delay: .24s; }
.anim-stagger > *:nth-child(6) { animation-delay: .30s; }
.anim-stagger > *:nth-child(7) { animation-delay: .36s; }
.anim-stagger > *:nth-child(8) { animation-delay: .42s; }

/* 卡片入场动画 */
.home-card {
  animation: fadeInScale .35s ease both;
}
.home-card:nth-child(1) { animation-delay: .05s; }
.home-card:nth-child(2) { animation-delay: .1s; }
.home-card:nth-child(3) { animation-delay: .15s; }
.home-card:nth-child(4) { animation-delay: .2s; }

/* 按钮微交互 */
.btn, .ghost-btn, .mode-chip, .tab-chip, .quick-chip, .sidebar-mode-btn {
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease, color .12s ease;
}
.btn:active, .ghost-btn:active, .mode-chip:active, .tab-chip:active,
.quick-chip:active, .sidebar-mode-btn:active {
  transform: scale(.96);
}

/* 侧边栏平滑过渡 */
.workspace-sidebar {
  transition: width .25s cubic-bezier(.4,0,.2,1);
}
.sidebar-panel {
  animation: fadeIn .2s ease both;
}

/* 背景网格纹理 (极淡参考线) */
.page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .06;
  background-image:
    linear-gradient(rgba(160,140,100,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(160,140,100,.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at 50% 0%, black 15%, transparent 55%);
}
[data-theme=dark] .page::before {
  opacity: .04;
  background-image:
    linear-gradient(rgba(200,180,140,.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(200,180,140,.02) 1px, transparent 1px);
}

/* ================================================================
   专业排版层级
   ================================================================ */

.result-card h3 {
  font-family: var(--font-serif, "Source Han Serif SC", serif);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.result-card.accent h3 {
  color: var(--gold-700, #a86e00);
}

[data-theme=dark] .result-card.accent h3 {
  color: var(--gold-400, #f7c73e);
}

/* 章节分隔线 */
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 12px;
}
.section-divider::before,
.section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.section-divider span {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* 命理术语高亮 */
.term-highlight {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: rgba(220,160,0,0.1);
  color: var(--gold-700);
  font-weight: 700;
  font-family: var(--font-serif);
}

[data-theme=dark] .term-highlight {
  background: rgba(247,181,0,0.12);
  color: var(--gold-400);
}

/* ================================================================
   微交互与过渡效果
   ================================================================ */

/* 卡片悬浮 */
.result-card,
.panel,
.card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

@media (min-width: 781px) {
  .result-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
  }
}

/* 按钮涟漪效果 */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.3) 10%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn:active::after {
  opacity: 1;
  transition: opacity 0s;
}

/* 页面进入动画 */
@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-enter {
  animation: page-enter 0.35s ease-out;
}

.result-stack > * {
  animation: page-enter 0.35s ease-out;
}

.result-stack > *:nth-child(1) { animation-delay: 0s; }
.result-stack > *:nth-child(2) { animation-delay: 0.05s; }
.result-stack > *:nth-child(3) { animation-delay: 0.1s; }
.result-stack > *:nth-child(4) { animation-delay: 0.15s; }

/* ================================================================
   加载状态优化
   ================================================================ */

/* 骨架屏变体 */
.skeleton-text {
  height: 14px;
  margin: 8px 0;
}
.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }

.skeleton-title {
  height: 22px;
  width: 40%;
  margin: 12px 0;
}

.skeleton-card {
  height: 120px;
  margin: 12px 0;
}

/* AI 思考中脉冲 */
@keyframes ai-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.ai-thinking-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(220,160,0,0.06), rgba(45,95,130,0.04));
  border: 1px solid var(--line);
  animation: ai-pulse 2s ease-in-out infinite;
}

.ai-thinking-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: ai-pulse 1.4s ease-in-out infinite;
}
.ai-thinking-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.ai-thinking-indicator .dot:nth-child(3) { animation-delay: 0.4s; }

/* ================================================================
   空状态优化
   ================================================================ */

.empty-state {
  text-align: center;
  padding: 40px 24px;
}

.empty-state::before {
  content: "";
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(220,160,0,0.1), rgba(45,95,130,0.08));
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dca000' stroke-width='1.5'%3E%3Cpath d='M12 2L2 7l10 5 10-5-10-5z'/%3E%3Cpath d='M2 17l10 5 10-5'/%3E%3Cpath d='M2 12l10 5 10-5'/%3E%3C/svg%3E");
  background-size: 36px;
  background-position: center;
  background-repeat: no-repeat;
}

.empty-state h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  margin: 0 0 8px;
}

.empty-state p {
  max-width: 400px;
  margin: 0 auto;
}

/* ================================================================
   通知/Toast 优化
   ================================================================ */

@keyframes toast-slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.app-welcome-feedback {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  max-width: 480px;
  width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  animation: toast-slide-up 0.3s ease-out;
  box-shadow: var(--shadow-lg);
}

.app-welcome-feedback.ok {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(34,139,34,0.2);
}

.app-welcome-feedback.warn {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid rgba(200,30,30,0.2);
}

.app-welcome-feedback.info {
  background: var(--info-soft);
  color: var(--info);
  border: 1px solid rgba(45,95,130,0.2);
}

/* ================================================================
   结果分享卡片优化
   ================================================================ */

.share-preview-card {
  border: 2px solid var(--gold-300);
  border-radius: var(--radius-xl);
  padding: 24px;
  background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(248,240,220,0.95));
  box-shadow: var(--shadow-lg);
}

[data-theme=dark] .share-preview-card {
  background: linear-gradient(135deg, rgba(40,42,50,0.98), rgba(30,32,38,0.95));
  border-color: var(--gold-600);
}

.share-preview-card .brand-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 0.82rem;
  color: var(--gold-600);
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* ================================================================
   打印优化
   ================================================================ */

@media print {
  body {
    background: white !important;
    color: black !important;
  }
  .page {
    max-width: 100%;
    padding: 0;
  }
  .control-panel,
  .hero-auth-shell,
  .theme-toggle-btn,
  .panel-backdrop,
  .desktop-expand-panel,
  button,
  .ghost-btn,
  .tool-btn {
    display: none !important;
  }
  .layout {
    grid-template-columns: 1fr !important;
  }
  .result-card,
  .panel {
    break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
}

/* ================================================================
   iOS 风格导航指示器 (移动端)
   ================================================================ */

@media (max-width: 780px) {
  .mobile-nav-indicator {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 8px 0;
  }
  .mobile-nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--line);
    transition: all 0.2s ease;
  }
  .mobile-nav-dot.active {
    width: 20px;
    border-radius: 3px;
    background: var(--accent);
  }
}

/* ================================================================
   高对比度 / 无障碍增强
   ================================================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: high) {
  :root {
    --line: rgba(0,0,0,0.2);
    --muted: #555;
  }
  [data-theme=dark] {
    --line: rgba(255,255,255,0.25);
    --muted: #bbb;
  }
  .result-card,
  .panel {
    border-width: 2px;
  }
}

/* 焦点环 (键盘导航) */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ================================================================
   滚动条美化 (Webkit)
   ================================================================ */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

[data-theme=dark] ::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
}

[data-theme=dark] ::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.25);
}

/* ================================================================
   Admin Data Tables — Professional grade
   ================================================================ */

.admin-data-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--panel-strong);
}

.admin-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  line-height: 1.5;
}

.admin-data-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.admin-data-table th {
  background: linear-gradient(180deg, var(--panel-strong), rgba(0,0,0,0.02));
  padding: 11px 12px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
  user-select: none;
}

.admin-data-table th.sortable {
  cursor: pointer;
  transition: color 0.15s;
}

.admin-data-table th.sortable:hover {
  color: var(--accent);
}

.admin-data-table th.sortable::after {
  content: " ↕";
  font-size: 0.7rem;
  opacity: 0.4;
}

.admin-data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.admin-data-table tbody tr {
  transition: background 0.1s;
}

.admin-data-table tbody tr:hover {
  background: rgba(220,160,0,0.04);
}

.admin-data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Cell variants */
.admin-data-table .cell-id {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-data-table .cell-email {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-data-table .cell-number {
  font-family: var(--font-mono);
  text-align: right;
  font-size: 0.85rem;
}

.admin-data-table .cell-date {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ================================================================
   Admin Search Bar
   ================================================================ */

.admin-search-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  flex-wrap: wrap;
}

.admin-search-input {
  flex: 1;
  min-width: 200px;
  padding: 8px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  background: var(--panel);
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.admin-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(220,160,0,0.12);
}

.admin-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-filter-chip {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--panel);
  color: var(--ink);
  transition: all 0.15s;
  white-space: nowrap;
}

.admin-filter-chip:hover {
  border-color: var(--accent);
  background: rgba(220,160,0,0.05);
}

.admin-filter-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.admin-filter-chip .count {
  margin-left: 4px;
  opacity: 0.7;
  font-size: 0.75rem;
}

/* ================================================================
   Admin Stats Cards
   ================================================================ */

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding: 8px 0;
}

.admin-stat-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  text-align: center;
}

.admin-stat-card .stat-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  font-family: var(--font-serif);
  color: var(--accent);
  line-height: 1.2;
}

.admin-stat-card .stat-label {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-stat-card .stat-sub {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--muted);
}

/* ================================================================
   Admin Action Bar
   ================================================================ */

.admin-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 10px 0;
}

.admin-bulk-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.admin-bulk-actions .select-all-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  cursor: pointer;
}

/* ================================================================
   Admin Pagination
   ================================================================ */

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 0;
}

.admin-pagination button {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}

.admin-pagination button:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(220,160,0,0.06);
}

.admin-pagination button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.admin-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.admin-pagination .page-info {
  font-size: 0.82rem;
  color: var(--muted);
}

/* ================================================================
   Admin Detail Panel
   ================================================================ */

.admin-detail-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.admin-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.admin-detail-item {
  padding: 8px 0;
}

.admin-detail-item .detail-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-detail-item .detail-value {
  font-size: 0.95rem;
  margin-top: 2px;
}

/* ================================================================
   Admin Toast / Feedback
   ================================================================ */

.admin-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  max-width: 400px;
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 600;
  animation: admin-toast-in 0.3s ease;
}

@keyframes admin-toast-in {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.admin-toast.ok { background: var(--success-soft); color: var(--success); border: 1px solid rgba(34,139,34,0.2); }
.admin-toast.warn { background: var(--warning-soft); color: var(--warning); border: 1px solid rgba(200,30,30,0.2); }
.admin-toast.info { background: var(--info-soft); color: var(--info); border: 1px solid rgba(45,95,130,0.2); }

/* ================================================================
   Admin shortcuts / quick-jump improvements
   ================================================================ */

.admin-quick-jump-results {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-top: 8px;
}

.admin-quick-jump-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.1s;
}

.admin-quick-jump-item:last-child { border-bottom: none; }

.admin-quick-jump-item:hover {
  background: rgba(220,160,0,0.05);
}

.admin-quick-jump-item .jump-label {
  font-weight: 600;
}

.admin-quick-jump-item .jump-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ================================================================
   Dark mode admin
   ================================================================ */

[data-theme=dark] .admin-data-table th {
  background: linear-gradient(180deg, rgba(40,42,50,0.95), rgba(30,32,38,0.5));
}

[data-theme=dark] .admin-data-table tbody tr:hover {
  background: rgba(247,181,0,0.05);
}

[data-theme=dark] .admin-search-input {
  background: rgba(255,255,255,0.06);
}
