/* ============================================================
   电商数据中枢 · 2026 Calm Admin
   参考：Linear / Stripe / Vercel 的克制后台语言
   原则：信息优先 · 边框代替重阴影 · 排版承担层级 · 装饰归零
   结构：左侧导航 + 右侧内容（需求文档第 5 节）
   ============================================================ */

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --sidebar: #f4f4f5;
  --sidebar-hover: #e4e4e7;
  --sidebar-active: #e4e4e7;

  --text: #18181b;
  --text-2: #52525b;
  --text-3: #a1a1aa;

  --border: #e4e4e7;
  --border-strong: #d4d4d8;

  --accent: #142b52;
  --accent-hover: #1f3f72;
  --accent-fg: #fafafa;
  --focus: #1f3f72;
  --focus-ring: 0 0 0 2px #fff, 0 0 0 4px rgba(31, 63, 114, 0.45);

  --success: #16a34a;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;
  --warning: #ca8a04;
  --warning-bg: #fefce8;
  --warning-border: #fde68a;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --info: #2563eb;
  --info-bg: #eff6ff;

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;

  --font: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont,
    "PingFang SC", "HarmonyOS Sans SC", "Segoe UI", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", "Menlo", "Consolas", "PingFang SC", monospace;

  --sidebar-w: 220px;
  --header-h: 52px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01", "tnum";
}

::selection { background: #dbeafe; color: var(--text); }

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Shell ---------- */
.layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* ---------- Sidebar · light, calm (Linear-like) ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
  padding: 0 10px 12px;
}

.sidebar .logo {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  margin: 0 -10px 12px;
  padding-left: 18px;
  padding-right: 18px;
}

.sidebar .logo-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, #142b52, #1f3f72);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.04em;
}

.sidebar .nav-label {
  padding: 8px 10px 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.02em;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  color: var(--text-2);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}

.sidebar nav a svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
  flex-shrink: 0;
}

.sidebar nav a:hover {
  background: var(--sidebar-hover);
  color: var(--text);
  text-decoration: none;
}

.sidebar nav a:hover svg { opacity: 1; }

.sidebar nav a.active {
  background: var(--sidebar-active);
  color: var(--text);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.sidebar nav a.active svg { opacity: 1; }

.sidebar .side-foot {
  margin-top: auto;
  padding: 12px 6px 4px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar .side-foot-meta strong {
  display: block;
  color: var(--text-2);
  font-weight: 550;
  margin-bottom: 2px;
}

/* A/B 主题切换（仅 UI，无业务逻辑） */
.ab-panel { display: flex; flex-direction: column; gap: 6px; }

.ab-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  padding: 0 4px;
  letter-spacing: 0.02em;
}

.ab-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.ab-switch button {
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 550;
  color: var(--text-3);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}

.ab-switch button:hover { color: var(--text-2); }

.ab-switch button.active {
  background: var(--text);
  color: #fff;
}

/* ---------- Main content ---------- */
.content {
  flex: 1;
  min-width: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* Page header bar — title / meta / primary action */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-h);
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.page-header h1 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
}

.page-meta {
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.page-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Body under sticky header */
.page-body {
  padding: 20px 28px 48px;
  flex: 1;
}

/* Legacy page-title (detail etc.) */
.page-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

/* ---------- Surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 16px;
}

.card.card-flush {
  padding: 0;
  overflow: hidden;
}

.card.card-flush .toolbar {
  padding: 12px 16px;
  margin: 0;
  border-bottom: 1px solid var(--border);
  background: #fcfcfc;
}

.card.card-flush .table-wrap { margin: 0; }

.card-hint {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.55;
}

.section {
  margin-top: 28px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

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

/* ---------- Empty / loading ---------- */
.loading,
.empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-3);
  font-size: 13px;
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.loading::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--text);
  animation: spin 0.65s linear infinite;
}

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

.empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: #fcfcfc;
  margin: 8px 0;
}

/* ---------- Toolbar / filters ---------- */
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 0;
  flex-wrap: wrap;
}

.toolbar label {
  color: var(--text-2);
  font-weight: 500;
  font-size: 12.5px;
}

.toolbar > span { color: var(--text-3); font-size: 12.5px; }

.toolbar-spacer { flex: 1; min-width: 8px; }

/* ---------- Controls ---------- */
input[type="text"],
input[type="date"],
input[type="number"],
input[type="file"],
select,
textarea {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.12s var(--ease), box-shadow 0.12s var(--ease);
  font-family: inherit;
  line-height: 1.4;
}

