/* ═══════════════════════════════════════════════════════
   土豆销冠孵化器 — 设计系统
   Operate mode · Warm Light Theme
   ═══════════════════════════════════════════════════════ */

/* ── CSS Variables ──────────────────────────────────── */
:root {
  --bg-primary: #faf9f6;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f3f1ec;
  --bg-hover: #ede9e2;
  --bg-input: #ffffff;
  --border: #e5e1d8;
  --border-light: #d5d0c5;
  --text-primary: #2d2a24;
  --text-secondary: #6b6560;
  --text-tertiary: #99948e;
  --accent: #b8912e;
  --accent-hover: #a07d22;
  --accent-muted: rgba(184, 145, 46, 0.1);
  --success: #4a8c5c;
  --success-bg: rgba(74, 140, 92, 0.1);
  --danger: #c4554d;
  --danger-bg: rgba(196, 85, 77, 0.1);
  --warning: #b8912e;
  --warning-bg: rgba(184, 145, 46, 0.1);
  --info: #5d7fa0;
  --info-bg: rgba(93, 127, 160, 0.1);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

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

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

code { font-family: var(--font-mono); font-size: 0.875em; }

/* ── Layout ─────────────────────────────────────────── */
.container { max-width: 1400px; margin: 0 auto; padding: 24px; }

.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary); }
.page-header .subtitle { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }

/* ── Nav ────────────────────────────────────────────── */
nav {
  display: flex; gap: 4px; margin-bottom: 28px;
  background: var(--bg-secondary); border-radius: var(--radius);
  padding: 4px; width: fit-content;
}
nav a {
  padding: 8px 18px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text-secondary); font-size: 13px; font-weight: 500;
  transition: all 0.15s ease;
}
nav a:hover { color: var(--text-primary); background: var(--bg-tertiary); }
nav a.active { background: var(--accent-muted); color: var(--accent); }

/* ── Cards ──────────────────────────────────────────── */
.card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; margin-bottom: 16px;
}
.card h2, .card h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; color: var(--text-primary); }
.card p { color: var(--text-secondary); line-height: 1.7; font-size: 14px; }

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; font-family: var(--font); cursor: pointer;
  background: var(--bg-tertiary); color: var(--text-primary);
  transition: all 0.15s ease; white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-light); }
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); font-weight: 600; }
.btn-success:hover { background: #5a9e6e; border-color: #5a9e6e; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); font-weight: 600; }
.btn-danger:hover { background: #d06b63; border-color: #d06b63; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ── Badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: 10px; font-size: 12px; font-weight: 500;
  white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-accent { background: var(--accent-muted); color: var(--accent); }
.badge-neutral { background: var(--bg-tertiary); color: var(--text-secondary); }

/* ── Stats Bar ──────────────────────────────────────── */
.stats-bar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.stat-chip {
  padding: 5px 14px; border-radius: 14px; font-size: 12px; font-weight: 500;
  background: var(--bg-tertiary); color: var(--text-secondary);
}
.stat-chip.accent { background: var(--accent-muted); color: var(--accent); }

/* ── Table ──────────────────────────────────────────── */
.table-wrap {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  background: var(--bg-tertiary); padding: 10px 14px; text-align: left;
  font-weight: 600; font-size: 12px; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border);
}
td {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  color: var(--text-primary); vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

/* ── Forms ──────────────────────────────────────────── */
label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em;
}
input, select, textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px; font-family: var(--font);
  background: var(--bg-input); color: var(--text-primary);
  transition: border-color 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}
textarea { resize: vertical; min-height: 60px; }
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='%236b6560' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }

/* ── Toolbar ────────────────────────────────────────── */
.toolbar { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.toolbar select, .toolbar input[type="text"] {
  width: auto; min-width: 140px; padding: 7px 12px; font-size: 13px;
}
.toolbar input[type="text"] { min-width: 200px; }

/* ── Pagination ─────────────────────────────────────── */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 20px; }
.pagination button {
  padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-secondary); color: var(--text-secondary);
  font-size: 13px; cursor: pointer; transition: all 0.15s ease;
}
.pagination button:hover { color: var(--text-primary); border-color: var(--border-light); }
.pagination button.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }

/* ── Modal ──────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.25);
  z-index: 100; align-items: flex-start; justify-content: center;
  padding-top: 50px; overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px; width: 100%; max-width: 640px;
  box-shadow: var(--shadow);
}
.modal h2 { font-size: 18px; font-weight: 700; margin-bottom: 20px; color: var(--text-primary); }
.modal label { margin-top: 12px; }
.modal label:first-of-type { margin-top: 0; }
.modal .actions { display: flex; gap: 8px; margin-top: 20px; justify-content: flex-end; }

.field-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }

/* ── Detail Panel ───────────────────────────────────── */
.detail-panel {
  display: none; position: fixed; right: 0; top: 0; bottom: 0;
  width: 560px; max-width: 100vw; background: var(--bg-secondary);
  border-left: 1px solid var(--border); z-index: 90;
  overflow-y: auto; padding: 28px; box-shadow: -4px 0 24px rgba(0,0,0,0.08);
}
.detail-panel.open { display: block; }
.detail-panel h2 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }

.context-box {
  background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; margin-bottom: 16px; font-size: 13px; color: var(--text-secondary);
}
.context-box .label { font-weight: 600; color: var(--text-tertiary); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Tabs ───────────────────────────────────────────── */
.tab-nav { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 2px solid var(--border); }
.tab-btn {
  padding: 10px 20px; border: none; background: none; font-size: 14px;
  font-family: var(--font); cursor: pointer; color: var(--text-secondary);
  font-weight: 500; transition: all 0.15s ease; position: relative;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); font-weight: 600; }
.tab-btn.active::after {
  content: ''; position: absolute; bottom: -2px; left: 0; right: 0;
  height: 2px; background: var(--accent); border-radius: 1px 1px 0 0;
}

/* ── Utility ────────────────────────────────────────── */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.ok { background: var(--success); }
.status-dot.warn { background: var(--warning); }
.quote-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.muted { opacity: 0.6; }

/* ── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-tertiary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }
