/* ==========================================================================
   拾光 · 个人工作台 — 设计系统 & 外壳
   Apple / macOS Sonoma · iOS Widget 气质，零外部资源
   --------------------------------------------------------------------------
   01 设计变量 & 深浅色主题
   02 Reset / 基础排版
   03 环境背景 Ambient
   04 外壳 Shell（侧栏 / 顶栏 / 内容容器）
   05 页面标题 & 12 栏网格
   06 卡片 Cards
   07 按钮 Buttons
   08 徽标 Pills / Tags / Chips / Segmented
   09 数据 Stats / Progress / List / Empty
   10 表单 Forms
   11 图表 Charts
   12 表格 Tables
   13 弹窗 Modal
   14 Toast
   15 快速添加 Quick Sheet
   16 命令面板 Palette
   17 响应式 Responsive（1260 / 1100 / 760）
   18 杂项 & 动效降级
   ========================================================================== */

/* ==========================================================================
   01 设计变量 & 深浅色主题
   ========================================================================== */

:root {
  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "PingFang SC", "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  /* 布局 */
  --sidebar-w: 236px;
  --topbar-h: 68px;
  --content-max: 1360px;
  --page-pad-x: clamp(24px, 3.2vw, 40px);

  /* 圆角 */
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  /* 动效 */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur-fast: 220ms;
  --dur: 260ms;
  --dur-slow: 320ms;

  /* 基础表面 —— 浅色：暖灰底 + 白色悬浮卡片 */
  --bg: #f5f4f1;
  --bg-elevated: #fbfaf8;
  --surface: #ffffff;
  --surface-2: #f3f1ed;
  --card: rgba(255, 255, 255, 0.78);
  --card-solid: #ffffff;
  --card-tinted: linear-gradient(155deg, #ffffff 6%, #f3f6ff 100%);
  --card-glow: rgba(10, 132, 255, 0.1);
  --card-inset: rgba(255, 255, 255, 0.7);
  --border: rgba(36, 30, 24, 0.075);
  --border-strong: rgba(36, 30, 24, 0.14);
  --text: #1d1d1f;
  --text-2: #57575e;
  --text-3: #8a8a90;

  /* 强调色（Apple 系统色） */
  --blue: #0a84ff;
  --green: #34c759;
  --orange: #ff9500;
  --pink: #ff2d55;
  --purple: #af52de;
  --teal: #30b0c7;
  --yellow: #ffcc00;
  --red: #ff3b30;

  /* 文字型强调色（用于浅底徽标，保证可读） */
  --ink-blue: #0071e3;
  --ink-green: #1e8f4c;
  --ink-orange: #b45c00;
  --ink-pink: #d61a46;
  --ink-purple: #8e3fd1;
  --ink-teal: #0b7d92;
  --ink-yellow: #8a6d00;
  --ink-red: #d70015;

  /* 柔色底 */
  --tint-blue: rgba(10, 132, 255, 0.1);
  --tint-green: rgba(52, 199, 89, 0.13);
  --tint-orange: rgba(255, 149, 0, 0.14);
  --tint-pink: rgba(255, 45, 85, 0.11);
  --tint-purple: rgba(175, 82, 222, 0.12);
  --tint-teal: rgba(48, 176, 199, 0.13);
  --tint-yellow: rgba(255, 204, 0, 0.17);
  --tint-red: rgba(255, 59, 48, 0.11);
  --tint-gray: rgba(120, 120, 128, 0.1);

  /* 玻璃与浮层 */
  --glass: rgba(255, 255, 255, 0.6);
  --glass-strong: rgba(255, 255, 255, 0.84);
  --glass-border: rgba(255, 255, 255, 0.7);
  --sidebar-bg: rgba(250, 249, 246, 0.68);
  --sidebar-drawer-bg: rgba(250, 249, 246, 0.93);
  --topbar-bg: rgba(246, 245, 242, 0.7);
  --field-bg: rgba(255, 255, 255, 0.92);
  --modal-bg: rgba(255, 255, 255, 0.94);
  --modal-border: rgba(255, 255, 255, 0.8);
  --toast-bg: rgba(255, 255, 255, 0.9);
  --btn-bg: #ffffff;
  --btn-bg-hover: #ffffff;
  --hover: rgba(24, 22, 20, 0.045);
  --hover-strong: rgba(24, 22, 20, 0.07);
  --switch-off: rgba(120, 120, 128, 0.28);

  /* 阴影：极轻、多层 */
  --shadow-sm: 0 1px 2px rgba(28, 24, 18, 0.04),
    0 2px 8px -4px rgba(28, 24, 18, 0.06);
  --shadow-md: 0 2px 6px rgba(28, 24, 18, 0.05),
    0 16px 34px -20px rgba(28, 24, 18, 0.25);
  --shadow-lg: 0 12px 28px -12px rgba(28, 24, 18, 0.18),
    0 40px 80px -32px rgba(28, 24, 18, 0.32);

  /* 焦点 / 滚动条 */
  --focus: rgba(10, 132, 255, 0.55);
  --focus-ring: rgba(10, 132, 255, 0.2);
  --scroll-thumb: rgba(60, 60, 67, 0.22);
  --scroll-thumb-hover: rgba(60, 60, 67, 0.36);

  /* 图表：描边圆点会引用该变量，需贴近卡片底色 */
  --chart-bg: #ffffff;

  /* 渐变 */
  --avatar-grad: linear-gradient(140deg, #ffc46b 0%, #ff8a8a 52%, #f76fb3 100%);
  --accent-grad: linear-gradient(170deg, #0a84ff 0%, #0063d9 100%);
  --danger-grad: linear-gradient(170deg, #ff5b52 0%, #ef3b30 100%);
  --blue-glow: rgba(10, 132, 255, 0.55);
  --red-glow: rgba(255, 59, 48, 0.45);
}

html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;

  /* 石墨黑玻璃 */
  --bg: #0b0b0d;
  --bg-elevated: #131315;
  --surface: #17171a;
  --surface-2: #1d1d21;
  --card: rgba(27, 27, 31, 0.72);
  --card-solid: #1b1b1f;
  --card-tinted: linear-gradient(155deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  --card-glow: rgba(10, 132, 255, 0.18);
  --card-inset: rgba(255, 255, 255, 0.035);
  --border: rgba(255, 255, 255, 0.075);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f5f7;
  --text-2: #a8a8b0;
  --text-3: #7f7f87;

  --blue: #0a84ff;
  --green: #30d158;
  --orange: #ff9f0a;
  --pink: #ff375f;
  --purple: #bf5af2;
  --teal: #64d2ff;
  --yellow: #ffd60a;
  --red: #ff453a;

  --ink-blue: #64a8ff;
  --ink-green: #5ddc85;
  --ink-orange: #ffb340;
  --ink-pink: #ff6d92;
  --ink-purple: #d78bff;
  --ink-teal: #6fd6ec;
  --ink-yellow: #ffd95e;
  --ink-red: #ff7b72;

  --tint-blue: rgba(10, 132, 255, 0.2);
  --tint-green: rgba(48, 209, 88, 0.18);
  --tint-orange: rgba(255, 159, 10, 0.18);
  --tint-pink: rgba(255, 55, 95, 0.18);
  --tint-purple: rgba(191, 90, 242, 0.18);
  --tint-teal: rgba(100, 210, 255, 0.16);
  --tint-yellow: rgba(255, 214, 10, 0.16);
  --tint-red: rgba(255, 69, 58, 0.18);
  --tint-gray: rgba(255, 255, 255, 0.08);

  --glass: rgba(30, 30, 35, 0.55);
  --glass-strong: rgba(36, 36, 41, 0.78);
  --glass-border: rgba(255, 255, 255, 0.09);
  --sidebar-bg: rgba(17, 17, 19, 0.64);
  --sidebar-drawer-bg: rgba(18, 18, 21, 0.94);
  --topbar-bg: rgba(11, 11, 13, 0.62);
  --field-bg: rgba(255, 255, 255, 0.055);
  --modal-bg: rgba(31, 31, 36, 0.94);
  --modal-border: rgba(255, 255, 255, 0.09);
  --toast-bg: rgba(40, 40, 46, 0.88);
  --btn-bg: rgba(255, 255, 255, 0.07);
  --btn-bg-hover: rgba(255, 255, 255, 0.11);
  --hover: rgba(255, 255, 255, 0.055);
  --hover-strong: rgba(255, 255, 255, 0.09);
  --switch-off: rgba(255, 255, 255, 0.18);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35),
    0 24px 48px -24px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --shadow-lg: 0 18px 48px -16px rgba(0, 0, 0, 0.65),
    0 40px 90px -30px rgba(0, 0, 0, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);

  --focus: rgba(10, 132, 255, 0.65);
  --focus-ring: rgba(10, 132, 255, 0.28);
  --scroll-thumb: rgba(255, 255, 255, 0.16);
  --scroll-thumb-hover: rgba(255, 255, 255, 0.26);
  --chart-bg: #1b1b1f;
}

/* ==========================================================================
   02 Reset / 基础排版
   ========================================================================== */

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
  scroll-padding-top: calc(var(--topbar-h) + 24px);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color 0.35s ease, color 0.35s ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-weight: 650;
  line-height: 1.28;
  letter-spacing: -0.015em;
  color: var(--text);
}

h1 {
  font-size: 28px;
}
h2 {
  font-size: 18px;
}
h3 {
  font-size: 15px;
}

p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
video,
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

svg {
  max-width: 100%;
}

.icon {
  display: inline-block;
  vertical-align: -0.15em;
  flex: none;
  pointer-events: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

::selection {
  background: rgba(10, 132, 255, 0.22);
  color: var(--text);
}

html[data-theme="dark"] ::selection {
  background: rgba(10, 132, 255, 0.36);
}

:where(a, button, [role="button"], input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* 细、低调的自定义滚动条 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--scroll-thumb);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--scroll-thumb-hover);
  background-clip: content-box;
}

kbd,
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  color: var(--text-3);
  background: var(--hover-strong);
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: nowrap;
}

