/* ==========================================================================
   耗材管理系统 · Apple HIG 设计系统
   纯 CSS，无外链字体 / 图标 / 框架
   ========================================================================== */

/* ---------- 设计令牌 ---------- */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --surface-3: #f2f2f4;
  --surface-4: #e9e9ed;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #8e8e93;
  --hairline: rgba(0, 0, 0, 0.08);
  --hairline-strong: rgba(0, 0, 0, 0.14);
  --hover: rgba(0, 0, 0, 0.035);
  --pressed: rgba(0, 0, 0, 0.06);

  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-text: #ffffff;
  --danger: #ff3b30;
  --danger-soft: rgba(255, 59, 48, 0.1);
  --success: #34c759;
  --success-soft: rgba(52, 199, 89, 0.12);
  --warning: #ff9500;
  --warning-soft: rgba(255, 149, 0, 0.12);
  --purple: #6c4cf1;

  --radius-card: 18px;
  --radius-ctl: 12px;
  --radius-sm: 10px;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.06), 0 24px 64px rgba(0, 0, 0, 0.16);

  --sidebar-w: 248px;
  --topbar-h: 52px;
  --field-bg: #ffffff;
  --glass-sidebar: rgba(255, 255, 255, 0.72);
  --glass-topbar: rgba(245, 245, 247, 0.72);
  --glass-card: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.55);
  --blur: blur(30px) saturate(180%);
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --dur: 220ms;
  --toast-bg: rgba(255, 255, 255, 0.86);
  --menu-bg: rgba(255, 255, 255, 0.9);
  --chart-grid: rgba(0, 0, 0, 0.06);
  --scrollbar: rgba(0, 0, 0, 0.18);
  --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 22%, transparent);
  --accent-contrast: #ffffff;
}

[data-theme="dark"] {
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --surface: #1c1c1e;
  --surface-2: #232325;
  --surface-3: #2c2c2e;
  --surface-4: #3a3a3c;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #8e8e93;
  --hairline: rgba(255, 255, 255, 0.1);
  --hairline-strong: rgba(255, 255, 255, 0.16);
  --hover: rgba(255, 255, 255, 0.05);
  --pressed: rgba(255, 255, 255, 0.09);
  --heart: #ff453a;
  --danger: #ff453a;
  --danger-soft: rgba(255, 69, 58, 0.16);
  --success: #30d158;
  --success-soft: rgba(48, 209, 88, 0.16);
  --warning: #ff9f0a;
  --warning-soft: rgba(255, 159, 10, 0.16);
  --field-bg: #1c1c1e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.5), 0 30px 80px rgba(0, 0, 0, 0.7);
  --glass-sidebar: rgba(28, 28, 30, 0.72);
  --glass-topbar: rgba(0, 0, 0, 0.62);
  --glass-card: rgba(28, 28, 30, 0.72);
  --glass-border: rgba(255, 255, 255, 0.09);
  --toast-bg: rgba(44, 44, 46, 0.9);
  --menu-bg: rgba(44, 44, 46, 0.94);
  --chart-grid: rgba(255, 255, 255, 0.08);
  --scrollbar: rgba(255, 255, 255, 0.22);
}

/* ---------- 重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, figure { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent); text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--accent) 26%, transparent); }

.num, .tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.grow { flex: 1; min-width: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.w-full { width: 100%; }

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* 焦点 */
:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 32%, transparent);
}
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 32%, transparent);
}

/* ---------- 启动态 ---------- */
.boot {
  position: fixed; inset: 0; z-index: 500;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--bg);
}
.boot-logo { width: 52px; height: 52px; border-radius: 14px; box-shadow: var(--shadow); animation: boot-pulse 1.8s var(--ease) infinite; }
.boot-text { font-size: 13px; color: var(--text-2); letter-spacing: 0.02em; }
.boot-bar { width: 132px; height: 3px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.boot-bar span { display: block; width: 42%; height: 100%; border-radius: inherit; background: var(--accent); animation: boot-slide 1.2s var(--ease) infinite; }
@keyframes boot-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.96); opacity: 0.85; } }
@keyframes boot-slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(340%); } }

