/* ==========================================================================
   门店 SaaS · 平台总后台 · 设计系统 tokens 与基础组件
   唯一依据：design/DESIGN-SYSTEM.md v1.0
   ========================================================================== */

:root {
  /* 主色：墨绿 */
  --brand-900: oklch(24% 0.045 160);
  --brand-800: oklch(30% 0.055 160);
  --brand-700: oklch(40% 0.07 160);
  --brand-600: oklch(48% 0.09 160);
  --brand-100: oklch(94% 0.03 160);
  --brand-50:  oklch(97% 0.015 160);

  /* 中性色（带绿调） */
  --ink-900: oklch(18% 0.01 160);
  --ink-700: oklch(38% 0.01 160);
  --ink-500: oklch(55% 0.01 160);
  --ink-300: oklch(80% 0.01 160);
  --ink-200: oklch(88% 0.01 160);
  --ink-100: oklch(95% 0.008 160);

  /* 表面 */
  --bg:      oklch(97.5% 0.008 80);
  --surface: oklch(99.5% 0.003 80);
  --surface-2: oklch(98.5% 0.006 80);

  /* 语义色 */
  --amber-700: oklch(55% 0.14 60);  --amber-500: oklch(72% 0.15 70);  --amber-50: oklch(96% 0.04 80);
  --red-700:   oklch(50% 0.17 25);  --red-500:   oklch(60% 0.19 25);  --red-50:   oklch(96% 0.025 25);
  --blue-700:  oklch(48% 0.12 250); --blue-500:  oklch(58% 0.13 250); --blue-50:  oklch(96% 0.02 250);

  /* 字体 */
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-num: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  /* 空间与形状 */
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;

  /* 布局 */
  --sb-w: 240px;
  --top-h: 52px;

  /* 动效 */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 160ms;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 0.875rem;
  line-height: 1.375rem;
  color: var(--ink-900);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.5; flex-shrink: 0; }

/* ---------- 字号层级 ---------- */
.t-xs   { font-size: 0.75rem;   line-height: 1rem; }
.t-sm   { font-size: 0.8125rem; line-height: 1.25rem; }
.t-base { font-size: 0.875rem;  line-height: 1.375rem; }
.t-lg   { font-size: 1.125rem;  line-height: 1.5rem; }
.t-xl   { font-size: 1.5rem;    line-height: 2rem; }
.t-display { font-size: 1.75rem; line-height: 2.25rem; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.t-num  { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.w-600  { font-weight: 600; }
.c-700  { color: var(--ink-700); }
.c-500  { color: var(--ink-500); }
.c-brand { color: var(--brand-700); }
.c-red  { color: var(--red-700); }
.c-amber { color: var(--amber-700); }

/* ==========================================================================
   布局
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--sb-w) 1fr;
  grid-template-rows: var(--top-h) 1fr;
  grid-template-areas:
    "sb top"
    "sb main";
  height: 100vh;
  overflow: hidden;
}

/* ---------- 侧边栏 ---------- */
.sb {
  grid-area: sb;
  background: var(--brand-900);
  color: oklch(85% 0.01 160);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}
.sb::-webkit-scrollbar { width: 0; }

.sb-brand {
  padding: var(--sp-6) var(--sp-4) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sb-brand strong {
  font-size: 1rem;
  font-weight: 600;
  color: oklch(98% 0.005 160);
  letter-spacing: 0.01em;
}
.sb-brand span {
  font-size: 0.6875rem;
  color: oklch(65% 0.02 160);
  letter-spacing: 0.08em;
}

.sb-group {
  font-size: 0.6875rem;
  color: oklch(70% 0.02 160);
  padding: var(--sp-4) var(--sp-4) var(--sp-1);
  margin-top: var(--sp-1);
  letter-spacing: 0.04em;
}
.sb-group:first-of-type { margin-top: 0; }

.sb-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: 36px;
  padding: 0 var(--sp-3);
  margin: 1px var(--sp-2);
  border-radius: var(--r-md);
  color: oklch(78% 0.015 160);
  font-size: var(--sp-4)px;
  font-size: 0.875rem;
  position: relative;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  cursor: pointer;
}
.sb-item svg { stroke: oklch(70% 0.02 160); transition: stroke var(--dur) var(--ease); }
.sb-item:hover { background: var(--brand-800); color: oklch(96% 0.005 160); }
.sb-item:hover svg { stroke: oklch(90% 0.01 160); }
.sb-item.active {
  background: var(--brand-800);
  color: oklch(98% 0.005 160);
}
.sb-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--amber-500);
}
.sb-item.active svg { stroke: oklch(98% 0.005 160); }