/* ==========================================================================
   03 环境背景 Ambient
   ========================================================================== */

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--bg);
}

.ambient-blob {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(76px);
  opacity: 0.85;
  will-change: transform;
  animation: ambient-drift 34s var(--ease) infinite alternate;
}

.ambient-blob--blue {
  top: -200px;
  left: -110px;
  width: 620px;
  height: 620px;
  background: radial-gradient(
    circle at 38% 38%,
    rgba(10, 132, 255, 0.42),
    rgba(10, 132, 255, 0) 68%
  );
  animation-duration: 36s;
}

.ambient-blob--pink {
  top: -160px;
  right: -140px;
  width: 580px;
  height: 580px;
  background: radial-gradient(
    circle at 52% 42%,
    rgba(255, 105, 180, 0.3),
    rgba(255, 105, 180, 0) 68%
  );
  animation-duration: 42s;
  animation-delay: -8s;
}

.ambient-blob--orange {
  right: 14%;
  bottom: -300px;
  width: 680px;
  height: 680px;
  background: radial-gradient(
    circle at 50% 45%,
    rgba(255, 159, 10, 0.26),
    rgba(255, 159, 10, 0) 70%
  );
  animation-duration: 48s;
  animation-delay: -16s;
}

.ambient-grain {
  position: absolute;
  inset: -12%;
  display: block;
  opacity: 0.5;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)' opacity='.42'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