/* ---------- 应用骨架 ---------- */
.app-body { overflow: hidden; }
.app { min-height: 100dvh; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); color: var(--text-2); z-index: 999; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 60;
  display: flex; flex-direction: column;
  background: var(--glass-sidebar);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-right: 1px solid var(--hairline);
}
[data-theme="dark"] .sidebar { border-right-color: rgba(255, 255, 255, 0.08); }
.sidebar-head { padding: 18px 16px 10px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px; border-radius: 12px; color: var(--text); }
.brand img { border-radius: 9px; box-shadow: 0 2px 8px rgba(0, 113, 227, 0.28); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
.brand-text small { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav { flex: 1; overflow-y: auto; padding: 8px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-group { padding: 18px 10px 7px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; color: var(--text-3); }
.nav-group:first-child { padding-top: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  height: 40px; padding: 0 11px; border-radius: 10px;
  color: var(--text-2); font-size: 14px; font-weight: 500;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform 160ms var(--ease);
  position: relative;
}
.nav-item svg { width: 20px; height: 20px; flex: none; opacity: 0.9; }
.nav-icon { display: inline-flex; flex: none; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}
.nav-item.active svg { opacity: 1; }
.nav-item .nav-count {
  font-size: 11px; font-weight: 600; color: var(--text-3);
  background: var(--surface-3); border-radius: 999px; padding: 1px 7px;
}
.nav-item.active .nav-count { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.sidebar-foot { padding: 14px 22px 18px; border-top: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 4px; }
.side-status { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-2); }
.side-version { font-size: 11px; color: var(--text-3); }

.main-wrap { margin-left: var(--sidebar-w); min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
  background: var(--glass-topbar);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--hairline);
}
.title-block { display: flex; flex-direction: column; min-width: 0; }
.title-block h1 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
.title-block p { font-size: 11.5px; color: var(--text-3); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.clock { display: flex; flex-direction: column; align-items: flex-end; margin-right: 10px; line-height: 1.25; }
.clock-time { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.clock-date { font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.menu-btn { display: none !important; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2); transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform 160ms var(--ease);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn i { display: inline-flex; }

.i-moon { display: none; }
[data-theme="dark"] .i-sun { display: none; }
[data-theme="dark"] .i-moon { display: block; }

.user-wrap { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 9px;
  padding: 3px 8px 3px 3px; border-radius: 999px;
  transition: background var(--dur) var(--ease);
}
.user-btn:hover { background: var(--hover); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #3ea0ff 0%, var(--accent) 55%, var(--purple) 100%);
  color: #fff; font-size: 12px; font-weight: 600; letter-spacing: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.avatar-lg { width: 40px; height: 40px; font-size: 15px; }
.user-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; min-width: 0; }
.user-name { font-size: 12.5px; font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 10.5px; color: var(--text-3); }
.user-btn > svg { color: var(--text-3); }

.menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 80;
  min-width: 248px; padding: 6px; border-radius: 14px;
  background: var(--menu-bg);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--hairline); box-shadow: var(--shadow-lg);
  animation: menu-in 180ms var(--ease);
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }
.menu-head { display: flex; align-items: center; gap: 11px; padding: 10px 10px 12px; border-bottom: 1px solid var(--hairline); margin-bottom: 6px; }
.menu-name { font-size: 13.5px; font-weight: 600; }
.menu-sub { font-size: 11.5px; color: var(--text-3); max-width: 168px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  height: 36px; padding: 0 10px; border-radius: 9px;
  font-size: 13px; color: var(--text); text-align: left;
  transition: background 140ms var(--ease);
}
.menu-item:hover { background: var(--hover); }
.menu-item svg { color: var(--text-2); }
.menu-item-danger { color: var(--danger); }
.menu-item-danger svg { color: var(--danger); }
.menu-item-danger:hover { background: var(--danger-soft); }
.menu-sep { height: 1px; background: var(--hairline); margin: 6px 4px; }

.view {
  flex: 1; width: 100%; max-width: 1560px; margin: 0 auto;
  padding: 24px 28px 56px;
}
.page { animation: page-in 260ms var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* ---------- 页头 ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { font-size: 26px; font-weight: 650; letter-spacing: -0.025em; line-height: 1.2; }
.page-desc { margin-top: 5px; font-size: 13px; color: var(--text-2); max-width: 680px; }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 15px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
    color var(--dur) var(--ease), transform 150ms var(--ease), box-shadow var(--dur) var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.btn svg { flex: none; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 90%, #000); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--hairline-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; gap: 5px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-icon.btn-sm { width: 28px; height: 28px; }
.btn .spinner { display: none; }
.btn.loading { color: transparent !important; pointer-events: none; position: relative; }
.btn.loading .spinner { display: block; position: absolute; visibility: visible; }
.btn.loading > *:not(.spinner) { visibility: hidden; }
.btn .spinner {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
.btn-secondary.loading .spinner, .btn-ghost.loading .spinner { border-color: var(--hairline-strong); border-top-color: var(--text-2); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 表单控件 ---------- */
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 11px;
  background: var(--field-bg); color: var(--text);
  border: 1px solid var(--hairline-strong); border-radius: var(--radius-sm);
  font-size: 13.5px; transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease), background 160ms var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input::-webkit-search-cancel-button, .input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--text-3) 55%, transparent); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent);
}
.textarea { height: auto; min-height: 78px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 15px 15px;
}
[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.input[type="color"] { padding: 4px; cursor: pointer; }
.input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.input[type="color"]::-webkit-color-swatch { border: none; border-radius: 6px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 4px; }
.field-label .req { color: var(--danger); }
.field-hint { font-size: 11.5px; color: var(--text-3); }
.field-error { font-size: 11.5px; color: var(--danger); }
.field.invalid .input, .field.invalid .select, .field.invalid .textarea { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-section-title { font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; color: var(--text-3); text-transform: uppercase; margin: 4px 0 -4px; }
.form-section-title:not(:first-child) { margin-top: 12px; }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-icon { position: absolute; left: 12px; display: inline-flex; color: var(--text-3); pointer-events: none; }
.input.has-icon { padding-left: 38px; }
.input.has-action { padding-right: 42px; }
.input-action { position: absolute; right: 5px; width: 32px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); }
.input-action:hover { color: var(--text); background: var(--hover); }

.search { position: relative; min-width: 220px; }
.search .input { padding-left: 34px; height: 36px; background: var(--field-bg); }
.toolbar .search .input {
  background: color-mix(in srgb, var(--surface) 62%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border-color: var(--hairline);
}
.toolbar .search .input:focus { background: var(--field-bg); }
.search .input-icon { left: 11px; }
.search-clear { position: absolute; right: 4px; width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); }
.search-clear:hover { background: var(--hover); color: var(--text); }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; color: var(--text-2); user-select: none; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check-box {
  width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--hairline-strong);
  display: inline-flex; align-items: center; justify-content: center; color: transparent;
  background: var(--field-bg); transition: all 150ms var(--ease); flex: none;
}
.check input:checked + .check-box { background: var(--accent); border-color: var(--accent); color: #fff; }
.check input:focus-visible + .check-box { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.check:hover .check-box { border-color: var(--text-3); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { width: 40px; height: 24px; border-radius: 999px; background: var(--surface-4); transition: background 200ms var(--ease); flex: none; position: relative; }
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 220ms var(--ease);
}
.switch input:checked + .switch-track { background: var(--success); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }

/* ---------- 分段控件 ---------- */
.segmented {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--surface-3); border-radius: 12px; border: 1px solid var(--hairline);
}
.seg-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 13px;
  border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--text-2);
  transition: background 180ms var(--ease), color 180ms var(--ease), box-shadow 180ms var(--ease);
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.09), 0 0 0 0.5px rgba(0, 0, 0, 0.02); }
[data-theme="dark"] .seg-btn.active { background: var(--surface-4); }
.seg-count {
  font-size: 11px; font-weight: 600; line-height: 1; padding: 3px 6px; border-radius: 999px;
  background: var(--surface-4); color: var(--text-2); font-variant-numeric: tabular-nums;
}
.seg-btn.active .seg-count { background: var(--accent-soft); color: var(--accent); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius-card); box-shadow: var(--shadow);
}
.card-flat { box-shadow: none; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 20px 0; }
.card-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.card-sub { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.card-body { padding: 18px 20px; }
.card-body.tight { padding: 12px 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--hairline); }
.card-link { font-size: 12.5px; font-weight: 600; color: var(--accent); display: inline-flex; align-items: center; gap: 3px; }
.card-link:hover { text-decoration: underline; }

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-dash { grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr); }
.grid-dash-bottom { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 18px; }

