:root {
  --crimson: #b3122f;
  --crimson-deep: #7e0e22;
  --gold: #d9b25f;
  --gold-light: #f3e4c2;
  --ink: #2a1c14;
  --muted: #8a7a63;
  --dim: #a99a84;
  --bg: #f6f1e7;
  --card: #fffdf8;
  --line: #e6dac6;
  --ok: #1f7a4d;
  --ok-bg: #e7f4ec;
  --warn: #a86a12;
  --warn-bg: #fbf0d9;
  --bad: #b3261e;
  --bad-bg: #fbe8e6;
  --shadow: 0 18px 44px -28px rgba(68, 42, 20, 0.35);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--crimson); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }
::selection { background: rgba(179, 18, 47, 0.16); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 253, 248, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.topbar .inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 22px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 4px 12px -4px rgba(126, 14, 34, 0.35);
}
.brand .name { font-weight: 800; font-size: 14px; letter-spacing: 0.4px; color: var(--ink); line-height: 1.25; }
.brand .name small {
  display: block;
  font-size: 9px;
  letter-spacing: 1.6px;
  color: var(--muted);
  font-weight: 700;
}
.topbar .spacer { flex: 1; }
.topbar .user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
}
.topbar .user b { color: var(--ink); font-weight: 800; }
.topbar .quota {
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  background: #fffaf0;
  color: var(--crimson);
  font-weight: 700;
}