html[data-theme="dark"] .ambient-blob {
  opacity: 0.55;
  filter: blur(88px);
}

html[data-theme="dark"] .ambient-blob--blue {
  background: radial-gradient(
    circle at 38% 38%,
    rgba(10, 132, 255, 0.4),
    rgba(10, 132, 255, 0) 68%
  );
}

html[data-theme="dark"] .ambient-blob--pink {
  background: radial-gradient(
    circle at 52% 42%,
    rgba(255, 55, 95, 0.24),
    rgba(255, 55, 95, 0) 68%
  );
}

html[data-theme="dark"] .ambient-blob--orange {
  background: radial-gradient(
    circle at 50% 45%,
    rgba(255, 159, 10, 0.2),
    rgba(255, 159, 10, 0) 70%
  );
}

html[data-theme="dark"] .ambient-grain {
  opacity: 0.32;
  mix-blend-mode: overlay;
}

@keyframes ambient-drift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  100% {
    transform: translate3d(2.4%, -2%, 0) scale(1.06);
  }
}

/* ==========================================================================
   04 外壳 Shell
   ========================================================================== */

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

/* ---- 侧栏 -------------------------------------------------------------- */

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 60;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  transition: transform var(--dur-slow) var(--ease),
    background-color 0.35s ease, border-color 0.35s ease;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 18px 14px calc(16px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.sidebar-inner::-webkit-scrollbar {
  display: none;
}

/* 品牌 */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 20px;
  border-radius: var(--radius-md);
}

.brand-mark {
  display: block;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 16px -6px rgba(94, 92, 230, 0.5),
    0 1px 2px rgba(20, 20, 40, 0.12);
}

.brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.brand-name {
  font-size: 16px;
  font-weight: 680;
  letter-spacing: 0.01em;
  line-height: 1.18;
  color: var(--text);
}

.brand-sub {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* 导航 */
.nav {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group-label {
  margin: 0;
  padding: 0 11px 6px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-3);
  opacity: 0.82;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 37px;
  padding: 0 10px;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  transition: background-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.nav-item:hover {
  background: var(--hover);
  color: var(--text);
}

.nav-item.is-active {
  background: var(--surface);
  color: var(--text);
  font-weight: 580;
  box-shadow: 0 1px 2px rgba(28, 24, 18, 0.05),
    0 5px 14px -10px rgba(28, 24, 18, 0.28);
}

html[data-theme="dark"] .nav-item.is-active {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 1px 2px rgba(0, 0, 0, 0.3);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--text-3);
  transition: color var(--dur-fast) var(--ease);
}

.nav-item:hover .nav-icon {
  color: var(--text-2);
}

.nav-item.is-active .nav-icon {
  color: var(--blue);
}

.nav-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 2px 6px -2px var(--blue-glow);
}

.nav-badge[hidden] {
  display: none !important;
}

.sidebar-spacer {
  flex: 1 1 auto;
  min-height: 22px;
}

/* 侧栏底部：今日节奏小卡 */
.sidebar-card {
  padding: 13px 14px;
  border-radius: 18px;
  background: linear-gradient(165deg, var(--glass-strong), var(--glass));
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--card-inset);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
}

.side-note-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.side-note-kicker {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.side-note-value {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--text);
}

.side-note-value small {
  margin-left: 1px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-3);
}

.micro-bars {
  display: flex;
  gap: 5px;
  margin: 10px 0 9px;
}

.micro-bar {
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: var(--hover-strong);
  overflow: hidden;
}

.micro-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.7s var(--ease);
}

.side-note-text {
  margin: 0;
  font-size: 11px;
  line-height: 1.55;
  color: var(--text-3);
}

/* 侧栏底部：个人卡片 */
.profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease);
}

.profile-card:hover {
  background: var(--hover);
  border-color: var(--border);
}

.profile-card:active {
  background: var(--hover-strong);
}

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 650;
  color: #fff;
  background: var(--avatar-grad);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 2px 6px -2px rgba(220, 90, 120, 0.45);
  overflow: hidden;
  line-height: 1;
}

.avatar--md {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

.avatar--sm {
  width: 30px;
  height: 30px;
  font-size: 11.5px;
}

.profile-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  gap: 1px;
}