.sb-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--amber-500);
  color: var(--brand-900);
  font-size: 0.6875rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.sb-foot {
  margin-top: auto;
  padding: var(--sp-4);
  font-size: 0.6875rem;
  color: oklch(60% 0.02 160);
  border-top: 1px solid oklch(30% 0.03 160);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---------- 顶栏 ---------- */
.top {
  grid-area: top;
  height: var(--top-h);
  background: var(--surface);
  border-bottom: 1px solid var(--ink-200);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-6);
  gap: var(--sp-4);
}
.crumb {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.8125rem;
  color: var(--ink-500);
}
.crumb strong { color: var(--ink-900); font-weight: 500; }
.crumb-sep { color: var(--ink-300); }

.top-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.top-search {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: 32px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink-500);
  font-size: 0.8125rem;
  min-width: 220px;
}
.top-search svg { width: 15px; height: 15px; }
.top-search input {
  border: none; background: transparent; outline: none;
  width: 100%; font-size: 0.8125rem; color: var(--ink-900);
}
.top-search input::placeholder { color: var(--ink-500); }

.top-icon {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  color: var(--ink-700);
  position: relative;
  transition: background var(--dur) var(--ease);
}
.top-icon:hover { background: var(--ink-100); }
.top-icon .dot-alert {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--amber-500);
  border: 2px solid var(--surface);
}

.top-user {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 4px var(--sp-2) 4px var(--sp-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.top-user:hover { background: var(--ink-100); }
.top-user .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand-100); color: var(--brand-700);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 600;
}
.top-user .u-name { font-size: 0.8125rem; color: var(--ink-900); }
.top-user .u-role { font-size: 0.6875rem; color: var(--ink-500); }

/* ---------- 内容区 ---------- */
.main {
  grid-area: main;
  overflow-y: auto;
  padding: var(--sp-6);
  animation: pageIn var(--dur) var(--ease);
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
}
.page-title { font-size: 1.5rem; line-height: 2rem; font-weight: 600; color: var(--ink-900); }
.page-sub   { font-size: 0.8125rem; color: var(--ink-500); margin-top: 2px; }
.page-actions { display: flex; gap: var(--sp-2); align-items: center; }

/* ==========================================================================
   组件
   ========================================================================== */

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-lg);
  box-shadow: none;
}
.card-head {
  padding: var(--sp-4) var(--sp-6);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3);
  border-bottom: 1px solid var(--ink-200);
}
.card-title { font-size: 1.125rem; font-weight: 600; line-height: 1.5rem; }
.card-title-sm { font-size: 0.875rem; font-weight: 600; }
.card-body { padding: var(--sp-6); }
.card-body-sm { padding: var(--sp-4) var(--sp-6); }
.card-foot {
  padding: var(--sp-3) var(--sp-6);
  border-top: 1px solid var(--ink-200);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.8125rem; color: var(--ink-500);
}

