/* 数据交付控制台 · 浅色主题:浅蓝灰底 + 白卡片 */
:root {
  --bg: #eef2f7;
  --card: #ffffff;
  --ink: #1c2733;
  --muted: #66788a;
  --line: #e2e8f0;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --orange: #ea8600;
  --orange-soft: #fef3c7;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --green: #15803d;
  --green-soft: #dcfce7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 42, 67, 0.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 14px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.full { grid-column: 1 / -1; }
.req { color: var(--red); }

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: #16283a; color: #dbe4ee;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.logo {
  width: 38px; height: 38px; border-radius: 10px; background: #fff;
  object-fit: contain; padding: 2px; box-sizing: border-box; flex: none;
}
.brand-name { font-size: 15px; font-weight: 700; color: #fff; }
.brand-sub { font-size: 10px; letter-spacing: 1px; color: #8fa6bd; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 12px; }
.nav a {
  color: #c3d2e2; padding: 10px 12px; border-radius: 8px; font-size: 14px;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--accent); color: #fff; }
.sidebar-foot { margin-top: auto; padding: 14px 16px; font-size: 12px; color: #8fa6bd; border-top: 1px solid rgba(255,255,255,.08); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 18px 24px 8px;
}
.topbar h1 { margin: 0; font-size: 22px; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.content { padding: 16px 24px 32px; display: flex; flex-direction: column; gap: 16px; }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 8px; font-size: 14px;
}
.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-ghost { border: none; background: transparent; padding: 6px 10px; color: var(--muted); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.card h3 .hint { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 6px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.stat .stat-label { font-size: 13px; color: var(--muted); }
.stat .stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat .stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.clickable { cursor: pointer; }
.stat.clickable:hover { outline: 2px solid var(--accent-soft); }

.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill-pending { background: var(--orange-soft); color: var(--orange); }
.pill-billed { background: var(--blue-soft); color: var(--blue); }
.pill-settled { background: var(--green-soft); color: var(--green); }
.pill-rejected { background: var(--red-soft); color: var(--red); }
.pill-grey { background: #f1f5f9; color: var(--muted); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--ink); }
.tbl tr:hover td { background: #f8fafc; }
.tbl .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.tbl-wrap { overflow-x: auto; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 140px; }
.toolbar .spacer { flex: 1; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; font-size: 13px; color: var(--muted); }

.empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.empty .big { font-size: 16px; color: var(--ink); margin-bottom: 4px; }

.triage-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 0;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.triage-item:last-child { border-bottom: none; }
.triage-item:hover .triage-title { color: var(--accent); }
.triage-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.triage-dot.high { background: var(--red); }
.triage-dot.medium { background: var(--orange); }
.triage-title { font-weight: 600; }
.triage-detail { font-size: 12px; color: var(--muted); }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.kv dd .mono { font-size: 12px; }

.check { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.check:last-child { border-bottom: none; }
.check .ok { color: var(--green); font-weight: 700; }
.check .bad { color: var(--red); font-weight: 700; }
.health-score { font-size: 26px; font-weight: 700; }
.health-score .of { font-size: 14px; color: var(--muted); font-weight: 400; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; font-size: 13px; border-left: 2px solid var(--line); margin-left: 5px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--accent); border: 2px solid #fff;
}
.timeline .t-time { font-size: 12px; color: var(--muted); }

.drawer-overlay, .modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 30, 45, .45);
  opacity: 0; pointer-events: none; transition: opacity .18s; z-index: 40;
}
.drawer-overlay.open, .modal-overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 94vw);
  background: #fff; z-index: 50; transform: translateX(100%); transition: transform .2s;
  display: flex; flex-direction: column; box-shadow: -4px 0 24px rgba(0,0,0,.15);
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 17px; }
.drawer-body { overflow-y: auto; padding: 18px 20px 28px; display: flex; flex-direction: column; gap: 16px; }
.drawer-body .card { box-shadow: none; border: 1px solid var(--line); }

.modal-overlay { display: flex; align-items: flex-start; justify-content: center; z-index: 60; overflow-y: auto; padding: 40px 16px; }
.modal {
  background: #fff; border-radius: 14px; width: 720px; max-width: 100%;
  padding: 20px 22px; margin: auto 0; box-shadow: 0 12px 40px rgba(0,0,0,.2);
}
.modal-small { width: 480px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid.form-single { grid-template-columns: 1fr; }
.form-hint { font-size: 12px; color: var(--muted); margin: 12px 0 0; }
.form-error { color: var(--red); font-size: 13px; margin-top: 8px; min-height: 18px; }
.size-row { display: flex; gap: 8px; }
.size-row input { flex: 1; }
.size-row select { width: 90px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: #16283a; color: #fff; padding: 10px 18px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: all .2s; z-index: 80; font-size: 14px;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.target-card { display: flex; flex-direction: column; gap: 8px; }
.target-card .t-name { font-size: 16px; font-weight: 700; }
.target-card .t-meta { font-size: 13px; color: var(--muted); word-break: break-all; }
.target-card .t-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.fresh-ok { color: var(--green); font-weight: 600; }
.fresh-warn { color: var(--orange); font-weight: 600; }
.fresh-none { color: var(--muted); }

.ann-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ann-item:last-child { border-bottom: none; }
.ann-item .ann-title { font-weight: 700; font-size: 15px; }
.ann-item .ann-meta { font-size: 12px; color: var(--muted); margin: 2px 0 6px; }
.ann-item .ann-body { white-space: pre-wrap; font-size: 14px; }

.note-card input:focus, .note-card textarea:focus { outline: none; background: #f8fafc; border-radius: 6px; }

.chart { width: 100%; }
.chart-bar { fill: #93c5fd; }
.chart-bar.today { fill: var(--accent); }
.chart-label { font-size: 10px; fill: var(--muted); }
.chart-value { font-size: 10px; fill: var(--ink); font-weight: 600; }

.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-title h3 { margin: 0; font-size: 15px; }

@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .brand-text, .nav a { font-size: 0; }
  .nav a { text-align: center; padding: 10px 4px; }
  .nav a::first-letter { font-size: 14px; }
  .sidebar-foot { display: none; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
}