.profile-name {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-sub {
  font-size: 10.5px;
  line-height: 1.3;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-chevron {
  display: flex;
  flex: none;
  color: var(--text-3);
  opacity: 0.75;
}

/* 移动端遮罩（默认不存在于布局中） */
.sidebar-scrim {
  display: none;
}

/* ---- 主区域 ------------------------------------------------------------ */

.app-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: var(--sidebar-w);
}

.view-root {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 30px var(--page-pad-x) 84px;
  outline: none;
}

/* ---- 顶栏 -------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 var(--page-pad-x);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  transition: background-color 0.35s ease, border-color 0.35s ease;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.topbar-center {
  display: flex;
  justify-content: center;
  flex: 0 1 420px;
  min-width: 0;
  padding: 0 8px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  line-height: 1.2;
}

.crumb-section {
  color: var(--text-3);
  font-weight: 500;
  white-space: nowrap;
}

.crumb-sep {
  color: var(--text-3);
  opacity: 0.55;
  font-weight: 400;
}

.crumb-page {
  color: var(--text);
  font-weight: 620;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-toggle {
  display: none;
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  max-width: 420px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--field-bg);
  color: var(--text-3);
  font-family: inherit;
  font-size: 12.5px;
  text-align: left;
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--card-inset);
  transition: border-color var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}

.search-trigger:hover {
  border-color: var(--border-strong);
  color: var(--text-2);
  box-shadow: var(--shadow-md), inset 0 1px 0 var(--card-inset);
}

.search-trigger > span:not(.kbd) {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-trigger .kbd {
  margin-left: auto;
  flex: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--text-2);
  transition: background-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}

.icon-btn:hover {
  background: var(--hover);
  border-color: var(--border);
  color: var(--text);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn svg {
  display: block;
}

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 2px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-3);
  opacity: 0.72;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}

.save-status::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--green);
  opacity: 0.55;
  transition: opacity var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}

.save-status.is-saving {
  color: var(--text-2);
  opacity: 1;
}

.save-status.is-saving::before {
  opacity: 1;
  box-shadow: 0 0 0 3px var(--tint-green);
  animation: save-pulse 1.4s var(--ease) infinite;
}

@keyframes save-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(0.72);
    opacity: 0.6;
  }
}

.quick-add-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--accent-grad);
  box-shadow: 0 6px 16px -6px var(--blue-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease);
}

.quick-add-btn:hover {
  transform: translateY(-1px) scale(1.03);
  filter: brightness(1.05);
  box-shadow: 0 10px 22px -8px var(--blue-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.quick-add-btn:active {
  transform: scale(0.96);
}

.quick-add-btn svg {
  display: block;
}

.topbar-avatar {
  margin-left: 2px;
  cursor: pointer;
  transition: box-shadow var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}

.topbar-avatar:hover {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 0 0 3px var(--hover-strong);
}

.topbar-avatar:active {
  transform: scale(0.95);
}

#themeIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#themeIcon svg {
  display: block;
}

/* ==========================================================================
   05 页面标题 & 12 栏网格
   ========================================================================== */

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 6px 0 26px;
  flex-wrap: wrap;
}

.page-heading > div:first-child {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
}

.page-heading h1 {
  margin: 0 0 6px;
  font-size: clamp(24px, 2.4vw, 30px);
  font-weight: 700;
  letter-spacing: -0.024em;
  line-height: 1.12;
}

.page-sub {
  margin: 0;
  max-width: 68ch;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-2);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
}

.grid-12 > * {
  min-width: 0;
}

.span-3 {
  grid-column: span 3;
}
.span-4 {
  grid-column: span 4;
}
.span-5 {
  grid-column: span 5;
}
.span-6 {
  grid-column: span 6;
}
.span-7 {
  grid-column: span 7;
}
.span-8 {
  grid-column: span 8;
}
.span-9 {
  grid-column: span 9;
}
.span-12 {
  grid-column: span 12;
}

/* 视图入场 */
.view-enter {
  animation: view-enter var(--dur-slow) var(--ease) both;
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ==========================================================================
   06 卡片 Cards
   ========================================================================== */

.card {
  position: relative;
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--card-inset);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  transition: box-shadow var(--dur) var(--ease),
    border-color var(--dur) var(--ease), transform var(--dur) var(--ease),
    background-color 0.35s ease;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md), inset 0 1px 0 var(--card-inset);
  transform: translateY(-1px);
}

.card--tinted {
  background: var(--card-tinted);
}

.card--tinted::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background: radial-gradient(
    120% 90% at 0% 0%,
    var(--card-glow),
    transparent 62%
  );
  pointer-events: none;
}

.card--tinted > * {
  position: relative;
  z-index: 1;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.card-head > div {
  min-width: 0;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}

.card-sub {
  margin: 3px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-3);
}

.card-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  padding: 5px 8px;
  margin: -3px -4px -3px 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 550;
  color: var(--text-3);
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}

.card-action:hover {
  color: var(--text);
  background: var(--hover);
}

.divider {
  width: 100%;
  height: 1px;
  margin: 16px 0;
  border: 0;
  background: var(--border);
}

/* ==========================================================================
   07 按钮 Buttons
   ========================================================================== */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.005em;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--card-inset);
  transition: transform var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    filter var(--dur-fast) var(--ease);
}

.btn:hover {
  background: var(--btn-bg-hover);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md), inset 0 1px 0 var(--card-inset);
  transform: translateY(-1px);
}

.btn:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3.5px var(--focus-ring), var(--shadow-sm);
}

.btn svg {
  display: block;
  flex: none;
}