/* ---------- 布局 ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 26px 22px 60px; }
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; line-height: 1.25; }
.page-head .sub { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.kicker {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--crimson);
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.16s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: #d4c2a6; background: #fffaf0; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--crimson);
  color: #fff8ec;
  border-color: var(--crimson);
  box-shadow: 0 8px 18px -10px rgba(179, 18, 47, 0.55);
}
.btn-primary:hover { background: var(--crimson-deep); border-color: var(--crimson-deep); color: #fff8ec; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #2a1c14; }
.btn-gold:hover { background: #e5c274; border-color: #e5c274; color: #2a1c14; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--bad); border-color: #e9c4bf; background: #fff8f6; }
.btn-danger:hover { background: #fbe8e6; border-color: #d9a7a1; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card.pad { padding: 20px; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px 16px;
}
.stat .n { font-size: 26px; font-weight: 900; letter-spacing: -0.03em; line-height: 1.1; color: var(--crimson); }
.stat .l { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.stat .s { font-size: 10px; color: var(--dim); margin-top: 2px; }

/* ---------- 报告卡 ---------- */
.report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.report-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: 0.18s;
  position: relative;
  overflow: hidden;
}
.report-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--crimson), var(--gold));
  opacity: 0.9;
}
.report-card:hover { border-color: #d8c3a3; box-shadow: 0 20px 42px -28px rgba(68, 42, 20, 0.45); transform: translateY(-2px); }
.report-card .name { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.report-card .meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.report-card .foot { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.report-card .updated { font-size: 10.5px; color: var(--dim); }
.report-card .summary { font-size: 12px; color: var(--muted); line-height: 1.6; }

/* ---------- 状态 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 800;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.active, .badge.completed { color: var(--ok); background: var(--ok-bg); border-color: #c6e4d2; }
.badge.disabled, .badge.deleted { color: var(--muted); background: #efe9dd; border-color: #dfd4c0; }
.badge.draft { color: var(--warn); background: var(--warn-bg); border-color: #efd7ab; }
.badge.admin { color: var(--crimson); background: #fbe9ec; border-color: #efc9d1; }
.badge.lock { color: var(--muted); background: #f2ece0; border-color: #e0d3bd; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
table.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th, .table td { text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { background: #faf5ea; font-size: 11px; color: var(--muted); font-weight: 800; letter-spacing: 0.3px; white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fffaf0; }
.table .num { font-variant-numeric: tabular-nums; }
.table .actions-cell { display: flex; gap: 5px; flex-wrap: wrap; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 800; color: var(--ink); }
.field .hint { font-size: 11px; color: var(--muted); font-weight: 400; }
.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fffdf9;
  border-radius: 9px;
  padding: 9px 11px;
  color: var(--ink);
  outline: none;
  transition: 0.15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--crimson); box-shadow: 0 0 0 3px rgba(179, 18, 47, 0.1); }
.textarea { min-height: 96px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-error {
  display: none;
  background: var(--bad-bg);
  border: 1px solid #ecc4bf;
  color: var(--bad);
  border-radius: 9px;
  padding: 9px 11px;
  font-size: 12px;
  margin-bottom: 12px;
}
.form-error.show { display: block; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink); }
.checkbox input { width: 15px; height: 15px; accent-color: var(--crimson); }

/* ---------- 空状态 / 加载 ---------- */
.empty {
  border: 1px dashed #dccdb4;
  background: #fffaf1;
  border-radius: var(--radius);
  padding: 46px 20px;
  text-align: center;
  color: var(--muted);
}
.empty .ic { font-size: 30px; margin-bottom: 8px; }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; }
.loading { padding: 30px; text-align: center; color: var(--muted); font-size: 13px; }
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #e6dac6;
  border-top-color: var(--crimson);
  border-radius: 50%;
  display: inline-block;
  vertical-align: -3px;
  margin-right: 7px;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(24, 14, 8, 0.45);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.modal-mask.show { display: flex; }
.modal {
  width: 100%;
  max-width: 520px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.5);
  max-height: 90vh;
  overflow: auto;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .close {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
}
.modal-body { padding: 18px; }
.modal-foot {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
}
.secret {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  background: #faf3e4;
  border: 1px dashed #d8c3a3;
  border-radius: 9px;
  padding: 12px;
  font-size: 17px;
  letter-spacing: 1.5px;
  text-align: center;
  color: var(--crimson);
  font-weight: 800;
  user-select: all;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 14px);
  z-index: 200;
  background: #241a13;
  color: #fff8ec;
  border: 1px solid rgba(217, 178, 95, 0.35);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 12.5px;
  opacity: 0;
  pointer-events: none;
  transition: 0.22s;
  max-width: min(92vw, 520px);
  box-shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.6);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { border-color: rgba(111, 191, 139, 0.5); }
.toast.err { border-color: rgba(224, 90, 90, 0.6); }

/* ---------- 登录页 ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 0.95fr; background: var(--bg); }
.login-brand {
  position: relative;
  overflow: hidden;
  background: #0a0908;
  color: #f6efe2;
  padding: 54px 58px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(700px 420px at 85% -10%, rgba(217, 178, 95, 0.18), transparent 62%),
    radial-gradient(620px 420px at 0% 100%, rgba(179, 18, 47, 0.28), transparent 60%),
    linear-gradient(rgba(217, 178, 95, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(217, 178, 95, 0.05) 1px, transparent 1px);
  background-size: auto, auto, 54px 54px, 54px 54px;
}
.login-brand > * { position: relative; z-index: 1; }
.login-brand .logo-row { display: flex; align-items: center; gap: 12px; }
.login-brand .logo-row img { width: 54px; height: 54px; border-radius: 50%; }
.login-brand .logo-row .t { font-size: 18px; font-weight: 900; letter-spacing: 1px; }
.login-brand .logo-row .t small { display: block; font-size: 9px; letter-spacing: 3px; color: var(--gold); margin-top: 3px; }
.login-brand h1 { font-size: clamp(30px, 3.4vw, 46px); line-height: 1.2; letter-spacing: -0.03em; margin: 60px 0 16px; font-weight: 900; }
.login-brand h1 span { color: var(--gold); }
.login-brand p { color: #b9a98f; font-size: 14px; max-width: 430px; line-height: 1.85; margin: 0; }
.login-brand .tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 28px; }
.login-brand .tags span {
  border: 1px solid rgba(217, 178, 95, 0.28);
  color: #e9dcc2;
  background: rgba(217, 178, 95, 0.06);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11.5px;
}
.login-brand .foot { font-size: 10.5px; color: #8a7a63; letter-spacing: 0.4px; }
.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 380px; }
.login-card .kicker { color: var(--crimson); }
.login-card h2 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.02em; }
.login-card .sub { color: var(--muted); font-size: 12.5px; margin: 0 0 24px; }
.login-card .btn-primary { width: 100%; padding: 11px 16px; font-size: 14px; }
.login-card .tip { font-size: 11.5px; color: var(--dim); margin-top: 18px; line-height: 1.7; text-align: center; }
.login-card .back { display: inline-block; margin-top: 14px; font-size: 12px; color: var(--muted); }

/* ---------- 报告只读页 ---------- */
.doc-head {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
}
.doc-head h1 { margin: 0 0 6px; font-size: 24px; }
.doc-head .meta { color: var(--muted); font-size: 12px; }
.doc-section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 12px; }
.doc-section h3 { margin: 0 0 12px; font-size: 14px; color: var(--crimson); display: flex; align-items: center; gap: 8px; }
.doc-section h3::before { content: ""; width: 3px; height: 14px; background: linear-gradient(180deg, var(--crimson), var(--gold)); border-radius: 2px; }
.kv-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.kv-table td { padding: 7px 8px; border-bottom: 1px dashed var(--line); vertical-align: top; }
.kv-table td:first-child { width: 34%; color: var(--muted); }
.kv-table tr:last-child td { border-bottom: none; }

