/* ==========================================================================
   海洋 ERP (Ocean ERP) · 极简高级黑白灰工业设计系统 v2.0
   Apple / Linear / Vercel Monochrome Design Language
   ========================================================================== */

:root {
  --bg: #f4f4f6;
  --bg-subtle: #ededf0;
  --surface: #ffffff;
  --surface-hover: #fafafa;
  --surface-elevated: #ffffff;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;

  --text-primary: #09090b;
  --text-secondary: #52525b;
  --text-muted: #71717a;
  --text-faint: #a1a1aa;

  --accent: #111113;
  --accent-hover: #27272a;
  --accent-fg: #ffffff;
  --accent-soft: #f0f0f3;

  --ok: #059669;
  --ok-bg: rgba(5, 150, 105, 0.09);
  --warn: #d97706;
  --warn-bg: rgba(217, 119, 6, 0.10);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.09);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 12px 32px -12px rgba(0, 0, 0, 0.09), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-drawer: -16px 0 48px rgba(0, 0, 0, 0.12);

  --sidebar-w: 248px;
  --sidebar-collapsed-w: 68px;
  --topbar-h: 54px;
  --tabbar-h: 38px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #09090b;
  --bg-subtle: #141418;
  --surface: #111114;
  --surface-hover: #18181c;
  --surface-elevated: #16161a;
  --border: #242429;
  --border-strong: #34343c;

  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-faint: #52525b;

  --accent: #fafafa;
  --accent-hover: #e4e4e7;
  --accent-fg: #09090b;
  --accent-soft: #1d1d22;

  --ok: #10b981;
  --ok-bg: rgba(16, 185, 129, 0.14);
  --warn: #f59e0b;
  --warn-bg: rgba(245, 158, 11, 0.14);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.65);
  --shadow-drawer: -16px 0 48px rgba(0, 0, 0, 0.65);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* 布局骨架 */
.app-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* 左侧边栏 */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.25s var(--ease);
  z-index: 20;
}
.sidebar.collapsed { width: var(--sidebar-collapsed-w); }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-group-label,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .sidebar-foot-text {
  display: none;
}
.sidebar.collapsed .nav-item { justify-content: center; padding: 9px; }
.sidebar.collapsed .brand { justify-content: center; padding: 0 12px; }

.brand {
  height: var(--topbar-h);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-fg);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  display: flex;
  align-items: center;
  gap: 6px;
}
.brand-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.brand-ver {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--text-secondary);
  font-weight: 500;
}

.nav-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 16px;
}
.nav-group { margin-bottom: 14px; }
.nav-group-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px 6px;
}
.nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7.5px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.8px;
  font-weight: 500;
  text-align: left;
  position: relative;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), transform 0.16s var(--ease);
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 1.75; opacity: 0.78; }
.nav-item:hover { background: var(--accent-soft); color: var(--text-primary); }
.nav-item:hover svg { opacity: 1; }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--text-primary);
  font-weight: 600;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 2.5px;
  border-radius: 99px;
  background: var(--accent);
}
.nav-item.active svg { opacity: 1; }
.nav-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.sidebar-foot {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sidebar-foot-text {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* 右侧主区 */
.main-shell {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* 顶部栏 */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.16s var(--ease);
}
.icon-btn:hover { background: var(--accent-soft); color: var(--text-primary); border-color: var(--border-strong); }
.icon-btn svg { width: 15px; height: 15px; }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 280px;
}
.search-box svg {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--text-faint);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  height: 32px;
  padding: 0 46px 0 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-primary);
  font-size: 12.5px;
  outline: none;
  transition: all 0.16s var(--ease);
}
.search-box input:focus { border-color: var(--accent); background: var(--surface); }
.search-kbd {
  position: absolute;
  right: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface);
}
.search-dropdown {
  position: absolute;
  top: 38px;
  left: 0;
  right: 0;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 60;
  display: none;
  max-height: 280px;
  overflow-y: auto;
}
.search-dropdown.open { display: block; }
.search-opt {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  padding: 7px 10px;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 12.5px;
}
.search-opt:hover { background: var(--accent-soft); }
.search-opt span.muted { font-size: 11px; color: var(--text-muted); }

