/* ==========================================================================
   app.css —— 「账号流程演示」全站样式表
   --------------------------------------------------------------------------
   设计说明（给产品经理新人）：
   1) 全站零外部依赖：不引入任何 CDN 样式，所有样式集中在这一个文件里。
   2) 采用"设计令牌（Design Token）"思路：颜色、圆角、阴影、间距都定义在
      :root 变量里。改一处变量，全站视觉统一变化，方便讲解"设计规范"。
   3) 组件化命名：.btn / .field / .card / .toast / .flow-node ... 每个组件
      的样式只写一次，所有页面复用。
   4) 移动优先：先写移动端样式，再用 min-width 媒体查询逐级增强。
   ========================================================================== */

/* ==========================================================================
   1. 设计令牌（Design Tokens）
   ========================================================================== */
:root {
  /* 让浏览器原生控件（滚动条、下拉框、日期选择器）跟随主题 */
  color-scheme: light;

  /* —— 品牌主色：靛蓝 —— */
  --brand-700: #4338CA;
  --brand-600: #4F46E5;
  --brand-500: #6366F1;
  --brand-400: #818CF8;
  --brand-100: #E0E7FF;
  --brand-50: #EEF2FF;
  --brand-gradient: linear-gradient(135deg, #4F46E5 0%, #6366F1 55%, #818CF8 100%);
  --brand-gradient-soft: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);

  /* —— 背景与表面 —— */
  --bg-page: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F1F5F9;
  --bg-gradient-page: radial-gradient(1200px 600px at 12% -10%, #E0E7FF 0%, rgba(248, 250, 252, 0) 60%),
                      radial-gradient(900px 500px at 100% 0%, #DBEAFE 0%, rgba(248, 250, 252, 0) 55%);

  /* —— 文字三级 —— */
  --text-900: #0F172A;
  --text-700: #334155;
  --text-600: #475569;
  --text-400: #94A3B8;
  --text-invert: #FFFFFF;

  /* —— 边框与分割线 —— */
  --border: #E2E8F0;
  --border-strong: #CBD5E1;

  /* —— 功能色（成功/错误/警告/信息）—— */
  --success: #10B981;
  --success-bg: #ECFDF5;
  --success-border: #A7F3D0;
  --danger: #EF4444;
  --danger-bg: #FEF2F2;
  --danger-border: #FECACA;
  --warning: #F59E0B;
  --warning-bg: #FFFBEB;
  --warning-border: #FDE68A;
  --info: #3B82F6;
  --info-bg: #EFF6FF;
  --info-border: #BFDBFE;

  /* —— 圆角 —— */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-pill: 999px;

  /* —— 阴影 —— */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 48px rgba(15, 23, 42, 0.12);
  --shadow-brand: 0 12px 28px rgba(79, 70, 229, 0.26);

  /* —— 字体 —— */
  --font-sans: "PingFang SC", "HarmonyOS Sans SC", "Source Han Sans SC", "Noto Sans SC",
    "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace;

  /* —— 间距节奏 —— */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* —— 动效 —— */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 140ms;
  --dur: 220ms;
  --dur-slow: 360ms;

  /* —— 反色表面：始终是深色的区域（控制台头部、终端式事件流、代码块等） ——
     单独抽成令牌，暗色模式下才能把它们与页面底色区分开 */
  --surface-inverse: #0F172A;
  --surface-inverse-alt: #1E293B;

  /* —— 遮罩层（页面级 loading） —— */
  --overlay: rgba(248, 250, 252, 0.86);

  /* —— 表格行悬停 —— */
  --row-hover: rgba(238, 242, 255, 0.5);
}

/* ==========================================================================
   1.1 暗色主题
   --------------------------------------------------------------------------
   实现思路：全站颜色都走 CSS 变量，所以暗色模式不需要重写任何组件样式，
   只要把同一批令牌换一组值即可 —— 这正是当初"设计令牌"的回报。
   只有少数几处必须单独覆盖：
     · 反色表面上的强调色（badge / 流程节点），浅色场景的深色文字在暗色下会看不清
     · 实体危险按钮，浅红底 + 白字在暗色下对比度不足
     · 表格行悬停、遮罩层这类含固定 rgba 的地方
   触发方式：html[data-theme="dark"]。
   这个属性由两处设置：
     ① 每个页面 <head> 里的内联脚本 —— 在样式表之前执行，避免"先亮后暗"的闪烁；
     ② ui.js 的主题切换按钮 + 系统偏好监听。
   注意："跟随系统"并不是靠 CSS 媒体查询实现的，而是由 JS 把系统偏好解析成具体值
   再写进这个属性。这样 CSS 只需要维护一套暗色选择器，不必把上百行令牌写两遍。
   ========================================================================== */
[data-theme="dark"] {
  color-scheme: dark;

  /* —— 品牌色：暗色下整体提亮，保证可读性与对比度 —— */
  --brand-700: #C7D2FE;
  --brand-600: #818CF8;
  --brand-500: #6366F1;
  --brand-400: #4F46E5;
  --brand-100: #312E81;
  --brand-50: #1E1B4B;
  --brand-gradient-soft: linear-gradient(135deg, #1E1B4B 0%, #312E81 100%);

  /* —— 背景与表面 —— */
  --bg-page: #0B1120;
  --bg-surface: #111C2E;
  --bg-subtle: #1B2740;
  --bg-gradient-page: radial-gradient(1200px 600px at 12% -10%, #1E1B4B 0%, rgba(11, 17, 32, 0) 60%),
                      radial-gradient(900px 500px at 100% 0%, #0C2A4D 0%, rgba(11, 17, 32, 0) 55%);

  /* —— 文字三级 —— */
  --text-900: #F1F5F9;
  --text-700: #CBD5E1;
  --text-600: #94A3B8;
  --text-400: #7C8AA3;

  /* —— 边框 —— */
  --border: #23324B;
  --border-strong: #3A4C69;

  /* —— 功能色：底色变暗、主色提亮 —— */
  --success: #34D399;
  --success-bg: #06281F;
  --success-border: #14532D;
  --danger: #F87171;
  --danger-bg: #2A1113;
  --danger-border: #7F1D1D;
  --warning: #FBBF24;
  --warning-bg: #2A1F05;
  --warning-border: #78350F;
  --info: #60A5FA;
  --info-bg: #0B1F3A;
  --info-border: #1E40AF;

  /* —— 阴影：暗色下用更深的黑色，否则阴影看不见 —— */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.6);
  --shadow-brand: 0 12px 28px rgba(99, 102, 241, 0.32);

  /* —— 反色表面与遮罩 —— */
  --surface-inverse: #1E293B;
  --surface-inverse-alt: #2A3A52;
  --overlay: rgba(11, 17, 32, 0.86);
  --row-hover: rgba(99, 102, 241, 0.14);
}

/* 反色表面上的强调色：浅色场景用的深色文字在暗色下必须换成浅色 */
[data-theme="dark"] .badge--success {
  color: #6EE7B7;
}
[data-theme="dark"] .badge--danger {
  color: #FCA5A5;
}
[data-theme="dark"] .badge--warning {
  color: #FCD34D;
}
[data-theme="dark"] .badge--info {
  color: #93C5FD;
}

[data-theme="dark"] .flow-node--ok {
  color: #6EE7B7;
}
[data-theme="dark"] .flow-node--fail {
  color: #FCA5A5;
}
[data-theme="dark"] .flow-node--warn {
  color: #FCD34D;
}
[data-theme="dark"] .flow-node--decision {
  color: #FCD34D;
}

/* 实体危险按钮：浅红底 + 白字对比度不足，暗色下改用深红底 */
[data-theme="dark"] .btn--danger {
  --btn-bg: #B91C1C;
}

/* 密码强度条的"中点"颜色在暗色下要更亮一点才看得清 */
[data-theme="dark"] .strength[data-level="2"] {
  --strength-color: #FBBF24;
}

/* 代码块与反色面板在暗色下与页面底色接近，补一层描边以保持层次 */
[data-theme="dark"] pre,
[data-theme="dark"] .event-stream,
[data-theme="dark"] .console__header {
  border: 1px solid var(--border);
}

/* ==========================================================================
   2. 基础重置与排版
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px; /* 锚点跳转时为吸顶导航预留空间 */
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-600);
  background-color: var(--bg-page);
  background-image: var(--bg-gradient-page);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 var(--space-3);
  color: var(--text-900);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 30px;
}
h2 {
  font-size: 22px;
}
h3 {
  font-size: 19px;
}
h4 {
  font-size: 16px;
}

p {
  margin: 0 0 var(--space-4);
}

a {
  color: var(--brand-600);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}

a:hover {
  color: var(--brand-700);
  text-decoration: underline;
}

ul,
ol {
  margin: 0 0 var(--space-4);
  padding-left: 1.25em;
}

li + li {
  margin-top: var(--space-1);
}

code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 1px 6px;
  color: var(--brand-700);
  /* 用 overflow-wrap 而非 word-break:break-all：
     前者只在单词单独放不下时才断行，短验证码（123456）不会被拆成两行；
     后者会在任意字符处断开，长 token 与短 code 都不安全。 */
  overflow-wrap: break-word;
}

pre {
  margin: 0 0 var(--space-4);
  padding: var(--space-4);
  background: var(--surface-inverse);
  color: #E2E8F0;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.65;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-6) 0;
}

img,
svg {
  max-width: 100%;
  vertical-align: middle;
}

/* 统一且明显的键盘焦点样式（可访问性要求） */
:focus-visible {
  outline: 2px solid var(--brand-600);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* 屏幕阅读器专属文本 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 跳转到主内容（键盘用户友好） */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -60px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--brand-600);
  color: #fff;
  border-radius: var(--radius-sm);
  transition: top var(--dur) var(--ease);
}