/* ---------- 筛选条 ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
  align-items: center;
  margin-bottom: var(--sp-4);
}
.filters .spacer { flex: 1; }

.seg {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-sm);
  padding: 2px;
}
.seg button {
  height: 26px; padding: 0 var(--sp-3);
  border-radius: 4px;
  font-size: 0.8125rem;
  color: var(--ink-700);
  transition: all var(--dur) var(--ease);
}
.seg button:hover { color: var(--ink-900); }
.seg button.active { background: var(--surface); color: var(--ink-900); font-weight: 500; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 var(--sp-4);
  border-radius: var(--r-sm);
  font-size: 0.8125rem; font-weight: 500;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn svg { width: 15px; height: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--brand-700); color: oklch(98% 0.005 160); }
.btn-primary:hover:not(:disabled) { background: var(--brand-600); }

.btn-secondary { background: var(--surface); border-color: var(--ink-200); color: var(--ink-900); }
.btn-secondary:hover:not(:disabled) { border-color: var(--ink-300); background: var(--surface-2); }

.btn-ghost { color: var(--brand-700); padding: 0 var(--sp-2); height: 28px; }
.btn-ghost:hover:not(:disabled) { background: var(--brand-50); }

.btn-danger-ghost { color: var(--red-700); padding: 0 var(--sp-2); height: 28px; }
.btn-danger-ghost:hover:not(:disabled) { background: var(--red-50); }

.btn-danger { background: var(--red-700); color: oklch(98% 0.005 160); }
.btn-danger:hover:not(:disabled) { background: var(--red-500); }

.btn-sm { height: 28px; padding: 0 var(--sp-3); font-size: 0.75rem; }
.btn-sm svg { width: 13px; height: 13px; }

/* ---------- 表单 ---------- */
.form { display: grid; gap: var(--sp-4); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-4); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 0.8125rem; font-weight: 500; color: var(--ink-900); }
.field-label .req { color: var(--red-500); margin-right: 2px; }
.field-help { font-size: 0.75rem; color: var(--ink-500); }
.field-error { font-size: 0.75rem; color: var(--red-700); }

.input, .select, .textarea {
  height: 34px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-900);
  font-size: 0.8125rem;
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  width: 100%;
}
.textarea { height: auto; min-height: 80px; padding: var(--sp-2) var(--sp-3); resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--ink-500); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand-700);
  box-shadow: 0 0 0 2px var(--brand-100);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23737373' 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 var(--sp-3) center;
  padding-right: 30px;
}
.input-group { display: flex; align-items: center; gap: 0; }
.input-group .input { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-group .input + .input { border-left: none; border-radius: 0 var(--r-sm) var(--r-sm) 0; }

.check {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: 0.8125rem; cursor: pointer; user-select: none;
}
.check input { width: 15px; height: 15px; accent-color: var(--brand-700); cursor: pointer; }

/* 开关 */
.switch {
  position: relative; width: 32px; height: 18px;
  background: var(--ink-200); border-radius: 9px; cursor: pointer;
  transition: background var(--dur) var(--ease);
  flex-shrink: 0;
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface);
  transition: transform var(--dur) var(--ease);
}
.switch.on { background: var(--brand-700); }
.switch.on::after { transform: translateX(14px); }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; font-size: 0.8125rem; }
.tbl th {
  text-align: left; font-weight: 600; font-size: 0.75rem;
  color: var(--ink-700);
  background: var(--ink-100);
  height: 40px; padding: 0 var(--sp-4);
  white-space: nowrap;
  border-bottom: 1px solid var(--ink-200);
}
.tbl td {
  height: 44px; padding: 0 var(--sp-4);
  border-bottom: 1px solid var(--ink-200);
  color: var(--ink-900);
  vertical-align: middle;
}
.tbl tbody tr { transition: background var(--dur) var(--ease); }
.tbl tbody tr:hover { background: var(--ink-100); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .num { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.tbl .c-500 { color: var(--ink-500); }
.tbl .actions { text-align: right; white-space: nowrap; }
.tbl .actions .btn { margin-left: 2px; }
.tbl .primary-cell { color: var(--ink-900); font-weight: 500; }
.tbl .sub-cell { font-size: 0.75rem; color: var(--ink-500); margin-top: 1px; }

/* ---------- 色点状态 ---------- */
.dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle;
  background: var(--ink-300);
}
.dot-green  { background: var(--brand-600); }
.dot-blue   { background: var(--blue-500); }
.dot-amber  { background: var(--amber-500); }
.dot-red    { background: var(--red-500); }
.dot-gray   { background: var(--ink-300); }

.status { display: inline-flex; align-items: center; white-space: nowrap; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex; align-items: center;
  height: 20px; padding: 0 var(--sp-2);
  font-size: 0.6875rem; font-weight: 500;
  border-radius: 4px;
  background: var(--ink-100); color: var(--ink-700);
  white-space: nowrap;
}
.tag-brand { background: var(--brand-100); color: var(--brand-700); }
.tag-amber { background: var(--amber-50); color: var(--amber-700); }
.tag-red   { background: var(--red-50); color: var(--red-700); }
.tag-blue  { background: var(--blue-50); color: var(--blue-700); }
.tag-gray  { background: var(--ink-100); color: var(--ink-700); }

/* ---------- 分页 ---------- */
.pager {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 0.8125rem; color: var(--ink-500);
}
.pager button {
  height: 28px; min-width: 28px; padding: 0 var(--sp-2);
  border: 1px solid var(--ink-200); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink-700);
  font-size: 0.8125rem; display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--dur) var(--ease);
}
.pager button:hover:not(:disabled) { border-color: var(--ink-300); color: var(--ink-900); }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }
.pager .pg-info { padding: 0 var(--sp-2); font-variant-numeric: tabular-nums; }