.btn--primary {
  color: #fff;
  background: var(--accent-grad);
  border-color: rgba(5, 90, 190, 0.28);
  box-shadow: 0 8px 18px -10px var(--blue-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.btn--primary:hover {
  border-color: rgba(5, 90, 190, 0.3);
  filter: brightness(1.05);
  box-shadow: 0 12px 24px -10px var(--blue-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.btn--primary:focus-visible {
  box-shadow: 0 0 0 3.5px var(--focus-ring),
    0 8px 18px -10px var(--blue-glow), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-2);
}

.btn--ghost:hover {
  background: var(--hover);
  border-color: transparent;
  color: var(--text);
  box-shadow: none;
}

.btn--ghost:active {
  background: var(--hover-strong);
}

.btn--small {
  height: 29px;
  padding: 0 12px;
  gap: 5px;
  font-size: 12px;
  border-radius: 999px;
}

.btn--danger {
  color: #fff;
  background: var(--danger-grad);
  border-color: rgba(160, 20, 15, 0.25);
  box-shadow: 0 8px 18px -10px var(--red-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.btn--danger:hover {
  filter: brightness(1.05);
  box-shadow: 0 12px 24px -10px var(--red-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.btn[disabled],
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  filter: none !important;
}

/* 提交中的按钮 */
.btn.is-loading {
  color: transparent !important;
  pointer-events: none;
}

.btn.is-loading > * {
  visibility: hidden;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn--ghost.is-loading::after {
  border-color: var(--border-strong);
  border-top-color: var(--text-2);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   08 徽标 Pills / Tags / Chips / Segmented
   ========================================================================== */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.005em;
  white-space: nowrap;
  color: var(--text-2);
  background: var(--tint-gray);
}

.pill--green {
  color: var(--ink-green);
  background: var(--tint-green);
}
.pill--blue {
  color: var(--ink-blue);
  background: var(--tint-blue);
}
.pill--orange {
  color: var(--ink-orange);
  background: var(--tint-orange);
}
.pill--pink {
  color: var(--ink-pink);
  background: var(--tint-pink);
}
.pill--purple {
  color: var(--ink-purple);
  background: var(--tint-purple);
}
.pill--teal {
  color: var(--ink-teal);
  background: var(--tint-teal);
}
.pill--yellow {
  color: var(--ink-yellow);
  background: var(--tint-yellow);
}
.pill--red {
  color: var(--ink-red);
  background: var(--tint-red);
}
.pill--gray {
  color: var(--text-2);
  background: var(--tint-gray);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 21px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 30px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 550;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--hover);
}

.chip:active {
  transform: scale(0.97);
}

.chip--active,
.chip--active:hover {
  color: var(--bg-elevated);
  background: var(--text);
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}

.segment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 27px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-3);
  font-family: inherit;
  font-size: 12px;
  font-weight: 550;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}

.segment:hover {
  color: var(--text);
}

.segment.is-active {
  color: var(--text);
  background: var(--card-solid);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   09 数据展示 Stats / Progress / List / Empty
   ========================================================================== */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 18px 24px;
}

.stat {
  min-width: 0;
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 7px;
  font-size: 11.5px;
  font-weight: 550;
  letter-spacing: 0.015em;
  color: var(--text-3);
}

.stat-value {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 3px 5px;
  margin: 0;
  font-size: clamp(25px, 2.5vw, 32px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.stat-unit {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-3);
}

.stat-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 8px 0 0;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.stat-delta--up {
  color: var(--ink-green);
  background: var(--tint-green);
}

.stat-delta--down {
  color: var(--ink-red);
  background: var(--tint-red);
}

.progress {
  position: relative;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--hover-strong);
  overflow: hidden;
}

.progress-bar {
  position: relative;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.65s var(--ease), background-color var(--dur) var(--ease);
}

.progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.24),
    rgba(255, 255, 255, 0) 62%
  );
  pointer-events: none;
}

.progress--sm {
  height: 5px;
}

/* 列表 */
.list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px;
  border-radius: 12px;
  transition: background-color var(--dur-fast) var(--ease);
}

.list-row:hover {
  background: var(--hover);
}

.list-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-2);
}

.list-icon svg {
  display: block;
}

.list-main {
  flex: 1;
  min-width: 0;
}

.list-title {
  margin: 0;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.4;
  color: var(--text);
  overflow-wrap: anywhere;
}

.list-sub {
  margin: 2px 0 0;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-3);
  overflow-wrap: anywhere;
}

.list-end {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  margin-left: auto;
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
}

.list-row--done .list-title {
  color: var(--text-3);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--text-3);
}

.list-row--done .list-icon {
  opacity: 0.55;
}

.list-row--done .list-end {
  opacity: 0.7;
}

/* 空状态 / 渲染错误 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 34px 20px;
  text-align: center;
  color: var(--text-3);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text-3);
  box-shadow: inset 0 1px 0 var(--card-inset);
}

.empty-icon svg {
  display: block;
}

.empty-state h2,
.empty-state h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}

.empty-state p {
  margin: 4px 0 0;
  max-width: 40ch;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-3);
}

.empty-state .btn {
  margin-top: 14px;
}

.render-error {
  margin: 12px 0;
  padding: 24px;
  border: 1px solid rgba(255, 59, 48, 0.22);
  border-radius: var(--radius-lg);
  background: var(--tint-red);
  color: var(--text);
}

.render-error h2 {
  margin: 0 0 6px;
  font-size: 16px;
}

.render-error p {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--ink-red);
  overflow-wrap: anywhere;
}

/* ==========================================================================
   10 表单 Forms
   ========================================================================== */

.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* 宽字段：始终占满整行（2 列 / 1 列均安全） */
.form-grid > .field--wide,
.form-grid--2 > .field--wide {
  grid-column: 1 / -1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-2);
}

.field-hint {
  font-size: 11px;
  line-height: 1.55;
  color: var(--text-3);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--field-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: inset 0 1px 2px rgba(20, 18, 14, 0.025);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}

html[data-theme="dark"] .input,
html[data-theme="dark"] .select,
html[data-theme="dark"] .textarea {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--text-3);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--blue);
  background: var(--card-solid);
  box-shadow: 0 0 0 3.5px var(--focus-ring);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-3);
  opacity: 0.9;
}

.input:disabled,
.select:disabled,
.textarea:disabled,
.input[readonly] {
  opacity: 0.6;
  cursor: not-allowed;
}

.select {
  padding-right: 34px;
  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='%238a8a90' stroke-width='2.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 12px center;
  background-size: 12px;
  cursor: pointer;
}

html[data-theme="dark"] .select {
  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='%237f7f87' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.select option {
  background: var(--card-solid);
  color: var(--text);
}

.textarea {
  min-height: 92px;
  padding: 10px 12px;
  line-height: 1.65;
  resize: vertical;
}

input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"] {
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

.input[type="file"],
input[type="file"].input {
  padding: 7px 10px;
  font-size: 12px;
  color: var(--text-2);
}

.input[type="file"]::file-selector-button,
input[type="file"].input::file-selector-button {
  margin-right: 10px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--hover-strong);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease);
}