.skip-link:focus {
  top: var(--space-4);
  text-decoration: none;
}

/* ==========================================================================
   3. 布局容器
   ========================================================================== */
.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.container--narrow {
  max-width: 720px;
}

.container--wide {
  max-width: 1240px;
}

.page-main {
  padding: var(--space-8) 0 var(--space-12);
}

@media (min-width: 768px) {
  .page-main {
    padding: var(--space-10) 0 64px;
  }
}

/* 两栏布局：侧边锚点导航 + 正文（桌面端） */
.layout-split {
  display: grid;
  gap: var(--space-8);
  align-items: start;
}

@media (min-width: 1024px) {
  .layout-split {
    grid-template-columns: 232px minmax(0, 1fr);
  }
}

/* 通用网格 */
.grid {
  display: grid;
  gap: var(--space-4);
}

.grid--2 {
  grid-template-columns: 1fr;
}
.grid--3 {
  grid-template-columns: 1fr;
}
.grid--4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 640px) {
  .grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .grid--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ==========================================================================
   4. 顶部导航与页脚
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: 62px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text-900);
  text-decoration: none;
  flex-shrink: 0;
}

.brand:hover {
  text-decoration: none;
  color: var(--brand-700);
}

.brand__logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  box-shadow: var(--shadow-xs);
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand__name {
  font-size: 15px;
  font-weight: 700;
}

.brand__sub {
  font-size: 11px;
  color: var(--text-400);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  margin-left: auto;
}