/* ---------- 空状态 ---------- */
.empty {
  padding: var(--sp-8) var(--sp-6);
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-3);
  color: var(--ink-500);
  text-align: center;
}
.empty svg { width: 36px; height: 36px; stroke-width: 1.2; color: var(--ink-300); }
.empty .e-title { font-size: 0.875rem; color: var(--ink-700); font-weight: 500; }
.empty .e-desc { font-size: 0.8125rem; max-width: 360px; }

/* ---------- 加载 ---------- */
.loading {
  padding: var(--sp-8);
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  color: var(--ink-500); font-size: 0.8125rem;
}
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--ink-200); border-top-color: var(--brand-700);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0;
  background: oklch(20% 0.01 160 / 0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  animation: fadeIn var(--dur) var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--ink-200);
  width: 480px; max-width: calc(100vw - 48px);
  max-height: calc(100vh - 80px);
  display: flex; flex-direction: column;
  animation: modalIn var(--dur) var(--ease);
  overflow: hidden;
}
.modal.w-lg { width: 640px; }
.modal.w-xl { width: 820px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: scale(1); }
}
.modal-head {
  padding: var(--sp-4) var(--sp-6);
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--ink-200);
}
.modal-title { font-size: 1.125rem; font-weight: 600; }
.modal-close {
  width: 28px; height: 28px; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-500);
}
.modal-close:hover { background: var(--ink-100); }
.modal-body { padding: var(--sp-6); overflow-y: auto; }
.modal-foot {
  padding: var(--sp-3) var(--sp-6);
  border-top: 1px solid var(--ink-200);
  display: flex; justify-content: flex-end; gap: var(--sp-2);
}

