:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #697386;
  --line: #e6eaf0;
  --primary: #315efb;
  --primary-soft: #eef2ff;
  --danger: #d92d20;
  --shadow: 0 14px 34px rgba(29, 41, 57, 0.07);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.topbar {
  height: 76px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 4vw; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px);
}
.brand { display: flex; gap: 12px; align-items: center; min-width: 260px; }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; background: var(--primary); color: white; display: grid; place-items: center; font-weight: 800; }
.brand strong { display: block; font-size: 17px; }
.brand span { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav-btn { border: 0; background: transparent; padding: 10px 13px; border-radius: 9px; color: #4d586a; }
.nav-btn:hover, .nav-btn.active { background: var(--primary-soft); color: var(--primary); }

.shell { width: min(1440px, 94vw); margin: 30px auto 60px; }
.page { display: none; }
.page.active { display: block; }

.hero { min-height: 180px; padding: 34px 38px; border-radius: 22px; background: linear-gradient(125deg, #182b6b, #315efb 60%, #6f8cff); color: white; display: flex; align-items: center; justify-content: space-between; gap: 24px; box-shadow: var(--shadow); }
.hero h1, .page-title h1 { margin: 6px 0 10px; font-size: clamp(28px, 3vw, 42px); letter-spacing: -1px; }
.hero p { margin: 0; opacity: .86; }
.eyebrow { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: 1.5px; color: var(--primary); }
.hero .eyebrow { color: #cbd6ff; }

.notice { margin: 18px 0; padding: 13px 16px; border-radius: 12px; background: #fff8e8; border: 1px solid #f4d38c; color: #7a4e00; }
.hidden { display: none !important; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 20px 0; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); }
.stat-card span, .stat-card small { color: var(--muted); display: block; }
.stat-card strong { display: block; font-size: 30px; margin: 9px 0 5px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 18px 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.panel-head, .split, .table-meta, .modal-head, .button-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel h2 { margin: 5px 0 10px; }
.page-title { margin: 8px 0 22px; }
.page-title p { color: var(--muted); margin: 0; }
.page-title .eyebrow { color: var(--primary); }

.chart { width: 100%; height: 340px; }
.chart.tall { height: 520px; }
.chart.graph { height: 590px; }

.primary, .secondary, .ghost, .link-button {
  border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.primary { background: var(--primary); color: white; }
.secondary { background: var(--primary-soft); color: var(--primary); }
.ghost { background: #f8fafc; color: #344054; border: 1px solid var(--line); }
.danger { color: var(--danger); }
.hero .primary { background: white; color: var(--primary); }
.back-link { border: 0; background: transparent; color: var(--primary); font-weight: 700; padding: 8px 0 16px; }

.toolbar { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; margin-bottom: 18px; }
label { display: flex; flex-direction: column; gap: 7px; color: #465166; font-size: 13px; font-weight: 700; flex: 1; min-width: 150px; }
label.wide { flex: 2; min-width: 260px; }
input, select, textarea { width: 100%; border: 1px solid #d7dce5; border-radius: 9px; padding: 10px 11px; background: white; color: var(--text); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(49,94,251,.1); }
.inline { display: flex; gap: 12px; }
.form-stack { display: grid; gap: 13px; margin-top: 16px; }

.table-panel { padding: 0; overflow: hidden; }
.table-meta { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1050px; }
th, td { text-align: left; padding: 13px 14px; border-bottom: 1px solid #edf0f4; vertical-align: top; }
th { font-size: 12px; color: #667085; background: #fafbfc; }
td { font-size: 13px; }
.paper-title { font-weight: 750; max-width: 360px; }
.actions { display: flex; gap: 6px; white-space: nowrap; }
.actions button { border: 0; background: var(--primary-soft); color: var(--primary); padding: 6px 8px; border-radius: 7px; }
.actions button.delete { background: #fff0ef; color: var(--danger); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag, .badge { background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: 5px 9px; font-size: 11px; font-weight: 750; }
.badge.warn { background: #fff4d9; color: #8a5a00; }
.muted, .hint { color: var(--muted); font-size: 12px; }
.paragraph { color: #596579; line-height: 1.75; }
.dropzone { min-height: 200px; border: 1.5px dashed #b8c1d1; border-radius: 14px; display: grid; place-items: center; text-align: center; padding: 24px; gap: 12px; background: #fbfcff; }
.result-box { margin-top: 18px; color: #4d586a; }
code { background: #f0f3f8; padding: 2px 5px; border-radius: 5px; }

.detail-card { padding: 34px; }
.detail-card h1 { font-size: 32px; margin: 10px 0 28px; }
.detail-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
.detail-grid div, .detail-block { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.detail-grid span, .detail-block > span { color: var(--muted); font-size: 12px; display: block; margin-bottom: 8px; }
.detail-block { margin-top: 14px; }
.link-button { margin-top: 18px; }

.feature-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 12px; color: #4d586a; }

.modal { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-card { width: min(680px, 96vw); max-height: 92vh; overflow: auto; background: white; border-radius: 18px; padding: 24px; box-shadow: 0 30px 80px rgba(0,0,0,.2); }
.modal-head button { border: 0; background: transparent; font-size: 28px; }
#paper-form { display: grid; gap: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.toast { position: fixed; right: 24px; bottom: 24px; background: #172033; color: white; padding: 12px 16px; border-radius: 10px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; z-index: 80; max-width: 420px; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .topbar { height: auto; padding: 14px 3vw; align-items: flex-start; gap: 12px; }
  .brand { min-width: 210px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .hero { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 680px) {
  .topbar { position: static; flex-direction: column; }
  nav { justify-content: flex-start; }
  .stat-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .inline { flex-direction: column; }
}