.site-nav__link {
  display: inline-block;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  color: var(--text-600);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.site-nav__link:hover {
  background: var(--brand-50);
  color: var(--brand-700);
  text-decoration: none;
}

.site-nav__link[aria-current="page"] {
  background: var(--brand-gradient);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* 主题切换按钮：由 ui.js 注入到导航栏最右侧 */
.theme-toggle {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-600);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.theme-toggle:hover {
  color: var(--brand-600);
  background: var(--brand-50);
  border-color: var(--brand-100);
  transform: translateY(-1px);
}

/* 登录态徽标（头像首字 + 账号） */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  font-size: 13px;
  color: var(--text-700);
  max-width: 220px;
}

.user-chip__avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-chip__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-footer {
  margin-top: auto;
  padding: var(--space-10) 0 var(--space-8);
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-400);
}

.site-footer__grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
  margin-bottom: var(--space-8);
}

@media (min-width: 768px) {
  .site-footer__grid {
    grid-template-columns: 1.6fr 1fr 1fr;
  }
}

/* 页脚栏目标题：使用 h2 以保持"每页唯一 H1"与标题层级连续，样式上按小标签呈现 */
.site-footer h2,
.site-footer h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-700);
  margin-bottom: var(--space-3);
}

.site-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-footer li {
  margin-bottom: 6px;
}

.site-footer a {
  color: var(--text-600);
}

.site-footer__bottom {
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  justify-content: space-between;
  align-items: center;
}

/* 页面采用 flex 纵向布局，保证页脚在内容不足时贴底 */
body {
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   5. 按钮组件
   ========================================================================== */
.btn {
  --btn-bg: var(--bg-surface);
  --btn-fg: var(--text-700);
  --btn-border: var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  min-height: 44px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease),
    background var(--dur) var(--ease), border-color var(--dur) var(--ease), opacity var(--dur) var(--ease);
  user-select: none;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 主按钮：靛蓝渐变 */
.btn--primary {
  --btn-bg: var(--brand-gradient);
  --btn-fg: #fff;
  --btn-border: transparent;
  box-shadow: var(--shadow-xs);
}

.btn--primary:hover:not(:disabled) {
  box-shadow: var(--shadow-brand);
}

/* 次按钮 */
.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--brand-700);
  --btn-border: var(--brand-100);
}

.btn--ghost:hover:not(:disabled) {
  --btn-bg: var(--brand-50);
}

/* 危险按钮 */
.btn--danger {
  --btn-bg: var(--danger);
  --btn-fg: #fff;
  --btn-border: transparent;
}

/* 文字按钮 */
.btn--text {
  --btn-bg: transparent;
  --btn-fg: var(--brand-600);
  --btn-border: transparent;
  min-height: 36px;
  padding: 6px 10px;
}

.btn--text:hover:not(:disabled) {
  --btn-bg: var(--brand-50);
  box-shadow: none;
}

.btn--sm {
  min-height: 36px;
  padding: 7px 13px;
  font-size: 13.5px;
  border-radius: var(--radius-sm);
}

.btn--lg {
  min-height: 50px;
  font-size: 16px;
}

.btn--block {
  width: 100%;
}

/* loading 态：按钮内 spinner */
.btn__spinner {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 640ms linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   6. 表单组件
   ========================================================================== */
.field {
  margin-bottom: var(--space-5);
}

.field__label {
  display: block;
  margin-bottom: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-700);
}

.field__label .required {
  color: var(--danger);
  margin-left: 3px;
}

.field__control {
  position: relative;
  display: flex;
  align-items: stretch;
}

.input {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text-900);
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    background var(--dur) var(--ease);
  font-variant-numeric: tabular-nums;
}

.input::placeholder {
  color: var(--text-400);
}

.input:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14);
}

.input:disabled {
  background: var(--bg-subtle);
  color: var(--text-400);
  cursor: not-allowed;
}

/* 带内嵌按钮的输入框（验证码 / 密码显隐） */
.input--with-suffix {
  padding-right: 104px;
}

.input--with-icon {
  padding-right: 48px;
}

.field__suffix {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
}

.field__suffix .btn {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* 密码显隐切换按钮 */
.toggle-password {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-400);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.toggle-password:hover {
  color: var(--brand-600);
  background: var(--brand-50);
}

/* 错误态 */
.field--error .input,
.input[aria-invalid="true"] {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.field--error .input:focus,
.input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.14);
}

/* 字段级错误 / 提示文案 */
.field__error,
.field__hint {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.55;
}

.field__error {
  color: var(--danger);
  font-weight: 500;
}

.field__error[hidden] {
  display: none;
}

.field__hint {
  color: var(--text-400);
}

.field__error svg,
.field__hint svg {
  flex-shrink: 0;
  margin-top: 2px;
}

/* 复选框行 */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: var(--space-5);
  font-size: 13.5px;
  color: var(--text-600);
  line-height: 1.6;
}

.checkbox-row input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin: 3px 0 0;
  accent-color: var(--brand-600);
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-row label {
  cursor: pointer;
}

/* 开关（配合"模拟网络异常"） */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-700);
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch__track {
  position: relative;
  width: 44px;
  height: 25px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  transition: background var(--dur) var(--ease);
  flex-shrink: 0;
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-xs);
  transition: transform var(--dur) var(--ease);
}

.switch input:checked + .switch__track {
  background: var(--brand-gradient);
}

.switch input:checked + .switch__track::after {
  transform: translateX(19px);
}

.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--brand-600);
  outline-offset: 2px;
}

/* ==========================================================================
   7. 密码强度条
   ========================================================================== */
.strength {
  margin-top: 10px;
}

.strength__bars {
  display: flex;
  gap: 5px;
}

.strength__bar {
  flex: 1;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--border);
  transition: background var(--dur) var(--ease);
}