.input[type="file"]::file-selector-button:hover,
input[type="file"].input::file-selector-button:hover {
  background: var(--border);
}

/* 输入组合（输入框 + 单位 / 按钮） */
.input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.input-group .input,
.input-group .select {
  flex: 1;
  min-width: 0;
}

.input-group > .btn,
.input-group > .icon-btn {
  flex: none;
}

/* 自定义复选框 */
input[type="checkbox"] {
  display: inline-grid;
  place-content: center;
  width: 17px;
  height: 17px;
  flex: none;
  margin: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--field-bg);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  vertical-align: middle;
  transition: background-color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}

input[type="checkbox"]:hover {
  border-color: var(--text-3);
}

input[type="checkbox"]:checked {
  background: var(--blue);
  border-color: var(--blue);
}

input[type="checkbox"]:checked::after {
  content: "";
  width: 4px;
  height: 8px;
  margin-top: -1px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
}

input[type="radio"] {
  width: 16px;
  height: 16px;
  flex: none;
  margin: 0;
  accent-color: var(--blue);
  cursor: pointer;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--field-bg);
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}

.checkbox-row:hover {
  border-color: var(--border-strong);
}

/* 开关：label.switch > input[type=checkbox]，也兼容独立 role=switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.switch input[type="checkbox"] {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 24px;
  flex: none;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--switch-off);
  box-shadow: inset 0 0 0 1px var(--border);
  vertical-align: middle;
}

.switch input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  transform: none;
  transition: transform var(--dur) var(--ease);
}

.switch input[type="checkbox"]:checked {
  background: var(--green);
  border-color: transparent;
}

.switch input[type="checkbox"]:checked::after {
  width: 18px;
  height: 18px;
  margin: 0;
  border: 0;
  background: #fff;
  transform: translateX(16px);
}

.switch:not(:has(input)) {
  position: relative;
  width: 40px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--switch-off);
  transition: background-color var(--dur) var(--ease);
}

.switch:not(:has(input))::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  transition: transform var(--dur) var(--ease);
}

.switch:not(:has(input)).is-on,
.switch:not(:has(input))[aria-checked="true"] {
  background: var(--green);
}

.switch:not(:has(input)).is-on::after,
.switch:not(:has(input))[aria-checked="true"]::after {
  transform: translateX(16px);
}

details {
  border-radius: var(--radius-md);
}

summary {
  cursor: pointer;
  user-select: none;
}

/* ==========================================================================
   11 图表 Charts
   ========================================================================== */

.chart-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  color: var(--text);
  font-family: var(--font);
}

.chart-svg text {
  font-family: var(--font);
}

.chart-line,
.chart-bars,
.chart-sparkline,
.chart-hbars {
  display: block;
  width: 100%;
  height: auto;
}

.chart-donut,
.chart-rings {
  display: block;
  width: 100%;
  max-width: 232px;
  height: auto;
  margin: 0 auto;
}

.chart-heatmap {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  margin: 0 auto;
}

.chart-line {
  margin-top: 2px;
}

.chart-bars {
  margin-top: 2px;
}

.chart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 132px;
  padding: 26px 16px;
  color: var(--text-3);
  text-align: center;
}

.chart-empty span {
  display: grid;
  place-items: center;
  color: var(--text-3);
  opacity: 0.8;
}

.chart-empty svg {
  display: block;
}

.chart-empty p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

.ring-progress {
  animation: ring-reveal 0.95s var(--ease) both;
}

@keyframes ring-reveal {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ==========================================================================
   12 表格 Tables
   ========================================================================== */

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border-radius: 14px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 12.5px;
  text-align: left;
}

.table th {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
  background: transparent;
}

.table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}

.table th:first-child,
.table td:first-child {
  padding-left: 4px;
}

.table th:last-child,
.table td:last-child {
  padding-right: 4px;
}

.table tbody tr {
  transition: background-color var(--dur-fast) var(--ease);
}

.table tbody tr:hover {
  background: var(--hover);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table strong {
  color: var(--text);
  font-weight: 600;
}

/* ==========================================================================
   13 弹窗 Modal
   ========================================================================== */

/* 浮层挂载点：内容为空时不占据文档流；z-index 必须高于 .app-shell(1)，
   否则 fixed 子层的 z-index 会被限制在挂载点的 stacking context 里。 */
.modal-root,
.palette-root {
  position: relative;
  z-index: 200;
}

.palette-root {
  z-index: 210;
}

.modal-root:empty,
.palette-root:empty {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(16, 15, 20, 0.28);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
  backdrop-filter: blur(10px) saturate(130%);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-slow) var(--ease),
    visibility 0s linear var(--dur-slow);
}

html[data-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.52);
}

.modal-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--dur-slow) var(--ease);
}

.modal-backdrop.is-closing {
  opacity: 0;
  transition: opacity 160ms var(--ease);
}

.modal {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--modal-border);
  border-radius: 22px;
  background: var(--modal-bg);
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  transform: translateY(16px) scale(0.97);
  transition: transform var(--dur-slow) var(--ease), opacity var(--dur) var(--ease);
}

.modal-backdrop.is-visible .modal {
  transform: none;
}

.modal-backdrop.is-closing .modal {
  transform: translateY(10px) scale(0.985);
  opacity: 0;
  transition-duration: 160ms;
}

.modal--sm {
  max-width: 384px;
}

.modal--md {
  max-width: 460px;
}

.modal--lg {
  max-width: 640px;
}