textarea {
  height: auto;
  min-height: 84px;
  padding: 8px 10px;
  line-height: 1.55;
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #a1a1aa;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

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

select {
  cursor: pointer;
  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='%23a1a1aa' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

.search-box { position: relative; }

.search-box svg {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-3);
  pointer-events: none;
}

.search-box input {
  padding-left: 30px;
  width: 260px;
  background: var(--surface);
}

/* ---------- Buttons · flat, decisive ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease), color 0.12s var(--ease);
  font-family: inherit;
  white-space: nowrap;
  user-select: none;
}

.btn:hover {
  background: #f4f4f5;
  border-color: #a1a1aa;
}

.btn:active { background: #e4e4e7; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-fg);
}

.btn-danger {
  color: var(--danger);
  border-color: var(--danger-border);
  background: var(--surface);
}

.btn-danger:hover {
  background: var(--danger-bg);
  border-color: #fca5a5;
  color: var(--danger);
}

.btn-sm {
  height: 26px;
  padding: 0 9px;
  font-size: 12px;
  border-radius: 5px;
}

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

.btn-ghost:hover {
  background: #f4f4f5;
  border-color: transparent;
  color: var(--text);
}

/* ---------- Data table · dense, scannable ---------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.grid {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 13px;
}

table.grid th,
table.grid td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

table.grid th {
  background: #fafafa;
  font-weight: 500;
  color: var(--text-3);
  font-size: 11.5px;
  letter-spacing: 0.01em;
  position: sticky;
  top: 0;
  z-index: 1;
}

table.grid tbody tr {
  transition: background 0.08s var(--ease);
}

table.grid tbody tr[data-sku] { cursor: pointer; }

table.grid tbody tr:hover { background: #fafafa; }

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

table.grid td.num,
table.grid th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

table.grid td.num { font-weight: 500; }

table.grid .sku-code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-2);
}

table.grid .name-cell {
  font-weight: 500;
  color: var(--text);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Thumbnails — compact */
.thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  background: #f4f4f5;
  display: inline-block;
  vertical-align: middle;
  border: 1px solid var(--border);
}

.thumb-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #f4f4f5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 500;
  vertical-align: middle;
  border: 1px solid var(--border);
}

/* ---------- Tags — quiet status chips ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 500;
  background: #f4f4f5;
  color: var(--text-2);
  border: 1px solid var(--border);
  line-height: 1;
}

/* no decorative dots */
.tag::before { display: none; }

.tag.status-新品 {
  background: var(--info-bg);
  color: var(--info);
  border-color: #bfdbfe;
}

.tag.status-主推 {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}

.tag.status-清仓 {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}

.tag.status-下架 {
  background: #f4f4f5;
  color: var(--text-3);
  border-color: var(--border);
}

/* ---------- Modal ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(24, 24, 27, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 0.12s var(--ease);
}

@keyframes fadeIn { from { opacity: 0; } }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 640px;
  max-width: 100%;
  max-height: 88vh;
  overflow: auto;
  padding: 20px 22px;
  border: 1px solid var(--border);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
  animation: rise 0.16s var(--ease);
}

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

.modal h3 {
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.modal-mask > img {
  max-width: 88vw;
  max-height: 88vh;
  border-radius: var(--radius);
  object-fit: contain;
  background: #09090b;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

/* ---------- Forms ---------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}

.form-grid .full { grid-column: 1 / -1; }

.form-item label {
  display: block;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 5px;
  font-weight: 500;
}

.form-item input,
.form-item select,
.form-item textarea { width: 100%; }

.form-item input:disabled {
  background: #fafafa;
  color: var(--text-3);
  cursor: not-allowed;
}

.form-actions {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: #fff;
  z-index: 200;
  background: #18181b;
  border: 1px solid #27272a;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  font-weight: 500;
  font-size: 13px;
  animation: toastIn 0.18s var(--ease);
  max-width: min(90vw, 400px);
  text-align: center;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.toast.error {
  background: var(--danger);
  border-color: #b91c1c;
}

/* ---------- Product detail ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  padding: 4px 8px;
  margin-left: -8px;
  border-radius: var(--radius-sm);
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}

.back-link:hover {
  background: #f4f4f5;
  color: var(--text);
  text-decoration: none;
}

.detail-header {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 18px 20px !important;
}

.detail-img,
.detail-img-placeholder {
  width: 88px;
  height: 88px;
  border-radius: var(--radius);
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: #f4f4f5;
}

.detail-img-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 12px;
}

.detail-meta { min-width: 0; flex: 1; }

.detail-meta h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.detail-sub {
  color: var(--text-2);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
}

.detail-sub .sku-code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
}

.detail-nums {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.detail-nums > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11.5px;
  color: var(--text-3);
  font-weight: 500;
}

.detail-nums b {
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* Tabs — underline style (calm, not pill chrome) */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin: -4px 0 18px;
  overflow-x: auto;
}