.strength[data-level="1"] .strength__bar:nth-child(-n + 1),
.strength[data-level="2"] .strength__bar:nth-child(-n + 2),
.strength[data-level="3"] .strength__bar:nth-child(-n + 3) {
  background: var(--strength-color, var(--danger));
}

.strength[data-level="0"] {
  --strength-color: var(--border-strong);
}
.strength[data-level="1"] {
  --strength-color: var(--danger);
}
.strength[data-level="2"] {
  --strength-color: var(--warning);
}
.strength[data-level="3"] {
  --strength-color: var(--success);
}

.strength__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-400);
}

.strength__label {
  font-weight: 600;
  color: var(--strength-color, var(--text-400));
}

/* 密码规则清单 */
.rule-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: grid;
  gap: 5px;
}

.rule-list li {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-400);
  margin: 0;
}

.rule-list li::before {
  content: "";
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface);
  transition: all var(--dur) var(--ease);
}

.rule-list li.is-pass {
  color: var(--success);
}

.rule-list li.is-pass::before {
  border-color: var(--success);
  background: var(--success)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-6.5'/%3E%3C/svg%3E")
    center/11px no-repeat;
}

/* ==========================================================================
   8. 卡片
   ========================================================================== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
}

.card + .card {
  margin-top: var(--space-5);
}

.card__head {
  margin-bottom: var(--space-5);
}

.card__title {
  font-size: 17px;
  margin-bottom: 4px;
}

.card__desc {
  font-size: 13.5px;
  color: var(--text-400);
  margin: 0;
}

/* 认证卡（注册/登录等表单页专用） */
.auth-wrap {
  display: flex;
  justify-content: center;
  padding: var(--space-8) 0 var(--space-12);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: var(--space-6);
  animation: cardIn var(--dur-slow) var(--ease) both;
}

@media (min-width: 640px) {
  .auth-card {
    padding: var(--space-8);
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-card__head {
  text-align: center;
  margin-bottom: var(--space-6);
}

.auth-card__icon {
  width: 54px;
  height: 54px;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--brand-gradient-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-600);
}

.auth-card__title {
  font-size: 24px;
  margin-bottom: 6px;
}

.auth-card__subtitle {
  font-size: 13.5px;
  color: var(--text-400);
  margin: 0;
}

.auth-card__footer {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px dashed var(--border);
  font-size: 13.5px;
  text-align: center;
  color: var(--text-400);
}

/* ==========================================================================
   9. 提示条 / 横幅
   ========================================================================== */
.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--info-border);
  background: var(--info-bg);
  color: var(--text-700);
  font-size: 13.5px;
  line-height: 1.6;
  margin-bottom: var(--space-5);
}

.alert[hidden] {
  display: none;
}

.alert svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.alert--success {
  border-color: var(--success-border);
  background: var(--success-bg);
}

.alert--warning {
  border-color: var(--warning-border);
  background: var(--warning-bg);
}

.alert--danger {
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

.alert--info {
  border-color: var(--info-border);
  background: var(--info-bg);
}

.alert strong {
  color: var(--text-900);
}

.alert__icon {
  color: var(--info);
}
.alert--success .alert__icon {
  color: var(--success);
}
.alert--warning .alert__icon {
  color: var(--warning);
}
.alert--danger .alert__icon {
  color: var(--danger);
}

/* ==========================================================================
   10. 徽标（Badge）
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge--brand {
  background: var(--brand-50);
  color: var(--brand-700);
  border-color: var(--brand-100);
}
.badge--success {
  background: var(--success-bg);
  color: #047857;
  border-color: var(--success-border);
}
.badge--danger {
  background: var(--danger-bg);
  color: #B91C1C;
  border-color: var(--danger-border);
}
.badge--warning {
  background: var(--warning-bg);
  color: #B45309;
  border-color: var(--warning-border);
}
.badge--info {
  background: var(--info-bg);
  color: #1D4ED8;
  border-color: var(--info-border);
}
.badge--muted {
  background: var(--bg-subtle);
  color: var(--text-400);
  border-color: var(--border);
}

.badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* ==========================================================================
   11. Toast（右上角堆叠提示）
   ========================================================================== */
.toast-stack {
  position: fixed;
  top: 76px;
  right: var(--space-4);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-700);
  animation: toastIn var(--dur) var(--ease) both;
}

.toast.is-closing {
  animation: toastOut var(--dur-fast) var(--ease) both;
}

.toast--success {
  border-left-color: var(--success);
}
.toast--error {
  border-left-color: var(--danger);
}
.toast--warning {
  border-left-color: var(--warning);
}
.toast--info {
  border-left-color: var(--info);
}

.toast__icon {
  flex-shrink: 0;
  margin-top: 2px;
}
.toast--success .toast__icon {
  color: var(--success);
}
.toast--error .toast__icon {
  color: var(--danger);
}
.toast--warning .toast__icon {
  color: var(--warning);
}
.toast--info .toast__icon {
  color: var(--info);
}

.toast__body {
  flex: 1;
  min-width: 0;
}

.toast__title {
  font-weight: 700;
  color: var(--text-900);
  margin-bottom: 2px;
}

.toast__close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-400);
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.toast__close:hover {
  color: var(--text-700);
  background: var(--bg-subtle);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(28px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(28px);
  }
}

/* ==========================================================================
   12. 步骤指示器
   ========================================================================== */