.modal-grabber {
  display: none;
  width: 38px;
  height: 5px;
  flex: none;
  margin: 8px auto 0;
  border-radius: 999px;
  background: var(--border-strong);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 22px 0;
}

.modal-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 12px;
  background: var(--tint-blue);
  color: var(--blue);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.modal-icon svg {
  display: block;
}

.modal-heading {
  flex: 1;
  min-width: 0;
  padding-top: 1px;
}

.modal-title {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
}

.modal-sub {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-3);
}

.modal-close {
  flex: none;
  margin: -3px -6px 0 auto;
}

.modal-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.modal-body {
  padding: 18px 22px 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-body:empty {
  padding: 6px 22px 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 22px 20px;
}

.modal-body:not(:empty) + .modal-footer {
  border-top: 1px solid var(--border);
  margin-top: 14px;
}

body.modal-open,
body.overlay-open {
  overflow: hidden;
}

/* ==========================================================================
   14 Toast
   ========================================================================== */

.toast-root {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(92vw, 440px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  padding: 9px 15px 9px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--toast-bg);
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.45;
  text-align: left;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: none;
}

.toast-icon {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  flex: none;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
}

.toast-icon svg {
  display: block;
}

.toast--success .toast-icon {
  background: var(--green);
}

.toast--plain .toast-icon {
  color: var(--text-2);
  background: var(--hover-strong);
}

.toast--warning .toast-icon {
  background: var(--orange);
}

.toast--danger .toast-icon {
  background: var(--red);
}

.toast--warning {
  color: var(--text);
}

.toast--danger {
  border-color: rgba(255, 59, 48, 0.24);
}

/* ==========================================================================
   15 快速添加 Quick Sheet
   ========================================================================== */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(16, 15, 20, 0.3);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
  backdrop-filter: blur(10px) saturate(130%);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur) var(--ease),
    visibility 0s linear var(--dur);
}

html[data-theme="dark"] .sheet-backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.sheet-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--dur) var(--ease);
}

.sheet-backdrop.is-closing {
  opacity: 0;
  transition: opacity 140ms var(--ease);
}

.quick-sheet {
  width: 100%;
  max-width: 640px;
  max-height: min(82vh, 720px);
  padding: 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--modal-border);
  border-radius: 26px;
  background: var(--modal-bg);
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  transform: translateY(16px) scale(0.97);
  opacity: 0;
  transition: transform var(--dur-slow) var(--ease), opacity var(--dur) var(--ease);
}

.sheet-backdrop.is-visible .quick-sheet {
  transform: none;
  opacity: 1;
}

.sheet-backdrop.is-closing .quick-sheet {
  transform: translateY(12px) scale(0.985);
  opacity: 0;
  transition-duration: 140ms;
}

.sheet-grabber {
  display: none;
  width: 38px;
  height: 5px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: var(--border-strong);
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.sheet-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
}

.sheet-sub {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-3);
}

.sheet-groups {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sheet-group {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.sheet-group-label {
  margin: 0;
  padding-left: 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-3);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 9px;
}

.quick-action {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--field-bg);
  color: var(--text);
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}

.quick-action:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: var(--card-solid);
  box-shadow: var(--shadow-sm);
}

.quick-action:active {
  transform: scale(0.985);
}

.quick-action-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 11px;
  background: var(--tint-blue);
  color: var(--blue);
}

.quick-action-icon svg {
  display: block;
}

.quick-action-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.quick-action-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.quick-action-desc {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 20px 0 0;
  font-size: 11px;
  color: var(--text-3);
}

.sheet-hint svg {
  display: block;
  flex: none;
}

/* ==========================================================================
   16 命令面板 Palette
   ========================================================================== */

.palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 115;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(64px, 13vh, 140px) 20px 24px;
  background: rgba(16, 15, 20, 0.24);
  -webkit-backdrop-filter: blur(8px) saturate(130%);
  backdrop-filter: blur(8px) saturate(130%);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-fast) var(--ease),
    visibility 0s linear var(--dur-fast);
}

html[data-theme="dark"] .palette-backdrop {
  background: rgba(0, 0, 0, 0.46);
}

.palette-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--dur-fast) var(--ease);
}

.palette-backdrop.is-closing {
  opacity: 0;
  transition: opacity 140ms var(--ease);
}

.palette {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: min(70vh, 560px);
  overflow: hidden;
  border: 1px solid var(--modal-border);
  border-radius: 20px;
  background: var(--modal-bg);
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  transform: translateY(-10px) scale(0.985);
  opacity: 0;
  transition: transform var(--dur-slow) var(--ease), opacity var(--dur) var(--ease);
}

.palette-backdrop.is-visible .palette {
  transform: none;
  opacity: 1;
}

.palette-backdrop.is-closing .palette {
  transform: translateY(-6px) scale(0.99);
  opacity: 0;
  transition-duration: 140ms;
}

.palette-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
}

.palette-input-wrap svg {
  display: block;
  flex: none;
}

.palette-input {
  flex: 1;
  min-width: 0;
  height: 24px;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.palette-input::placeholder {
  color: var(--text-3);
}

.palette-input-wrap kbd {
  flex: none;
}

.palette-results {
  flex: 1;
  min-height: 0;
  padding: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease);
}

.palette-item:hover {
  background: var(--hover);
}

.palette-item.is-active {
  background: var(--tint-blue);
}

.palette-item.is-active .palette-icon {
  color: var(--blue);
  background: var(--tint-blue);
}

.palette-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: var(--hover);
  color: var(--text-2);
  transition: color var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}

.palette-icon svg {
  display: block;
}

.palette-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.35;
}

