/* ==========================================================================
   base.css —— 设计变量 / 基础重置 / 通用组件
   ========================================================================== */

:root {
  /* ---- 品牌色 ---- */
  --brand-50:  #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-300: #a5b4fc;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;

  --violet-500: #8b5cf6;
  --violet-600: #7c3aed;
  --violet-700: #6d28d9;
  --cyan-500:   #06b6d4;

  /* ---- 语义色 ---- */
  --success-500: #10b981;
  --success-50:  #ecfdf5;
  --success-700: #047857;
  --warning-500: #f59e0b;
  --warning-50:  #fffbeb;
  --warning-700: #b45309;
  --danger-500:  #ef4444;
  --danger-50:   #fef2f2;
  --danger-700:  #b91c1c;
  --info-500:    #0ea5e9;
  --info-50:     #f0f9ff;
  --info-700:    #0369a1;

  /* ---- 中性色 ---- */
  --white: #ffffff;
  --n-25:  #fcfcfd;
  --n-50:  #f8fafc;
  --n-100: #f1f5f9;
  --n-200: #e8edf3;
  --n-300: #cbd5e1;
  --n-400: #94a3b8;
  --n-500: #64748b;
  --n-600: #475569;
  --n-700: #334155;
  --n-800: #1e293b;
  --n-900: #0f172a;

  /* ---- 文本 ---- */
  --text-strong: #0f172a;
  --text:        #334155;
  --text-muted:  #64748b;
  --text-faint:  #94a3b8;

  /* ---- 背景 / 描边 ---- */
  --bg-body:       #f6f8fc;
  --bg-card:       #ffffff;
  --border:        #e7ecf3;
  --border-strong: #d7e0ea;

  /* ---- 圆角 ---- */
  --amount-up:   #dc2626;
  --amount-down: #059669;

  /* ---- 阴影 ---- */
  --solid-danger-1: #ef4444;
  --solid-danger-2: #dc2626;
  --solid-danger-3: #b91c1c;
  --solid-ok-1:     #22a06b;
  --solid-brand-1:  #7c3aed;
  --solid-brand-2:  #6d28d9;

  /* ---- 动效 ---- */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 999px;

  /* ---- 渐变 ---- */
  --sh-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --sh-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --sh-md: 0 6px 18px rgba(15, 23, 42, .07);
  --sh-lg: 0 18px 44px rgba(15, 23, 42, .12);
  --sh-brand: 0 10px 26px rgba(99, 102, 241, .34);

  /* 原注释丢失（见 .theme-backup/static-src.tar） */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur: .22s;

  /* 原注释丢失（见 .theme-backup/static-src.tar） */
  --grad-brand: linear-gradient(135deg, #6366f1 0%, #8b5cf6 58%, #a855f7 100%);
  --grad-brand-hover: linear-gradient(135deg, #5457e5 0%, #7c3aed 58%, #9333ea 100%);
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, figure { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; padding: 0; }
input, select, textarea { font: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
svg { display: block; }
img { max-width: 100%; display: block; }
table { border-collapse: collapse; width: 100%; }

::selection { background: var(--brand-200-s); color: var(--brand-700); }

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

/* ---- 滚动条 ---- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--xd5dde8-s);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: var(--xb9c6d6-s); background-clip: content-box; }

/* ==========================================================================
   按钮
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .01em;
  white-space: nowrap;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              background var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.btn:active { transform: translateY(1px); }

/* 主按钮：紫色**实心**（2026-09-28 按用户给的设计图统一全站）
   ⚠️ 原来是靛蓝渐变（--grad-brand，135deg #6366f1→#8b5cf6→#a855f7）。
   渐变在 40px 高的小按钮上几乎看不出层次，反而让「查询 / 保存」这类高频按钮显得花；
   设计图要的是**一个确定的紫色**。--grad-brand 仍然被登录页 / 侧栏 / 头像等引用，那些不动。 */
.btn-primary {
  color: var(--white);
  /* 🔴 实心主按钮：白字压在深紫上，暗色下**不能**提亮（--violet-600 会被提亮去当文字色） */
  background: var(--solid-brand-1);
  box-shadow: 0 6px 16px rgba(124, 58, 237, .26);
}
.btn-primary:hover {
  background: var(--solid-brand-2);
  box-shadow: 0 12px 26px rgba(124, 58, 237, .34);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  color: var(--n-600);
  /* 🔴 这里是**表面**不是「白字」→ 必须用 --bg-card（暗色下变深）。
     用 --white 的话暗色下按钮还是白底，而 --white 必须保持白色（品牌按钮上的白字要用）。 */
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--sh-xs);
}
.btn-ghost:hover {
  color: var(--n-800);
  border-color: var(--border-strong);
  background: var(--n-25);
}

.btn-lg { height: 46px; font-size: 15px; border-radius: var(--r-md); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .62; cursor: not-allowed; box-shadow: none; transform: none; }

/* ==========================================================================
   输入框
   ========================================================================== */
.input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  color: var(--text-strong);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              background var(--dur) var(--ease);
}
.input::placeholder { color: var(--text-faint); }
.input:hover { border-color: var(--xc6d2e0-s); }
.input:focus {
  outline: none;
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .14);
}

/* ==========================================================================
   卡片
   ========================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
}
.card__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -.01em;
}
.card__sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

/* ==========================================================================
   徽标 / 标签
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 23px;
  padding: 0 9px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.badge--success { color: var(--success-700); background: var(--success-50); }
.badge--warning { color: var(--warning-700); background: var(--warning-50); }
.badge--danger  { color: var(--danger-700);  background: var(--danger-50); }
.badge--info    { color: var(--info-700);    background: var(--info-50); }
.badge--neutral { color: var(--n-600);       background: var(--n-100); }
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ==========================================================================
   链接
   ========================================================================== */
.link {
  color: var(--brand-600);
  font-weight: 600;
  transition: color var(--dur) var(--ease);
}
.link:hover { color: var(--brand-700); }
.link--strong { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }

/* ==========================================================================
   头像
   ========================================================================== */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  color: var(--white);
  background: var(--grad-brand);
  flex: none;
  letter-spacing: .02em;
}

/* ==========================================================================
   工具类
   ========================================================================== */
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.mono { font-variant-numeric: tabular-nums; }
.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;
}

/* ==========================================================================
   主题切换按钮（夜晚模式，2026-10-01）
   两个图标都渲染出来，靠 <html data-theme> 决定显示哪一个 —— 这样
   图标状态永远和实际主题一致，不依赖 JS 再去换图标。
   （2026-10-01 用户要求取消「跟随系统」，所以没有第三个图标了。）
   ========================================================================== */
#themeBtn .ico-sun,
#themeBtn .ico-moon { display: none; }
html[data-theme="light"] #themeBtn .ico-sun,
html:not([data-theme])   #themeBtn .ico-sun { display: block; }
html[data-theme="dark"]  #themeBtn .ico-moon { display: block; }