.steps {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-400);
  /* 步骤按内容自适应，不再与连接线平分宽度。
     原来是 flex: 1 —— 3 个 step 和 2 条 step__line 都是 flex:1，
     于是 5 个 item 各占 1/5 宽度；扣掉 24px 序号圆和 8px 间距后，
     文字只剩约 36px（12.5px 字号 ≈ 3 个汉字），
     配合 .step__text 的 nowrap + ellipsis 就被截成「验…」「设…」「完…」。
     改成 0 1 auto（以内容宽度为基准、只在空间不足时才压缩）后：
     常规宽度下文字完整显示，剩余空间全部由 .step__line 吸收；
     万一容器更窄，才退化成省略号，而不会撑破容器。 */
  flex: 0 1 auto;
  min-width: 0;
}

.step__index {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.step__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.step.is-active {
  color: var(--brand-700);
  font-weight: 600;
}

.step.is-active .step__index {
  background: var(--brand-gradient);
  border-color: transparent;
  color: #fff;
}

.step.is-done {
  color: var(--success);
}

.step.is-done .step__index {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}

.step__line {
  flex: 1;
  height: 2px;
  background: var(--border);
  border-radius: var(--radius-pill);
  min-width: 12px;
}

/* ==========================================================================
   13. 表格
   ========================================================================== */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table caption {
  caption-side: top;
  text-align: left;
  padding: 12px 14px 0;
  font-size: 12.5px;
  color: var(--text-400);
}

.table th,
.table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table thead th {
  background: var(--bg-subtle);
  font-weight: 600;
  color: var(--text-700);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover {
  background: var(--row-hover);
}

.table--compact th,
.table--compact td {
  padding: 8px 12px;
}

/* ==========================================================================
   14. 流程图（纯 HTML + CSS，无任何图表库）
   --------------------------------------------------------------------------
   思路：用 flex 纵向排列节点，节点之间用 .flow-arrow（伪元素画箭头）连接；
   分支用 .flow-branch 横向排布多个分支列。
   ========================================================================== */
.flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: var(--space-5);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.flow + .flow {
  margin-top: var(--space-5);
}

.flow-node {
  position: relative;
  width: 100%;
  max-width: 340px;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--brand-100);
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  line-height: 1.5;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.flow-node:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.flow-node small {
  display: block;
  font-weight: 400;
  font-size: 12px;
  color: var(--text-400);
  margin-top: 2px;
}

.flow-node--start {
  background: var(--brand-gradient);
  border-color: transparent;
  color: #fff;
  border-radius: var(--radius-pill);
}

.flow-node--end {
  background: var(--surface-inverse);
  border-color: transparent;
  color: #fff;
  border-radius: var(--radius-pill);
}

.flow-node--ok {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: #047857;
}

.flow-node--fail {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: #B91C1C;
}

.flow-node--warn {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: #B45309;
}

/* 菱形判断节点：用旋转的方块 + 反向文字实现 */
.flow-node--decision {
  width: auto;
  max-width: 300px;
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: #92400E;
  transform: rotate(0deg);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  padding: 26px 34px;
  border-radius: 0;
  border-width: 0;
  background-image: none;
  box-shadow: inset 0 0 0 2px var(--warning-border);
}

.flow-node--decision:hover {
  transform: translateY(-2px);
}

/* 箭头连接线 */
.flow-arrow {
  position: relative;
  width: 2px;
  height: 28px;
  background: var(--border-strong);
  flex-shrink: 0;
}

.flow-arrow::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1px;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid var(--border-strong);
}

.flow-arrow__label {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11.5px;
  color: var(--text-400);
  white-space: nowrap;
  background: var(--bg-surface);
  padding: 0 4px;
}

.flow-arrow--ok {
  background: var(--success-border);
}
.flow-arrow--ok::after {
  border-top-color: var(--success-border);
}
.flow-arrow--fail {
  background: var(--danger-border);
}
.flow-arrow--fail::after {
  border-top-color: var(--danger-border);
}

/* 分支：横向两列（成功 / 失败） */
.flow-branch {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
  width: 100%;
}

.flow-branch > * {
  flex: 1 1 240px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 图例 */
.flow-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--border);
  font-size: 12.5px;
  color: var(--text-400);
}

.flow-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.flow-legend i {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  display: inline-block;
  border: 1.5px solid transparent;
}

.legend-start {
  background: var(--brand-gradient);
}
.legend-process {
  background: var(--brand-50);
  border-color: var(--brand-100) !important;
}
.legend-decision {
  background: var(--warning-bg);
  border-color: var(--warning-border) !important;
}
.legend-ok {
  background: var(--success-bg);
  border-color: var(--success-border) !important;
}
.legend-fail {
  background: var(--danger-bg);
  border-color: var(--danger-border) !important;
}

/* ==========================================================================
   15. 状态机
   ========================================================================== */
.states {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.state-pill {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  min-width: 148px;
  flex: 1 1 148px;
}

.state-pill strong {
  font-size: 14px;
  color: var(--text-900);
}

.state-pill span {
  font-size: 12px;
  color: var(--text-400);
}

.state-pill--idle {
  border-color: var(--border);
  background: var(--bg-subtle);
}
.state-pill--registered {
  border-color: var(--brand-100);
  background: var(--brand-50);
}
.state-pill--logged {
  border-color: var(--success-border);
  background: var(--success-bg);
}
.state-pill--locked {
  border-color: var(--danger-border);
  background: var(--danger-bg);
}
.state-pill--resetting {
  border-color: var(--warning-border);
  background: var(--warning-bg);
}
.state-pill--reset {
  border-color: var(--info-border);
  background: var(--info-bg);
}

/* 当前状态高亮：与"实时状态看板"联动 */
.state-pill.is-current {
  box-shadow: 0 0 0 2px var(--brand-600), var(--shadow-md);
  transform: translateY(-2px);
}

.state-pill.is-current::after {
  content: "当前状态";
  align-self: flex-start;
  margin-top: 6px;
  padding: 1px 9px;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  background: var(--brand-gradient);
  border-radius: var(--radius-pill);
}

/* ==========================================================================
   实时状态看板（业务逻辑说明页）
   ========================================================================== */
.sm-live {
  padding: var(--space-5);
  border: 1px solid var(--brand-100);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--brand-50) 0%, var(--bg-surface) 62%);
  margin-bottom: var(--space-5);
}

.sm-live__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

.sm-live__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-700);
}

.sm-live__desc {
  margin: 0 0 var(--space-4);
  font-size: 14px;
  color: var(--text-700);
  line-height: 1.7;
}

.sm-live .data-list {
  margin-bottom: var(--space-4);
}

.transitions {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.transitions li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  font-size: 13px;
  margin: 0;
}

.transitions .arrow {
  color: var(--brand-500);
  font-weight: 700;
}

/* ==========================================================================
   16. 折叠面板（FAQ / 控制台）
   ========================================================================== */
.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-surface);
}

.accordion + .accordion {
  margin-top: 10px;
}

.accordion__header {
  margin: 0;
}

.accordion__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 14px 16px;
  border: none;
  background: var(--bg-surface);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-900);
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}

.accordion__trigger:hover {
  background: var(--brand-50);
}

.accordion__icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--brand-50);
  color: var(--brand-600);
  font-size: 15px;
  transition: transform var(--dur) var(--ease);
}

.accordion__trigger[aria-expanded="true"] .accordion__icon {
  transform: rotate(45deg);
}

.accordion__panel {
  padding: 0 16px 16px;
  font-size: 13.5px;
  color: var(--text-600);
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}

.accordion__panel[hidden] {
  display: none;
}

/* ==========================================================================
   17. 首页英雄区
   ========================================================================== */
.hero {
  display: grid;
  gap: var(--space-8);
  align-items: center;
  padding: var(--space-8) 0;
}

@media (min-width: 900px) {
  .hero {
    grid-template-columns: 1.15fr 1fr;
    padding: var(--space-12) 0;
  }
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  color: var(--brand-700);
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: var(--space-4);
}

.hero__title {
  font-size: 30px;
  line-height: 1.28;
  margin-bottom: var(--space-4);
}

@media (min-width: 768px) {
  .hero__title {
    font-size: 40px;
  }
}

.hero__title .grad {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__desc {
  font-size: 15.5px;
  color: var(--text-600);
  max-width: 560px;
  margin-bottom: var(--space-6);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px dashed var(--border);
}

.hero__stat strong {
  display: block;
  font-size: 21px;
  color: var(--text-900);
  font-variant-numeric: tabular-nums;
}

.hero__stat span {
  font-size: 12.5px;
  color: var(--text-400);
}

.hero__art {
  display: flex;
  justify-content: center;
}

.hero__art svg {
  width: 100%;
  max-width: 420px;
  height: auto;
  filter: drop-shadow(0 24px 40px rgba(79, 70, 229, 0.16));
}

/* ==========================================================================
   18. 功能入口卡
   ========================================================================== */
.entry-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  text-decoration: none;
  color: inherit;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

.entry-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-100);
  text-decoration: none;
}

.entry-card__icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--brand-gradient-soft);
  color: var(--brand-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.entry-card__body {
  flex: 1;
  min-width: 0;
}

.entry-card__title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-900);
  margin: 0 0 2px;
}

.entry-card__desc {
  font-size: 12.5px;
  color: var(--text-400);
  margin: 0;
}

.entry-card__arrow {
  color: var(--text-400);
  transition: transform var(--dur) var(--ease), color var(--dur) var(--ease);
  flex-shrink: 0;
}

.entry-card:hover .entry-card__arrow {
  color: var(--brand-600);
  transform: translateX(3px);
}

/* 流程卡 */
.flow-card {
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  position: relative;
  overflow: hidden;
}

.flow-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--brand-gradient);
}

.flow-card__step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.flow-card h3 {
  font-size: 16px;
  margin-bottom: 6px;
}

.flow-card ul {
  margin: 0;
  padding-left: 1.1em;
  font-size: 13px;
  color: var(--text-600);
}

/* ==========================================================================
   19. 演示数据控制台
   ========================================================================== */
.console {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.console__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(135deg, var(--surface-inverse) 0%, var(--surface-inverse-alt) 100%);
  color: #fff;
  flex-wrap: wrap;
}

.console__header h2,
.console__header h3 {
  color: #fff;
  margin: 0;
  font-size: 16px;
}

.console__header p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: #94A3B8;
}

.console__header .badge {
  margin-left: auto;
}

.console__body {
  padding: var(--space-5);
}

.console__body[hidden] {
  display: none;
}

.console__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.console__grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
  margin-bottom: var(--space-5);
}

@media (min-width: 768px) {
  .console__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.data-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  background: var(--bg-surface);
}

.data-panel__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-900);
  margin-bottom: 10px;
}

.data-list {
  margin: 0;
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.data-list > div {
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}

.data-list > div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.data-list dt {
  color: var(--text-400);
  flex-shrink: 0;
}

.data-list dd {
  margin: 0;
  color: var(--text-900);
  font-weight: 600;
  text-align: right;
  word-break: break-all;
  font-variant-numeric: tabular-nums;
}

/* 控制台内的分区（例如"分类清除"） */
.console__section {
  padding-top: var(--space-4);
  border-top: 1px dashed var(--border);
  margin-bottom: var(--space-4);
}

/* 按钮组：演示时常用的"按需重置"操作集合 */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

/* ==========================================================================
   演示账号一键填入（登录 / 注册 / 找回密码页共用）
   ========================================================================== */
.demo-fill {
  padding: var(--space-3) var(--space-4);
  border: 1px dashed var(--brand-100);
  border-radius: var(--radius-md);
  background: var(--brand-50);
  margin-bottom: var(--space-5);
}

.demo-fill__label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand-700);
  margin-bottom: 9px;
}