/* ---------- 指标卡 ---------- */
.stat-card { position: relative; padding: 20px 20px 18px; overflow: hidden; }
.stat-card::after {
  content: ""; position: absolute; width: 130px; height: 130px; right: -46px; top: -56px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%); pointer-events: none;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.stat-icon {
  width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.stat-icon.warn { background: var(--warning-soft); color: var(--warning); }
.stat-icon.success { background: var(--success-soft); color: var(--success); }
.stat-icon.purple { background: color-mix(in srgb, var(--purple) 12%, transparent); color: var(--purple); }
.stat-value { margin-top: 12px; font-size: 30px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 14px; font-weight: 600; color: var(--text-3); margin-left: 3px; letter-spacing: 0; }
.stat-foot { margin-top: 8px; display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); }
.trend-up { color: var(--success); font-weight: 600; }
.trend-down { color: var(--danger); font-weight: 600; }

/* ---------- 图表 ---------- */
.chart { width: 100%; display: block; overflow: visible; }
.chart-box { padding: 6px 4px 0; }
.chart-grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart-axis-label { font-size: 10px; fill: var(--text-3); font-variant-numeric: tabular-nums; }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; padding: 7px 10px; border-radius: 9px;
  background: var(--menu-bg); border: 1px solid var(--hairline); box-shadow: var(--shadow);
  font-size: 11.5px; color: var(--text); white-space: nowrap; transform: translate(-50%, -120%);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  opacity: 0; transition: opacity 120ms var(--ease);
}
.chart-tip.show { opacity: 1; }
.chart-holder { position: relative; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 10px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-2); }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-val { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut-holder { position: relative; width: 150px; height: 150px; flex: none; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.donut-center b { font-size: 21px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.donut-center span { font-size: 10.5px; color: var(--text-3); margin-top: 2px; }
.donut-legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.donut-legend .legend-item { justify-content: space-between; }
.donut-legend .legend-left { display: flex; align-items: center; gap: 7px; min-width: 0; }

.bar-list { display: flex; flex-direction: column; gap: 13px; }
.bar-row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 12.5px; margin-bottom: 6px; }
.bar-row-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row-val { color: var(--text-2); font-variant-numeric: tabular-nums; font-size: 11.5px; flex: none; }
.bar-track { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 75%, #fff), var(--accent)); transition: width 500ms var(--ease); }
.bar-fill.alt { background: linear-gradient(90deg, #9b8bff, var(--purple)); }

/* ---------- 列表 / 时间线 ---------- */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--hairline); }
.list-row:last-child { border-bottom: 0; }
.list-row.clickable { cursor: pointer; border-radius: 10px; padding: 10px 8px; margin: 0 -8px; transition: background 150ms var(--ease); }
.list-row.clickable:hover { background: var(--hover); }
.list-main { flex: 1; min-width: 0; }
.list-title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-val { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.timeline { display: flex; flex-direction: column; gap: 0; position: relative; }
.tl-item { display: flex; gap: 12px; padding: 9px 0; position: relative; }
.tl-dot {
  width: 26px; height: 26px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); margin-top: 1px; z-index: 1;
}
.tl-dot.inbound { background: var(--success-soft); color: var(--success); }
.tl-dot.delete { background: var(--danger-soft); color: var(--danger); }
.tl-dot.transfer { background: color-mix(in srgb, var(--purple) 12%, transparent); color: var(--purple); }
.tl-line { position: absolute; left: 13px; top: 34px; bottom: -4px; width: 1px; background: var(--hairline); }
.tl-item:last-child .tl-line { display: none; }
.tl-body { flex: 1; min-width: 0; padding-top: 3px; }
.tl-text { font-size: 12.5px; line-height: 1.45; }
.tl-text b { font-weight: 600; }
.tl-time { font-size: 11px; color: var(--text-3); margin-top: 1px; }

/* ---------- Pills / 徽章 ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-success { background: var(--success-soft); color: color-mix(in srgb, var(--success) 80%, #000); }
[data-theme="dark"] .pill-success { color: var(--success); }
.pill-warn { background: var(--warning-soft); color: color-mix(in srgb, var(--warning) 78%, #000); }
[data-theme="dark"] .pill-warn { color: var(--warning); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-purple { background: color-mix(in srgb, var(--purple) 12%, transparent); color: color-mix(in srgb, var(--purple) 85%, #000); }
[data-theme="dark"] .pill-purple { color: #a89aff; }
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-lg { height: 26px; padding: 0 11px; font-size: 11.5px; }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.dot-success { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.dot-danger { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.dot-warn { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 9px; margin-left: auto; flex-wrap: wrap; }
.toolbar .select { height: 36px; width: auto; min-width: 118px; }
.filter-wrap { position: relative; }
.filter-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; width: 300px; padding: 16px; border-radius: 14px; background: var(--menu-bg); border: 1px solid var(--hairline); box-shadow: var(--shadow-lg); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); display: flex; flex-direction: column; gap: 13px; animation: menu-in 180ms var(--ease); }
.filter-menu .form-grid { grid-template-columns: 1fr; gap: 12px; }

/* ---------- 表格 ---------- */
.table-card { overflow: hidden; }
.table-scroll { overflow: auto; max-height: calc(100dvh - 300px); }
.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.data th {
  position: sticky; top: 0; z-index: 3; text-align: left; white-space: nowrap;
  padding: 11px 12px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; color: var(--text-3);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline);
}
.data th:first-child, .data td:first-child { padding-left: 20px; }
.data th:last-child, .data td:last-child { padding-right: 20px; }
.data td { height: 52px; padding: 9px 12px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.data tbody tr { transition: background 140ms var(--ease); }
.data tbody tr:hover { background: var(--hover); }
.data tbody tr:last-child td { border-bottom: 0; }
.data .cell-main { font-weight: 500; color: var(--text); }
.data .cell-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.data .cell-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.data .row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; opacity: 0.72; transition: opacity 140ms var(--ease); }
.data tr:hover .row-actions { opacity: 1; }
.data .name-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.data .name-text { min-width: 0; }
.data .name-text .cell-main { max-width: 218px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.color-dot { width: 28px; height: 28px; border-radius: 6px; flex: none; border: 1px solid rgba(0, 0, 0, 0.12); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25); }
[data-theme="dark"] .color-dot { border-color: rgba(255, 255, 255, 0.16); }
.color-dot.lg { width: 34px; height: 34px; border-radius: 8px; }

.meter { width: 78px; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; flex: none; }
.meter-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 72%, #fff), var(--accent)); }
.meter-fill.warn { background: linear-gradient(90deg, #ffc46b, var(--warning)); }
.meter-fill.danger { background: linear-gradient(90deg, #ff8a80, var(--danger)); }
.meter-cell { display: flex; flex-direction: column; gap: 5px; }
.meter-top { display: flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }
.meter-top b { font-size: 13px; font-weight: 600; }
.meter-top span { font-size: 10.5px; color: var(--text-3); }

/* 行内下拉菜单（挂载 body，fixed 定位） */
.rowmenu {
  position: fixed; z-index: 200; min-width: 176px; padding: 5px; border-radius: 12px;
  background: var(--menu-bg); border: 1px solid var(--hairline); box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); animation: menu-in 150ms var(--ease);
}
.rowmenu button {
  display: flex; align-items: center; gap: 9px; width: 100%; height: 32px; padding: 0 9px;
  border-radius: 8px; font-size: 12.5px; color: var(--text); text-align: left;
}
.rowmenu button:hover { background: var(--hover); }
.rowmenu button svg { color: var(--text-2); }
.rowmenu button.danger { color: var(--danger); }
.rowmenu button.danger svg { color: var(--danger); }
.rowmenu button.danger:hover { background: var(--danger-soft); }
.rowmenu .rowmenu-sep { height: 1px; margin: 4px; background: var(--hairline); }

/* ---------- 分页 ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 20px; border-top: 1px solid var(--hairline); flex-wrap: wrap; }
.pager-info { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.pager { display: flex; align-items: center; gap: 6px; }
.pager button {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px;
  font-size: 12px; font-weight: 500; color: var(--text-2); font-variant-numeric: tabular-nums;
  transition: background 150ms var(--ease), color 150ms var(--ease);
}
.pager button:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.pager button.active { background: var(--accent); color: #fff; font-weight: 600; }
.pager button:disabled { opacity: 0.35; pointer-events: none; }
.pager button svg { margin: 0 auto; }
.pager-ellipsis { color: var(--text-3); font-size: 12px; padding: 0 2px; }

/* ---------- 空状态 / 骨架 ---------- */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 54px 24px; gap: 5px; }
.empty-art { width: 108px; height: 88px; margin-bottom: 10px; color: var(--text-3); opacity: 0.9; }
.empty-title { font-size: 14.5px; font-weight: 600; }
.empty-desc { font-size: 12.5px; color: var(--text-3); max-width: 340px; line-height: 1.55; }
.empty-actions { margin-top: 12px; display: flex; gap: 8px; }

.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, color-mix(in srgb, var(--surface-3) 55%, var(--surface)) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: shimmer 1.5s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.sk-line { height: 12px; }
.sk-line.w40 { width: 40%; }
.sk-line.w60 { width: 60%; }
.sk-line.w80 { width: 80%; }
.sk-card { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.sk-table { display: flex; flex-direction: column; gap: 0; }
.sk-tr { display: flex; align-items: center; gap: 16px; height: 52px; padding: 0 20px; border-bottom: 1px solid var(--hairline); }
.sk-tr > * { flex: none; }

/* ---------- Toast ---------- */
.toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: center; gap: 9px; max-width: min(480px, calc(100vw - 32px));
  padding: 9px 16px 9px 12px; border-radius: 999px;
  background: var(--toast-bg); border: 1px solid var(--hairline); box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  font-size: 12.5px; font-weight: 500; color: var(--text);
  pointer-events: auto; animation: toast-in 260ms var(--ease);
  overflow: hidden;
}
.toast.leaving { animation: toast-out 200ms var(--ease) forwards; }
.toast-icon { width: 21px; height: 21px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.toast.success .toast-icon { background: var(--success-soft); color: var(--success); }
.toast.error .toast-icon { background: var(--danger-soft); color: var(--danger); }
.toast.warning .toast-icon { background: var(--warning-soft); color: var(--warning); }
.toast-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px) scale(0.97); } }

/* ---------- 弹窗 ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  animation: overlay-in 200ms var(--ease);
}
.modal-overlay.closing { animation: overlay-out 170ms var(--ease) forwards; }
.modal {
  width: min(560px, 100%); max-height: min(88dvh, 900px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 20px;
  box-shadow: var(--shadow-lg); animation: sheet-in 240ms var(--ease); overflow: hidden;
}
.modal.sm { width: min(400px, 100%); }
.modal.wide { width: min(780px, 100%); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--hairline); }
.modal-head-text { flex: 1; min-width: 0; }
.modal-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
.modal-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.modal-close { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); background: var(--surface-3); flex: none; }
.modal-close:hover { background: var(--surface-4); color: var(--text); }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-body.flush { padding: 0; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--hairline); background: var(--surface-2); }
.modal-foot .grow { margin-right: auto; }
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes overlay-out { to { opacity: 0; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(10px) scale(0.965); } to { opacity: 1; transform: none; } }

.confirm-icon { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.confirm-icon.danger { background: var(--danger-soft); color: var(--danger); }
.confirm-icon.warning { background: var(--warning-soft); color: var(--warning); }
.confirm-body { display: flex; gap: 14px; }
.confirm-text { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.confirm-text b { color: var(--text); font-weight: 600; }

/* ---------- 顶部提示条 / 行内提示 ---------- */
.notice-host { padding: 12px 28px 0; }
.notice-bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-radius: 12px; background: var(--warning-soft);
  border: 1px solid color-mix(in srgb, var(--warning) 24%, transparent);
  font-size: 12.5px; line-height: 1.5;
}
.notice-icon { color: var(--warning); display: inline-flex; flex: none; }
.notice-text { flex: 1; min-width: 0; color: color-mix(in srgb, var(--text) 76%, var(--warning)); }
.notice-text b { font-weight: 600; }
.notice-action { flex: none; background: color-mix(in srgb, var(--surface) 72%, transparent); }
.inline-notice {
  display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px;
  border-radius: 10px; background: var(--warning-soft);
  font-size: 12px; line-height: 1.55; color: var(--text-2);
}
.inline-notice-icon { color: var(--warning); flex: none; margin-top: 1px; }
.inline-notice-info { background: var(--accent-soft); }
.inline-notice-info .inline-notice-icon { color: var(--accent); }
.inline-notice-success { background: var(--success-soft); }
.inline-notice-success .inline-notice-icon { color: var(--success); }
@media (max-width: 760px) {
  .notice-host { padding: 10px 14px 0; }
  .notice-bar { align-items: flex-start; flex-wrap: wrap; }
}

/* ---------- 登录页 ---------- */
html:has(.login-body) { background: #f5f5f7; }
[data-theme="dark"]:has(.login-body) { background: #000; }
.login-body { background: #f5f5f7; min-height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden; }
[data-theme="dark"] .login-body { background: #000; }
.login-bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.blob { position: absolute; border-radius: 50%; filter: blur(72px); opacity: 0.62; will-change: transform; }
.blob-a { width: 620px; height: 620px; left: -160px; top: -200px; background: radial-gradient(circle at 35% 35%, #cfe4ff, #7db9ff 55%, #3d8bfd 100%); animation: drift-a 22s var(--ease) infinite alternate; }
.blob-b { width: 540px; height: 540px; right: -120px; top: -120px; background: radial-gradient(circle at 40% 40%, #ebe1ff, #b9a4ff 50%, #7c5cff 100%); opacity: 0.5; animation: drift-b 26s var(--ease) infinite alternate; }
.blob-c { width: 660px; height: 520px; left: 50%; bottom: -300px; transform: translateX(-50%); background: radial-gradient(circle at 50% 50%, #ffe4d6, #ffc0ad 45%, #ff9f8a 100%); opacity: 0.5; animation: drift-c 24s var(--ease) infinite alternate; }
[data-theme="dark"] .blob { opacity: 0.3; filter: blur(90px); }
[data-theme="dark"] .blob-a { background: radial-gradient(circle at 35% 35%, #123a66, #0a62b8 55%, #0b3f78 100%); }
[data-theme="dark"] .blob-b { background: radial-gradient(circle at 40% 40%, #2b1d55, #4c2fa8 50%, #2a1a5e 100%); opacity: 0.4; }
[data-theme="dark"] .blob-c { background: radial-gradient(circle at 50% 50%, #4a2418, #7a3a22 45%, #4a1f14 100%); opacity: 0.35; }
.login-grain {
  position: absolute; inset: 0; opacity: 0.28; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}
@keyframes drift-a { to { transform: translate(70px, 60px) scale(1.08); } }
@keyframes drift-b { to { transform: translate(-60px, 70px) scale(1.06); } }
@keyframes drift-c { to { transform: translateX(-50%) translateY(-50px) scale(1.1); } }
.login-theme { position: fixed; top: 18px; right: 20px; z-index: 5; background: rgba(255, 255, 255, 0.6); border: 1px solid rgba(255, 255, 255, 0.6); box-shadow: var(--shadow-xs); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
[data-theme="dark"] .login-theme { background: rgba(28, 28, 30, 0.6); border-color: rgba(255, 255, 255, 0.1); }
.login-stage { position: relative; z-index: 2; flex: 1; display: flex; align-items: center; justify-content: center; padding: 72px 20px; }
.login-card {
  width: min(420px, 100%); padding: 34px 34px 26px;
  background: var(--glass-card); border: 1px solid var(--glass-border); border-radius: 26px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05), 0 30px 70px rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(34px) saturate(180%); backdrop-filter: blur(34px) saturate(180%);
  animation: login-in 500ms var(--ease);
}
[data-theme="dark"] .login-card { border-color: rgba(255, 255, 255, 0.1); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4), 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06); }
@keyframes login-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
.login-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 26px; }
.login-brand img { border-radius: 12px; box-shadow: 0 6px 18px rgba(0, 113, 227, 0.3); }
.login-brand-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.login-brand-text strong { font-size: 15.5px; font-weight: 650; letter-spacing: -0.015em; }
.login-brand-text span { font-size: 11.5px; color: var(--text-2); margin-top: 1px; }
.login-card h1 { font-size: 29px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.15; }
.login-sub { font-size: 13px; color: var(--text-2); margin-top: 7px; margin-bottom: 24px; }
.login-card form { display: flex; flex-direction: column; gap: 15px; }
.login-card .field-label { font-size: 12px; color: var(--text-2); }
.login-card .input { height: 42px; border-radius: 11px; background: rgba(255, 255, 255, 0.7); border-color: rgba(0, 0, 0, 0.1); font-size: 14px; }
[data-theme="dark"] .login-card .input { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.12); }
.login-card .input:focus { background: var(--field-bg); }
.login-card .input-icon { color: var(--text-3); }
.login-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 1px; }
.login-hint { font-size: 11.5px; color: var(--text-3); }
.login-card .btn-primary { height: 44px; margin-top: 4px; font-size: 14.5px; border-radius: 11px; background: linear-gradient(180deg, #0b7df0, var(--accent)); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 8px 20px rgba(0, 113, 227, 0.28); }
.login-card .btn-primary:hover { background: linear-gradient(180deg, #0b7df0, #0068d0); }
.form-error {
  display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: 10px;
  background: var(--danger-soft); color: var(--danger); font-size: 12.5px; line-height: 1.5;
  animation: shake 320ms var(--ease);
}
.form-error svg { flex: none; margin-top: 1px; }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 60% { transform: translateX(3px); } 80% { transform: translateX(-1px); } }
.demo-tip { margin-top: 18px; padding: 11px 13px; border-radius: 11px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent); font-size: 11.5px; line-height: 1.6; color: var(--text-2); }
.demo-tip-title { font-size: 11.5px; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.demo-tip code { font-family: var(--font-mono); font-size: 11px; background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 1px 4px; border-radius: 4px; color: var(--text); }
.login-sep { height: 1px; background: var(--hairline); margin: 22px 0 14px; }
.login-company { text-align: center; font-size: 11.5px; color: var(--text-3); }
.login-footer { position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 20px; font-size: 11px; color: var(--text-3); }
.login-footer-dot { opacity: 0.6; }

/* ---------- 概览 ---------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr); gap: 18px; }
.chart-card .card-body { padding-top: 10px; }
.donut-card .card-body { padding-top: 14px; }
.low-stock-list .list-row { gap: 10px; }
.zones-mini { display: flex; gap: 10px; }
.zone-mini { flex: 1; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--hairline); }
.zone-mini-label { font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.zone-mini-value { font-size: 15px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }
.zone-mini-sub { font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.lib-summary { display: flex; align-items: center; gap: 16px; font-size: 11.5px; color: var(--text-2); }
.lib-summary b { font-size: 14px; color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- 库存 ---------- */
.inv-summary { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.inv-summary .chips { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border-radius: 999px; background: var(--surface-3); font-size: 11.5px; color: var(--text-2);
}
.filter-chip button { color: var(--text-3); display: inline-flex; }
.filter-chip button:hover { color: var(--text); }
.inv-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-3); }

.qty-quick { display: flex; gap: 7px; flex-wrap: wrap; }
.quick-chip { height: 30px; padding: 0 12px; border-radius: 999px; background: var(--surface-3); font-size: 12px; font-weight: 600; color: var(--text-2); border: 1px solid transparent; font-variant-numeric: tabular-nums; transition: all 150ms var(--ease); }
.quick-chip:hover { background: var(--accent-soft); color: var(--accent); }
.quick-chip.active { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.quick-chip:active { transform: scale(0.96); }
.quick-chip:disabled { opacity: 0.4; pointer-events: none; }
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 999px; background: var(--surface-4); outline: none; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 1px solid rgba(0, 0, 0, 0.1); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); cursor: pointer; }
.range::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); cursor: pointer; }

.item-hero { display: flex; align-items: center; gap: 13px; padding: 13px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--hairline); margin-bottom: 17px; }
.item-hero .list-title { font-size: 14px; }
.item-hero .list-sub { font-size: 11.5px; }
.item-hero-stat { margin-left: auto; text-align: right; }
.item-hero-stat b { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; display: block; }
.item-hero-stat span { font-size: 10.5px; color: var(--text-3); }

/* 选择卡片（区域 / 选项） */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-card {
  display: flex; flex-direction: column; gap: 3px; padding: 11px 13px; text-align: left;
  border: 1px solid var(--hairline-strong); border-radius: 11px; background: var(--field-bg);
  transition: border-color 160ms var(--ease), background 160ms var(--ease), box-shadow 160ms var(--ease);
}
.choice-card:hover { border-color: var(--text-3); }
.choice-card.active {
  border-color: var(--accent); background: var(--accent-soft);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
}
.choice-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.choice-title svg { color: var(--text-2); }
.choice-card.active .choice-title { color: var(--accent); }
.choice-card.active .choice-title svg { color: var(--accent); }
.choice-desc { font-size: 11px; color: var(--text-3); line-height: 1.45; }
.choice-radio {
  width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--hairline-strong);
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.choice-card.active .choice-radio { border-color: var(--accent); }
.choice-card.active .choice-radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

.summary-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-2); }
.summary-chips b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.summary-sep { color: var(--hairline-strong); }
.chip-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.active-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px 0 10px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  font-size: 11.5px; font-weight: 500;
}
.active-chip button { display: inline-flex; color: currentColor; opacity: 0.7; padding: 2px; border-radius: 50%; }
.active-chip button:hover { opacity: 1; background: color-mix(in srgb, var(--accent) 14%, transparent); }
.chip-clear { font-size: 11.5px; color: var(--text-3); text-decoration: underline; }
.chip-clear:hover { color: var(--text); }
.table-error { padding: 46px 20px; text-align: center; }
.form-suffix { position: relative; }
.form-suffix .input { padding-right: 36px; }
.form-suffix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--text-3); pointer-events: none; }
.weight-preview { font-size: 11.5px; color: var(--text-3); margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ---------- 品牌库 ---------- */
.library-grid { display: grid; grid-template-columns: 292px minmax(0, 1fr); gap: 18px; align-items: start; }
.brand-pane { display: flex; flex-direction: column; max-height: calc(100dvh - 190px); }
.brand-pane-head { padding: 15px 16px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand-pane-title { font-size: 13px; font-weight: 600; }
.brand-list { overflow-y: auto; padding: 0 8px 10px; display: flex; flex-direction: column; gap: 3px; }
.brand-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 10px;
  border-radius: 11px; text-align: left; transition: background 150ms var(--ease), box-shadow 150ms var(--ease);
  border: 1px solid transparent;
}
.brand-item:hover { background: var(--hover); }
.brand-item.active { background: var(--surface); border-color: var(--hairline); box-shadow: var(--shadow-xs); }
.brand-badge {
  width: 34px; height: 34px; border-radius: 10px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 650; color: #fff;
  background: linear-gradient(135deg, #68b5ff, var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.brand-item:nth-child(5n+2) .brand-badge { background: linear-gradient(135deg, #b6a6ff, var(--purple)); }
.brand-item:nth-child(5n+3) .brand-badge { background: linear-gradient(135deg, #7ee0a3, #1faf55); }
.brand-item:nth-child(5n+4) .brand-badge { background: linear-gradient(135deg, #ffc46b, #f08a00); }
.brand-item:nth-child(5n+5) .brand-badge { background: linear-gradient(135deg, #ff9d9d, #e0453b); }
.brand-info { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.brand-name { display: block; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-meta { display: block; font-size: 10.5px; color: var(--text-3); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-count { font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; flex: none; }
.sku-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 17px 20px; border-bottom: 1px solid var(--hairline); flex-wrap: wrap; }
.sku-title { font-size: 16px; font-weight: 650; letter-spacing: -0.02em; }
.sku-sub { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.sku-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- 统计 ---------- */
.stats-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.stat-grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; }
.rank-list { display: flex; flex-direction: column; }
.rank-item { display: flex; align-items: center; gap: 11px; padding: 9px 2px; border-bottom: 1px solid var(--hairline); }
.rank-item:last-child { border-bottom: 0; }
.rank-no { width: 22px; height: 22px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; background: var(--surface-3); color: var(--text-3); flex: none; font-variant-numeric: tabular-nums; }
.rank-no.top { background: var(--accent-soft); color: var(--accent); }
.rank-main { flex: 1; min-width: 0; }
.rank-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-sub { font-size: 10.5px; color: var(--text-3); margin-top: 1px; }
.rank-val { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- 用户 / 角色 ---------- */
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-chip .avatar { width: 30px; height: 30px; font-size: 11px; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }

.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.role-card { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.role-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.role-name { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.role-key { font-size: 10.5px; color: var(--text-3); font-family: var(--font-mono); margin-top: 2px; }
.role-desc { font-size: 12px; color: var(--text-2); line-height: 1.5; min-height: 36px; }
.role-perms { display: flex; flex-wrap: wrap; gap: 5px; }
.role-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid var(--hairline); margin-top: auto; }

.perm-group { border: 1px solid var(--hairline); border-radius: 12px; overflow: hidden; margin-bottom: 12px; background: var(--surface-2); }
.perm-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 13px; background: var(--surface-3); }
.perm-group-name { font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }
.perm-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 12px; padding: 11px 13px; }
.perm-item { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; font-size: 12.5px; }
.perm-name { display: block; line-height: 1.35; }
.perm-item .check { align-items: flex-start; }
.perm-item .perm-key { display: block; font-size: 10px; color: var(--text-3); font-family: var(--font-mono); margin-top: 1px; }
.perm-readonly-note { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--warning); background: var(--warning-soft); border-radius: 9px; padding: 8px 11px; margin-bottom: 14px; }

/* ---------- 邮件 ---------- */
.mail-status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.mail-status { padding: 16px 17px; display: flex; align-items: center; gap: 12px; }
.mail-status-icon { width: 38px; height: 38px; border-radius: 11px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.mail-status-icon.success { background: var(--success-soft); color: var(--success); }
.mail-status-icon.warn { background: var(--warning-soft); color: var(--warning); }
.mail-status-icon.muted { background: var(--surface-3); color: var(--text-3); }
.mail-status-label { font-size: 11px; color: var(--text-3); }
.mail-status-value { font-size: 13.5px; font-weight: 600; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-notice { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--warning-soft); color: color-mix(in srgb, var(--warning) 70%, #000); font-size: 12px; line-height: 1.6; margin-bottom: 18px; }
[data-theme="dark"] .mail-notice { color: var(--warning); }
.mail-notice svg { flex: none; margin-top: 1px; }
.mail-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.mail-side { display: flex; flex-direction: column; gap: 18px; }
.scan-result { margin-top: 14px; border: 1px solid var(--hairline); border-radius: 12px; overflow: hidden; }
.scan-head { padding: 10px 13px; background: var(--surface-3); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.scan-list { max-height: 220px; overflow: auto; }
.scan-item { display: flex; align-items: center; gap: 10px; padding: 8px 13px; border-top: 1px solid var(--hairline); font-size: 12px; }
.scan-item:first-child { border-top: 0; }
.scan-item .ellipsis { flex: 1; }
.smtp-note { font-size: 11px; color: var(--text-3); line-height: 1.55; }

/* ---------- 设置 ---------- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.settings-col { display: flex; flex-direction: column; gap: 18px; }
.swatches { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.swatch {
  width: 30px; height: 30px; border-radius: 9px; border: 2px solid transparent; position: relative;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); transition: transform 150ms var(--ease);
}
.swatch:hover { transform: scale(1.08); }
.swatch.active { border-color: var(--text); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12), 0 0 0 3px var(--surface); }
.swatch.custom { display: inline-flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--hairline); position: relative; overflow: hidden; }
.swatch.custom input { position: absolute; inset: -6px; opacity: 0; cursor: pointer; }
.settings-admin-note { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.pref-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--hairline); }
.pref-row:last-child { border-bottom: 0; }
.pref-label { font-size: 13px; font-weight: 500; }
.pref-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ---------- 审计 ---------- */
.audit-action { font-family: var(--font-mono); font-size: 10.5px; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.audit-action.use { background: var(--accent-soft); color: var(--accent); }
.audit-action.delete { background: var(--danger-soft); color: var(--danger); }
.audit-action.failed { background: var(--danger-soft); color: var(--danger); }
.audit-action.login, .audit-action.logout { background: var(--success-soft); color: color-mix(in srgb, var(--success) 78%, #000); }
[data-theme="dark"] .audit-action.login, [data-theme="dark"] .audit-action.logout { color: var(--success); }
.audit-detail { font-size: 12px; color: var(--text-2); max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 403 / 错误页 ---------- */
.forbidden { min-height: 56vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 40px; }
.forbidden-art { width: 150px; margin-bottom: 6px; }
.forbidden h2 { font-size: 20px; font-weight: 650; letter-spacing: -0.02em; }
.forbidden p { font-size: 13px; color: var(--text-2); max-width: 380px; }
.forbidden .btn { margin-top: 10px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mail-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1120px) {
  .dash-grid, .stat-grid-2, .mail-grid, .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .library-grid { grid-template-columns: 250px minmax(0, 1fr); }
  .grid-dash-bottom { grid-template-columns: minmax(0, 1fr); }
  .brand-pane { max-height: none; }
}
@media (max-width: 960px) {
  :root { --sidebar-w: 268px; }
  .sidebar { transform: translateX(-102%); transition: transform 300ms var(--ease); box-shadow: 24px 0 60px rgba(0, 0, 0, 0.16); }
  .app.nav-open .sidebar { transform: none; }
  .main-wrap { margin-left: 0; }
  .menu-btn { display: inline-flex !important; }
  .scrim { position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, 0.22); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: overlay-in 200ms var(--ease); }
  .view { padding: 20px 20px 48px; }
  .library-grid { grid-template-columns: minmax(0, 1fr); }
  .brand-pane { max-height: none; }
  .brand-list { flex-direction: row; overflow-x: auto; padding: 0 12px 12px; gap: 8px; }
  .brand-item { width: auto; min-width: 190px; flex: none; }
  .brand-item .brand-count { display: none; }
}
@media (max-width: 760px) {
  .clock { display: none; }
  .user-meta { display: none; }
  .user-btn { padding: 3px; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .mail-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head h2 { font-size: 23px; }
  .page-actions { width: 100%; }
  .toolbar .search { width: 100%; min-width: 0; }
  .toolbar .select { flex: 1 1 calc(50% - 5px); min-width: 0; }
  .toolbar-right { width: 100%; margin-left: 0; }
  .table-scroll { max-height: none; }
  .data { min-width: 820px; }
  .data th, .data td { padding-left: 12px; padding-right: 12px; }
  .data th:first-child, .data td:first-child { padding-left: 14px; }
  .data th:last-child, .data td:last-child { padding-right: 14px; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { width: 100%; max-height: 92dvh; border-radius: 20px 20px 0 0; animation: sheet-up 280ms var(--ease); }
  .modal.sm, .modal.wide { width: 100%; }
  @keyframes sheet-up { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: span 1; }
  .donut-wrap { flex-direction: column; align-items: stretch; }
  .donut-holder { margin: 0 auto; }
  .login-card { padding: 28px 22px 22px; border-radius: 22px; }
  .login-card h1 { font-size: 26px; }
  .login-stage { padding: 40px 16px 24px; }
  .login-footer { padding: 14px 16px 22px; flex-wrap: wrap; row-gap: 2px; }
  .inv-summary { gap: 10px; }
  .segmented { width: 100%; }
  .seg-btn { flex: 1; justify-content: center; }
}
@media (max-width: 480px) {
  .view { padding: 16px 14px 40px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .page-actions .btn { flex: 1; }
  .mail-status-grid { grid-template-columns: minmax(0, 1fr); }
  .perm-list { grid-template-columns: minmax(0, 1fr); }
  .user-btn > svg { display: none; }
  .stat-value { font-size: 27px; }
}

/* ---------- 动效偏好 ---------- */
@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;
  }
}
