:root {
  --primary: #1a3a6b;
  --primary-dark: #142d54;
  --primary-light: #eef3fa;
  --accent: #c8963e;
  --bg: #f5f7fb;
  --card: #ffffff;
  --line: #dfe5ef;
  --text: #1f2937;
  --muted: #6b7280;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0ea5e9;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
#app { height: 100vh; display: flex; flex-direction: column; }

.topbar {
  height: 60px;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary));
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 1px 8px rgba(0,0,0,0.08);
  flex-shrink: 0;
}
.topbar h1 { margin: 0; font-size: 18px; letter-spacing: 1px; }
.topbar .user { display: flex; align-items: center; gap: 12px; }
.topbar .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; font-weight: bold; color: white; }
.topbar .divider { width: 1px; height: 24px; background: rgba(255,255,255,0.3); }

.layout { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: 240px;
  background: white;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar .logo { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.sidebar .logo .title { font-weight: 700; color: var(--primary); font-size: 16px; }
.sidebar .logo .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; }
.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 11px 14px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  text-align: left;
}
.nav button:hover { background: var(--primary-light); }
.nav button.active { background: var(--primary); color: white; }
.nav .icon { width: 18px; text-align: center; }
.sidebar .footer { margin-top: auto; padding: 16px 20px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.page { padding: 20px 24px; overflow-y: auto; height: 100%; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 16px; flex-wrap: wrap; }
.page-title { margin: 0; font-size: 20px; }
.page-desc { color: var(--muted); margin-top: 6px; font-size: 13px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1200px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } .grid.cols-3 { grid-template-columns: 1fr; } }

.stat-card { display: flex; flex-direction: column; gap: 6px; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--primary); }
.stat-extra { color: var(--muted); font-size: 12px; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; background: #f9fafc; }
tr:hover td { background: #fbfdff; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 14px;
  font-family: inherit;
  background: white;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(26,58,107,0.18); border-color: var(--primary); }
label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid .full { grid-column: span 2; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: white; }
.btn.primary:hover { background: var(--primary-dark); color: white; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: white; }
.btn.danger { color: var(--danger); border-color: #f1b7b7; }
.btn.small { padding: 6px 10px; font-size: 13px; }

.tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 10px; font-size: 12px; background: var(--primary-light); color: var(--primary); margin: 2px 4px 2px 0; }
.tag.gold { background: #fdf3e1; color: #9a6b20; }
.tag.green { background: #e8f7ee; color: #166534; }
.tag.orange { background: #fff2e3; color: #9a3412; }
.tag.gray { background: #f3f4f6; color: #4b5563; }
.tag.blue { background: #e8f2fd; color: #1d4ed8; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: white; border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; }
@media (max-width: 1100px) { .detail-grid { grid-template-columns: 1fr; } }
.profile { border: 1px solid var(--line); border-radius: var(--radius); background: white; padding: 18px; }
.profile h2 { margin: 0 0 8px; font-size: 22px; }
.profile .meta { color: var(--muted); margin-bottom: 12px; }
.profile p { line-height: 1.7; margin: 0; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; margin-top: 14px; }
.kv div:nth-child(odd) { color: var(--muted); }
.kv div[data-kv='label'] { color: var(--muted); }
.kv div[data-kv='value'] { overflow-wrap: anywhere; }
.section-title { font-size: 16px; font-weight: 700; margin: 0 0 12px; }
.list-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.list-item .head { display: flex; justify-content: space-between; gap: 12px; }
.list-item .head strong { font-size: 15px; }
.list-item .sub { color: var(--muted); margin-top: 6px; font-size: 13px; }
.list-item p { margin: 8px 0 0; line-height: 1.6; }

.progress { display: flex; gap: 6px; margin: 12px 0; }
.progress span { flex: 1; height: 8px; background: #e5e7eb; border-radius: 999px; }
.progress span.active { background: var(--accent); }

.chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 42px; gap: 10px; align-items: center; }
.bar-track { height: 12px; background: #eef1f5; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }

.modal { position: fixed; inset: 0; background: rgba(15,23,42,0.45); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal-card { width: min(760px, 100%); max-height: 90vh; overflow-y: auto; background: white; border-radius: 16px; padding: 22px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 { margin: 0; font-size: 18px; }
.close-btn { border: none; background: transparent; font-size: 20px; cursor: pointer; color: var(--muted); }
.toast { position: fixed; right: 20px; top: 76px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast-item { background: #111827; color: white; padding: 10px 14px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.18); }
textarea { min-height: 90px; resize: vertical; }
.checkbox-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.checkbox-item { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.checkbox-item input { width: auto; }
.checkbox-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-content { white-space: pre-wrap; line-height: 1.8; }
.report-preview { background: #f8fafc; border: 1px dashed var(--line); border-radius: 10px; padding: 16px; }
.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #142d54, #1a3a6b 45%, #24508f); padding: 20px; }
.login-card { width: min(430px, 100%); background: white; border-radius: 18px; padding: 30px; box-shadow: 0 24px 60px rgba(0,0,0,0.22); }
.login-card h1 { margin: 0 0 8px; color: var(--primary); font-size: 24px; }
.login-card .sub { color: var(--muted); margin-bottom: 22px; }
.login-card label { margin-top: 14px; }
.login-card .actions { justify-content: flex-end; margin-top: 22px; }
.login-hint { margin-top: 16px; padding: 12px; border-radius: 10px; background: #f7f9fc; color: var(--muted); font-size: 13px; line-height: 1.6; }
.import-drop { border: 1px dashed var(--line); border-radius: 12px; padding: 18px; margin-top: 14px; }
.timeline { border-left: 3px solid var(--primary); padding-left: 18px; margin-top: 14px; }
.timeline-item { position: relative; padding-bottom: 14px; }
.timeline-item:before { content: ''; position: absolute; left: -25px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid white; box-shadow: 0 0 0 2px var(--primary); }
@media print {
  .topbar, .sidebar, .toolbar, .actions, .tabs, .row-actions, .btn, .modal, .toast { display: none !important; }
  .layout { display: block; }
  .page { padding: 0; overflow: visible; }
  body { background: white; }
}