/* ---------- 公开区占位 ---------- */
.public-page { background: #0a0908; color: #f6efe2; min-height: 100vh; }
.public-top { position: sticky; top: 0; z-index: 30; background: rgba(10, 9, 8, 0.82); backdrop-filter: blur(14px); border-bottom: 1px solid rgba(217, 178, 95, 0.16); }
.public-top .inner { max-width: 1180px; margin: auto; padding: 0 22px; height: 66px; display: flex; align-items: center; gap: 14px; }
.public-top .brand .name { color: #f6efe2; }
.public-top .brand .name small { color: #b9a98f; }
.public-top .spacer { flex: 1; }
.public-top a { color: #e9dcc2; font-size: 12.5px; }
.public-hero { max-width: 1180px; margin: auto; padding: 88px 22px 70px; display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 48px; align-items: center; }
.public-hero .eyebrow { font-size: 10px; letter-spacing: 2.4px; color: var(--gold); font-weight: 800; }
.public-hero h1 { font-size: clamp(34px, 4.6vw, 60px); line-height: 1.12; letter-spacing: -0.03em; margin: 16px 0 18px; font-weight: 900; }
.public-hero h1 span { color: var(--gold); }
.public-hero p { color: #b9a98f; font-size: 15px; max-width: 560px; line-height: 1.85; }
.public-hero .cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.public-hero .btn-ghost { color: #f6efe2; border-color: rgba(217, 178, 95, 0.3); background: rgba(255, 248, 235, 0.03); }
.public-hero .btn-ghost:hover { background: rgba(217, 178, 95, 0.08); }
.public-card {
  background: linear-gradient(180deg, #fffdf8, #f8f0e2);
  color: #2a1c14;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.public-card .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid #e8dcc6; padding-bottom: 12px; }
.public-card .top .brandline { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 800; color: #a5122a; }
.public-card .top .brandline img { width: 23px; height: 23px; border-radius: 50%; }
.public-card .top .tag { font-size: 9px; color: #8a7a63; border: 1px solid #e8dcc6; border-radius: 999px; padding: 2px 8px; }
.public-card h3 { margin: 16px 0 4px; font-size: 19px; line-height: 1.3; }
.public-card .meta { font-size: 10px; color: #8a7a63; }
.public-card .kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.public-card .kpi { background: #fbf3e4; border: 1px solid #e8dcc6; border-radius: 10px; padding: 8px 9px; }
.public-card .kpi b { display: block; color: #a5122a; font-size: 17px; line-height: 1.2; }
.public-card .kpi span { font-size: 8.5px; color: #8a7a63; }
.public-section { max-width: 1180px; margin: auto; padding: 64px 22px; border-top: 1px solid rgba(217, 178, 95, 0.14); }
.public-section .kicker { color: var(--gold); }
.public-section h2 { font-size: clamp(24px, 3vw, 36px); letter-spacing: -0.02em; margin: 0 0 10px; }
.public-section p { color: #b9a98f; font-size: 14px; max-width: 720px; line-height: 1.85; }
.public-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 24px; }
.public-grid .cell { border: 1px solid rgba(217, 178, 95, 0.16); background: rgba(255, 248, 235, 0.03); border-radius: 12px; padding: 16px; }
.public-grid .cell b { display: block; color: #f6efe2; font-size: 13px; margin-bottom: 5px; }
.public-grid .cell span { color: #b9a98f; font-size: 12px; line-height: 1.7; }
.public-footer { max-width: 1180px; margin: auto; padding: 30px 22px 44px; border-top: 1px solid rgba(217, 178, 95, 0.14); color: #8a7a63; font-size: 11px; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-page { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .public-hero { grid-template-columns: 1fr; padding-top: 56px; }
  .public-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .container { padding: 18px 14px 48px; }
  .topbar .inner { padding: 0 14px; height: 58px; }
  .topbar .user .uname { display: none; }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 22px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .report-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .public-grid { grid-template-columns: 1fr; }
  .public-hero { padding: 42px 14px 46px; }
  .public-section { padding: 44px 14px; }
  .public-footer { padding: 24px 14px 36px; }
  .modal { max-height: 94vh; }
}