/* ---------- 抽屉（详情） ---------- */
.drawer-mask {
  position: fixed; inset: 0;
  background: oklch(20% 0.01 160 / 0.35);
  z-index: 900;
  animation: fadeIn var(--dur) var(--ease);
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 720px; max-width: calc(100vw - 80px);
  background: var(--bg);
  border-left: 1px solid var(--ink-200);
  z-index: 901;
  display: flex; flex-direction: column;
  animation: drawerIn 220ms var(--ease);
}
@keyframes drawerIn {
  from { transform: translateX(24px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
.drawer-head {
  padding: var(--sp-4) var(--sp-6);
  background: var(--surface);
  border-bottom: 1px solid var(--ink-200);
  display: flex; align-items: flex-start; justify-content: space-between;
}
.drawer-body { flex: 1; overflow-y: auto; padding: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-4); }

/* ---------- 描述列表 ---------- */
.dl { display: grid; grid-template-columns: 96px 1fr; gap: var(--sp-3) var(--sp-4); font-size: 0.8125rem; }
.dl dt { color: var(--ink-500); }
.dl dd { color: var(--ink-900); }

/* ---------- 统计卡（工作台） ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); }
.stat {
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-6);
  display: flex; flex-direction: column; gap: var(--sp-2);
  min-height: 108px;
}
.stat-label { font-size: 0.8125rem; color: var(--ink-500); }
.stat-value { font-size: 1.75rem; line-height: 2.25rem; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 500; color: var(--ink-900); }
.stat-value small { font-size: 0.875rem; color: var(--ink-500); font-weight: 400; margin-left: 4px; }
.stat-sub { font-size: 0.75rem; color: var(--ink-500); display: flex; gap: var(--sp-3); margin-top: auto; }
.stat-sub b { color: var(--ink-700); font-weight: 500; }

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

/* 待办 */
.todo-list { display: flex; flex-direction: column; }
.todo-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-6);
  border-bottom: 1px solid var(--ink-200);
  transition: background var(--dur) var(--ease);
  cursor: pointer;
}
.todo-item:last-child { border-bottom: none; }
.todo-item:hover { background: var(--ink-100); }
.todo-item .todo-count {
  font-family: var(--font-num); font-variant-numeric: tabular-nums;
  font-size: 1.125rem; font-weight: 600; min-width: 32px;
  color: var(--ink-900);
}
.todo-item.high .todo-count { color: var(--amber-700); }
.todo-item .todo-title { font-size: 0.8125rem; color: var(--ink-900); }
.todo-item .todo-arrow { margin-left: auto; color: var(--ink-300); }
.todo-item:hover .todo-arrow { color: var(--ink-700); }

/* 迷你趋势图 */
.spark { display: flex; align-items: flex-end; gap: 6px; height: 72px; padding-top: var(--sp-2); }
.spark .bar {
  flex: 1;
  background: var(--brand-100);
  border-radius: 3px 3px 0 0;
  position: relative;
  transition: background var(--dur) var(--ease);
  min-height: 2px;
}
.spark .bar:hover { background: var(--brand-600); }
.spark .bar:last-child { background: var(--brand-700); }
.spark-labels { display: flex; gap: 6px; margin-top: var(--sp-2); }
.spark-labels span { flex: 1; text-align: center; font-size: 0.6875rem; color: var(--ink-500); font-variant-numeric: tabular-nums; }