/* 顶部多工作标签栏 */
.tabbar {
  height: var(--tabbar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 18px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  overflow-x: auto;
  flex-shrink: 0;
}
.work-tab {
  height: 31px;
  padding: 0 12px;
  border-radius: 8px 8px 0 0;
  border: 1px solid transparent;
  border-bottom: 0;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s var(--ease);
}
.work-tab:hover { color: var(--text-primary); background: var(--bg-subtle); }
.work-tab.active {
  background: var(--bg);
  color: var(--text-primary);
  font-weight: 600;
  border-color: var(--border);
  box-shadow: inset 0 2px 0 var(--accent);
  position: relative;
}
.work-tab-close {
  opacity: 0.45;
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 3px;
}
.work-tab-close:hover { opacity: 1; background: var(--bg-subtle); }

/* 主内容滚动视口 */
.viewport {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 36px;
  scroll-behavior: smooth;
}
.view-panel {
  display: none;
  animation: viewFadeIn 0.24s var(--ease);
  max-width: 1440px;
  margin: 0 auto;
}
.view-panel.active { display: block; }

@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 页面标题行 */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
}
.page-desc {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 卡片与栅格 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.card:hover { border-color: var(--border-strong); }
.card + .card { margin-top: 16px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid-asymmetric { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.grid-split-left { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }

/* KPI 指标卡 */
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.kpi-val {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.kpi-foot {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 按钮体系 */
.btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 550;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s var(--ease);
}
.btn svg { width: 14px; height: 14px; }
.btn:hover { background: var(--accent-soft); border-color: var(--border-strong); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 11.8px; border-radius: 6px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--text-primary); }
.btn-danger { color: var(--danger); border-color: rgba(220, 38, 38, 0.25); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }

/* 表单与输入 */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11.8px; font-weight: 550; color: var(--text-secondary); }
.input, select.input, textarea.input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12.8px;
  outline: none;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
textarea.input { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(17, 17, 19, 0.08); }
[data-theme="dark"] .input:focus { box-shadow: 0 0 0 3px rgba(250, 250, 250, 0.12); }

/* 分段控件（周期/子 Tab） */
.segmented {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  padding: 4px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.16s var(--ease);
}
.seg-btn.active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

/* 状态点与克制徽章 */
.dot { width: 7px; height: 7px; border-radius: 99px; display: inline-block; flex-shrink: 0; }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-danger { background: var(--danger); }
.dot-neutral { background: var(--text-muted); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11.2px;
  font-weight: 550;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  white-space: nowrap;
}
.pill-ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.pill-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.pill-danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.pill-dark { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* 数据表格 */
.table-wrap { width: 100%; overflow-x: auto; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
table.data-table th {
  text-align: left;
  padding: 9px 12px;
  font-size: 11.2px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}
table.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data-table tbody tr { transition: background 0.14s var(--ease); }
table.data-table tbody tr:hover { background: var(--surface-hover); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }

/* 开关 Toggle */
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { display: none; }
.switch-track {
  width: 34px;
  height: 19px;
  border-radius: 99px;
  background: var(--border-strong);
  position: relative;
  transition: background 0.2s var(--ease);
  flex-shrink: 0;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 99px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: transform 0.2s var(--ease);
}
.switch input:checked + .switch-track { background: var(--accent); }
[data-theme="dark"] .switch input:checked + .switch-track::after { background: #09090b; }
.switch input:checked + .switch-track::after { transform: translateX(15px); }

/* 市场芯片选择 */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 11.8px;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.chip:hover { border-color: var(--border-strong); color: var(--text-primary); }
.chip.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* 图表容器 */
.chart-svg { width: 100%; height: auto; display: block; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-label { width: 88px; font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 8px; border-radius: 99px; background: var(--bg-subtle); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--accent); transition: width 0.5s var(--ease); }
.bar-num { width: 58px; text-align: right; font-family: var(--font-mono); font-size: 11.8px; color: var(--text-primary); }

/* AI 美工拉帘对比容器 */
.compare-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 430px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: repeating-conic-gradient(var(--bg-subtle) 0% 25%, var(--surface) 0% 50%) 50% / 16px 16px;
  user-select: none;
}
.compare-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
}
.compare-before {
  position: absolute;
  inset: 0;
  overflow: hidden;
  width: 50%;
  border-right: 2px solid var(--accent);
}
.compare-before img { width: 200%; max-width: none; }
.compare-tag {
  position: absolute;
  top: 12px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(9, 9, 11, 0.78);
  color: #fff;
  backdrop-filter: blur(6px);
  z-index: 4;
}
.compare-tag.left { left: 12px; }
.compare-tag.right { right: 12px; }
.compare-slider {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
  z-index: 6;
  margin: 0;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.gallery-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  transition: transform 0.16s var(--ease), border-color 0.16s var(--ease);
}
.gallery-item:hover { transform: translateY(-2px); border-color: var(--accent); }
.gallery-item img { width: 100%; aspect-ratio: 1/1; object-fit: contain; display: block; }
.gallery-cap {
  padding: 5px 8px;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--surface);
  border-top: 1px solid var(--border);
  text-align: center;
}

/* 右侧滑出抽屉（含仿真手机预览） */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(9, 9, 11, 0.36);
  backdrop-filter: blur(2px);
  z-index: 80;
  display: none;
  justify-content: flex-end;
}
.drawer-mask.open { display: flex; }
.drawer {
  width: min(560px, 95vw);
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-drawer);
  display: flex;
  flex-direction: column;
  animation: drawerSlide 0.24s var(--ease);
}
@keyframes drawerSlide {
  from { transform: translateX(32px); opacity: 0.7; }
  to { transform: translateX(0); opacity: 1; }
}
.drawer-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.drawer-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* 仿真 iPhone 商品页预览卡 */
.phone-frame {
  width: 286px;
  margin: 0 auto 18px;
  border: 6px solid #18181b;
  border-radius: 30px;
  overflow: hidden;
  background: #ffffff;
  color: #09090b;
  box-shadow: var(--shadow-md);
}
.phone-notch {
  height: 22px;
  background: #18181b;
  display: flex;
  justify-content: center;
  align-items: center;
}
.phone-notch::after {
  content: "";
  width: 64px;
  height: 8px;
  border-radius: 99px;
  background: #27272a;
}
.phone-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #fafafa;
  display: grid;
  place-items: center;
  border-bottom: 1px solid #f0f0f2;
  overflow: hidden;
}
.phone-img img { width: 100%; height: 100%; object-fit: contain; }
.phone-content { padding: 12px 14px 16px; }
.phone-price-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.phone-price { font-size: 18px; font-weight: 800; color: #09090b; font-family: var(--font-mono); }
.phone-strike { font-size: 11.5px; color: #a1a1aa; text-decoration: line-through; font-family: var(--font-mono); }
.phone-title { font-size: 12.8px; font-weight: 600; line-height: 1.4; color: #18181b; margin-bottom: 6px; }
.phone-title .first40 { background: rgba(17, 17, 19, 0.08); border-bottom: 1.5px solid #111113; padding: 0 2px; }
.phone-desc { font-size: 11.2px; color: #52525b; line-height: 1.45; max-height: 92px; overflow: hidden; }

/* 规则卡片与模板列表 */
.rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.rule-row:last-child { border-bottom: 0; }
.rule-title { font-size: 13px; font-weight: 600; }
.rule-desc { font-size: 11.8px; color: var(--text-muted); margin-top: 2px; }

.tpl-card {
  padding: 11px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.16s var(--ease);
}
.tpl-card:hover { border-color: var(--accent); background: var(--surface); }
.tpl-card.active { border-color: var(--accent); background: var(--surface); box-shadow: var(--shadow-xs); }

/* 通知 Toast */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--accent);
  color: var(--accent-fg);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.2s var(--ease);
  max-width: 360px;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.empty-state {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-muted);
  font-size: 12.5px;
}

@media (max-width: 1120px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3, .grid-2, .grid-asymmetric, .grid-split-left { grid-template-columns: 1fr; }
  .search-box { width: 190px; }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
}
