/* ==========================================================================
   base.css —— 设计令牌（CSS 变量）/ 重置 / 应用骨架布局
   主题：浅色 · 简洁科技风 + iOS 质感 · 中国移动蓝
   ========================================================================== */

:root {
  /* —— 品牌与语义色 —— */
  --brand: #1677ff;            /* 中国移动蓝：主色 */
  --brand-strong: #0a66ff;     /* 主色加深（active / hover 提亮用 strong） */
  --brand-weak: #e8f1ff;       /* 主色浅底 */
  --brand-weak-2: #f2f7ff;     /* 主色更浅底 */
  --up: #e34d59;               /* 中式金融：增 / 涨 / 正向 = 红 */
  --up-weak: #fdecee;
  --down: #00a870;             /* 中式金融：减 / 跌 / 负向 = 绿 */
  --down-weak: #e6f6f0;
  --warn: #ed7b2f;             /* 中风险 = 橙 */
  --warn-weak: #fdf0e5;

  /* —— 中性灰阶 —— */
  --bg: #f5f7fa;               /* 页面底色 */
  --surface: #ffffff;          /* 卡片 / 面板 */
  --surface-2: #fafbfc;        /* 次级面 */
  --border: #e5e8ee;           /* 描边 */
  --border-strong: #d5d9e0;
  --text: #1f2329;             /* 主文字 */
  --text-2: #646a73;           /* 次文字 */
  --text-3: #8f959e;           /* 弱文字 / 占位 */

  /* —— 形状与阴影 —— */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06);
  --shadow-lg: 0 8px 28px rgba(31, 35, 41, .12);
  --shadow-pop: 0 12px 40px rgba(31, 35, 41, .18);

  /* —— 尺寸 —— */
  --sidebar-w: 200px;
  --topbar-h: 56px;
  --content-max: 1400px;

  /* —— 字体 —— */
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, "Courier New", monospace;
}

/* —— reset —— */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }
img { max-width: 100%; display: block; }
::selection { background: var(--brand-weak); }

/* 滚动条精修（WebKit） */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d5d9e0; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #c0c6d0; background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* 数值等宽对齐 */
.num { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   应用骨架：登录页全屏 / 主应用 shell（侧栏 + 顶栏 + 主区）
   ========================================================================== */
.app-root { min-height: 100vh; }

/* —— 登录页 —— */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at 15% -10%, #e8f1ff 0%, rgba(232, 241, 255, 0) 60%),
    radial-gradient(900px 500px at 100% 110%, #eef4ff 0%, rgba(238, 244, 255, 0) 55%),
    var(--bg);
  padding: 32px;
}
.login-card {
  position: relative;
  width: 420px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 36px 28px;
  border: 1px solid var(--border);
  overflow: hidden;
}
/* 顶部 3px 品牌渐变条（UI 精修 P1-7） */
.login-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-strong), #5aa2ff);
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand .login-logo {
  width: 52px; height: 52px; margin: 0 auto 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 22px; font-weight: 700; letter-spacing: 1px;
  box-shadow: 0 6px 16px rgba(22, 119, 255, .32);
}
.login-brand h1 { font-size: 19px; font-weight: 600; letter-spacing: .3px; }
.login-brand .login-sub { color: var(--text-2); font-size: 13px; margin-top: 6px; }
.login-foot { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 22px; }
.login-quick { margin-top: 18px; }
.login-quick .quick-label { font-size: 12px; color: var(--text-3); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.login-quick .quick-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.quick-chip {
  position: relative; overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 8px 10px 8px 12px;
  cursor: pointer;
  transition: all 150ms ease;
  text-align: left;
}
.quick-chip::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--brand), var(--brand-strong));
  transform: scaleY(0); transform-origin: 50% 100%;
  transition: transform 180ms ease;
}
.quick-chip:hover { border-color: var(--brand); background: var(--brand-weak-2); transform: translateY(-1px); box-shadow: var(--shadow); }
.quick-chip:hover::before { transform: scaleY(1); }
.quick-chip .qc-name { font-weight: 600; font-size: 13px; }
.quick-chip .qc-role { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* —— 主应用 shell —— */
.shell { display: flex; min-height: 100vh; }

/* 侧栏 */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 30;
}
.sidebar-brand {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.sidebar-brand .brand-mark {
  width: 28px; height: 28px; border-radius: 8px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-brand .brand-text { line-height: 1.15; }
.sidebar-brand .brand-text b { font-size: 13px; display: block; }
.sidebar-brand .brand-text span { font-size: 10px; color: var(--text-3); }
.sidebar-nav { padding: 12px 10px; overflow-y: auto; flex: 1 1 auto; }
.nav-group-label { font-size: 11px; color: var(--text-3); padding: 12px 12px 6px; letter-spacing: .5px; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); cursor: pointer; margin-bottom: 2px;
  transition: all 150ms ease; font-size: 13.5px; user-select: none;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--brand-weak); color: var(--brand); font-weight: 600; }
