:root {
  --bg: #0f172a;
  --card: #ffffff;
  --primary: #1f6feb;
  --primary-d: #1657bf;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --err: #dc2626;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f1f5f9;
  color: var(--text);
}
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 20px; background: var(--bg); color: #fff;
  flex-wrap: wrap;
}
.brand { font-size: 18px; font-weight: 700; }
.tabs { display: flex; gap: 8px; }
.tabs button {
  background: transparent; color: #cbd5e1; border: 1px solid #334155;
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tab-link { display:inline-flex; align-items:center; text-decoration:none; color:#cbd5e1; border:1px solid #334155; padding:7px 14px; border-radius:8px; font-size:14px; }
.tab-link:hover { background:#1f6feb; color:#fff; border-color:#1f6feb; }
.container { max-width: 1100px; margin: 20px auto; padding: 0 16px; }
.card { background: var(--card); border-radius: 14px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
h2 { margin: 0 0 8px; font-size: 18px; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0; }
textarea, .kw, input[type=date] {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; font-family: inherit; outline: none;
}
textarea:focus, .kw:focus, input[type=date]:focus { border-color: var(--primary); }
.kw { margin-top: 10px; }
.row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.row label { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.row input[type=date] { width: auto; }
.row .count b { color: var(--primary); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
button.primary, button.ghost {
  border-radius: 10px; padding: 10px 18px; font-size: 14px; cursor: pointer; border: 1px solid transparent;
}
button.primary { background: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-d); }
button.primary:disabled { opacity: .6; cursor: not-allowed; }
button.ghost { background: #fff; color: var(--text); border-color: var(--line); }
button.ghost:hover { background: #f8fafc; }
.error { color: var(--err); font-size: 14px; margin-top: 10px; }
.table-wrap { overflow-x: auto; margin-top: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #f8fafc; color: #374151; font-weight: 600; position: sticky; top: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.missing { background: #fff7ed; }
tr:hover { background: #f9fafb; }
a { color: var(--primary); text-decoration: none; }
.dash-head { display: flex; justify-content: space-between; align-items: center; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin: 16px 0; }
.kpi { background: linear-gradient(135deg,#1f6feb,#3b82f6); color: #fff; border-radius: 12px; padding: 16px; }
.kpi-label { font-size: 13px; opacity: .9; }
.kpi-value { font-size: 26px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.chart-box { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.chart { width: 100%; height: 300px; }
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-body { background: #fff; border-radius: 14px; padding: 18px; width: 100%; max-width: 720px; max-height: 80vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
@media (max-width: 640px) {
  .topbar { padding: 10px 12px; }
  .brand { font-size: 16px; }
  .card { padding: 14px; }
}