.palette-text > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.palette-text small {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.palette-type {
  flex: none;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--hover);
  color: var(--text-3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.palette-empty {
  padding: 32px 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-3);
}

.palette-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  flex: none;
  padding: 9px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 10.5px;
  color: var(--text-3);
}

/* ==========================================================================
   17 响应式 Responsive
   ========================================================================== */

/* ---- ≤1260：三栏收敛为两栏 ---- */
@media (max-width: 1260px) {
  .span-3 {
    grid-column: span 6;
  }

  .topbar-center {
    flex-basis: 340px;
  }

  .search-trigger {
    max-width: 340px;
  }
}

/* ---- ≤1100：侧栏抽屉化 ---- */
@media (max-width: 1100px) {
  .sidebar {
    width: min(86vw, 300px);
    background: var(--sidebar-drawer-bg);
    border-right: 1px solid var(--border-strong);
    transform: translateX(-104%);
  }

  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .sidebar-scrim {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(14, 14, 18, 0.3);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
  }

  body.sidebar-open .sidebar-scrim {
    display: block;
    animation: scrim-in var(--dur) var(--ease) both;
  }

  @keyframes scrim-in {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  .app-main {
    margin-left: 0;
  }

  .topbar {
    height: 64px;
  }

  .sidebar-toggle {
    display: inline-grid;
    margin-left: -4px;
  }

  .topbar-center {
    display: none;
  }

  .topbar-left {
    flex: 1 1 auto;
  }

  .topbar-right {
    margin-left: auto;
  }

  .view-root {
    padding-top: 26px;
  }
}

/* ---- ≤760：单列移动端 ---- */
@media (max-width: 760px) {
  :root {
    --radius-lg: 18px;
    --radius-md: 12px;
    --topbar-h: 58px;
  }

  .topbar {
    height: 58px;
    gap: 10px;
    padding: 0 14px;
  }

  .topbar-right {
    gap: 5px;
  }

  .crumb {
    font-size: 12.5px;
    gap: 6px;
  }

  .save-status {
    display: none;
  }

  .quick-add-btn,
  .icon-btn {
    width: 32px;
    height: 32px;
  }

  .view-root {
    padding: 20px 16px 60px;
  }

  .page-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    margin: 2px 0 20px;
  }

  .page-heading h1 {
    font-size: 24px;
  }

  .page-sub {
    font-size: 13px;
  }

  .page-actions {
    width: 100%;
  }

  .grid-12 {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .span-3,
  .span-4,
  .span-5,
  .span-6,
  .span-7,
  .span-8,
  .span-9,
  .span-12 {
    grid-column: 1 / -1;
  }

  .card {
    padding: 16px;
  }

  .card-head {
    margin-bottom: 13px;
  }

  .form-grid {
    gap: 13px;
  }

  .form-grid--2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
    gap: 14px 18px;
  }

  .stat-value {
    font-size: 26px;
  }

  .toast-root {
    bottom: 16px;
    width: calc(100vw - 24px);
  }

  /* 弹窗 → 底部抽屉 */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    max-width: 100%;
    max-height: min(88vh, 720px);
    border-radius: 26px 26px 0 0;
    border-bottom: 0;
    transform: translateY(100%);
  }

  .modal-backdrop.is-visible .modal {
    transform: none;
  }

  .modal-grabber {
    display: block;
  }

  .modal-head {
    padding: 14px 18px 0;
  }

  .modal-body {
    padding: 16px 18px 4px;
    max-height: 58vh;
  }

  .modal-body:empty {
    padding: 4px 18px 0;
  }

  .modal-footer {
    padding: 14px 18px calc(18px + env(safe-area-inset-bottom));
  }

  .modal-footer .btn {
    flex: 1;
    height: 42px;
  }

  /* 快速添加 → 底部抽屉 */
  .sheet-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .quick-sheet {
    max-width: 100%;
    max-height: 88vh;
    padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
    border-radius: 26px 26px 0 0;
    border-bottom: 0;
    transform: translateY(100%);
  }

  .sheet-grabber {
    display: block;
  }

  .sheet-head {
    margin-bottom: 16px;
  }

  .quick-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
  }

  .quick-action {
    padding: 10px;
    gap: 9px;
    border-radius: 13px;
  }

  .quick-action-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .quick-action-desc {
    display: none;
  }

  .sheet-hint {
    margin-top: 16px;
  }

  /* 命令面板贴顶铺满 */
  .palette-backdrop {
    padding: 10vh 10px 16px;
  }

  .palette {
    max-width: 100%;
    max-height: min(76vh, 620px);
    border-radius: 18px;
  }

  .palette-foot {
    justify-content: center;
    gap: 14px;
  }

  .chart-donut,
  .chart-rings {
    max-width: 200px;
  }

  .table {
    font-size: 12px;
  }

  .table th,
  .table td {
    padding: 10px 8px;
  }
}

/* ---- 超窄屏 ---- */
@media (max-width: 420px) {
  .quick-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-actions .btn {
    flex: 1;
  }

  .topbar-avatar {
    width: 28px;
    height: 28px;
  }
}

/* ==========================================================================
   18 杂项 & 动效降级
   ========================================================================== */

/* 少量通用工具类，方便视图对齐数字与文字 */
.num,
.tabular {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--text-3);
}

.grow {
  flex: 1;
  min-width: 0;
}

.nowrap {
  white-space: nowrap;
}

.right {
  text-align: right;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .ambient-blob {
    animation: none !important;
  }

  .card:hover,
  .btn:hover,
  .quick-action:hover,
  .quick-add-btn:hover {
    transform: none;
  }

  .view-enter {
    animation: none;
  }
}