/* 选中态左侧 3px 品牌渐变强调条（UI 精修 P0-2） */
.nav-item.active::before {
  content: "";
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--brand), var(--brand-strong));
}
/* 图标容器：内联 SVG 跟随文字色 */
.nav-item .nav-ico {
  width: 18px; height: 18px; flex: 0 0 18px;
  display: inline-flex; align-items: center; justify-content: center;
  color: inherit;
}
.nav-item .nav-ico .ico { display: block; }
.nav-item .nav-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-3); }

/* 顶栏 + 主区 */
.main { flex: 1 1 auto; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-date { color: var(--text-3); font-size: 12px; padding: 3px 10px; background: var(--bg); border-radius: 999px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.icon-btn {
  position: relative; width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; transition: all 150ms ease; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); box-shadow: var(--shadow); }
.icon-btn:active { transform: translateY(0); }
.icon-btn .badge-dot {
  position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 999px; background: var(--up); color: #fff;
  font-size: 10px; line-height: 16px; text-align: center; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--surface);
}
.user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 999px; transition: all 150ms ease; }
.user-chip:hover { background: var(--bg); }
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.user-chip .uc-meta { line-height: 1.15; }
.user-chip .uc-meta b { font-size: 13px; display: block; }
.user-chip .uc-meta span { font-size: 11px; color: var(--text-3); }

/* 内容容器 */
.content { padding: 20px 24px 40px; flex: 1 1 auto; }
.content-inner { max-width: var(--content-max); margin: 0 auto; }
/* 页面切换入场：淡入 + 轻微上移（≤250ms，UI 精修 P1-5） */
.content-inner { animation: page-in 200ms cubic-bezier(.2, .8, .2, 1) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 通用间距 */
.stack-16 > * + * { margin-top: 16px; }
.stack-12 > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--text-2); }
.muted-3 { color: var(--text-3); }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }

/* 页面标题区 */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 18px; font-weight: 600; }
.page-head .page-desc { color: var(--text-2); font-size: 12.5px; margin-top: 4px; }
.page-head .page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ==========================================================================
   可访问性 & 动效基线（UI 精修）
   ========================================================================== */

/* 内联 SVG 图标基线：垂直居中、不参与文本选择 */
.ico { display: inline-block; vertical-align: middle; flex: 0 0 auto; }
.btn .ico, .icon-btn .ico, .um-item .ico, .tag .ico, .quick-label .ico { flex: 0 0 auto; }
.um-item .ico { margin-right: 8px; color: var(--text-2); }
.um-item.um-danger .ico { color: currentColor; }
.quick-label .quick-ico { display: inline-flex; align-items: center; color: var(--brand); }
.user-chip .uc-caret { display: inline-flex; align-items: center; color: var(--text-3); margin-left: 2px; transition: color 150ms ease; }
.user-chip:hover .uc-caret { color: var(--brand); }

/* 键盘可见焦点环（鼠标点击不显示） */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: none; }

/* 登录页背景装饰（纯 CSS，无图片/外链） */
.login-wrap { position: relative; overflow: hidden; }
.login-wrap::before {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(22, 119, 255, .10) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(900px 520px at 78% 18%, #000 0%, transparent 72%);
  mask-image: radial-gradient(900px 520px at 78% 18%, #000 0%, transparent 72%);
  pointer-events: none;
}
.login-card { position: relative; z-index: 1; }

/* 金额 / 单位小字（UI 精修 P2-11） */
.money > .cur, .m-value > .cur { font-size: 60%; font-weight: 500; color: var(--text-3); margin-right: 2px; }
.unit { font-size: 12px; font-weight: 500; color: var(--text-3); margin-left: 3px; }

/* 列表错峰入场（inline animation-delay 由 JS 叠加，≤10 项） */
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.anim-up { animation: fade-up 240ms cubic-bezier(.2, .8, .2, 1) both; }

/* —— 无障碍：尊重「减少动态效果」系统设置 —— */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