/* 最近列表 */
.mini-list { display: flex; flex-direction: column; }
.mini-item {
  display: grid; grid-template-columns: 1fr auto auto; gap: var(--sp-3); align-items: center;
  padding: var(--sp-3) var(--sp-6);
  border-bottom: 1px solid var(--ink-200);
  font-size: 0.8125rem;
}
.mini-item:last-child { border-bottom: none; }
.mini-item .mi-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mini-item .mi-title { color: var(--ink-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-item .mi-sub { font-size: 0.75rem; color: var(--ink-500); }
.mini-item .mi-amount { font-family: var(--font-num); font-variant-numeric: tabular-nums; color: var(--ink-900); }

/* 到期提醒 */
.exp-item {
  display: grid; grid-template-columns: 1fr auto; gap: var(--sp-3); align-items: center;
  padding: var(--sp-3) var(--sp-6);
  border-bottom: 1px solid var(--ink-200);
}
.exp-item:last-child { border-bottom: none; }
.exp-item .exp-name { font-size: 0.8125rem; color: var(--ink-900); }
.exp-item .exp-meta { font-size: 0.75rem; color: var(--ink-500); margin-top: 1px; }
.exp-item .exp-days {
  font-family: var(--font-num); font-variant-numeric: tabular-nums;
  font-size: 0.875rem; font-weight: 600; color: var(--ink-900);
}
.exp-item .exp-days.warn { color: var(--amber-700); }
.exp-item .exp-days.over { color: var(--red-700); }

/* ---------- Toast ---------- */
.toasts {
  position: fixed; top: var(--sp-6); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: var(--sp-2);
  z-index: 2000; pointer-events: none;
}
.toast {
  background: var(--ink-900); color: oklch(97% 0.005 160);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm);
  font-size: 0.8125rem;
  display: flex; align-items: center; gap: var(--sp-2);
  animation: toastIn 200ms var(--ease);
  box-shadow: 0 4px 16px oklch(20% 0.01 160 / 0.15);
  pointer-events: auto;
}
.toast svg { width: 15px; height: 15px; }
.toast.success svg { stroke: var(--brand-100); }
.toast.error svg { stroke: var(--amber-500); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.toast.leaving { animation: toastOut 160ms var(--ease) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--bg);
}
.login-art {
  background: var(--brand-900);
  color: oklch(90% 0.01 160);
  padding: var(--sp-8);
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-art::after {
  content: '';
  position: absolute; right: -120px; bottom: -120px;
  width: 420px; height: 420px;
  border-radius: 50%;
  border: 1px solid oklch(35% 0.04 160);
}
.login-art::before {
  content: '';
  position: absolute; right: -40px; bottom: -40px;
  width: 260px; height: 260px;
  border-radius: 50%;
  border: 1px solid oklch(35% 0.04 160);
}
.login-art .la-brand { font-size: 1rem; font-weight: 600; color: oklch(98% 0.005 160); letter-spacing: 0.01em; }
.login-art .la-brand span { display: block; font-size: 0.6875rem; color: oklch(65% 0.02 160); letter-spacing: 0.08em; margin-top: 2px; font-weight: 400; }
.login-art .la-title { font-size: 2rem; line-height: 1.25; font-weight: 600; color: oklch(98% 0.005 160); letter-spacing: -0.01em; max-width: 420px; }
.login-art .la-title em { font-style: normal; color: var(--amber-500); }
.login-art .la-desc { font-size: 0.875rem; color: oklch(70% 0.02 160); max-width: 400px; line-height: 1.6; margin-top: var(--sp-3); }
.login-art .la-foot { font-size: 0.75rem; color: oklch(55% 0.02 160); display: flex; gap: var(--sp-4); }

.login-form-side {
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-8);
}
.login-box { width: 360px; display: flex; flex-direction: column; gap: var(--sp-5); }
.login-box h1 { font-size: 1.5rem; font-weight: 600; line-height: 2rem; }
.login-box .lb-sub { font-size: 0.875rem; color: var(--ink-500); margin-top: var(--sp-1); }
.login-box .form { gap: var(--sp-4); }
.login-box .btn-primary { height: 40px; font-size: 0.875rem; margin-top: var(--sp-2); }
.login-err {
  background: var(--red-50); color: var(--red-700);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm);
  font-size: 0.8125rem; display: none;
}
.login-err.show { display: block; }
.login-foot { font-size: 0.75rem; color: var(--ink-500); text-align: center; }

/* ---------- 权限矩阵 ---------- */
.perm-matrix { display: flex; flex-direction: column; gap: var(--sp-3); }
.perm-module { border: 1px solid var(--ink-200); border-radius: var(--r-md); overflow: hidden; }
.perm-module-head {
  background: var(--surface-2); padding: var(--sp-2) var(--sp-3);
  font-size: 0.8125rem; font-weight: 600; color: var(--ink-900);
  display: flex; align-items: center; justify-content: space-between;
}
.perm-module-head .btn-ghost { height: 22px; font-size: 0.75rem; }
.perm-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-1) var(--sp-3); padding: var(--sp-3); }
.perm-list .check { font-size: 0.8125rem; color: var(--ink-700); padding: 4px 0; }
.perm-list .check input { width: 14px; height: 14px; }