.demo-fill .field__hint {
  color: var(--text-400);
  /* 该提示是"纯文本 + 行内 code"，不是"图标 + 文本"，
     用回 block 让句子自然内联流动：
     否则 flex 会把文本与 <code> 拆成独立 item，挤压后换行，
     且 gap 会在中文标点前插入多余空隙。 */
  display: block;
}

/* 双行信息按钮：上行账号、下行密码 */
.btn--chip {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding: 6px 12px;
  line-height: 1.35;
  background: var(--bg-surface);
  border-color: var(--border);
  font-weight: 500;
  text-align: left;
}

.btn--chip:hover:not(:disabled) {
  border-color: var(--brand-400);
  background: var(--bg-surface);
}

.btn__main {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-900);
  font-variant-numeric: tabular-nums;
}

.btn__sub {
  font-size: 11.5px;
  color: var(--text-400);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   20. 状态块（空 / 加载 / 成功）
   ========================================================================== */
.state-block {
  text-align: center;
  padding: var(--space-10) var(--space-4);
  color: var(--text-400);
}

.state-block__icon {
  width: 62px;
  height: 62px;
  margin: 0 auto var(--space-4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-gradient-soft);
  color: var(--brand-600);
}

.state-block__icon--success {
  background: var(--success-bg);
  color: var(--success);
}

.state-block__icon--danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.state-block__icon--warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.state-block h3 {
  margin-bottom: 6px;
}

/* 状态块标题（不占用 h1，保证每页只有一个 H1） */
.state-block__title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-900);
  margin: 0 0 6px;
  line-height: 1.35;
}

.state-block p {
  font-size: 13.5px;
  max-width: 460px;
  margin: 0 auto var(--space-4);
}

/* 页面级加载遮罩 */
.page-loading {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  background: var(--overlay);
  backdrop-filter: blur(3px);
  color: var(--text-400);
  font-size: 13.5px;
}

.page-loading[hidden] {
  display: none;
}

.page-loading__spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--brand-100);
  border-top-color: var(--brand-600);
  border-radius: 50%;
  animation: spin 720ms linear infinite;
}

/* ==========================================================================
   21. 锚点侧栏（业务逻辑页）
   ========================================================================== */
.toc {
  position: sticky;
  top: 86px;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  font-size: 13px;
  display: none;
}

@media (min-width: 1024px) {
  .toc {
    display: block;
  }
}

.toc__title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-400);
  margin-bottom: var(--space-3);
  font-weight: 600;
}

.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc li {
  margin: 0;
}

.toc a {
  display: block;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-600);
  border-left: 2px solid transparent;
}

.toc a:hover {
  background: var(--brand-50);
  color: var(--brand-700);
  text-decoration: none;
}

.toc a.is-active {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 600;
  border-left-color: var(--brand-600);
}

/* ==========================================================================
   面包屑导航 + HTML 站点地图（层级树）
   --------------------------------------------------------------------------
   面包屑不只是给人看的：它同时声明了页面在整个站点里的层级归属。
   爬虫顺着「首页 › 分组 › 当前页」这条链接链自上而下抓取，层级权重也
   随之内链传递，这正是 XML sitemap（扁平列表）表达不出来的部分。
   ========================================================================== */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  color: var(--text-400);
  margin-bottom: var(--space-4);
}

.breadcrumb a {
  color: var(--text-600);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--brand-700);
  text-decoration: underline;
}

.breadcrumb__sep {
  color: var(--text-400);
  user-select: none;
}

.breadcrumb__current {
  color: var(--text-900);
  font-weight: 600;
}

/* 站点地图层级树：每一条都带「面包屑路径 + 收录状态」 */
.sitemap-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-3);
}

.sitemap-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  padding: var(--space-4);
  transition: border-color 0.18s var(--ease), transform 0.18s var(--ease);
}

.sitemap-item:hover {
  border-color: var(--brand-600);
  transform: translateY(-1px);
}

.sitemap-item__crumb {
  display: block;
  font-size: 12px;
  color: var(--text-400);
  margin-bottom: 4px;
}

.sitemap-item__link {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--brand-700);
  text-decoration: none;
}

.sitemap-item__link:hover {
  text-decoration: underline;
}

.sitemap-item__desc {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: var(--text-600);
}

.sitemap-item__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

/* 章节区块 */
.section {
  margin-bottom: var(--space-10);
  scroll-margin-top: 88px;
}

.section__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 21px;
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--space-5);
}

.section__title::before {
  content: "";
  width: 4px;
  height: 20px;
  border-radius: var(--radius-pill);
  background: var(--brand-gradient);
  flex-shrink: 0;
}

.subsection-title {
  font-size: 15.5px;
  color: var(--text-900);
  margin: var(--space-6) 0 var(--space-3);
}

/* ==========================================================================
   22. 工具类
   ========================================================================== */
.text-center {
  text-align: center;
}
.text-muted {
  color: var(--text-400);
}
.text-small {
  font-size: 12.5px;
}
.text-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.text-danger {
  color: var(--danger);
}
.text-success {
  color: var(--success);
}
.text-warning {
  color: var(--warning);
}
.text-strong {
  color: var(--text-900);
  font-weight: 600;
}

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.flex {
  display: flex;
}
.flex-wrap {
  flex-wrap: wrap;
}
.items-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.gap-2 {
  gap: var(--space-2);
}
.gap-3 {
  gap: var(--space-3);
}
.gap-4 {
  gap: var(--space-4);
}

.section-desc {
  font-size: 14px;
  color: var(--text-600);
  max-width: 780px;
  margin-bottom: var(--space-5);
}

