/* ============================================================
   Auxin 进销存 · 设计系统 (Enterprise Grade UI)
   设计语言：克制的奢华 · 系统性 · 有温度的专业感
   参考：Material 3 / Apple HIG / Fluent / 大厂 B 端审美
   ============================================================ */

:root {
  /* —— 品牌主色：靛蓝 Indigo，专业且高级 —— */
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-700: #3730a3;
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-glow: rgba(79, 70, 229, .35);

  /* —— 中性色阶（带蓝调的 slate，更精致） —— */
  --bg: #f5f6fb;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #eef1ff 0%, transparent 55%),
             radial-gradient(900px 500px at -10% 110%, #f0f9ff 0%, transparent 50%);
  --surface: #ffffff;
  --surface-2: #f3f5fa;
  --surface-3: #eaeef6;
  --text: #0f1629;
  --text-2: #4a5269;
  --muted: #8b93a7;
  --border: #e7eaf2;
  --border-strong: #d6dbe8;

  /* —— 侧边栏（深空蓝黑，玻璃质感） —— */
  --side: #0e1326;
  --side-2: #161d36;
  --side-grad: linear-gradient(180deg, #141a30 0%, #0e1326 100%);
  --side-text: #b6bdce;
  --side-text-2: #6f7896;
  --side-hover: rgba(255, 255, 255, .07);
  --side-active: rgba(255, 255, 255, .12);

  /* —— 状态色 —— */
  --ok: #10b981;        --ok-bg: #e7f8f1;     --ok-text: #047857;
  --warn: #f59e0b;      --warn-bg: #fef3e2;    --warn-text: #b45309;
  --danger: #ef4444;    --danger-bg: #fdeaea;  --danger-text: #b91c1c;
  --info: #3b82f6;      --info-bg: #e8f1fe;    --info-text: #1d4ed8;

  /* —— 圆角（统一节奏） —— */
  --r-xs: 6px; --r-sm: 8px; --r: 10px; --r-md: 12px;
  --r-lg: 16px; --r-xl: 20px; --r-2xl: 24px; --r-full: 999px;

  /* —— 阴影（克制双层） —— */
  --sh-1: 0 1px 2px rgba(16, 22, 41, .04), 0 1px 3px rgba(16, 22, 41, .06);
  --sh-2: 0 6px 16px -4px rgba(16, 22, 41, .10), 0 2px 6px -2px rgba(16, 22, 41, .05);
  --sh-3: 0 16px 32px -10px rgba(16, 22, 41, .16);
  --sh-pop: 0 24px 56px -16px rgba(16, 22, 41, .30);
  --sh-glow: 0 10px 30px -8px var(--primary-glow);

  /* —— 动效曲线 —— */
  --ease: cubic-bezier(.2, 0, 0, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --dur: 220ms;

  /* —— 字体 —— */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* —— 暗色模式 —— */
[data-theme="dark"] {
  --bg: #0a0d18;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #161b33 0%, transparent 55%),
             radial-gradient(900px 500px at -10% 110%, #0e1830 0%, transparent 50%);
  --surface: #141a2b;
  --surface-2: #1b2238;
  --surface-3: #232c46;
  --text: #e8ebf5;
  --text-2: #a7afc6;
  --muted: #6c7593;
  --border: #232c44;
  --border-strong: #313c5c;
  --side: #070a14;
  --side-2: #0e1326;
  --side-text: #aab2c8;
  --side-text-2: #646d8a;
  --side-hover: rgba(255, 255, 255, .06);
  --side-active: rgba(255, 255, 255, .10);
  --ok-bg: #0e2b22;   --ok-text: #34d399;
  --warn-bg: #2c2110; --warn-text: #fbbf24;
  --danger-bg: #2c1414; --danger-text: #f87171;
  --info-bg: #10203a; --info-text: #60a5fa;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
  --sh-2: 0 8px 20px -6px rgba(0, 0, 0, .5);
  --sh-3: 0 18px 40px -12px rgba(0, 0, 0, .6);
  --sh-pop: 0 30px 60px -16px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg); background-image: var(--bg-grad); background-attachment: fixed;
  color: var(--text); font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "tnum";
}
::selection { background: var(--primary-100); color: var(--primary-700); }

/* 滚动条 */
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

.app { display: flex; min-height: 100vh; }

/* ============================================================
   侧边栏
   ============================================================ */
.sidebar {
  width: 244px; background: var(--side-grad); color: var(--side-text);
  display: flex; flex-direction: column; flex-shrink: 0;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
  border-right: 1px solid rgba(255, 255, 255, .06);
}
.sidebar .brand {
  display: flex; align-items: center; gap: 12px; padding: 20px 20px 18px;
  font-size: 17px; font-weight: 700; color: #fff; letter-spacing: -.02em;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  position: relative; cursor: pointer; transition: opacity .15s ease;
}
.sidebar .brand:hover { opacity: .82; }
.sidebar .brand:active { opacity: .65; }
.sidebar .brand .logo {
  width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  display: grid; place-items: center; position: relative;
  box-shadow: 0 6px 16px -4px var(--primary-glow);
}
.sidebar .brand .logo::after {
  content: ''; position: absolute; inset: 0; border-radius: 11px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3);
}
.sidebar .brand .logo svg { position: relative; z-index: 1; }
.sidebar .brand small { display: block; font-size: 10.5px; font-weight: 500; color: var(--side-text-2); letter-spacing: .04em; margin-top: 1px; }

.nav { flex: 1; overflow-y: auto; padding: 12px 12px; }
.nav-group { margin-bottom: 4px; }
.nav .group-title {
  cursor: pointer; user-select: none; padding: 11px 12px;
  font-size: 11px; letter-spacing: .09em; color: var(--side-text-2);
  text-transform: uppercase; font-weight: 700;
  display: flex; align-items: center; gap: 9px;
  border-radius: var(--r-sm); transition: background .15s, color .15s;
}
.nav .group-title:hover { background: var(--side-hover); color: var(--side-text); }
.nav .gc-dot { display: none; }
.nav .gc-ic {
  width: 18px; height: 18px; flex-shrink: 0; color: var(--gc);
  display: grid; place-items: center; opacity: .9;
}
.nav .gc-ic svg { width: 17px; height: 17px; }
.nav .gc-text { flex: 1; }
.nav .gc-arrow { font-size: 10px; transition: transform .25s var(--ease); opacity: .45; }
.nav-group.collapsed .gc-arrow { transform: rotate(-90deg); }
.nav-group .nav-group-body {
  overflow: hidden; transition: max-height .3s var(--ease), opacity .2s ease;
  max-height: 700px; opacity: 1; padding: 3px 0 5px;
}
.nav-group.collapsed .nav-group-body { max-height: 0; opacity: 0; padding: 0; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px 9px 30px;
  color: var(--side-text); text-decoration: none; font-size: 13.5px; font-weight: 500;
  border-radius: var(--r-sm); transition: all .15s var(--ease); margin-bottom: 2px; position: relative;
}
.nav a::before {
  content: ''; position: absolute; left: 18px; top: 50%; width: 5px; height: 5px;
  border-radius: 50%; background: var(--gc); opacity: .35; transform: translateY(-50%);
  transition: opacity .15s, transform .15s;
}
.nav a:hover { background: var(--side-hover); color: #eef1f8; }
.nav a:hover::before { opacity: .7; }
.nav a.active {
  background: linear-gradient(100deg, color-mix(in srgb, var(--gc) 30%, transparent), color-mix(in srgb, var(--gc) 12%, transparent));
  color: #fff; font-weight: 600;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gc) 30%, transparent);
}
.nav a.active::after {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 4px 4px 0; background: var(--gc);
  box-shadow: 0 0 12px var(--gc);
}
.nav a.active::before { opacity: 1; box-shadow: 0 0 8px var(--gc); transform: translateY(-50%) scale(1.2); }
.nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; }

/* 侧边栏底部：同步指示 + 用户卡 */
.sync {
  padding: 12px 18px; font-size: 12px; color: var(--side-text-2);
  border-top: 1px solid rgba(255, 255, 255, .06);
  display: flex; align-items: center; gap: 8px;
}
.sync .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(16, 185, 129, .22); }
.side-user {
  padding: 12px 14px; display: flex; align-items: center; gap: 11px;
  border-top: 1px solid rgba(255, 255, 255, .06);
}
.side-user .avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  box-shadow: 0 4px 12px -2px var(--primary-glow);
}
.side-user .u-meta { min-width: 0; line-height: 1.3; }
.side-user .u-name { color: #fff; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .u-role { color: var(--side-text-2); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================
   主区域
   ============================================================ */
.main { flex: 1; margin-left: 244px; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px; background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar .lead { display: flex; align-items: center; gap: 14px; min-width: 0; }
.hamburger { display: none; background: none; border: none; cursor: pointer; color: var(--text); padding: 4px; border-radius: var(--r-sm); }
.hamburger:hover { background: var(--surface-2); }
.topbar .crumb { display: flex; flex-direction: column; min-width: 0; }
.topbar h1 { font-size: 19px; margin: 0; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.topbar .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.topbar .actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.top-search {
  position: relative; display: flex; align-items: center;
}
.top-search input {
  width: 240px; height: 38px; padding: 0 14px 0 38px; border-radius: var(--r-full);
  background: var(--surface-2); border: 1px solid transparent; color: var(--text);
  font-size: 13.5px; transition: all .18s var(--ease);
}
.top-search input:focus { outline: none; background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); width: 280px; }
.top-search svg { position: absolute; left: 13px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }

.top-ic-btn {
  width: 38px; height: 38px; border-radius: var(--r-full); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); cursor: pointer; display: grid; place-items: center;
  transition: all .15s var(--ease); position: relative;
}
.top-ic-btn:hover { color: var(--primary); border-color: var(--primary-100); background: var(--primary-50); transform: translateY(-1px); }
.top-ic-btn svg { width: 18px; height: 18px; }
.top-ic-btn .badge-dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--surface); }

