/* =====================================================
   hy2 Design System
   Product Tech Minimal - CSS Variables & Global
   ===================================================== */

/* Administrator entry: quiet grid, diffuse light and a compact form. */
body.page-admin-login {
  min-height: 100svh;
  background: #f8f9f7;
  color: #182026;
}
.page-admin-login .auth-header { background: transparent; border-bottom: 1px solid #e5e9e8; }
.page-admin-login .auth-header-inner { max-width: 1240px; height: 76px; padding: 0 40px; }
.page-admin-login .auth-header-logo { gap: 12px; font-size: 19px; letter-spacing: -.5px; }
.page-admin-login .auth-header-back { color: #606b70; font-size: 13px; }
.page-admin-login .login-mark { display: grid; place-items: center; width: 30px; height: 30px; background: #172027; color: white; border-radius: 7px; font-size: 17px; }
.page-admin-login .login-stage {
  min-height: calc(100svh - 76px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px 40px 28px;
  background: radial-gradient(ellipse at 25% 42%, #e5f0f3 0, transparent 52%);
}
.page-admin-login .login-layout {
  width: 100%; max-width: 1080px; margin: auto;
  display: grid; grid-template-columns: 1.2fr 1fr;
  border: 1px solid #dfe5e5; border-radius: 22px; overflow: hidden;
  background: #fff; box-shadow: 0 20px 70px -35px #34536738;
  animation: login-enter 550ms ease-out both;
}
.page-admin-login .login-story {
  position: relative; isolation: isolate; display: flex; flex-direction: column;
  padding: 52px 48px 28px; min-width: 0;
  background: radial-gradient(ellipse at 60% 50%, #e0edf2 0, #f2f6f5 70%);
  border-right: 1px solid #e1e8e8;
}
.page-admin-login .login-story::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(#8099a20b 1px, transparent 1px), linear-gradient(90deg, #8099a20b 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(transparent, black 35%, black 70%, transparent);
}
.page-admin-login .login-eyebrow { display: flex; align-items: center; gap: 9px; color: #53707c; font: 10px var(--font-mono); letter-spacing: 2px; }
.page-admin-login .login-eyebrow span { width: 6px; height: 6px; background: #6397aa; border-radius: 50%; }
.page-admin-login .login-story h1 { margin: 35px 0 20px; font-size: clamp(34px, 3.7vw, 48px); font-weight: 600; line-height: 1.35; letter-spacing: -2px; }
.page-admin-login .login-story h1 span { color: #55747f; }
.page-admin-login .login-description { font-size: 14px; line-height: 1.95; color: #626f75; }
.page-admin-login .login-network { margin: 8px -20px 4px; flex: 1; display: flex; align-items: center; }
.page-admin-login .login-network svg { width: 100%; height: auto; }
.page-admin-login .login-story-foot { display: flex; justify-content: space-between; gap: 16px; color: #667d86; font-size: 10px; letter-spacing: 1.5px; padding-top: 15px; border-top: 1px solid #d6e2e5; }
.page-admin-login .login-panel { min-width: 0; padding: 58px 48px 32px; }
.page-admin-login .login-panel-kicker { display: flex; align-items: center; gap: 7px; color: #617077; font-size: 11px; letter-spacing: 1px; margin-bottom: 20px; }
.page-admin-login .login-panel-kicker svg, .page-admin-login .login-panel-foot svg { width: 14px; height: 14px; flex-shrink: 0; }
.page-admin-login .login-panel h2 { font-size: 28px; font-weight: 600; letter-spacing: -1px; margin: 0 0 8px; }
.page-admin-login .login-subtitle { color: #657078; font-size: 13px; line-height: 1.7; }
.page-admin-login .login-form { display: flex; flex-direction: column; gap: 22px; margin-top: 18px; }
.page-admin-login .login-feedback:empty { display: none; }
.page-admin-login .login-feedback .err, .page-admin-login .login-feedback .flash { margin: 0; overflow-wrap: anywhere; }
.page-admin-login .login-form .field { margin: 0; }
.page-admin-login .login-form .label { display: block; font-size: 12px; font-weight: 500; color: #35434b; margin-bottom: 9px; }
.page-admin-login .login-form .input { display: block; width: 100%; box-sizing: border-box; height: 48px; border: 1px solid #dce2e4; border-radius: 8px; background: #fff; padding: 0 14px; color: #182026; font-size: 16px; box-shadow: 0 1px 2px #17202703; }
.page-admin-login .login-form .input::placeholder { color: #727d83; font-size: 13px; }
.page-admin-login .login-form .input:focus { outline: 2px solid #8ab6c7; outline-offset: 2px; border-color: #6e9fb1; box-shadow: none; }
.page-admin-login .login-password { position: relative; }
.page-admin-login .login-password .input { padding-right: 64px; }
.page-admin-login #login-password-toggle { position: absolute; right: 4px; top: 2px; min-width: 52px; height: 44px; border: 0; background: transparent; color: #4a6976; font-size: 12px; border-radius: 6px; cursor: pointer; }
.page-admin-login #login-password-toggle:focus-visible { outline: 2px solid #6e9fb1; outline-offset: -3px; }
.page-admin-login .login-submit { display: flex; justify-content: space-between; align-items: center; width: 100%; height: 48px; padding: 0 18px; margin-top: 4px; border: 1px solid #172027; border-radius: 8px; background: #172027; color: white; font-size: 14px; font-weight: 500; cursor: pointer; }
.page-admin-login .login-submit:hover:not(:disabled) { background: #2d424e; border-color: #2d424e; }
.page-admin-login .login-submit:disabled { cursor: wait; opacity: .7; }
.page-admin-login .login-panel-foot { margin-top: 34px; padding-top: 22px; border-top: 1px solid #edf0f0; display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 11px; color: #69767b; }
.page-admin-login .login-footer { text-align: center; margin-top: 36px; font-size: 10px; color: #6c797f; letter-spacing: 1px; }
.page-admin-login .login-footer span { margin: 0 8px; color: #b2bec2; }
@keyframes login-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 800px) {
  .page-admin-login .login-stage { padding: 36px 24px 24px; }
  .page-admin-login .login-layout { max-width: 440px; grid-template-columns: 1fr; border-radius: 16px; }
  .page-admin-login .login-story { display: none; }
  .page-admin-login .login-panel { padding: 38px 30px 28px; }
  .page-admin-login .auth-header-inner { height: 64px; padding: 0 24px; }
  .page-admin-login .login-stage { min-height: calc(100svh - 64px); }
}
@media (max-width: 380px) {
  .page-admin-login .login-stage { padding: 28px 16px 20px; }
  .page-admin-login .login-panel { padding: 30px 22px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .page-admin-login .login-layout { animation: none; }
  .page-admin-login *, .page-admin-login *::before { transition: none !important; }
}

/* Public homepage, shared visual language with the administrator entry. */
body.page-site { background: #f8f9f7; color: #182026; }
.page-site .site-header { max-width: 1240px; margin: auto; padding: 22px 40px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid #e3e8e7; }
.site-brand { display: flex; align-items: center; gap: 11px; color: #182026; text-decoration: none; }
.site-brand > span { display: grid; place-items: center; width: 34px; height: 34px; background: #182026; color: white; border-radius: 7px; font-weight: 600; }
.site-brand strong { font-size: 17px; line-height: 1.25; }
.site-brand small { display: block; font-size: 8px; letter-spacing: 1.5px; font-weight: 400; color: #65767e; margin-top: 4px; }
.site-header nav { display: flex; gap: 28px; margin-left: auto; margin-right: 24px; font-size: 12px; }
.site-header nav a { color: #5a6970; text-decoration: none; }
.site-button { display: inline-flex; align-items: center; justify-content: space-between; gap: 28px; background: #182026; border: 1px solid #182026; border-radius: 8px; min-height: 48px; padding: 0 20px; color: #fff; font-size: 13px; text-decoration: none; transition: background 160ms; }
.site-button:hover { background: #314b57; color: white; }
.site-button-small { min-height: 38px; font-size: 12px; padding: 0 14px; gap: 14px; }
.site-main { max-width: 1240px; margin: auto; padding: 0 40px; }
.site-hero { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 48px; padding: 76px 0 66px; }
.site-eyebrow { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1.7px; color: #587683; margin: 0 0 22px; display: flex; align-items: center; gap: 9px; }
.site-eyebrow > span { width: 6px; height: 6px; background: #6797a9; border-radius: 50%; }
.site-hero h1 { font-size: clamp(38px, 4.6vw, 64px); font-weight: 600; line-height: 1.25; letter-spacing: -2.5px; margin: 0 0 24px; }
.site-hero h1 em { font-style: normal; color: #567581; }
.site-lead { font-size: 15px; color: #607078; line-height: 1.9; }
.site-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 25px; margin: 32px 0; }
.site-text-link { color: #4a6370; font-size: 12px; text-decoration: none; }
.site-protocols { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: 10px; color: #647780; }
.site-protocols b { font-weight: 500; color: #455c66; }
.site-topology { position: relative; height: 460px; isolation: isolate; border: 1px solid #dae5e7; border-radius: 20px; background: radial-gradient(ellipse at center, #dcebf0, #f3f7f6 72%); box-shadow: 0 18px 65px -40px #517c90; overflow: hidden; }
.site-topology-grid { position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(#86a5b329 .8px, transparent .8px); background-size: 16px 16px; }
.site-topology-caption { display: flex; justify-content: space-between; position: absolute; top: 24px; left: 24px; right: 24px; font-size: 8px; letter-spacing: 1.3px; color: #627e8b; }
.site-topology-lines { width: 100%; height: 100%; position: absolute; inset: 0; }
.site-hub { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 142px; height: 112px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #fff; border: 1px solid #cadde4; border-radius: 16px; box-shadow: 0 10px 40px #789fac24; }
.site-hub > span { background: #1c303a; color: white; border-radius: 7px; width: 30px; height: 30px; display: grid; place-items: center; margin-bottom: 5px; }
.site-hub strong { font-size: 16px; }.site-hub small { font-size: 7px; letter-spacing: 1px; color: #69808b; margin-top: 5px; }
.site-node { position: absolute; width: 148px; padding: 14px; background: #ffffffed; border: 1px solid #d8e3e7; border-radius: 10px; }
.site-node span { display: block; color: #748b96; font-size: 8px; letter-spacing: 1px; margin-bottom: 5px; }
.site-node strong { display: block; font-weight: 500; font-size: 13px; }.site-node small { display: block; color: #667f8a; font-size: 9px; margin-top: 5px; }
.site-node-top { left: 50%; top: 61px; transform: translateX(-50%); }.site-node-left { left: 22px; bottom: 76px; }.site-node-right { right: 22px; bottom: 76px; }
.site-topology-footer { position: absolute; bottom: 24px; left: 24px; right: 24px; border-top: 1px solid #d4e1e5; padding-top: 13px; font-size: 10px; color: #657e8a; }
.site-section-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 28px; }
.site-section-heading .site-eyebrow { margin-bottom: 12px; }.site-section-heading h2,.site-closing h2 { font-size: clamp(24px, 2.7vw, 34px); font-weight: 600; letter-spacing: -1px; margin: 0; }
.site-section-heading > p { color: #69777c; font-size: 12px; line-height: 1.8; margin: 0; }
.site-services { padding: 40px 0 64px; scroll-margin-top: 24px; }.site-feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.site-feature { position: relative; padding: 28px; border: 1px solid #dfe5e5; background: #fff; border-radius: 12px; }
.site-feature-icon { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid #dae6e9; background: #f0f6f7; color: #557d8d; border-radius: 8px; font-size: 22px; }
.site-feature-index { position: absolute; top: 31px; right: 27px; color: #8a9ba2; font: 11px var(--font-mono); }
.site-feature h3 { font-size: 17px; margin: 25px 0 12px; font-weight: 600; }.site-feature p { color: #647179; font-size: 12px; line-height: 1.9; margin: 0 0 24px; }
.site-feature-tags { display: flex; flex-wrap: wrap; gap: 6px; }.site-feature-tags span { font-size: 9px; border: 1px solid #e4e9e9; border-radius: 4px; padding: 4px 6px; color: #5d727d; }
.site-preview-section { padding: 36px 0 60px; scroll-margin-top: 24px; }.site-console { border: 1px solid #dce4e6; background: white; border-radius: 14px; box-shadow: 0 16px 50px -35px #6a899b; overflow: hidden; }
.site-console-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: #f1f5f5; padding: 20px 28px; border-bottom: 1px solid #e0e7e8; font-size: 12px; }.site-console-top strong { font-weight: 500; }.site-console-top strong span { margin-right: 12px; color: #648494; }.site-demo-label { font-size: 10px; color: #627781; }
.site-preview-nav { display: flex; gap: 28px; padding: 0 28px; border-bottom: 1px solid #e5eaeb; }.site-preview-nav a { display: block; padding: 17px 0; color: #65777f; font-size: 12px; text-decoration: none; border-bottom: 2px solid transparent; }.site-preview-nav a[aria-selected="true"] { color: #223e4c; border-bottom-color: #658fa1; }
.site-demo-panel { padding: 28px; min-height: 370px; }.site-demo-panel[hidden] { display: none; }.site-demo-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }.site-demo-heading h3 { font-size: 16px; font-weight: 500; margin: 0 0 6px; }.site-demo-heading p { font-size: 11px; color: #65757c; margin: 0; }.site-demo-heading > span { font-size: 10px; color: #607780; }
.site-demo-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; margin: 24px 0 20px; }.site-demo-stats > div { border-left: 2px solid #dce7eb; padding-left: 15px; }.site-demo-stats span { display: block; color: #617984; font-size: 10px; }.site-demo-stats strong { display: block; font-size: 26px; font-weight: 500; margin-top: 6px; }.site-demo-stats small { color: #758990; font-size: 11px; }
.site-chart { margin: 0; }.site-chart svg { display: block; width: 100%; max-height: 190px; }.site-chart figcaption { display: flex; justify-content: space-between; color: #75858b; font-size: 9px; padding-top: 10px; }
.site-demo-user { display: flex; align-items: center; gap: 18px; padding: 24px 0; border-bottom: 1px solid #e6eced; font-size: 12px; }.site-demo-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: #edf3f5; color: #638899; }.site-demo-user strong { display: block; font-weight: 500; }.site-demo-user small { display: block; color: #72868e; font-size: 10px; margin-top: 4px; }.site-demo-user meter { flex: 1; margin: 0 24px; accent-color: #719cac; }.site-demo-user > span:last-child { font: 11px var(--font-mono); color: #55707d; }
.site-demo-health { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 20px; padding: 22px 0; border-bottom: 1px solid #e6eced; font-size: 12px; }.site-demo-health > span:nth-child(2) { color: #677d88; }.site-demo-health b { font-size: 10px; font-weight: 400; color: #527982; text-align: right; }.site-preview-note { font-size: 10px; color: #667b85; margin-top: 20px; }
.site-closing { margin: 16px 0 52px; padding: 38px 40px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border: 1px solid #d8e4e8; border-radius: 14px; background: radial-gradient(ellipse at 20% 60%,#e3eff2, #f3f7f6); }.site-closing .site-eyebrow { margin-bottom: 12px; }.site-closing p:last-child { color: #617781; font-size: 12px; margin: 12px 0 0; }
.site-footer { max-width: 1160px; margin: auto; border-top: 1px solid #e1e7e7; display: flex; justify-content: space-between; gap: 24px; padding: 28px 0 32px; font-size: 10px; color: #687c86; }.site-footer-brand { text-decoration: none; color: #263e4a; font-weight: 500; }.site-footer-brand span { font-weight: 400; margin-left: 10px; color: #6a7e87; }
.page-site a:focus-visible { outline: 2px solid #679aae; outline-offset: 5px; }.site-reveal { animation: site-enter 500ms ease-out both; }@keyframes site-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@media(max-width: 900px) { .site-hero { gap: 28px; }.site-node { width: 120px; padding: 11px; }.site-node-left { left: 12px; }.site-node-right { right: 12px; }.site-feature { padding: 22px; }.site-header nav { gap: 18px; margin-right: 0; } }
@media(max-width: 760px) {
 .page-site .site-header { padding: 18px 22px; gap: 12px; }.site-header nav { display: none; }.site-main { padding: 0 22px; }.site-hero { grid-template-columns: 1fr; padding: 48px 0 30px; gap: 35px; }.site-hero h1 { font-size: 46px; }.site-topology { height: 400px; }.site-node { width: 135px; }.site-node-top { top: 45px; }.site-node-left,.site-node-right { bottom: 58px; }.site-topology-caption { font-size: 7px; }.site-topology-footer { bottom: 16px; }
 .site-section-heading { align-items: start; flex-direction: column; gap: 12px; }.site-section-heading > p br { display: none; }.site-feature-grid { grid-template-columns: 1fr; }.site-feature { padding: 24px; }.site-feature h3 { margin-top: 18px; }.site-services { padding-bottom: 28px; }.site-preview-section { padding: 20px 0 28px; }.site-console-top { padding: 18px; flex-wrap: wrap; gap: 8px; }.site-preview-nav { padding: 0 18px; gap: 24px; }.site-demo-panel { padding: 20px 18px; min-height: 360px; }.site-demo-heading { align-items: start; flex-direction: column; gap: 8px; }.site-demo-stats { gap: 8px; }.site-demo-stats strong { font-size: 22px; }.site-demo-stats > div { padding-left: 8px; }.site-chart svg { min-height: 120px; }.site-demo-user { gap: 10px; flex-wrap: wrap; }.site-demo-user meter { margin: 0; min-width: 45px; }.site-demo-health { grid-template-columns: 1fr 1fr; gap: 6px; padding: 16px 0; }.site-demo-health > span:nth-child(2) { grid-row: 2; grid-column: 1 / -1; font-size: 10px; }.site-demo-health b { grid-column: 2; grid-row: 1; }.site-closing { padding: 28px 24px; flex-direction: column; align-items: start; }.site-closing h2 { font-size: 25px; }.site-footer { margin: 0 22px; flex-wrap: wrap; gap: 12px; }
}
@media(prefers-reduced-motion: reduce) { .page-site .site-reveal { animation: none; }.page-site * { scroll-behavior: auto !important; transition: none !important; } }

/* ---- DESIGN TOKENS ---- */
:root {
  color-scheme: light;

  /* Background */
  --bg-page: #F8F7F3;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F3F2EE;
  --bg-overlay: #FAFAF8;

  /* Text */
  --text-primary: #111111;
  --text-secondary: #5F5E59;
  --text-tertiary: #92918B;
  --text-disabled: #B9B8B2;

  /* Border */
  --hairline: #E6E4DE;
  --border: #D8D6CF;
  --border-strong: #BDBBB4;

  /* Accent */
  --accent: #111111;
  --accent-hover: #292929;
  --accent-soft: rgba(17, 17, 17, 0.06);

  /* States */
  --ok: #1A7F4E;
  --ok-soft: #E8F5EE;
  --warn: #92660A;
  --warn-soft: #FDF4E3;
  --danger: #B64138;
  --danger-soft: #FFF6F5;

  /* Data accent */
  --data: #2C6E7F;
  --data-soft: rgba(44,110,127,.10);

  /* Border Radius */
  --radius-xs: 3px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Fonts */
  --font-sans: "Inter", "Noto Sans SC", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  --font-serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", Georgia, serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
  --font-num: "Inter", "Noto Sans SC", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  --font-label: "JetBrains Mono", "Noto Sans SC", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;

  /* Font Size */
  --text-caption: 11px;
  --text-small: 12px;
  --text-ui: 13px;
  --text-body: 14px;
  --text-body-lg: 15px;
  --text-card-title: 16px;
  --text-section: 28px;
  --text-hero: 72px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.04);
  --shadow-md: 0 8px 24px rgba(0,0,0,.05);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.04);

  /* Transitions */
  --transition: 150ms ease;
  --transition-md: 250ms ease;
}

/* ---- FONT FACES ---- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/inter-var.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono.woff2") format("woff2");
}

.stat-block-v {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-body);
  font-family: var(--font-num);
  font-weight: 500;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 1;
  color: var(--text-primary);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  min-height: 100%;
  background: var(--bg-page);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  color: var(--text-primary);
  background: var(--bg-page);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

img, svg { display: block; max-width: 100%; }

::selection { background: rgba(17,17,17,.06); }

:focus-visible {
  outline: 1px solid var(--data);
  outline-offset: 1px;
  box-shadow: 0 0 0 3px var(--data-soft);
  border-radius: var(--radius-xs);
}

[hidden] { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ---- SKIP LINK (Accessibility) ---- */
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10000;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-xs);
  font-family: var(--font-sans);
  font-size: var(--text-ui);
  line-height: 1;
  text-decoration: none;
  transform: translateY(-200%);
  opacity: 0;
  pointer-events: none;
  transition: transform var(--transition), opacity var(--transition);
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* =====================================================
   BUTTON SYSTEM
   ===================================================== */

/* Base Button */
.numeric { font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  font-family: var(--font-sans);
  font-size: var(--text-ui);
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

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

/* Primary */
.btn-primary {
  height: 44px;
  padding: 0 22px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-pill);
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

/* Secondary */
.btn-secondary {
  height: 44px;
  padding: 0 22px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

/* Ghost */
.btn-ghost {
  height: 44px;
  padding: 0 22px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

/* Small Button */
.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: var(--text-small);
}

/* Medium Button */
.btn-md {
  height: 34px;
  padding: 0 12px;
  font-size: var(--text-ui);
}

/* Icon Button */
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-xs);
}

/* Danger */
.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(182, 65, 56, 0.15);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

/* Full Width */
.btn-full { width: 100%; }

/* =====================================================
   FORM SYSTEM
   ===================================================== */

/* Input */
.input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input::placeholder { color: var(--text-disabled); }

.input:focus {
  border-color: var(--data);
}

.input:focus-visible {
  border-color: var(--data);
  box-shadow: 0 0 0 3px var(--data-soft);
}

.input-sm {
  height: 36px;
  padding: 0 10px;
  font-size: var(--text-ui);
}

/* Select — minimal reset; full product styles live under body.has-shell */
.select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2392918B' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

body.has-shell .select {
  width: 100%;
  height: 48px;
  padding: 0 36px 0 14px;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  color: var(--text-primary);
  background-color: var(--bg-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2392918B' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

body.has-shell .select:focus {
  border-color: var(--data);
}

body.has-shell .select:focus-visible {
  border-color: var(--data);
  box-shadow: 0 0 0 3px var(--data-soft);
}

/* Checkbox */
.checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Label */
.label {
  display: block;
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* Field */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

/* =====================================================
   TYPOGRAPHY
   ===================================================== */

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-disabled { color: var(--text-disabled); }
.text-mono { font-family: var(--font-mono); }

.text-caption { font-size: var(--text-caption); }
.text-small { font-size: var(--text-small); }
.text-ui { font-size: var(--text-ui); }
.text-body { font-size: var(--text-body); }
.text-body-lg { font-size: var(--text-body-lg); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* =====================================================
   UTILITIES
   ===================================================== */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
/* =====================================================
   PAGE-HOME: 首页 (Product Landing)
   ===================================================== */

body.page-home {
  background: var(--bg-page);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Home Header */
.home-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 64px;
  background: rgba(248, 247, 243, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.home-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  padding: 0 40px;
}

.home-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.home-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-xs);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
}

.home-logo-text strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}

.home-logo-text small {
  display: block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

.home-nav {
  display: flex;
  align-items: center;
  gap: 32px;
}

.home-nav-link {
  font-size: var(--text-ui);
  color: var(--text-secondary);
  transition: color var(--transition);
}

.home-nav-link:hover { color: var(--text-primary); }

.home-nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 24px;
  padding-left: 24px;
  border-left: 1px solid var(--border);
}

.home-nav-actions .btn {
  height: 34px;
  padding: 0 14px;
  font-size: var(--text-ui);
  border-radius: var(--radius-xs);
}

.home-nav-actions .btn-primary {
  height: 36px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  font-weight: 600;
}

/* Hero */
.home-hero {
  position: relative;
  min-height: 700px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 120px 40px 80px;
  overflow: hidden;
}

/* Tech Background Pattern */
.home-hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.home-hero-grid {
  --home-grid-size: 28px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 720px;
  height: 720px;
  opacity: 0.06;
  background-image:
    radial-gradient(circle, var(--text-primary) 1px, transparent 1px);
  background-size: var(--home-grid-size) var(--home-grid-size);
}

.home-hero-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(ellipse, var(--accent-soft) 0%, transparent 70%);
  opacity: 0.4;
}

.home-hero-content {
  position: relative;
  z-index: 1;
  max-width: 820px;
  text-align: center;
}

.home-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 24px;
}

.home-eyebrow::before,
.home-eyebrow::after {
  content: '';
  display: block;
  width: 24px;
  height: 1px;
  background: var(--border);
}

.home-title {
  font-family: var(--font-sans);
  font-size: clamp(48px, 8vw, 80px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text-primary);
  margin-bottom: 28px;
}

.home-headline {
  font-size: 26px;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 16px;
  line-height: 1.4;
}

.home-desc {
  font-size: var(--text-body-lg);
  color: var(--text-secondary);
  margin-bottom: 40px;
}

.home-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 64px;
}

.home-actions .btn-primary svg,
.home-actions .btn-secondary svg {
  width: 16px;
  height: 16px;
}

/* Protocol Strip */
.home-protocols {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.home-protocols-label {
  font-size: var(--text-caption);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-disabled);
}

.home-protocols-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.home-protocols-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: var(--text-small);
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
}

/* Home Sections */
.home-sections {
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 40px 120px;
}

.home-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
  padding: 64px 0;
}

.home-section + .home-section {
  border-top: 1px solid var(--border);
}

/* Alternating layout: explicit modifiers override nth-child for clarity */
.home-section.home-section-text-left {
  grid-template-areas: "content preview";
}

.home-section.home-section-text-left > .home-section-content {
  grid-area: content;
}

.home-section.home-section-text-left > .home-section-preview {
  grid-area: preview;
}

.home-section.home-section-text-right {
  grid-template-areas: "preview content";
}

.home-section.home-section-text-right > .home-section-preview {
  grid-area: preview;
}

.home-section.home-section-text-right > .home-section-content {
  grid-area: content;
}

.home-section-content {
  max-width: 480px;
}

.home-section-eyebrow {
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.home-section-title {
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  line-height: 1.2;
}

.home-section-desc {
  font-size: var(--text-body-lg);
  color: var(--text-secondary);
  line-height: 1.7;
}

.home-section-features {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
}

.home-section-feature {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-body);
  color: var(--text-secondary);
}

.home-section-feature::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

.home-section-preview {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Preview placeholder styles */
.preview-mini-panel {
  width: 100%;
  padding: 24px;
}

.preview-mini-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.preview-mini-title {
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--text-primary);
}

.preview-mini-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-mini-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.preview-mini-bar-label {
  width: 80px;
  font-size: var(--text-caption);
  color: var(--text-tertiary);
}

.preview-mini-bar-track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.preview-mini-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

.preview-mini-bar-value {
  width: 60px;
  font-size: var(--text-small);
  font-family: var(--font-mono);
  color: var(--text-secondary);
  text-align: right;
}

/* Home Footer (lightweight) */
.home-footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px 64px;
}

.home-footer-inner {
  text-align: center;
}

.home-footer-line {
  height: 1px;
  background: var(--border);
  margin-bottom: 20px;
}

.home-footer-copy {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
}

/* ===== Console Preview (Section 1 right card) ===== */
.console-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.console-protocols {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.console-protocol-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  font-size: var(--text-caption);
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

/* ===== Stats row (Section 1 — top of preview) ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.stat-block-k {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
}

.stat-block-mono {
  font-family: var(--font-mono);
}

.stat-dot {
  position: relative; /* containing block for the .is-live::before halo */
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  flex-shrink: 0;
}

/* ===== Traffic summary (Section 1 — middle) ===== */
.traffic-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.traffic-summary-title {
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.traffic-row {
  display: grid;
  grid-template-columns: 44px 1fr 64px;
  align-items: center;
  gap: 10px;
}

.traffic-row-label {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
}

.traffic-bar-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.traffic-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

.traffic-row-value {
  font-size: var(--text-small);
  font-family: var(--font-mono);
  color: var(--text-secondary);
  text-align: right;
}

/* ===== Meta summary (Section 1 & 2 — bottom stat rows) ===== */
.meta-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-size: var(--text-small);
}

.meta-summary-k {
  color: var(--text-tertiary);
}

.meta-summary-v {
  color: var(--text-primary);
  font-family: var(--font-mono);
}

/* ===== User rows (Section 2 — alice/bob/claire) ===== */
.user-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hairline);
}

.user-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.user-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-row-name {
  font-size: var(--text-body);
  font-weight: 500;
  color: var(--text-primary);
}

.user-row-badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.user-row-bar-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.user-row-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

.user-row-meta {
  display: flex;
  justify-content: flex-end;
}

.user-row-bytes {
  font-size: var(--text-small);
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

@media (max-width: 1024px) {
  .home-section {
    gap: 48px;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .home-section {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .home-section.home-section-text-left,
  .home-section.home-section-text-right {
    grid-template-areas:
      "content"
      "preview";
  }

  .home-footer {
    padding: 0 20px 48px;
  }
}

/* Home CTA */
.home-cta {
  text-align: center;
  padding: 64px 0;
  border-top: 1px solid var(--border);
}

.home-cta-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 24px;
}

/* =====================================================
   PAGE-AUTH: 登录页
   ===================================================== */

body.page-auth {
  background: var(--bg-page);
  min-height: 100vh;
}

/* ---- Auth Scene: shared container for unified visual group ---- */
.auth-scene {
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-height: calc(100vh - 64px);
  background: var(--bg-page);
  padding: 48px 40px;
}

/* ---- Auth Body: the two-column unified group ---- */
.auth-body {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 0;
  max-width: 1240px;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow:
    0 0 0 1px var(--border),
    0 0 80px -20px rgba(0, 0, 0, 0.06),
    0 24px 64px -12px rgba(0, 0, 0, 0.05);
}

/* ---- Auth Header ---- */
.auth-header {
  height: 64px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.auth-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  padding: 0 40px;
}

.auth-header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
}

.auth-header-logo svg {
  width: 24px;
  height: 24px;
}

.auth-header-back {
  font-size: var(--text-ui);
  color: var(--text-tertiary);
  transition: color var(--transition);
}

.auth-header-back:hover {
  color: var(--text-primary);
}

/* ---- Auth Brand Panel (left) ---- */
.auth-brand {
  display: flex;
  align-items: center;
  padding: 48px 52px 48px 48px;
  border-right: 1px solid var(--border);
}

.auth-brand-content {
  max-width: 520px;
  width: 100%;
}

.auth-brand-subtitle {
  font-size: var(--text-body-lg);
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 20px 0 28px;
}

.auth-brand-eyebrow {
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.auth-brand-title {
  font-size: clamp(32px, 3vw, 44px);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.auth-brand-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-brand-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-ui);
  color: var(--text-secondary);
}

.auth-brand-feature svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
}

.auth-brand-info {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-brand-info-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.auth-brand-info-label {
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.auth-brand-info-value {
  font-size: var(--text-small);
  color: var(--text-secondary);
}

/* ---- Auth Form Panel (right) ---- */
.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 52px 48px 48px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
}

.auth-card-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.auth-card-logo {
  width: 40px;
  height: 40px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-xs);
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.auth-card-brand-text strong {
  display: block;
  font-size: var(--text-body-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.auth-card-brand-text small {
  display: block;
  font-size: var(--text-small);
  color: var(--text-tertiary);
  margin-top: 2px;
}

.auth-card-title {
  font-size: 26px;
  font-weight: 650;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.auth-card-subtitle {
  font-size: var(--text-ui);
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.auth-card-subtitle code {
  font-family: var(--font-mono);
  font-size: var(--text-small);
  padding: 2px 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
}

/* ---- Auth Form ---- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form .btn-primary {
  margin-top: 8px;
  height: 48px;
  border-radius: var(--radius-sm);
  font-size: var(--text-body);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.auth-card-hint {
  margin-top: 12px;
  font-size: var(--text-small);
  color: var(--text-tertiary);
  text-align: center;
  line-height: 1.5;
}

.auth-note {
  margin-top: 16px;
  font-size: var(--text-small);
  color: var(--text-tertiary);
  text-align: center;
}

.auth-back {
  display: block;
  margin-top: 24px;
  font-size: var(--text-ui);
  color: var(--text-tertiary);
  text-align: center;
  transition: color var(--transition);
}

.auth-back:hover {
  color: var(--text-primary);
}

/* Auth Flash */
.auth-card .flash,
.auth-card .err {
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  font-size: var(--text-ui);
  margin-bottom: 0;
}

.auth-card .err {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid rgba(182, 65, 56, 0.15);
}

/* ---- Segmented Tab Control ---- */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.auth-tab-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.auth-tab-label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  font-size: var(--text-ui);
  font-weight: 500;
  color: var(--text-tertiary);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.auth-tab-label:hover {
  color: var(--text-secondary);
}

.auth-tab-input:checked + .auth-tab-label {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

/* ---- Single-card login scene (unified /login) ---- */
/* Standalone centered auth page (logout confirmation etc.) */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: var(--bg-page);
}
.auth-wrap { width: min(430px, 100%); }
.auth-page .auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md), var(--shadow-xs);
  padding: 32px 32px 28px;
}
.auth-page .auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 0 20px;
  margin-bottom: 20px;
  border-right: none;
  border-bottom: 1px solid var(--border);
}
.auth-page .auth-logo {
  width: 40px;
  height: 40px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-xs);
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}
.auth-page .auth-brand-text strong {
  display: block;
  font-size: var(--text-body-lg);
  font-weight: 600;
  color: var(--text-primary);
}
.auth-page .auth-brand-text small {
  display: block;
  font-size: var(--text-small);
  color: var(--text-tertiary);
  margin-top: 2px;
}
.auth-page .auth-title {
  font-size: 22px;
  font-weight: 650;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.auth-page .auth-subtitle {
  font-size: var(--text-ui);
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.auth-scene.auth-scene-single {
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.auth-scene-single .auth-card {
  width: 100%;
  max-width: 430px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md), var(--shadow-xs);
  padding: 32px 32px 28px;
}

.auth-scene-single .auth-card-brand {
  margin-bottom: 20px;
  padding-bottom: 20px;
}

.auth-scene-single .auth-card-title {
  font-size: 22px;
  margin-bottom: 6px;
}

.auth-scene-single .auth-card-subtitle {
  margin-bottom: 20px;
}

.auth-scene-single .auth-back {
  margin-top: 20px;
}

/* Inline auth error region: always rendered so showing the server message
   never shifts the card layout. */
.auth-error {
  min-height: 22px;
  margin-bottom: 4px;
  font-size: var(--text-ui);
  line-height: 1.6;
  color: var(--danger);
}
.auth-error:empty {
  visibility: hidden;
}
.auth-error-flash {
  color: var(--ok);
}

/* Pill submit with loading state */
.auth-submit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.auth-submit .auth-submit-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}
.auth-submit.is-loading .auth-submit-spinner {
  display: inline-block;
}
.auth-submit:disabled {
  opacity: 0.75;
  cursor: wait;
}
@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* Browser autofill: keep console colors instead of the UA yellow/blue tint. */
.auth-form .input:-webkit-autofill,
.auth-form .input:-webkit-autofill:hover,
.auth-form .input:-webkit-autofill:focus,
.auth-form .input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text-primary);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-surface) inset;
  caret-color: var(--text-primary);
  border-color: var(--border);
  border-radius: var(--radius-sm);
  transition: background-color 600000s 0s;
}
.auth-form .input:-webkit-autofill:focus {
  border-color: var(--data);
  -webkit-box-shadow:
    0 0 0 1000px var(--bg-surface) inset,
    0 0 0 3px var(--data-soft);
}

/* Segmented control keyboard focus: the input is visually hidden, so draw
   the focus ring on its label. */
.auth-tab-input:focus-visible + .auth-tab-label {
  outline: 2px solid var(--data);
  outline-offset: 2px;
}
.auth-tab-input:focus:not(:focus-visible) + .auth-tab-label {
  outline: none;
}

@media (max-width: 640px) {
  .auth-scene.auth-scene-single {
    padding: 24px 16px;
    align-items: flex-start;
  }
  .auth-scene-single .auth-card {
    padding: 24px 20px 20px;
    max-width: 100%;
  }
}

/* ---- Responsive ---- */
@media (max-width: 1280px) {
  .auth-scene {
    padding: 40px 32px;
  }
  .auth-brand {
    padding: 40px 36px;
  }
  .auth-form-panel {
    padding: 40px 36px;
  }
}

@media (max-width: 1024px) {
  .auth-scene {
    padding: 32px 24px;
  }
  .auth-body {
    grid-template-columns: 1fr 0.9fr;
    border-radius: var(--radius-md);
  }
  .auth-brand {
    padding: 36px 32px;
  }
  .auth-form-panel {
    padding: 36px 32px;
  }
}

@media (max-width: 768px) {
  .auth-scene {
    padding: 24px 20px;
    align-items: flex-start;
  }
  .auth-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    border-radius: var(--radius-md);
  }
  .auth-brand {
    padding: 32px 28px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .auth-form-panel {
    padding: 32px 28px;
  }
  .auth-header-inner {
    padding: 0 20px;
  }
}

/* =====================================================
   HAS-SHELL: 后台内页
   ===================================================== */

body.has-shell {
  background: var(--bg-page);
}

/* App Layout */
.app {
  display: grid;
  grid-template-columns: 212px minmax(0, 1fr);
  min-height: 100vh;
}

.app.anim-ready {
  transition: grid-template-columns 220ms cubic-bezier(.16, 1, .3, 1);
}

.app.sidebar-collapsed {
  grid-template-columns: 64px minmax(0, 1fr);
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-page);
  border-right: 1px solid var(--hairline);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 72px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-xs);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
}

.sidebar-brand-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar-brand-text small {
  display: block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-section {
  padding: 16px 16px 6px;
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 16px;
  font-size: var(--text-ui);
  color: var(--text-secondary);
  border-left: 2px solid transparent;
  transition: all var(--transition);
}

.sidebar-link svg {
  width: 16px;
  height: 16px;
  opacity: 0.5;
}

.sidebar-link:hover {
  color: var(--text-primary);
  background: rgba(0,0,0,0.02);
}

.sidebar-link.active {
  color: var(--text-primary);
  font-weight: 600;
  background: var(--data-soft);
  border-left-color: var(--data);
  box-shadow: inset 2px 0 0 var(--data);
}

.sidebar-link.active svg { opacity: 0.8; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  font-size: var(--text-ui);
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
}

.sidebar-logout:hover {
  color: var(--text-primary);
  background: rgba(0,0,0,0.03);
}

.sidebar-logout svg { width: 16px; height: 16px; }

.sidebar-collapse {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 8px 16px 12px;
  padding: 0;
  color: var(--text-tertiary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.sidebar-collapse:hover,
.sidebar-collapse:focus-visible {
  color: var(--text-primary);
  background: var(--data-soft);
}

.sidebar-collapse svg {
  width: 16px;
  height: 16px;
}

.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-section,
.sidebar.collapsed .sidebar-link span,
.sidebar.collapsed .sidebar-logout span,
.sidebar.collapsed .sidebar-close {
  display: none;
}

.sidebar.collapsed .sidebar-brand {
  justify-content: center;
  padding: 0;
}

.sidebar.collapsed .sidebar-link,
.sidebar.collapsed .sidebar-logout {
  justify-content: center;
  padding: 0;
  gap: 0;
}

.sidebar.collapsed .sidebar-collapse {
  margin: 8px auto 12px;
}

.sidebar.collapsed .sidebar-footer {
  padding: 12px 8px;
}

html.sidebar-pre-collapsed .app {
  grid-template-columns: 64px minmax(0, 1fr);
}
html.sidebar-pre-collapsed .sidebar {
  width: 64px;
}
html.sidebar-pre-collapsed .sidebar-brand-text,
html.sidebar-pre-collapsed .sidebar-section,
html.sidebar-pre-collapsed .sidebar-link span,
html.sidebar-pre-collapsed .sidebar-logout span,
html.sidebar-pre-collapsed .sidebar-close {
  display: none;
}
html.sidebar-pre-collapsed .sidebar-brand {
  justify-content: center;
  padding: 0;
}
html.sidebar-pre-collapsed .sidebar-link,
html.sidebar-pre-collapsed .sidebar-logout {
  justify-content: center;
  padding: 0;
  gap: 0;
}

@media (max-width: 880px) {
  .app.anim-ready { transition: none; }
  .sidebar-collapse { display: none; }
  .app.sidebar-collapsed,
  html.sidebar-pre-collapsed .app {
    grid-template-columns: 1fr;
  }
  html.sidebar-pre-collapsed .sidebar {
    width: min(260px, 85vw);
  }
  html.sidebar-pre-collapsed .sidebar-brand-text,
  html.sidebar-pre-collapsed .sidebar-section,
  html.sidebar-pre-collapsed .sidebar-link span,
  html.sidebar-pre-collapsed .sidebar-logout span {
    display: revert;
  }
  html.sidebar-pre-collapsed .sidebar-link,
  html.sidebar-pre-collapsed .sidebar-logout {
    justify-content: flex-start;
    padding: 0 16px;
    gap: 10px;
  }
}

/* Main Area */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  height: 64px;
  display: flex;
  align-items: center;
  background: rgba(248,247,243,.88);
  border-bottom: 1px solid var(--hairline);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 36px;
  gap: 24px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-title {
  font-size: var(--text-card-title);
  font-weight: 600;
  color: var(--text-primary);
}

.page-title small {
  display: inline;
  margin-left: 10px;
  font-size: var(--text-small);
  font-weight: 400;
  color: var(--text-tertiary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-toggle {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.sidebar-toggle svg { width: 18px; height: 18px; }

.scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9;
  background: rgba(0,0,0,0.3);
}

.content {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 36px 80px;
}

/* Shell Elements */
body.has-shell .btn {
  height: 34px;
  padding: 0 14px;
  font-size: var(--text-ui);
}

body.has-shell .btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: var(--text-small);
}

body.has-shell .btn-primary {
  height: 40px;
  padding: 0 18px;
  background: #111111;
  color: #fff;
  border: 1px solid #111111;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

body.has-shell .btn-primary:hover:not(:disabled) {
  background: #333333;
  border-color: #333333;
}

body.has-shell .btn-secondary {
  height: 40px;
  padding: 0 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

body.has-shell .btn-secondary:hover:not(:disabled) {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

body.has-shell .btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
}

body.has-shell .btn-ghost:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

/* =====================================================
   DASHBOARD OVERVIEW
   ===================================================== */

.overview-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: transparent;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  overflow: hidden;
  margin-bottom: 32px;
  box-shadow: none;
  position: relative;
}

.overview-stat {
  padding: 24px 28px;
}

.overview-stat + .overview-stat {
  border-left: 1px solid var(--hairline);
}

.overview-stat .label {
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.overview-stat .value {
  font-family: var(--font-num);
  font-size: clamp(32px, 3vw, 42px);
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 1;
}

.overview-stat .sub {
  font-size: var(--text-small);
  color: var(--text-tertiary);
}

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 16px;
}

.quick-actions .btn {
  justify-content: flex-start;
  height: 32px;
  padding: 0 10px;
  font-size: var(--text-small);
  font-weight: 400;
  color: var(--text-secondary);
  background: transparent;
  border-color: transparent;
}

.quick-actions .btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

/* =====================================================
   USER LIST
   ===================================================== */

.users-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: inset 0 1px 0 #fff, var(--shadow-xs);
}

.users-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.users-title {
  font-size: var(--text-body-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.users-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.user-filter-input {
  width: 200px;
  height: 36px;
  padding: 0 12px;
  font-family: var(--font-sans);
  font-size: var(--text-ui);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  outline: none;
}

.user-filter-input:focus {
  border-color: var(--accent);
}

.filter-chips {
  display: flex;
  gap: 4px;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  font-size: var(--text-small);
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--transition);
}

.chip:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.chip.active {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--text-primary);
  font-weight: 500;
}

.filter-count {
  font-size: var(--text-small);
  color: var(--text-tertiary);
}

/* Table */
@media (max-width: 720px) {
  .users-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .users-table tbody, .users-table tr { display: block; }
  .users-table tbody tr {
    width: calc(100% - 24px);
    margin: 0 12px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
  }
  .users-table tr.hidden { display: none; }
  .users-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }
  .users-table td::before {
    content: attr(data-label);
    display: block;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-size: 12px;
  }
  .users-table td[data-label="用户"] .bold,
  .users-table td[data-label="用户"] .small,
  .user-title,
  .user-title ~ .small.faint {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

@media (max-width: 560px) {
  .user-panel-nav {
    min-width: 0;
    flex-wrap: wrap;
  }
  .user-panel-nav > .row > div,
  .user-panel-nav > div:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .user-panel-nav .badge {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

.users-table-wrap {
  overflow-x: auto;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-ui);
  line-height: 1.45;
}

.users-table th,
.users-table td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: middle;
}

.users-table thead th {
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}

.users-table tbody tr {
  transition: background var(--transition);
}

.users-table tbody tr + tr td {
  border-top: 1px solid var(--hairline);
}

.users-table tbody tr:hover {
  background: var(--bg-subtle);
}

/* =====================================================
   ADMIN DIALOG — user edit
   ===================================================== */
.admin-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0;
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
  max-width: 560px;
  width: calc(100% - 32px);
  /* Native <dialog> resets */
  margin: auto;
  overflow: visible;
}

.admin-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
}

.admin-dialog .dialog-inner {
  padding: 24px;
}

.admin-dialog .dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.admin-dialog .dialog-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.admin-dialog .dialog-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.admin-dialog .dialog-close:hover {
  color: var(--text-primary);
  background: var(--bg-subtle);
}

.admin-dialog .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  margin-bottom: 16px;
}

.admin-dialog .form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.admin-dialog .form-field label {
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.4;
}

.admin-dialog .form-field input {
  padding: 8px 10px;
  font-size: var(--text-ui);
}

.admin-dialog .form-options {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.admin-dialog .dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 4px;
}

.admin-dialog .dialog-foot .btn {
  min-width: 90px;
}

/* =====================================================
   BADGES & STATUS
   ===================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  font-size: var(--text-caption);
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.badge.ok, .badge-info {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: rgba(26, 127, 78, 0.15);
}

.badge.warn {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: rgba(146, 102, 10, 0.15);
}

.badge.danger, .badge-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(182, 65, 56, 0.15);
}

/* Status dot */
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-small);
  color: var(--text-secondary);
}

.status-dot::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-dot.online { color: var(--ok); }
.status-dot.offline { color: var(--text-tertiary); }
.status-dot.over { color: var(--danger); }

.status-dot.online::before {
  box-shadow: 0 0 0 3px var(--data-soft);
  animation: status-pulse 2.4s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* =====================================================
   PROGRESS
   ===================================================== */

.progress {
  height: 3px;
  background: var(--bg-subtle);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--data);
  border-radius: 2px;
  transition: width 400ms ease;
}

.progress-fill.danger { background: var(--danger); }
.progress-fill.warn { background: var(--warn); }

body.has-shell .user-row-bar-track {
  background: var(--bg-subtle);
}

body.has-shell .user-row-bar-fill {
  height: 100%;
  background: var(--data);
  border-radius: 2px;
}

/* =====================================================
   ALERTS
   ===================================================== */

.flash {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: var(--text-ui);
  color: var(--ok);
  background: var(--ok-soft);
  border: 1px solid rgba(26, 127, 78, 0.15);
  border-radius: var(--radius-xs);
  margin-bottom: 16px;
}

.err {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: var(--text-ui);
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid rgba(182, 65, 56, 0.15);
  border-radius: var(--radius-xs);
  margin-bottom: 16px;
}

/* Inline form (admin shell) */
body.has-shell .user-identity { flex-wrap: nowrap; }
body.has-shell .user-identity-copy { min-width: 0; }
body.has-shell .usage-label { justify-content: space-between; margin-bottom: 4px; }
body.has-shell .users-table .row-error { color: var(--danger); margin-top: 4px; }
body.has-shell .form-field.form-field-wide { grid-column: 1 / -1; }
body.has-shell .reset-all-button { margin-top: 10px; }

.inline-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inline-form input,
.inline-form select {
  height: 36px;
  padding: 0 10px;
  font-family: var(--font-sans);
  font-size: var(--text-ui);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  outline: none;
}

.inline-form input:focus,
.inline-form select:focus {
  border-color: var(--accent);
}

/* Inline form row */
.inline-form-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-form-row input {
  height: 32px;
  padding: 0 10px;
  font-size: var(--text-small);
}

/* Cycle config form */
.cycle-config-form {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cycle-config-form label {
  font-size: var(--text-small);
  color: var(--text-tertiary);
}

.cycle-config-form input {
  width: 60px;
  height: 32px;
  text-align: center;
}

/* User Avatar */
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* Danger Button Variant */
.danger-btn {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(182, 65, 56, 0.15);
}

.danger-btn:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

/* Mini Progress Bar */
.mini-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.mini-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 400ms ease;
}

.mini-fill.danger { background: var(--danger); }
.mini-fill.warn { background: var(--warn); }

/* Edit User Control */
.edit-user-control {
  margin-bottom: 8px;
}

/* User Actions */
.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.row-error {
  font-size: var(--text-small);
}

/* Link Cell */
.link-cell {
  vertical-align: middle;
}

.link-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.link-row:last-child {
  margin-bottom: 0;
}

.link-row a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-small);
  color: var(--text-secondary);
  transition: color var(--transition);
}

.link-row a:hover {
  color: var(--text-primary);
}

.link-row a svg {
  width: 14px;
  height: 14px;
}

/* Switch / Checkbox */
.switch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-ui);
  color: var(--text-secondary);
  cursor: pointer;
}

.switch input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* Hint Text */
.hint {
  display: block;
  margin-top: 4px;
  font-size: var(--text-caption);
  color: var(--text-tertiary);
}

/* Spark Chart Cell */
.spark-cell {
  width: 120px;
}

/* Create Section */
.create-section {
  margin-top: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
}

.create-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  font-size: var(--text-ui);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  list-style: none;
  transition: color var(--transition);
}

.create-toggle::-webkit-details-marker {
  display: none;
}

.create-toggle::before {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--text-tertiary);
  border-bottom: 1.5px solid var(--text-tertiary);
  transform: rotate(-45deg);
  transition: transform var(--transition);
}

.create-section[open] .create-toggle::before {
  transform: rotate(45deg);
}

.create-section[open] .create-toggle {
  color: var(--text-primary);
}

.create-form {
  padding: 20px;
  border-top: 1px solid var(--border);
}

.create-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--text-secondary);
}

.form-field input,
.form-field select {
  height: 36px;
  padding: 0 10px;
  font-family: var(--font-sans);
  font-size: var(--text-ui);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  outline: none;
}

.form-field input:focus,
.form-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-field .hint a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Landing egress management */
body.has-shell .landing-node-list {
  padding-bottom: 0;
}

body.has-shell .landing-node-list .data-table-wrap {
  margin: 0 -24px;
}

body.has-shell .landing-node-list .data-table th:first-child,
body.has-shell .landing-node-list .data-table td:first-child {
  padding-left: 24px;
}

body.has-shell .landing-node-list .data-table th:last-child,
body.has-shell .landing-node-list .data-table td:last-child {
  padding-right: 24px;
}

body.has-shell .landing-node-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
}

body.has-shell .landing-access-list {
  border-top: 1px solid var(--hairline);
}

body.has-shell .landing-access-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.7fr) minmax(260px, 2fr) auto;
  align-items: center;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--hairline);
}

body.has-shell .landing-access-user {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

body.has-shell .landing-access-user strong {
  overflow-wrap: anywhere;
}

body.has-shell .landing-access-choices {
  display: flex;
  align-items: center;
  gap: 10px 18px;
  min-width: 0;
  border: 0;
  flex-wrap: wrap;
}

body.has-shell .landing-access-choice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: var(--text-ui);
  cursor: pointer;
}

body.has-shell .landing-access-choice input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

body.has-shell .landing-access-choice:has(input:disabled) {
  color: var(--text-disabled);
  cursor: not-allowed;
}

body.has-shell .landing-empty {
  padding: 20px;
  color: var(--text-tertiary);
  background: var(--bg-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}

@media (max-width: 768px) {
  body.has-shell .landing-node-list .data-table-wrap {
    margin-right: -16px;
    margin-left: -16px;
  }

  body.has-shell .landing-node-list .data-table th:first-child,
  body.has-shell .landing-node-list .data-table td:first-child {
    padding-left: 16px;
  }

  body.has-shell .landing-node-list .data-table th:last-child,
  body.has-shell .landing-node-list .data-table td:last-child {
    padding-right: 16px;
  }

  body.has-shell .landing-access-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  body.has-shell .landing-access-row .btn {
    width: 100%;
  }

  body.has-shell .landing-node-actions {
    align-items: stretch;
    flex-direction: column;
  }

  body.has-shell .landing-node-actions .btn {
    width: 100%;
  }
}

.form-options {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
/* =====================================================
   ADMIN COMMON COMPONENTS
   (For incident_console, usage_dashboard, etc.)
   ===================================================== */

/* Card - Generic content panel */
body.has-shell .card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

body.has-shell .card-flush {
  border-radius: 0;
  border-left: none;
  border-right: none;
}

/* Recovery screens still use the legacy card rather than section/body markup. */
body.has-shell .card:has(> .section-title),
body.has-shell .card:has(> .err) {
  padding: 24px;
}

/* Stat - Metric display */
body.has-shell .stat {
  padding: 20px 24px;
  text-align: center;
}

body.has-shell .stat .k {
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 10px;
  line-height: 1.4;
}

body.has-shell .stat .v {
  font-family: var(--font-num);
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 1;
}

body.has-shell .stat .v.big {
  font-size: 40px;
}

body.has-shell .v.is-text {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.3;
  color: var(--text-primary);
}

body.has-shell .stat .small {
  font-size: var(--text-small);
  color: var(--text-tertiary);
}

body.has-shell .stat .accent-bar {
  width: 40px;
  height: 2px;
  background: var(--accent);
  margin: 12px auto 0;
}

/* Grid layouts */
body.has-shell .grid {
  display: grid;
  gap: 16px;
}

body.has-shell .grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

body.has-shell .grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

body.has-shell .grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

body.has-shell .grid-2 > .card,
body.has-shell .grid-3 > .card,
body.has-shell .grid-4 > .card {
  margin: 0;
}

/* Table */
body.has-shell .table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-ui);
}

body.has-shell .table th,
body.has-shell .table td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: middle;
}

body.has-shell .table th {
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  background: #F5F4F0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

body.has-shell .table tbody tr {
  transition: background var(--transition);
}

body.has-shell .table tbody tr + tr td {
  border-top: 1px solid var(--border);
}

body.has-shell .table tbody tr:hover {
  background: var(--bg-subtle);
}

body.has-shell .table .empty {
  text-align: center;
  color: var(--text-tertiary);
  padding: 32px 16px;
}

/* Section Title */
.section-title {
  margin: 0;
  color: var(--text-strong);
  font-family: inherit;
  font-size: inherit;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  letter-spacing: normal;
  line-height: inherit;
}
.chart-card > .section-title { font-size: 13px; }

body.has-shell .section-title {
  font-size: var(--text-body-lg);
  font-weight: 600;
  color: var(--text-primary);
}

/* Code / Monospace */
body.has-shell code {
  font-family: var(--font-mono);
  font-size: var(--text-small);
  padding: 2px 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
}

/* Row utility */
body.has-shell .row {
  display: flex;
  align-items: center;
  gap: 8px;
}

body.has-shell .row.gap-sm {
  gap: 6px;
}

body.has-shell .row.gap-md {
  gap: 12px;
}

/* Inline form row */
body.has-shell .inline-form-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Bold / Faint */
body.has-shell .bold {
  font-weight: 600;
}

/* Mono — technical identifiers */
body.has-shell .mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* Scrollable container */
body.has-shell .scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* mt-md / mt-sm */
body.has-shell .mt-md {
  margin-top: 16px;
}

body.has-shell .mt-sm {
  margin-top: 8px;
}

/* Text utilities */
body.has-shell .small {
  font-size: var(--text-small);
  color: var(--text-secondary);
}

body.has-shell .faint {
  color: var(--text-tertiary);
}

/* Charts container */
body.has-shell .chart-card {
  min-height: 200px;
}

/* Section head card */
body.has-shell .section-head-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Daily table card */
body.has-shell .daily-table-card {
  min-height: 300px;
}

/* History card */
body.has-shell .history-card {
  min-height: 120px;
}

/* Health page */
body.has-shell .health-stat {
  text-align: center;
}

body.has-shell .health-stat .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: var(--radius-pill);
}

body.has-shell .health-stat .badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

body.has-shell .health-healthy .badge {
  color: var(--ok);
  background: var(--ok-soft);
}

body.has-shell .health-degraded .badge {
  color: var(--warn);
  background: var(--warn-soft);
}

body.has-shell .health-down .badge,
body.has-shell .health-error .badge {
  color: var(--danger);
  background: var(--danger-soft);
}
/* =====================================================
   HEALTH PAGE — Top 4 KPIs
   ===================================================== */
body.has-shell .hysteria-update-history .admin-section-body {
  display: grid;
  gap: 8px;
  overflow-wrap: anywhere;
}

body.has-shell .hysteria-update-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

body.has-shell .hysteria-update-actions form {
  margin: 0;
}

body.has-shell .health-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

body.has-shell .health-top-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

body.has-shell .health-kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  text-align: center;
  box-shadow: inset 0 1px 0 #fff, var(--shadow-xs);
}

body.has-shell .health-kpi-label {
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

body.has-shell .health-kpi-value {
  font-family: var(--font-num);
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 1;
}

body.has-shell .health-kpi-value.is-text {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
}

body.has-shell .health-kpi-value .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: var(--radius-pill);
}

body.has-shell .health-kpi-value .badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

body.has-shell .health-kpi-value .badge:not(.badge-danger) {
  color: var(--ok);
  background: var(--ok-soft);
}

body.has-shell .health-kpi-value .badge.badge-danger {
  color: var(--danger);
  background: var(--danger-soft);
}

body.has-shell .health-kpi-sub {
  font-size: var(--text-small);
  color: var(--text-tertiary);
}

/* =====================================================
   HEALTH PAGE — Section helpers
   ===================================================== */
body.has-shell .health-page .admin-section-body.no-pad {
  padding: 0;
}

body.has-shell .health-radar-section .admin-section-body.no-pad,
body.has-shell .health-calibrator-section .admin-section-body.no-pad {
  padding: 0;
}

/* =====================================================
   HEALTH PAGE — Cost calibrator form area
   ===================================================== */
body.has-shell .calibrator-form {
  padding: 0 20px 20px;
  border-top: 1px solid var(--border);
}

body.has-shell .grid.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

body.has-shell .grid.grid-3 .switch {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-ui);
  color: var(--text-primary);
  cursor: pointer;
  align-self: center;
}

body.has-shell .grid.grid-3 label:not(.switch) {
  display: block;
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* =====================================================
   COST CALIBRATOR — redesigned layout
   ===================================================== */

/* Section 1: Decision bar */
body.has-shell .calibrator-decision-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--hairline);
}

body.has-shell .calibrator-multiple {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

body.has-shell .calibrator-multiple-label {
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

body.has-shell .calibrator-multiple-value {
  font-family: var(--font-num);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

body.has-shell .calibrator-arrow {
  font-size: 20px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

body.has-shell .calibrator-delta {
  font-family: var(--font-num);
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

body.has-shell .calibrator-delta.delta-down { color: var(--text-secondary); }
body.has-shell .calibrator-delta.delta-up { color: var(--warn); }
body.has-shell .calibrator-delta:not(.delta-down):not(.delta-up) { color: var(--text-tertiary); }

body.has-shell .calibrator-confidence {
  margin-left: auto;
}

/* Window table: active row highlight */
body.has-shell .calibrator-active-row {
  background: var(--data-soft);
  border-left: 2px solid var(--data);
}

body.has-shell .calibrator-active-row td:first-child {
  border-left: 2px solid var(--data);
}

body.has-shell .calibrator-active-row td {
  border-left: 1px solid transparent;
}

/* Section 3: Sampling details (collapsible) */
body.has-shell .calibrator-details {
  border-top: 1px solid var(--hairline);
  padding: 0 24px 16px;
}

body.has-shell .calibrator-details summary {
  padding: 12px 0;
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  cursor: pointer;
  user-select: none;
}

body.has-shell .calibrator-details[open] summary {
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 12px;
}

body.has-shell .calibrator-dl {
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body.has-shell .calibrator-dl-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  font-size: var(--text-small);
}

body.has-shell .calibrator-dl-k {
  color: var(--text-tertiary);
}

body.has-shell .calibrator-dl-v {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* Section 4: Auto policy */
body.has-shell .calibrator-auto {
  border-top: 1px solid var(--border);
  padding: 16px 24px 20px;
}

body.has-shell .calibrator-auto-header {
  margin-bottom: 14px;
}

body.has-shell .calibrator-auto-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-ui);
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}

body.has-shell .calibrator-auto-fields {
  border: none;
  padding: 0;
  margin: 0;
  transition: opacity var(--transition);
}

body.has-shell .calibrator-auto-fields:disabled {
  opacity: 0.55;
  pointer-events: none;
}

body.has-shell .calibrator-last-check {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border-radius: var(--radius-xs);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

body.has-shell .badge-ok { background: var(--bg-subtle); color: var(--text-secondary); }
body.has-shell .badge-warn { background: var(--bg-subtle); color: var(--warn); }

/* =====================================================
   INCIDENTS PAGE
   ===================================================== */
body.has-shell .incidents-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

body.has-shell .incident-page-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

/* Recommendation action panel */
body.has-shell .incident-rec {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

body.has-shell .incident-rec-entry {
  display: flex;
  align-items: center;
  gap: 12px;
}

body.has-shell .incident-rec-badge {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-ui);
  font-weight: 600;
  color: var(--text-primary);
}

body.has-shell .incident-rec-reason {
  font-size: var(--text-body);
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Dual equal-height panels */
body.has-shell .incident-dual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

body.has-shell .incident-diagnostic-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* Radar summary (compact for incidents page) */
body.has-shell .radar-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body.has-shell .radar-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-ui);
  color: var(--text-primary);
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

body.has-shell .radar-summary-row:last-child {
  border-bottom: none;
}

/* Incident table action buttons */
body.has-shell .incident-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* Config Editor */
body.has-shell .code-editor {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

body.has-shell .code-editor textarea {
  width: 100%;
  min-height: 400px;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: var(--text-small);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: none;
  resize: vertical;
  outline: none;
}

body.has-shell .code-editor textarea:focus,
body.has-shell .code-editor textarea:focus-visible {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent-soft);
}

/* Rules page */
.rule-index-column { width: 50px; }
.rule-actions-column { width: 90px; }

body.has-shell .rules-table {
  width: 100%;
  border-collapse: collapse;
}

body.has-shell .rules-table th,
body.has-shell .rules-table td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

body.has-shell .rules-table th {
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  background: #F5F4F0;
}

body.has-shell .rules-table tbody tr:hover {
  background: var(--bg-subtle);
}

/* =====================================================
   /admin/rules: 信息架构重构
   ===================================================== */

/* ---- Rules intro note ---- */
body.has-shell .rules-intro {
  margin-bottom: 24px;
}

body.has-shell .rules-intro-note {
  font-size: var(--text-ui);
  color: var(--text-tertiary);
  line-height: 1.6;
}

/* ---- Rules operations grid: 双栏操作区 ---- */
body.has-shell .rules-ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 20px;
  margin-bottom: 20px;
}

/* ---- Individual operation panel ---- */
body.has-shell .op-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

body.has-shell .op-panel-title {
  font-size: var(--text-body-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

body.has-shell .op-panel-desc {
  font-size: var(--text-ui);
  color: var(--text-tertiary);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ---- Op form grid: 2-column field layout ---- */
body.has-shell .op-form {
  display: flex;
  flex-direction: column;
}

body.has-shell .op-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

body.has-shell .op-form-grid .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0;
}

body.has-shell .op-form-grid .field label {
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

body.has-shell .op-form-grid .field .select,
body.has-shell .op-form-grid .field .input {
  height: 44px;
  font-size: var(--text-ui);
  border-radius: var(--radius-sm);
}

/* ---- Op form footer: helper left + button right ---- */
body.has-shell .op-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}

body.has-shell .op-footer-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1;
  white-space: nowrap;
}

/* ---- Raw editor (Layer 2): default collapsed ---- */
body.has-shell .rules-raw-editor {
  margin-bottom: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

body.has-shell .rules-raw-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  font-size: var(--text-body);
  font-weight: 500;
  color: var(--text-secondary);
  user-select: none;
  list-style: none;
  transition: background var(--transition), color var(--transition);
}

body.has-shell .rules-raw-summary::-webkit-details-marker {
  display: none;
}

body.has-shell .rules-raw-summary::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid var(--text-tertiary);
  margin-right: 10px;
  transition: transform var(--transition);
  flex-shrink: 0;
}

body.has-shell .details[open] > .rules-raw-summary::before,
body.has-shell details[open] > .rules-raw-summary::before {
  transform: rotate(90deg);
}

body.has-shell .rules-raw-summary:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

body.has-shell .rules-raw-badge {
  font-size: var(--text-caption);
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  letter-spacing: 0.04em;
}

body.has-shell .rules-raw-body {
  padding: 0 20px 20px;
  border-top: 1px solid var(--border);
}

body.has-shell .rules-raw-help {
  font-size: var(--text-small);
  color: var(--text-tertiary);
  margin: 16px 0;
  line-height: 1.5;
}

body.has-shell .rules-raw-help code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1px 5px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
}

body.has-shell .rules-raw-textarea {
  width: 100%;
  min-height: 360px;
  max-height: 520px;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

body.has-shell .rules-raw-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---- Responsive ---- */
@media (max-width: 1100px) {
  body.has-shell .rules-ops-grid {
    grid-template-columns: 1fr;
  }

  body.has-shell .op-form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  body.has-shell .op-form-grid {
    grid-template-columns: 1fr;
  }

  body.has-shell .rules-raw-textarea {
    min-height: 280px;
  }
}

/* Logs page */
body.has-shell .logs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-ui);
}

body.has-shell .logs-table th,
body.has-shell .logs-table td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

body.has-shell .logs-table th {
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  background: #F5F4F0;
}

body.has-shell .logs-table tbody tr:hover {
  background: var(--bg-subtle);
}

/* Settings page */
body.has-shell .settings-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
}

body.has-shell .settings-section-title {
  font-size: var(--text-body-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

body.has-shell .settings-section-desc {
  font-size: var(--text-small);
  color: var(--text-tertiary);
  margin-bottom: 20px;
}

body.has-shell .settings-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 24px;
}

body.has-shell .settings-row:last-child {
  border-bottom: none;
}

body.has-shell .settings-row-label {
  flex: 1;
}

body.has-shell .settings-row-label strong {
  display: block;
  font-size: var(--text-ui);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

body.has-shell .settings-row-label span {
  font-size: var(--text-small);
  color: var(--text-tertiary);
}

body.has-shell .settings-row-control {
  flex-shrink: 0;
}

/* Page header for sub-pages */
body.has-shell .admin-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

body.has-shell .admin-page-eyebrow {
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

body.has-shell .admin-page-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

body.has-shell .admin-page-desc {
  font-size: var(--text-small);
  color: var(--text-secondary);
  margin-top: 4px;
}

body.has-shell .admin-page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Wrap / Card container for error pages */
body.has-shell .wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

/* Line / Radar chart */
body.has-shell .line-radar-wrap {
  margin-top: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: inset 0 1px 0 #fff, var(--shadow-xs);
}

body.has-shell .line-radar-title {
  font-size: var(--text-body-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

body.has-shell .line-radar-canvas {
  width: 100%;
  height: 180px;
}

/* Cost calibrator */
body.has-shell .cost-calibrator {
  margin-top: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: inset 0 1px 0 #fff, var(--shadow-xs);
}

body.has-shell .cost-calibrator-title {
  font-size: var(--text-body-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}
/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 1024px) {
  .overview-stats {
    grid-template-columns: 1fr;
  }

  .overview-stat + .overview-stat {
    border-left: none;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 768px) {
  .home-header-inner {
    padding: 0 20px;
  }

  .home-nav {
    display: none;
  }

  .home-nav-actions {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
  }

  .home-hero {
    padding: 100px 24px 60px;
    min-height: 600px;
  }

  .home-sections {
    padding: 48px 24px 80px;
  }

  .home-section {
    padding: 40px 0;
  }

  .home-section-preview {
    min-height: 240px;
  }

  /* Shell responsive */
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
    width: min(260px, 85vw);
    transform: translateX(-103%);
    transition: transform 220ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  body.sidebar-open .scrim {
    display: block;
  }

  .sidebar-toggle {
    display: flex;
  }

  .topbar-inner {
    padding: 0 16px;
  }

  .content {
    padding: 24px 16px 60px;
  }

  .users-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .users-toolbar {
    width: 100%;
  }

  .user-filter-input {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .home-title {
    font-size: 40px;
  }

  .home-headline {
    font-size: 20px;
  }

  .home-actions {
    flex-direction: column;
    width: 100%;
  }

  .home-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .topbar-right {
    flex-wrap: nowrap;
    overflow-x: auto;
  }
}

/* =====================================================
   ADMIN SUB-PAGE COMPONENTS
   ===================================================== */

/* Admin page wrapper */
body.has-shell .admin-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Admin section */
body.has-shell .admin-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: inset 0 1px 0 #fff, var(--shadow-xs);
}

body.has-shell .admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--hairline);
  background: var(--bg-subtle);
}

body.has-shell .admin-section-title {
  font-size: var(--text-body-lg);
  font-weight: 600;
  color: var(--text-primary);
}

body.has-shell .admin-section-body {
  padding: 20px;
}

/* Metric grid */
body.has-shell .metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

body.has-shell .metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  text-align: center;
  box-shadow: inset 0 1px 0 #fff, var(--shadow-xs);
}

body.has-shell .metric-k {
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

body.has-shell .metric-v {
  font-family: var(--font-num);
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 1;
}

body.has-shell .metric-v.big {
  font-size: 40px;
}

body.has-shell .metric-v.is-text {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0;
}

body.has-shell .metric-sub {
  font-size: var(--text-small);
  color: var(--text-tertiary);
}

/* Toolbar */
body.has-shell .toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
  }

body.has-shell .toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

body.has-shell .toolbar-label {
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--text-secondary);
}

/* Data table */
body.has-shell .data-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

body.has-shell .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-ui);
}

body.has-shell .data-table th,
body.has-shell .data-table td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: middle;
}

body.has-shell .data-table th:first-child,
body.has-shell .data-table td:first-child {
  padding-left: 20px;
}

body.has-shell .data-table th:last-child,
body.has-shell .data-table td:last-child {
  padding-right: 20px;
}

body.has-shell .data-table th {
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  background: #F5F4F0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

body.has-shell .data-table tbody tr {
  transition: background var(--transition);
}

body.has-shell .data-table tbody tr + tr td {
  border-top: 1px solid var(--border);
}

body.has-shell .data-table tbody tr:hover {
  background: var(--bg-subtle);
}

body.has-shell .data-table .empty {
  text-align: center;
  color: var(--text-tertiary);
  padding: 32px 16px;
}

/* Form section */
body.has-shell .form-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
}

body.has-shell .form-section-title {
  font-size: var(--text-body-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

body.has-shell .form-section-desc {
  font-size: var(--text-small);
  color: var(--text-tertiary);
  margin-bottom: 20px;
}

body.has-shell .form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

body.has-shell .form-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

body.has-shell .form-row:last-child {
  border-bottom: none;
}

body.has-shell .form-row-label {
  flex: 1;
}

body.has-shell .form-row-label strong {
  display: block;
  font-size: var(--text-ui);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

body.has-shell .form-row-label span {
  font-size: var(--text-small);
  color: var(--text-tertiary);
}

body.has-shell .form-row-control {
  flex-shrink: 0;
}

/* Code panel */
body.has-shell .code-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

body.has-shell .code-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: #F5F4F0;
  border-bottom: 1px solid var(--border);
}

body.has-shell .code-panel-title {
  font-size: var(--text-ui);
  font-weight: 600;
  color: var(--text-primary);
}

body.has-shell .code-panel-body {
  padding: 16px;
}

body.has-shell .code-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

body.has-shell .code-area {
  width: 100%;
  min-height: 400px;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: var(--text-small);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: none;
  resize: vertical;
  outline: none;
}

body.has-shell .code-area:focus {
  box-shadow: inset 0 0 0 2px var(--accent-soft);
}

body.has-shell .code-area.code-tall {
  min-height: 500px;
}

/* Status badge variants */
body.has-shell .badge-success {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: rgba(26, 127, 78, 0.15);
}

body.has-shell .badge-warning {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: rgba(146, 102, 10, 0.15);
}

body.has-shell .badge-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(182, 65, 56, 0.15);
}

body.has-shell .badge-neutral {
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border-color: var(--border);
}

/* Poll status */
body.has-shell .poll-status {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  font-size: var(--text-caption);
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

body.has-shell .poll-status.is-live {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: rgba(26, 127, 78, 0.15);
}

body.has-shell .poll-status.is-paused {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: rgba(146, 102, 10, 0.15);
}

body.has-shell .poll-status.is-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(182, 65, 56, 0.15);
}

/* JSON error */
body.has-shell .json-error {
  display: none;
  padding: 10px 14px;
  font-size: var(--text-ui);
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid rgba(182, 65, 56, 0.15);
  border-radius: var(--radius-xs);
  margin-bottom: 12px;
}

body.has-shell .json-error.visible {
  display: block;
}

/* Field help */
body.has-shell .field-help {
  font-size: var(--text-small);
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

/* Chart panel */
body.has-shell .chart-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

body.has-shell .chart-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

body.has-shell .chart-panel-title {
  margin: 0;
  font-size: var(--text-body-lg);
  font-weight: 600;
  color: var(--text-primary);
}

body.has-shell .chart-panel-desc {
  font-size: var(--text-small);
  color: var(--text-tertiary);
  margin-top: 2px;
}

body.has-shell .chart-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Settings page width */
body.has-shell .admin-page.settings-page {
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

/* Chart inner styling — fills/strokes for SVG primitives.
   Only color/opacity, never dataset. */
body.has-shell svg.hourly-bars .hourly-bar {
  fill: var(--accent);
  opacity: 0.85;
}

body.has-shell svg.hourly-bars .hourly-bar.peak {
  fill: var(--text-primary);
  opacity: 1;
}

body.has-shell svg.hourly-bars .day-separators line {
  stroke: var(--border);
  stroke-width: 1;
}

body.has-shell svg.hourly-bars .day-label {
  fill: var(--text-tertiary);
  font-family: var(--font-sans);
  font-size: 10px;
}

body.has-shell svg.heatmap .heat-cell {
  fill: var(--accent);
}

body.has-shell svg.heatmap .heat-cell.future {
  fill: var(--border);
}

body.has-shell svg.heatmap .heat-date,
body.has-shell svg.heatmap .heat-hour {
  fill: var(--text-tertiary);
  font-family: var(--font-sans);
  font-size: 10px;
}

body.has-shell svg.spark .spark-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.has-shell svg.spark .spark-area {
  fill: var(--accent);
  opacity: 0.08;
  /* explicit fill-opacity prevents browser default black fill if the
     fill declaration above is ever overridden by a more specific rule. */
  fill-opacity: 0.08;
}

body.has-shell svg.spark .spark-dot {
  fill: var(--accent);
}

body.has-shell svg.spark .spark-dot.today {
  fill: var(--text-primary);
}


/* Responsive */
@media (max-width: 1024px) {
  body.has-shell .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  body.has-shell .metric-grid {
    grid-template-columns: 1fr;
  }

  body.has-shell .admin-section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  body.has-shell .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  body.has-shell .toolbar-group {
    flex-wrap: wrap;
  }
}
/* =====================================================
   USER PANEL — Hysteria 个人控制台
   ===================================================== */
.wrap.user-panel {
  max-width: 1200px;
  margin-inline: auto;
  padding: 28px 32px 72px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---- Page Header ---- */
.wrap.user-panel .user-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.wrap.user-panel .user-panel-brand {
  display: flex;
  flex-direction: column;
}

.wrap.user-panel .user-panel-title {
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin: 2px 0 0 0;
}

.wrap.user-panel .user-panel-subtitle {
  font-size: var(--text-small);
  color: var(--text-tertiary);
  margin-top: 4px;
}

.wrap.user-panel .user-panel-account {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.wrap.user-panel .user-panel-name {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.wrap.user-panel .user-panel-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wrap.user-panel .user-panel-actions {
  display: flex;
  gap: 8px;
}

/* ---- Generic section head + Panel shell ---- */
.wrap.user-panel .section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.wrap.user-panel .section-head .section-title {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.wrap.user-panel .usage-section,
.wrap.user-panel .connection-section,
.wrap.user-panel .plan-section,
.wrap.user-panel .trend-section,
.wrap.user-panel .account-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
}

/* ---- 1. Usage ---- */
.wrap.user-panel .usage-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.wrap.user-panel .usage-kpi .k {
  font-family: var(--font-sans);
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.wrap.user-panel .usage-kpi .v {
  font-family: var(--font-num);
  font-size: 30px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 1;
}

.wrap.user-panel .usage-kpi .v.usage-date {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0;
}

.wrap.user-panel .usage-kpi .sub {
  font-family: var(--font-sans);
  font-size: var(--text-small);
  color: var(--text-tertiary);
  margin-top: 2px;
}

.wrap.user-panel .usage-progress {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.wrap.user-panel .usage-progress-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-sans);
  font-size: var(--text-small);
  color: var(--text-secondary);
}

.wrap.user-panel .usage-progress .bar {
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
}

.wrap.user-panel .usage-progress .bar .fill {
  height: 100%;
  background: var(--accent);
  transition: width 200ms ease;
}

.wrap.user-panel .usage-progress .bar .fill.danger {
  background: var(--danger);
}

.wrap.user-panel .usage-progress .bar .fill.unlimited {
  background: var(--text-tertiary);
}

/* ---- 2. Connection panel (formerly import-assistant) ---- */
.wrap.user-panel .connection-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wrap.user-panel .connection-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.wrap.user-panel .connection-head .k {
  font-family: var(--font-sans);
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.wrap.user-panel .connection-desc {
  color: var(--text-secondary);
}

.wrap.user-panel .connection-muted {
  font-family: var(--font-sans);
}

.wrap.user-panel .profile-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.wrap.user-panel .profile-tab {
  font-family: var(--font-sans);
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.wrap.user-panel .profile-tab:hover {
  color: var(--text-primary);
}

.wrap.user-panel .profile-tab.is-active {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border);
  box-shadow: 0 1px 0 var(--border);
}

.wrap.user-panel .connection-url {
  display: flex;
  align-items: stretch;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-width: 0;
}

.wrap.user-panel .connection-url .url-text {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--text-small);
  color: var(--text-primary);
  background: transparent;
  border: 0;
  padding: 6px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wrap.user-panel .connection-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.wrap.user-panel .profile-qr-panel {
  margin-top: 8px;
  padding: 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.wrap.user-panel .qr-wrap {
  background: #ffffff;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ---- 3. Plan & Devices (compact KV) ---- */
.wrap.user-panel .user-kv {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 24px;
}

.wrap.user-panel .user-kv > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.wrap.user-panel .user-kv dt {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.wrap.user-panel .user-kv dd {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
}

.wrap.user-panel .user-kv dd.mono,
.wrap.user-panel .user-kv dd .mono {
  font-family: var(--font-mono);
  font-weight: 500;
}

/* ---- 4. Trend section — fixed sparkline styling ---- */
.wrap.user-panel .trend-body {
  width: 100%;
  min-height: 72px;
  display: flex;
  align-items: center;
}

.wrap.user-panel .trend-body svg.spark {
  display: block;
  width: 100%;
  height: 56px;
  max-height: 56px;
}

.wrap.user-panel .trend-body svg.spark .spark-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.wrap.user-panel .trend-body svg.spark .spark-area {
  fill: var(--accent);
  opacity: 0.08;
  /* prevent browser default black fill if CSS fails to load */
  fill-opacity: 0.08;
}

.wrap.user-panel .trend-body svg.spark .spark-dot {
  fill: var(--accent);
}

.wrap.user-panel .trend-body svg.spark .spark-dot.today {
  fill: var(--text-primary);
}

/* ---- 5. Account & Security ---- */
.wrap.user-panel .account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.wrap.user-panel .account-session-details {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.wrap.user-panel .account-session-details summary {
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: var(--text-small);
  color: var(--text-secondary);
  list-style: none;
}

.wrap.user-panel .account-session-details summary::-webkit-details-marker {
  display: none;
}

.wrap.user-panel .account-session-details[open] summary {
  margin-bottom: 10px;
  color: var(--text-tertiary);
}

.wrap.user-panel .account-session-details .copy-mono {
  padding: 10px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .wrap.user-panel {
    padding: 24px 24px 64px;
  }
  .wrap.user-panel .usage-kpis {
    grid-template-columns: 1fr 1fr;
  }
  .wrap.user-panel .user-kv {
    grid-template-columns: 1fr;
  }
  .wrap.user-panel .connection-section + .plan-section {
    /* keep stacked on narrow desktop for readability */
  }
}

@media (max-width: 768px) {
  .wrap.user-panel {
    padding: 20px 16px 56px;
  }
  .wrap.user-panel .usage-kpis {
    grid-template-columns: 1fr;
  }
  .wrap.user-panel .user-panel-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .wrap.user-panel .user-panel-account {
    align-items: flex-start;
  }
  .wrap.user-panel .connection-url {
    flex-direction: column;
    align-items: stretch;
  }
  .wrap.user-panel .connection-url .url-text {
    overflow-x: auto;
    white-space: nowrap;
    text-overflow: clip;
  }
}

/* =====================================================
   REDUCED MOTION — admin + home
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
  .app.anim-ready { transition: none; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .status-dot.online::before,
  .progress-fill {
    animation: none;
    transition: none;
  }

}

@media (prefers-reduced-motion: reduce) and (min-width: 881px) {
  html.sidebar-motion-enabled .app.anim-ready {
    transition: grid-template-columns 220ms cubic-bezier(.16, 1, .3, 1) !important;
  }
}

/* Workspace redesign: scoped to authenticated surfaces. Public home/login
   remain independent. Keep the complete five-column management table. */
body.has-shell,
.wrap.user-panel {
  --bg-page: #f7f6f2;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f1ed;
  --bg-overlay: #fafaf7;
  --text-primary: #242726;
  --text-secondary: #626761;
  --text-tertiary: #686c68;
  --hairline: #e3e4de;
  --border: #e3e4de;
  --border-strong: #b4b8af;
  --accent: #242726;
  --accent-hover: #3a3f39;
  --accent-soft: #eeeee8;
  --data: #48544c;
  --data-soft: #edf0e9;
  --radius-xs: 5px;
  --radius-sm: 8px;
  --radius-md: 15px;
}
body.has-shell { background: var(--bg-page); }
body.has-shell .sidebar { background: #fafaf7; }
body.has-shell .sidebar-brand { height: 74px; }
body.has-shell .sidebar-logo { border-radius: 9px; }
body.has-shell .sidebar-brand-text small { font-size: 9px; letter-spacing: .1em; }
body.has-shell .sidebar-nav { padding: 16px 10px; }
body.has-shell .sidebar-section { padding: 18px 12px 8px; font-size: 10px; letter-spacing: .12em; }
body.has-shell .sidebar-link { margin: 3px 0; padding: 11px 12px; border-radius: 9px; gap: 11px; }
body.has-shell .sidebar-link svg { width: 18px; height: 18px; opacity: .8; }
body.has-shell .sidebar-link.active { background: #eaece5; color: #30382f; box-shadow: inset 3px 0 #737e6c; }
body.has-shell .sidebar-footer { background: #fafaf7; }
body.has-shell .topbar { background: rgba(255,255,255,.94); height: auto; min-height: 68px; }
body.has-shell .topbar-inner { max-width: 1800px; padding: 12px 28px; gap: 16px; flex-wrap: wrap; }
body.has-shell .topbar-left,
body.has-shell .topbar-right { min-width: 0; flex-wrap: wrap; }
body.has-shell .content { max-width: 1800px; padding: 28px 28px 64px; min-width: 0; }
body.has-shell .page-title { letter-spacing: -.02em; }
body.has-shell :is(.card,.users-section,.health-kpi-card,.stat-card) {
  border-color: var(--border); border-radius: var(--radius-md);
  background: var(--bg-surface); box-shadow: 0 2px 8px rgba(25,45,55,.025);
}
body.has-shell .overview-stats {
  gap: 16px; border: 0; border-radius: 0; overflow: visible; margin-bottom: 24px;
}
body.has-shell .overview-stat {
  padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: white; min-width: 0;
}
body.has-shell .overview-stat:first-child { background: #fff; }
body.has-shell .overview-stat .label { letter-spacing: .04em; }
body.has-shell .overview-stat .value { font-size: clamp(28px,2.3vw,38px); }
body.has-shell .users-section { overflow: hidden; border: 1px solid var(--border); }
body.has-shell .users-header { padding: 22px 24px; }
body.has-shell .users-table thead th { background: #f2f3ee; color: #686c68; }
body.has-shell .users-table tbody tr:hover { background: #f7f8f3; }
body.has-shell .users-table :is(th,td) { padding: 18px 16px; }
body.has-shell .users-table .spark-line { stroke: #303630; }
body.has-shell .users-table .bar .fill:not(.danger):not(.unlimited) { background: #424b40; }
body.has-shell .btn-primary,
.wrap.user-panel .btn-primary { background: #242726; border-color: #242726; color: white; }
body.has-shell .btn-primary:hover:not(:disabled),
.wrap.user-panel .btn-primary:hover:not(:disabled) { background: #3a3f39; border-color: #3a3f39; }
body.has-shell :is(input:not([type=checkbox]):not([type=radio]),select,textarea),
.wrap.user-panel :is(input:not([type=checkbox]):not([type=radio]),select,textarea) { border-color: var(--border); border-radius: 8px; }
body.has-shell .admin-dialog { border-radius: 18px; box-shadow: 0 24px 80px #142a3830; max-height: calc(100dvh - 32px); overflow-y: auto; }
body.has-shell .admin-dialog::backdrop { background: rgba(20,39,49,.32); }
body.has-shell .data-table th { background: #f2f3ee; color: #686c68; }
body.has-shell :is(.admin-section,.metric-card,.form-section) { box-shadow: 0 2px 8px rgba(25,45,55,.025); }
body.has-shell .admin-section-header { background: #fafaf7; padding: 20px 24px; flex-wrap: wrap; }
body.has-shell .metric-card { text-align: left; min-width: 0; }
body.has-shell .metric-k { letter-spacing: .04em; }
body.has-shell .users-section > .small { padding: 0 20px 10px; }
body.has-shell :is(.health-section,.settings-section) { margin-bottom: 24px; }
.wrap.user-panel {
  display: grid; grid-template-columns: minmax(0,1.5fr) minmax(0,1fr);
  max-width: 1240px; gap: 22px; padding: 36px 28px 64px;
  color: var(--text-primary);
}
.wrap.user-panel > * { grid-column: 1 / -1; min-width: 0; }
.wrap.user-panel > .connection-section { grid-column: 1; }
.wrap.user-panel > .plan-section { grid-column: 2; margin: 0; }
.wrap.user-panel .user-panel-header { padding: 4px 0 23px; gap: 24px; }
.wrap.user-panel .user-panel-title { font-size: clamp(26px,3vw,34px); letter-spacing: -.035em; }
.wrap.user-panel .user-panel-name { font-size: 15px; }
.wrap.user-panel :is(.usage-section,.connection-section,.plan-section,.trend-section,.account-section) { padding: 25px; border-radius: 16px; }
.wrap.user-panel .usage-section { background: #fff; }
.wrap.user-panel .usage-kpis { gap: 24px; }
.wrap.user-panel .usage-kpi .v { font-size: clamp(28px,3vw,40px); letter-spacing: -.025em; }
.wrap.user-panel .usage-kpi .v.usage-date { font-size: 25px; }
.wrap.user-panel .usage-progress .bar { height: 7px; background: #e9ece4; }
.wrap.user-panel .usage-progress .bar .fill:not(.danger):not(.unlimited) { background: #7e9275; }
.wrap.user-panel .profile-tabs { gap: 7px; }
.wrap.user-panel .profile-tab { border-radius: 8px; padding: 9px 13px; }
.wrap.user-panel .profile-tab.is-active { color: #40533a; background: #eef2e9; border-color: #bac9af; }
.wrap.user-panel .connection-url { background: #f7f8f4; border-color: var(--border); border-radius: 9px; }
.wrap.user-panel .connection-url .url-text { white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
.wrap.user-panel .user-kv { grid-template-columns: 1fr; gap: 0; }
.wrap.user-panel .user-kv > div { padding: 13px 0; border-bottom: 1px solid var(--hairline); }
.wrap.user-panel .user-kv > div:last-child { border: 0; }
.wrap.user-panel .trend-body svg.spark .spark-line { stroke: #6d8562; }
.wrap.user-panel .trend-body svg.spark .spark-area { fill: #e3eadb; opacity: .65; }
.wrap.user-panel .section-head { flex-wrap: wrap; gap: 8px; }
@media (min-width: 881px) {
  .wrap.user-panel .usage-kpis { grid-template-columns: repeat(3,minmax(0,1fr)); }
  body.has-shell .app:not(.sidebar-collapsed) { grid-template-columns: 224px minmax(0,1fr); }
  html.sidebar-pre-collapsed body.has-shell .app:not(.sidebar-collapsed) { grid-template-columns: 64px minmax(0,1fr); }
  body.has-shell .sidebar.collapsed .sidebar-link { padding-left: 0; padding-right: 0; }
}
@media (min-width: 1200px) {
  body.has-shell .users-table { min-width: 1160px; }
}
@media (max-width: 880px) {
  .wrap.user-panel { grid-template-columns: minmax(0,1fr); padding: 24px 18px 48px; }
  .wrap.user-panel > .connection-section,
  .wrap.user-panel > .plan-section { grid-column: 1; }
  body.has-shell .topbar-inner { padding: 12px 18px; }
  body.has-shell .content { padding: 24px 18px 48px; }
}
@media (max-width: 600px) {
  body.has-shell .content { padding: 18px 12px 40px; }
  body.has-shell .users-header { padding: 18px 14px; }
  body.has-shell .users-table td { padding: 10px 12px; }
  body.has-shell .overview-stat { padding: 20px; }
  .wrap.user-panel { gap: 16px; padding: 20px 12px 40px; }
  .wrap.user-panel :is(.usage-section,.connection-section,.plan-section,.trend-section,.account-section) { padding: 20px 16px; }
  .wrap.user-panel .usage-kpi .v { font-size: 30px; }
  .wrap.user-panel .user-panel-header { gap: 16px; }
}

/* Neutral workspace surfaces; color is reserved for data and status. */
body.has-shell .cycle-config-form { margin: 0; padding: 6px 8px; gap: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-overlay); }
body.has-shell .cycle-config-form input { appearance: textfield; box-sizing: border-box; width: 72px; height: 36px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-surface); color: var(--text-primary); box-shadow: none; font: inherit; }
body.has-shell .cycle-config-form input::-webkit-inner-spin-button,
body.has-shell .cycle-config-form input::-webkit-outer-spin-button { appearance: none; margin: 0; }
body.has-shell .cycle-config-form input:focus-visible { outline: 2px solid #717e65; outline-offset: 2px; }
body.has-shell .cycle-config-form .btn { height: 36px; border-radius: 8px; }
body.has-shell .daily-table-collapsed { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-variant-numeric: tabular-nums; }
body.has-shell .daily-table-collapsed :is(th,td) { min-width: 100px; padding: 14px 16px; white-space: nowrap; text-align: right; text-transform: none; letter-spacing: normal; border-bottom: 1px solid #e8e9e3; }
body.has-shell .daily-table-collapsed thead th { background: #f1f2ec; color: #646a60; font-weight: 500; }
body.has-shell .daily-table-collapsed tbody tr { background: white; }
body.has-shell .daily-table-collapsed tbody tr:nth-child(even) { background: #fafbf7; }
body.has-shell .daily-table-collapsed tbody tr:hover { background: #eff2e9; }
body.has-shell .daily-table-collapsed tr > :first-child { position: sticky; left: 0; z-index: 1; text-align: left; background: inherit; box-shadow: 1px 0 #e3e4de; }
body.has-shell .daily-table-collapsed thead tr { background: #f1f2ec; }
body.has-shell .daily-table-collapsed .is-today::after { content: ' ·'; color: #536449; font-weight: 700; }
body.has-shell .daily-history-scroll { overflow-x: auto; max-width: 100%; scrollbar-color: #b8bdb1 #f4f5ef; }
body.has-shell .daily-history-hint { padding: 8px 0; font-size: 12px; color: var(--text-secondary); }
body.has-shell .template-impact { margin: 12px 0 0; padding-left: 20px; line-height: 1.9; color: var(--text-secondary); }

/* Expanded hourly details must not contribute a grid item's intrinsic width. */
body.has-shell .analytics-grid { grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; }
body.has-shell .analytics-grid > *,
body.has-shell #heatmap-host,
body.has-shell .heatmap-data-details { min-width: 0; max-width: 100%; }
body.has-shell #heatmap-host > svg.heatmap { display: block; width: 100%; height: auto; }
body.has-shell .heatmap-data-scroll { width: 100%; max-width: 100%; overflow-x: auto; scrollbar-color: #b8bdb1 #f4f5ef; }
body.has-shell .heatmap-data-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; }
body.has-shell .heatmap-data-table :is(th,td) { min-width: 92px; white-space: nowrap; text-align: right; padding: 12px; font-variant-numeric: tabular-nums; }
body.has-shell .heatmap-data-table tr > :first-child { position: sticky; left: 0; z-index: 1; min-width: 112px; text-align: left; background: #f3f4ef; box-shadow: 1px 0 #e3e4de; }
body.has-shell .heatmap-data-details summary { padding: 10px 0; cursor: pointer; }
body.has-shell #top-n-host { padding: 4px 16px; }
body.has-shell .top-row { display: grid; grid-template-columns: minmax(0,1fr) 96px minmax(76px,auto); align-items: center; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--hairline); color: var(--text-primary); text-decoration: none; }
body.has-shell .top-row:last-child { border-bottom: 0; }
body.has-shell .top-row:hover { background: var(--bg-subtle); }
body.has-shell .top-uid { min-width: 0; overflow-wrap: anywhere; }
body.has-shell .top-spark { display: block; width: 96px; min-width: 0; }
body.has-shell .top-spark svg.spark { width: 96px; height: 24px; overflow: visible; }
body.has-shell .top-bytes { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 1100px) {
  body.has-shell .analytics-grid { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 400px) {
  body.has-shell .top-row { grid-template-columns: minmax(0,1fr) 64px auto; gap: 8px; }
  body.has-shell .top-spark, body.has-shell .top-spark svg.spark { width: 64px; }
}