.note {
  padding: 12px 14px;
  border-left: 3px solid var(--brand-500);
  background: var(--brand-50);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13.5px;
  color: var(--text-700);
  margin-bottom: var(--space-4);
}

.note--warning {
  border-left-color: var(--warning);
  background: var(--warning-bg);
}

.note--danger {
  border-left-color: var(--danger);
  background: var(--danger-bg);
}

.code-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--space-2);
  font-size: 13px;
}

.code-list li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  margin: 0;
}

.code-list code {
  flex-shrink: 0;
}

/* 事件流水（埋点展示） */
.event-stream {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-inverse);
  padding: var(--space-3);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: #94A3B8;
}

.event-stream__item {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 2px 0;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.18);
}

/* 带参数的事件：用原生 <details> 实现可展开明细，天然支持键盘与读屏 */
.event-stream__item--expandable,
.event-stream__item--expandable[open] {
  display: block;
}

.event-stream__item--expandable > summary {
  display: flex;
  gap: 8px;
  align-items: baseline;
  cursor: pointer;
  list-style: none;
  border-radius: var(--radius-xs);
}

.event-stream__item--expandable > summary::-webkit-details-marker {
  display: none;
}

.event-stream__item--expandable > summary:hover {
  background: rgba(148, 163, 184, 0.1);
}

.event-stream__item--expandable > summary::after {
  content: "▸";
  color: #64748B;
  flex-shrink: 0;
  transition: transform var(--dur-fast) var(--ease);
}

.event-stream__item--expandable[open] > summary::after {
  content: "▾";
}

/* 参数摘要（收起时的一行提示） */
.event-stream__brief {
  flex: 1;
  min-width: 0;
  color: #64748B;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 展开后的 payload 明细 */
.event-stream__payload {
  margin: 6px 0 6px 14px;
  padding: 8px 10px;
  background: rgba(148, 163, 184, 0.1);
  border-left: 2px solid var(--brand-500);
  border-radius: var(--radius-xs);
  color: #CBD5E1;
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
}

.event-stream__item:last-child {
  border-bottom: none;
}

.event-stream__time {
  color: #64748B;
  flex-shrink: 0;
}

.event-stream__name {
  color: #A5B4FC;
  font-weight: 600;
}

.event-stream__empty {
  color: #64748B;
  font-style: italic;
}

/* ==========================================================================
   23. 404 页
   ========================================================================== */
.error-code {
  font-size: 84px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: var(--space-4);
}

@media (min-width: 768px) {
  .error-code {
    font-size: 120px;
  }
}

/* ==========================================================================
   24. 全局演示控制条（所有页面左下角常驻）
   --------------------------------------------------------------------------
   由 ui.js 在运行时注入 DOM，因此各页面 HTML 无需改动。
   位置选左下角：桌面端 toast 在右上、移动端 toast 在底部整条，
   左下角是唯一不与两者冲突的区域。
   ========================================================================== */
.demo-dock {
  position: fixed;
  left: var(--space-4);
  bottom: var(--space-4);
  z-index: 250;
  font-size: 13px;
}

/* 收起态的悬浮按钮 */
.demo-dock__fab {
  position: relative;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--surface-inverse);
  color: #E2E8F0;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}

.demo-dock__fab:hover {
  transform: translateY(-2px) scale(1.03);
  background: var(--surface-inverse-alt);
}

.demo-dock__fab[aria-expanded="true"] {
  background: var(--brand-gradient);
  color: #fff;
}

.demo-dock__fab-icon {
  display: inline-flex;
}

/* 开启"模拟网络异常"时按钮上显示一个警示点 */
.demo-dock__fab-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--warning);
  border: 2px solid var(--surface-inverse);
  opacity: 0;
  transform: scale(0.5);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.demo-dock.is-alert .demo-dock__fab-dot {
  opacity: 1;
  transform: scale(1);
  animation: dockPulse 1.6s var(--ease) infinite;
}

@keyframes dockPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
  }
}

/* 展开面板 */
.demo-dock__panel {
  position: absolute;
  left: 0;
  bottom: 60px;
  width: min(330px, calc(100vw - 32px));
  padding: var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transform-origin: left bottom;
  animation: dockIn var(--dur) var(--ease) both;
}

.demo-dock__panel[hidden] {
  display: none;
}

@keyframes dockIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.demo-dock__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.demo-dock__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-900);
}

.demo-dock__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 9px 0;
  border-top: 1px dashed var(--border);
}

.demo-dock__status {
  margin: var(--space-2) 0 var(--space-3);
  padding-top: var(--space-2);
  border-top: 1px dashed var(--border);
}

.demo-dock__actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.demo-dock__actions .btn {
  flex: 1 1 auto;
}

/* ==========================================================================
   25. 响应式细节与降级
   ========================================================================== */
@media (max-width: 640px) {
  h1 {
    font-size: 24px;
  }
  h2 {
    font-size: 19px;
  }
  .site-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
    padding-bottom: 8px;
    overflow-x: auto;
  }
  .site-nav__link {
    flex-shrink: 0;
  }
  .toast-stack {
    top: auto;
    /* 上移给左下角的全局演示控制条让位，避免两者重叠 */
    bottom: 80px;
    right: var(--space-4);
    left: var(--space-4);
    width: auto;
  }
  .auth-card {
    border-radius: var(--radius-lg);
  }
  .step__text {
    display: none;
  }
  .step__line {
    min-width: 8px;
  }
  .flow {
    padding: var(--space-4) var(--space-3);
  }
}

/* 尊重系统的"减少动效"偏好 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* 高对比度模式下保证边框可见 */
@media (forced-colors: active) {
  .btn,
  .input,
  .card,
  .toast {
    border: 1px solid CanvasText;
  }
}