.top-user { display: flex; align-items: center; gap: 9px; padding: 4px 6px 4px 4px; border-radius: var(--r-full); cursor: pointer; transition: background .15s; }
.top-user:hover { background: var(--surface-2); }
.top-user .avatar {
  width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.top-user .u-name { font-size: 13.5px; font-weight: 600; line-height: 1.2; }
.top-user .u-role { font-size: 11px; color: var(--muted); line-height: 1.2; }

.content { padding: 20px 24px; flex: 1; }
.site-footer {
  padding: 16px 28px; text-align: center; background: transparent;
  font-size: 12px; color: var(--muted); border-top: 1px solid var(--border);
}
.site-footer a { color: var(--muted); text-decoration: none; transition: color .15s; }
.site-footer a:hover { color: var(--primary); text-decoration: underline; }
.scrim { display: none; }

/* 页面进场动画（交错淡入） */
.content > * { animation: rise .5s var(--ease) both; }
.content > *:nth-child(2) { animation-delay: .04s; }
.content > *:nth-child(3) { animation-delay: .08s; }
.content > *:nth-child(4) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============================================================
   卡片 / 网格
   ============================================================ */
.grid { display: grid; gap: 18px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 22px;
  box-shadow: var(--sh-1); transition: box-shadow .25s var(--ease), transform .25s var(--ease), border-color .25s;
  position: relative; overflow: hidden;
}
.card:hover { box-shadow: var(--sh-2); transform: translateY(-3px); border-color: var(--border-strong); }

/* stat 统计卡：图标 + 数值 */
.card.stat { display: flex; align-items: flex-start; gap: 16px; }
.card.stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; opacity: .9; }
.cards .card.stat:nth-child(8n+1)::before { background: #6366f1; }
.cards .card.stat:nth-child(8n+2)::before { background: #0ea5e9; }
.cards .card.stat:nth-child(8n+3)::before { background: #f59e0b; }
.cards .card.stat:nth-child(8n+4)::before { background: #ec4899; }
.cards .card.stat:nth-child(8n+5)::before { background: #10b981; }
.cards .card.stat:nth-child(8n+6)::before { background: #8b5cf6; }
.cards .card.stat:nth-child(8n+7)::before { background: #06b6d4; }
.cards .card.stat:nth-child(8n)::before { background: #ef4444; }

.stat-ic {
  width: 46px; height: 46px; border-radius: 13px; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; box-shadow: var(--sh-2);
}
.stat-ic svg { width: 23px; height: 23px; }
.cards .card.stat:nth-child(8n+1) .stat-ic { background: linear-gradient(135deg, #6366f1, #818cf8); }
.cards .card.stat:nth-child(8n+2) .stat-ic { background: linear-gradient(135deg, #0ea5e9, #38bdf8); }
.cards .card.stat:nth-child(8n+3) .stat-ic { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.cards .card.stat:nth-child(8n+4) .stat-ic { background: linear-gradient(135deg, #ec4899, #f472b6); }
.cards .card.stat:nth-child(8n+5) .stat-ic { background: linear-gradient(135deg, #10b981, #34d399); }
.cards .card.stat:nth-child(8n+6) .stat-ic { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }
.cards .card.stat:nth-child(8n+7) .stat-ic { background: linear-gradient(135deg, #06b6d4, #22d3ee); }
.cards .card.stat:nth-child(8n) .stat-ic { background: linear-gradient(135deg, #ef4444, #f87171); }

.stat .s-body { min-width: 0; flex: 1; }
.stat .label { color: var(--text-2); font-size: 13px; font-weight: 500; }
.stat .value { font-size: 27px; font-weight: 750; margin-top: 8px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .value.small { font-size: 21px; }
.stat .s-trend { display: inline-flex; align-items: center; gap: 3px; margin-top: 8px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-full); }
.stat .s-trend.up { color: var(--ok-text); background: var(--ok-bg); }
.stat .s-trend.down { color: var(--danger-text); background: var(--danger-bg); }

/* 通用面板 */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-1); margin-bottom: 18px; overflow: hidden;
}
.panel .panel-head {
  padding: 16px 22px; border-bottom: 1px solid var(--border);
  font-weight: 650; font-size: 14.5px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.panel .panel-head .ph-actions { display: flex; gap: 8px; }
.panel .panel-body { padding: 22px; }

/* 区块标题 */
.section-title { font-size: 16px; font-weight: 700; margin: 2px 0 14px; letter-spacing: -.01em; display: flex; align-items: center; gap: 9px; }
.section-title::before { content: ''; width: 4px; height: 16px; border-radius: 4px; background: linear-gradient(var(--primary), #7c3aed); }

/* ============================================================
   表格
   ============================================================ */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; table-layout: auto; }
/* 仅当列显式定义了宽度时才启用固定布局，避免无宽度的列表被强制等宽平分而错乱 */
.table-wrap table.fixed { table-layout: fixed; }
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--sh-1); }
.table-wrap table { margin: 0; }
th, td {
  padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-variant-numeric: tabular-nums; /* 数字等宽，金额/数量纵向对齐更专业 */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
th {
  background: var(--surface-2); color: var(--text-2);
  font-weight: 600; font-size: 12px; letter-spacing: .02em; white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
  border-bottom: 1.5px solid var(--border-strong); /* 表头与表体更清晰的分隔 */
  overflow: hidden; text-overflow: ellipsis;
}
th:first-child { border-top-left-radius: var(--r-lg); }
th:last-child { border-top-right-radius: var(--r-lg); }
/* 首列（单号/名称）略加重，建立阅读层级 */
td:first-child { font-weight: 550; color: var(--text); }
tbody tr { transition: background .12s var(--ease); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.row-clickable { cursor: pointer; }
tbody tr.row-clickable:hover { background: var(--primary-50); }
/* 数字列：等宽 + 右对齐 */
td.num, th.num, td.amount-cell, th.amount-cell { text-align: right; font-variant-numeric: tabular-nums; }
td.amount-cell { font-weight: 600; color: var(--text); }
/* 单号/编码类：等宽字体、弱化，作为次要标识 */
td.code { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-2); letter-spacing: .01em; }
.line-total { font-weight: 600; }

/* 操作列：按钮横向排列，不换行 */
.actions-cell { display: flex; gap: 4px; flex-wrap: nowrap; align-items: center; justify-content: flex-start; }
.actions-cell .btn { flex: 0 0 auto; }

/* ============================================================
   表单 / 输入
   ============================================================ */
label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 550; }
input, select, textarea {
  width: 100%; height: 42px; padding: 0 13px;
  border: 1.5px solid var(--border-strong); border-radius: var(--r);
  font-size: 14px; font-family: inherit; background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 11px 13px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-50);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
select { 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='%238b93a7' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 36px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.field { margin-bottom: 4px; }

/* 弹窗内表单统一改为 label 左 / 控件右 的横向网格 */
.modal-body .field {
  display: flex; align-items: center; gap: 10px;
}
.modal-body .field label {
  width: 96px; flex-shrink: 0;
  margin-bottom: 0; text-align: right;
  line-height: 1.3;
}
.modal-body .field input,
.modal-body .field select,
.modal-body .field textarea,
.modal-body .field > div:last-child {
  flex: 1; min-width: 0;
}
/* 查看模式下纯文本值垂直居中 */
.modal-body .field > div:last-child {
  min-height: 42px; display: flex; align-items: center;
  color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums;
}
/* 弹窗内字段横向铺开为多列网格（窄弹窗自动退化为单列，但字段内部仍横排） */
.modal-body .form-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px 20px;
}
/* 长文本/备注字段跨整行 */
.modal-body .field-textarea {
  grid-column: 1 / -1; align-items: flex-start;
}
.modal-body .field-textarea > div:last-child { align-items: flex-start; padding-top: 10px; }
.modal-body .field textarea {
  height: auto; min-height: 72px; padding: 11px 13px; margin: 0;
}
/* disabled 控件在 flex 下保持可读 */
.modal-body .field input:disabled,
.modal-body .field select:disabled,
.modal-body .field textarea:disabled {
  background: var(--surface-2); color: var(--text-2);
}

/* 按钮系统 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 18px; border: 1.5px solid transparent; border-radius: var(--r);
  font-size: 13.5px; cursor: pointer; background: var(--primary); color: #fff;
  font-weight: 600; letter-spacing: -.01em; white-space: nowrap;
  transition: all .15s var(--ease);
}
.btn:hover { background: var(--primary-600); transform: translateY(-1px); box-shadow: var(--sh-glow); }
.btn:active { transform: translateY(0) scale(.98); background: var(--primary-700); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-50); }
.btn svg { width: 16px; height: 16px; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--sh-1); }
.btn.secondary:hover { background: var(--surface-2); border-color: var(--muted); box-shadow: var(--sh-1); transform: translateY(-1px); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: #dc2626; box-shadow: 0 8px 20px -6px rgba(239, 68, 68, .5); }
.btn.danger.ghost { background: transparent; color: var(--danger); border-color: transparent; }
.btn.danger.ghost:hover { background: var(--danger-bg); box-shadow: none; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12px; border-radius: var(--r-sm); }
.btn.ghost { background: transparent; color: var(--primary); border-color: transparent; }
.btn.ghost:hover { background: var(--primary-50); transform: none; box-shadow: none; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar input { max-width: 280px; }
.filter-bar .flabel { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.filter-bar select, .filter-bar input[type="date"], .filter-bar input:not([type]) { min-width: 128px; }
.summary-bar { display: flex; gap: 24px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 13px 18px; margin-bottom: 16px; font-size: 13px; color: var(--muted); box-shadow: var(--sh-1); flex-wrap: wrap; }
.summary-bar span { display: inline-flex; align-items: center; }
.summary-bar b { color: var(--text); font-size: 16px; margin-left: 6px; font-variant-numeric: tabular-nums; }
.summary-bar b.amt { color: var(--danger); }

/* ============================================================
   徽标 / 标签
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px 3px 9px; border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em; line-height: 1.6;
  border: 1px solid transparent; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .6; flex-shrink: 0; }
.badge.muted::before { opacity: .35; }
.badge.ok { background: var(--ok-bg); color: var(--ok-text); }
.badge.warn { background: var(--warn-bg); color: var(--warn-text); }
.badge.muted { background: var(--surface-3); color: var(--muted); }
.badge.danger { background: var(--danger-bg); color: var(--danger-text); }
.badge.info { background: var(--info-bg); color: var(--info-text); }

/* ============================================================
   详情展示（键值卡片网格）
   ============================================================ */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px 22px;
}
.kv {
  display: flex; flex-direction: column; gap: 5px;
  min-width: 0; padding: 12px 14px;
  background: var(--surface-2); border-radius: var(--r-md);
  border: 1px solid var(--border);
  transition: background .15s, border-color .15s;
}
.kv:hover { background: var(--surface-3); border-color: var(--border-strong); }
.kv-label {
  font-size: 11.5px; color: var(--muted); font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
}
.kv-value {
  font-size: 14px; color: var(--text); font-weight: 650;
  line-height: 1.45; word-break: break-word;
  font-variant-numeric: tabular-nums;
  min-height: 20px;
}
.kv-value.muted { color: var(--text-2); font-weight: 500; }
.kv-right { text-align: right; align-items: flex-end; }
.kv-right .kv-value { font-weight: 700; color: var(--text); }
.kv-full { grid-column: 1 / -1; }
.kv-value .badge { margin-top: 2px; }

/* 弹窗内明细表格 */
.detail-table { margin-top: 22px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); }
.detail-table table { margin: 0; table-layout: fixed; }
.detail-table th { background: var(--surface-2); font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; padding: 11px 14px; }
.detail-table td { padding: 11px 14px; }
.detail-table td:first-child { font-weight: 500; }

/* ============================================================
   弹窗
   ============================================================ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 19, 38, .42);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; z-index: 60; padding: 24px;
  animation: maskIn .2s ease;
}
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: var(--r-xl); width: 100%;
  max-width: 720px; max-height: 90vh; overflow: auto; border: 1px solid var(--border);
  box-shadow: var(--sh-pop); animation: modalIn .28s var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
.modal .modal-head {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 16.5px; letter-spacing: -.01em;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  position: sticky; top: 0; background: var(--surface); z-index: 2;
}
.modal .modal-body { padding: 24px; }
.modal .modal-foot {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2);
  position: sticky; bottom: 0;
}
.modal .x {
  cursor: pointer; border: none; background: var(--surface-2);
  font-size: 18px; color: var(--text-2); width: 34px; height: 34px;
  border-radius: var(--r-sm); display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s; flex-shrink: 0; line-height: 1;
}
.modal .x:hover { background: var(--danger-bg); color: var(--danger); }

/* ============================================================
   Toast 提示
   ============================================================ */
.toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--side); color: #fff; padding: 13px 18px;
  border-radius: var(--r-md); font-size: 13.5px; font-weight: 550;
  box-shadow: var(--sh-pop); animation: slideIn .3s var(--ease);
  max-width: 360px; border: 1px solid rgba(255, 255, 255, .08);
  display: flex; align-items: center; gap: 9px;
}
.toast::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); flex-shrink: 0; box-shadow: 0 0 8px var(--primary); }
.toast.ok { background: var(--ok); } .toast.ok::before { background: #fff; box-shadow: none; }
.toast.err { background: var(--danger); } .toast.err::before { background: #fff; box-shadow: none; }
@keyframes slideIn { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============================================================
   仪表盘：快捷入口
   ============================================================ */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.quick {
  display: flex; align-items: center; gap: 13px; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  text-decoration: none; color: var(--text); transition: all .2s var(--ease); cursor: pointer;
}
.quick:hover { border-color: var(--primary-100); box-shadow: var(--sh-2); transform: translateY(-2px); background: var(--primary-50); }
.quick .q-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.quick .q-ic svg { width: 20px; height: 20px; }
.quick .q-text { font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.quick .q-sub { font-size: 11.5px; color: var(--muted); }

/* ============================================================
   登录页（分栏）
   ============================================================ */
.login-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; grid-template-rows: 1fr auto;
  background: var(--side-grad);
}
.login-hero {
  grid-row: 1; grid-column: 1;
  position: relative; display: flex; flex-direction: column; justify-content: space-between;
  padding: 56px 60px; color: #fff; overflow: hidden;
}
.login-hero::before {
  content: ''; position: absolute; width: 540px; height: 540px; border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 58, 237, .45), transparent 65%);
  top: -160px; right: -120px; filter: blur(10px);
}
.login-hero::after {
  content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 70, 229, .35), transparent 65%);
  bottom: -150px; left: -100px; filter: blur(10px);
}
.login-hero .lh-top { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; }
.login-hero .lh-logo {
  width: 46px; height: 46px; border-radius: 13px; background: linear-gradient(135deg, var(--primary), #7c3aed);
  display: grid; place-items: center; box-shadow: 0 8px 24px -6px var(--primary-glow);
}
.login-hero .lh-brand { font-size: 22px; font-weight: 750; letter-spacing: -.02em; }
.login-hero .lh-brand small { display: block; font-size: 12px; font-weight: 500; color: var(--side-text-2); letter-spacing: .08em; margin-top: 2px; }
.login-hero .lh-mid { position: relative; z-index: 1; max-width: 440px; }
.login-hero .lh-title { font-size: 38px; font-weight: 750; line-height: 1.18; letter-spacing: -.03em; margin: 0 0 16px; }
.login-hero .lh-desc { font-size: 15px; color: var(--side-text); line-height: 1.7; }
.login-hero .lh-feats { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.login-hero .lh-feat { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: var(--r-full); background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); font-size: 13px; color: var(--side-text); }
.login-hero .lh-feat svg { width: 15px; height: 15px; color: #a78bfa; }
.login-hero .lh-foot { position: relative; z-index: 1; font-size: 12px; color: var(--side-text-2); }

/* 整页底部居中版权栏（横跨两栏） */
.login-foot {
  grid-row: 2; grid-column: 1 / -1;
  display: flex; justify-content: center; align-items: center; gap: 6px;
  padding: 13px 16px; text-align: center;
  color: var(--side-text-2); font-size: 12px; letter-spacing: .02em;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.login-foot a { color: #c7d2fe; text-decoration: none; transition: color .15s; }
.login-foot a:hover { color: #fff; text-decoration: underline; }

.login-form { grid-row: 1; grid-column: 2; display: grid; place-items: center; padding: 40px; background: var(--bg); background-image: var(--bg-grad); }
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-2xl); padding: 44px 40px; width: 400px; max-width: 100%;
  box-shadow: var(--sh-3); animation: modalIn .4s var(--ease);
}
.login-card .lc-logo { width: 50px; height: 50px; border-radius: 14px; background: linear-gradient(135deg, var(--primary), #7c3aed); display: grid; place-items: center; box-shadow: var(--sh-glow); margin-bottom: 18px; }
.login-card h2 { margin: 0 0 6px; font-size: 25px; font-weight: 750; letter-spacing: -.03em; }
.login-card .hint { color: var(--muted); font-size: 13.5px; margin-bottom: 28px; }
.login-card .field { margin-bottom: 18px; }
.login-card .field label { font-size: 13px; }
.login-card input { height: 46px; font-size: 14.5px; }
.login-card .btn { width: 100%; height: 46px; font-size: 15px; margin-top: 6px; }
.login-card .lc-foot { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 22px; }
.login-card .lc-foot a { color: var(--primary); text-decoration: none; }
.login-footer { font-size: 12px; }
.login-footer a { color: var(--muted); text-decoration: none; transition: color .15s; }
.login-footer a:hover { color: var(--primary); text-decoration: underline; }

/* ============================================================
   杂项 / 工具类
   ============================================================ */
.muted { color: var(--muted); }
.right { text-align: right; }
.row { display: flex; gap: 10px; align-items: center; }
.wrap { flex-wrap: wrap; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--muted); padding: 72px 20px; font-size: 13.5px; text-align: center;
}
.empty svg { width: 54px; height: 54px; color: var(--border-strong); opacity: .85; }
.empty .e-title { font-weight: 600; color: var(--text-2); font-size: 14px; }
.empty .e-sub { font-size: 12.5px; color: var(--muted); max-width: 320px; }

/* 用户下拉菜单 */
.user-menu {
  position: absolute; top: 58px; right: 24px; z-index: 35;
  min-width: 168px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--sh-pop); padding: 6px;
  animation: slideIn .16s var(--ease);
}
.user-menu .um-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 10px 12px; border: none; background: none; border-radius: var(--r-sm);
  font-size: 13.5px; color: var(--text-2); cursor: pointer; font-family: inherit;
  transition: background .12s, color .12s;
}
.user-menu .um-item:hover { background: var(--surface-2); color: var(--danger); }
.user-menu .um-item svg { width: 16px; height: 16px; }

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s var(--ease); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .hamburger { display: inline-flex; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(15, 19, 38, .5); backdrop-filter: blur(2px); z-index: 39; }
  .content { padding: 16px; }
  .topbar { padding: 14px 16px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .top-search { display: none; }
  .topbar .u-role { display: none; }
  .login-wrap { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .login-hero { display: none; }
  .login-form { grid-column: 1; }
  .login-foot { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .cards { grid-template-columns: 1fr; }
  .top-user .u-name { display: none; }
}