.tab {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--text-3);
  font-weight: 500;
  font-size: 13px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.12s var(--ease), border-color 0.12s var(--ease);
  user-select: none;
  white-space: nowrap;
}

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

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* Channel pricing */
.cell-input {
  width: 96px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
}

.cell-input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

tr.price-warn td {
  background: var(--danger-bg);
}

tr.price-warn:hover td {
  background: #fee2e2;
}

.warn-text {
  color: var(--danger);
  font-weight: 600;
  font-size: 12px;
}

/* Sales / charts */
.chart-title {
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 13px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.trend-chart {
  width: 100%;
  max-width: 820px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
  color: var(--accent);
}

/* 缺数 ≠ 0：无数据时的占位符 */
.no-data { color: var(--text-3); }

/* 表单字段提示 */
.field-hint { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

tr.subtotal td {
  background: #fafafa;
  font-weight: 600;
  color: var(--text-2);
  font-size: 12.5px;
}

tr.subtotal.grand td {
  background: #f4f4f5;
  color: var(--text);
  font-weight: 650;
}

/* Assets */
.asset-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.asset-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition: border-color 0.12s var(--ease);
}

.asset-item:hover { border-color: var(--border-strong); }

.asset-item img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  cursor: zoom-in;
  display: block;
  background: #f4f4f5;
}

.asset-video {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 130px;
  background: #f4f4f5;
  color: var(--text-2);
  text-decoration: none;
  font-weight: 550;
  font-size: 13px;
}

.asset-video:hover { color: var(--text); text-decoration: none; }

.asset-broken {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 130px;
  color: var(--text-3);
  background: #f4f4f5;
  font-size: 12px;
}

.asset-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  background: #fafafa;
}

/* Calculator */
.calc-result {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-radius: var(--radius);
}

.calc-result:empty { display: none; }

.calc-row {
  margin: 4px 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.55;
}

.calc-row b {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  color: var(--text);
}

.calc-row .pos { color: var(--success); }
.calc-row .neg { color: var(--danger); }

/* ---------- Report KPI · Stripe-like number first ---------- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  margin-bottom: 8px;
}

.stat-card {
  padding: 18px 20px;
  position: relative;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.stat-card:last-child { border-right: none; }

/* kill decorative accents from previous design */
.stat-card::before,
.stat-card::after { display: none !important; }
.stat-card:hover { transform: none; box-shadow: none; }

.stat-label {
  color: var(--text-3);
  font-size: 12px;
  margin-bottom: 8px;
  font-weight: 500;
}

.stat-value {
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.15;
}

/* ---------- Import ---------- */
.import-hint {
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.55;
}

.import-desc {
  color: var(--text-2);
  font-size: 12.5px;
  margin-bottom: 8px;
  line-height: 1.5;
}

.import-cols {
  color: var(--text-3);
  font-size: 12px;
  margin-bottom: 12px;
  line-height: 1.55;
  padding: 10px 12px;
  background: #fafafa;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.import-cols b {
  color: var(--text-2);
  font-weight: 600;
}

.import-status {
  color: var(--text-3);
  font-size: 12.5px;
}

.import-result { margin-top: 10px; }

.muted {
  color: var(--text-3);
  font-size: 12.5px;
}

/* Report date inline in header */
.header-date {
  height: 32px;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #d4d4d8;
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #a1a1aa; background-clip: padding-box; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .stat-card:nth-child(2) { border-right: none; }
  .stat-card:nth-child(1),
  .stat-card:nth-child(2) { border-bottom: 1px solid var(--border); }
  .page-body { padding: 16px 18px 40px; }
  .page-header { padding: 0 18px; }
}

@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 8px 10px;
    gap: 4px;
  }
  .sidebar .logo {
    height: auto;
    border: none;
    margin: 0;
    padding: 6px 8px;
  }
  .sidebar .nav-label,
  .sidebar .side-foot-meta { display: none; }
  .sidebar .side-foot {
    margin: 0;
    padding: 0;
    border: none;
    width: 100%;
    order: 3;
  }
  .ab-switch { max-width: 220px; }
  .sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 2px;
    flex: 1;
  }
  .form-grid { grid-template-columns: 1fr; }
  .detail-header { flex-direction: column; align-items: flex-start; }
  .search-box input { width: 100%; min-width: 180px; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 20px; }
  .page-header { flex-wrap: wrap; min-height: auto; padding: 10px 16px; }
}
