/* theme.css —— 霓语经营工作台设计系统 */

:root {
  color-scheme: light;

  --page-bg: #f6f4ef;
  --surface: #ffffff;
  --surface-alt: #fbfaf7;
  --surface-sunk: #f1efe8;

  --border: #e4e0d8;
  --border-strong: #d3cec3;

  --text: #2a2e29;
  --text-muted: #6b7268;
  --text-faint: #9aa096;

  --accent: #35513c;
  --accent-hover: #2a4232;
  --accent-soft: #e9efe7;
  --accent-line: #c9d6c4;

  --warn: #a8681f;
  --warn-soft: #fbf1e2;
  --danger: #a62131;
  --danger-soft: #fbeaec;
  --info: #2f5d8a;
  --info-soft: #e8f0f7;

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

  --shadow-card: 0 1px 2px rgba(32, 48, 79, 0.05), 0 8px 24px rgba(32, 48, 79, 0.05);
  --shadow-pop: 0 12px 36px rgba(32, 48, 79, 0.14);

  --font: system-ui, -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.3; }
p { margin: 0; }
ul { margin: 0; padding-left: 1.2em; }

/* ── 眉标 / 标题 ─────────────────────────────────── */
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.page-title { font-size: 28px; letter-spacing: -0.01em; }
.page-sub { font-size: 13px; color: var(--text-muted); }
.section-title { font-size: 16px; }

/* ── 布局 ────────────────────────────────────────── */
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-tight { display: flex; align-items: center; gap: 6px; }
.spacer { flex: 1 1 auto; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

/* ── 卡片 ────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
}
.card-flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.card-body { padding: 20px; }

/* ── 指标 ────────────────────────────────────────── */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.metric-label { font-size: 12px; color: var(--text-muted); }
.metric-value { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.metric-note { font-size: 12px; color: var(--text-faint); }

/* ── 按钮 ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--surface-alt); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-soft { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.btn-soft:hover { background: #dfe9dc; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-sunk); }
.btn-danger { background: var(--danger-soft); border-color: #eec6cb; color: var(--danger); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; }
.btn-icon { width: 38px; padding: 0; }

/* ── 胶囊 / 标签 ─────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { border-color: var(--accent-line); background: var(--surface-alt); }
.chip-active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.chip-count {
  font-size: 12px;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}
.chip-static { cursor: default; }
.chip-x { cursor: pointer; opacity: 0.6; font-size: 15px; line-height: 1; }
.chip-x:hover { opacity: 1; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--surface-sunk);
  color: var(--text-muted);
  font-size: 12px;
}
.tag-accent { background: var(--accent-soft); color: var(--accent); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-info { background: var(--info-soft); color: var(--info); }

/* ── 表单 ────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 12px; color: var(--text-muted); font-weight: 600; }

.input, .select, .textarea {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  font: inherit;
  font-size: 14px;
  color: var(--text);
  width: 100%;
}
.textarea { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  outline: 3px solid rgba(53, 81, 60, 0.16);
  border-color: var(--accent);
}
.input::placeholder { color: var(--text-faint); }
.input-inline { height: 32px; font-size: 13px; border-radius: 8px; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* ── 表格 ────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-alt); }
.table tbody tr.selected { background: var(--accent-soft); }

/* ── 提示条 ──────────────────────────────────────── */
.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface-sunk);
  color: var(--text-muted);
  font-size: 13px;
}
.notice-accent { background: var(--accent-soft); color: var(--accent); }
.notice-warn { background: var(--warn-soft); color: var(--warn); }
.notice-danger { background: var(--danger-soft); color: var(--danger); }

/* ── 空态 / 加载 ─────────────────────────────────── */
.empty { padding: 40px 20px; text-align: center; color: var(--text-faint); font-size: 13px; }
.skeleton {
  background: linear-gradient(90deg, #efece5 25%, #f6f4ef 50%, #efece5 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── 弹窗 ────────────────────────────────────────── */
dialog.modal {
  border: 0;
  padding: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  max-width: 720px;
  width: calc(100vw - 48px);
  background: var(--surface);
  color: var(--text);
}
dialog.modal::backdrop { background: rgba(32, 48, 79, 0.32); }
.modal-head { padding: 20px 24px 0; }
.modal-body { padding: 16px 24px; max-height: 62vh; overflow: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
}

/* ── 工具类 ──────────────────────────────────────── */
.scroll-y { overflow-y: auto; }
.divider { height: 1px; background: var(--border); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 10px 14px;
  border: 0;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