/* ---------- 参数表 ---------- */
.param-group { margin-bottom: var(--sp-6); }
.param-group-title {
  font-size: 0.875rem; font-weight: 600; color: var(--ink-900);
  padding: 0 0 var(--sp-3);
  display: flex; align-items: center; gap: var(--sp-2);
}
.param-group-title .tag { font-weight: 500; }
.param-row {
  display: grid; grid-template-columns: 220px 1fr minmax(180px, 260px);
  gap: var(--sp-4); align-items: center;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--ink-200);
  background: var(--surface);
}
.param-row:last-child { border-bottom: none; }
.param-row:hover { background: var(--surface-2); }
.param-name { font-size: 0.8125rem; color: var(--ink-900); }
.param-name .pk { display: block; font-size: 0.6875rem; color: var(--ink-500); font-family: var(--font-num); margin-top: 1px; }
.param-desc { font-size: 0.75rem; color: var(--ink-500); }
.param-val { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.param-val .input { height: 30px; font-family: var(--font-num); font-size: 0.8125rem; min-width: 0; flex: 1; }
.param-val .btn { height: 28px; }

/* ---------- 运行状态 ---------- */
.health-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); }
.health-card {
  background: var(--surface); border: 1px solid var(--ink-200); border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-6);
}
.health-card .hc-label { font-size: 0.8125rem; color: var(--ink-500); }
.health-card .hc-value { font-size: 1.125rem; font-weight: 600; margin-top: 2px; font-family: var(--font-num); }
.health-card .hc-sub { font-size: 0.75rem; color: var(--ink-500); margin-top: 4px; }
.job-row {
  display: grid; grid-template-columns: 1fr auto auto auto; gap: var(--sp-4); align-items: center;
  padding: var(--sp-3) var(--sp-6);
  border-bottom: 1px solid var(--ink-200);
  font-size: 0.8125rem;
}
.job-row:last-child { border-bottom: none; }
.job-row .jr-name { font-weight: 500; color: var(--ink-900); }
.job-row .jr-desc { font-size: 0.75rem; color: var(--ink-500); margin-top: 1px; }
.job-row .jr-time { font-family: var(--font-num); font-size: 0.75rem; color: var(--ink-500); }

/* ---------- 应用卡片 ---------- */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-4); }
.app-card {
  background: var(--surface); border: 1px solid var(--ink-200); border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-6);
  display: flex; flex-direction: column; gap: var(--sp-3);
  transition: border-color var(--dur) var(--ease);
}
.app-card:hover { border-color: var(--ink-300); }
.app-card .ac-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); }
.app-card .ac-icon {
  width: 36px; height: 36px; border-radius: var(--r-md);
  background: var(--brand-50); color: var(--brand-700);
  display: inline-flex; align-items: center; justify-content: center;
}
.app-card .ac-icon svg { width: 18px; height: 18px; }
.app-card .ac-name { font-size: 0.875rem; font-weight: 600; }
.app-card .ac-ind { font-size: 0.75rem; color: var(--ink-500); }
.app-card .ac-desc { font-size: 0.8125rem; color: var(--ink-700); min-height: 2.5em; line-height: 1.5; }
.app-card .ac-meta { display: flex; gap: var(--sp-3); font-size: 0.75rem; color: var(--ink-500); }
.app-card .ac-foot { display: flex; align-items: center; justify-content: space-between; padding-top: var(--sp-2); border-top: 1px solid var(--ink-200); }

/* ---------- 套餐卡片 ---------- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--sp-4); }
.plan-card {
  background: var(--surface); border: 1px solid var(--ink-200); border-radius: var(--r-lg);
  padding: var(--sp-6);
  display: flex; flex-direction: column; gap: var(--sp-4);
}
.plan-card .pc-head { display: flex; align-items: flex-start; justify-content: space-between; }
.plan-card .pc-name { font-size: 1.125rem; font-weight: 600; }
.plan-card .pc-ver { font-size: 0.75rem; color: var(--ink-500); font-family: var(--font-num); margin-top: 2px; }
.plan-card .pc-price { font-size: 1.75rem; font-family: var(--font-num); font-weight: 500; line-height: 1; }
.plan-card .pc-price small { font-size: 0.8125rem; color: var(--ink-500); font-weight: 400; margin-left: 4px; }
.plan-card .pc-orig { font-size: 0.75rem; color: var(--ink-500); text-decoration: line-through; margin-top: 4px; text-align: right; }
.plan-card .pc-desc { font-size: 0.8125rem; color: var(--ink-700); min-height: 2.5em; }
.plan-card .pc-feats { display: flex; flex-wrap: wrap; gap: 6px; }
.plan-card .pc-quotas { display: flex; gap: var(--sp-4); padding: var(--sp-3) 0; border-top: 1px solid var(--ink-200); border-bottom: 1px solid var(--ink-200); }
.plan-card .pq { display: flex; flex-direction: column; gap: 2px; }
.plan-card .pq b { font-family: var(--font-num); font-weight: 500; font-size: 0.875rem; }
.plan-card .pq span { font-size: 0.6875rem; color: var(--ink-500); }
.plan-card .pc-foot { display: flex; align-items: center; justify-content: space-between; font-size: 0.8125rem; color: var(--ink-500); }

/* ---------- 详情页通用 ---------- */
.detail-tabs {
  display: flex; gap: var(--sp-1);
  border-bottom: 1px solid var(--ink-200);
  margin-bottom: var(--sp-4);
}
.detail-tabs button {
  height: 36px; padding: 0 var(--sp-3);
  font-size: 0.8125rem; color: var(--ink-500);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.detail-tabs button:hover { color: var(--ink-900); }
.detail-tabs button.active { color: var(--ink-900); font-weight: 500; border-bottom-color: var(--brand-700); }

.kv-section { display: flex; flex-direction: column; gap: var(--sp-2); }
.kv-section .kv-title { font-size: 0.8125rem; font-weight: 600; color: var(--ink-700); }
.kv-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3) var(--sp-6); }
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv .k { font-size: 0.75rem; color: var(--ink-500); }
.kv .v { font-size: 0.8125rem; color: var(--ink-900); }

/* ---------- 横幅提示 ---------- */
.notice {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  font-size: 0.8125rem;
  line-height: 1.5;
}
.notice svg { width: 16px; height: 16px; margin-top: 2px; }
.notice-amber { background: var(--amber-50); color: var(--amber-700); }
.notice-blue  { background: var(--blue-50);  color: var(--blue-700); }
.notice-red   { background: var(--red-50);   color: var(--red-700); }
.notice-brand { background: var(--brand-50); color: var(--brand-700); }

/* ---------- 响应式 ---------- */
@media (max-width: 1280px) {
  :root { --sb-w: 64px; }
  .sb-brand { padding: var(--sp-4) 0; align-items: center; }
  .sb-brand strong { font-size: 0; }
  .sb-brand strong::before { content: '门'; font-size: 1rem; }
  .sb-brand span, .sb-group, .sb-item span, .sb-badge, .sb-foot span { display: none; }
  .sb-item { justify-content: center; padding: 0; }
  .sb-foot { justify-content: center; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .health-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sb { display: none; }
  .dash-grid { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .perm-list { grid-template-columns: repeat(2, 1fr); }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .param-row { grid-template-columns: 1fr; gap: var(--sp-2); }
}

@media (max-width: 768px) {
  .stats, .health-grid { grid-template-columns: 1fr; }
  .kv-grid { grid-template-columns: 1fr; }
  .perm-list { grid-template-columns: 1fr; }
  .top-search { display: none; }
}
