:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #16232a;
  --ink-2: #5a6b73;
  --ink-3: #93a3aa;
  --line: #e3e9ec;
  --brand: #15505f;
  --brand-2: #1d6b7e;
  --brand-soft: #eaf3f5;
  --gold: #b8873b;
  --ok: #2f7d5d;
  --warn: #a8762a;
  --danger: #b4453c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 40, 48, .04), 0 8px 24px rgba(16, 40, 48, .05);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(circle at 20% 10%, #1d6b7e 0%, #123845 45%, #0d2831 100%);
}
.login-card {
  width: 372px; background: #fff; border-radius: 14px; padding: 38px 34px 30px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
}
.login-card .brand { font-size: 19px; font-weight: 700; letter-spacing: .5px; }
.login-card .sub { color: var(--ink-3); font-size: 12.5px; margin: 6px 0 26px; }
.login-card input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px;
  background: #fafbfb; margin-bottom: 14px; outline: none;
}
.login-card input:focus { border-color: var(--brand-2); background: #fff; }
.login-card button {
  width: 100%; padding: 11px; background: var(--brand); color: #fff; border: 0;
  border-radius: 8px; font-weight: 600; cursor: pointer; letter-spacing: 1px;
}
.login-card button:hover { background: var(--brand-2); }
.login-err { color: var(--danger); font-size: 12.5px; min-height: 18px; margin-bottom: 6px; }

/* ---------- 布局 ---------- */
.shell { display: flex; min-height: 100vh; }

.side {
  width: 216px; flex: 0 0 216px; background: #10323d; color: #cfe0e4;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side .logo {
  padding: 22px 20px 18px; border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.side .logo b { display: block; font-size: 15px; color: #fff; letter-spacing: .5px; }
.side .logo span { font-size: 11px; color: #7fa2ac; letter-spacing: 1.5px; }
.nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; color: #c3d6dc;
  text-decoration: none; border-radius: 7px; margin-bottom: 2px; font-size: 13px;
}
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.on { background: var(--brand-2); color: #fff; font-weight: 600; }
.nav .ico { width: 16px; text-align: center; opacity: .9; }
.side .foot { padding: 12px 16px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 11.5px; color: #6d8d97; }
.side .foot a { color: #9db8bf; cursor: pointer; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 16px; margin: 0; font-weight: 650; }
.topbar .hint { font-size: 12px; color: var(--ink-3); }
.content { padding: 20px 24px 48px; }

/* ---------- 通用 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden;
}
.card-h {
  padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex;
  align-items: center; justify-content: space-between; gap: 12px;
}
.card-h h3 { margin: 0; font-size: 14px; font-weight: 650; }
.card-h .sub { font-size: 12px; color: var(--ink-3); font-weight: 400; margin-left: 8px; }
.card-b { padding: 16px 18px; }
.card-b.flush { padding: 0; }

.btn {
  padding: 7px 14px; border: 1px solid var(--line); background: #fff; border-radius: 7px;
  cursor: pointer; font-size: 12.5px; font-weight: 550; color: var(--ink-2); white-space: nowrap;
}
.btn:hover { border-color: var(--brand-2); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand-2); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.danger { color: var(--danger); border-color: #eccfcc; }
.btn.danger:hover { background: #fbf1f0; border-color: var(--danger); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi:before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand-2);
}
.kpi.gold:before { background: var(--gold); } .kpi.ok:before { background: var(--ok); }
.kpi .k { font-size: 12px; color: var(--ink-3); margin-bottom: 8px; }
.kpi .v { font-size: 22px; font-weight: 700; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: 3px; }
.kpi .f { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }

table.tb { width: 100%; border-collapse: collapse; }
table.tb th {
  text-align: left; font-size: 12px; color: var(--ink-2); font-weight: 600;
  background: #f8fafb; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tb td { padding: 10px 12px; border-bottom: 1px solid #eef2f4; font-size: 13px; vertical-align: middle; }
table.tb tbody tr:hover { background: #fbfcfc; }
table.tb tbody tr:last-child td { border-bottom: 0; }
table.tb .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tb .strong { font-weight: 650; }
table.tb tfoot td { background: #f8fafb; font-weight: 650; border-top: 1px solid var(--line); }
table.tb tr.clickable { cursor: pointer; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11.5px;
  background: var(--brand-soft); color: var(--brand); font-weight: 550; white-space: nowrap;
}
.tag.gray { background: #f0f3f5; color: var(--ink-2); }
.tag.gold { background: #fbf3e6; color: #8f6520; }
.tag.green { background: #eaf5ef; color: var(--ok); }
.tag.red { background: #fbf0ef; color: var(--danger); }
.tag.blue { background: #eef3fb; color: #33558c; }

.empty { padding: 40px; text-align: center; color: var(--ink-3); font-size: 13px; }
.empty b { display: block; color: var(--ink-2); font-size: 14px; margin-bottom: 6px; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--ink-2); font-weight: 550; }
.field label i { color: var(--danger); font-style: normal; margin-left: 2px; }
.field input, .field select, .field textarea {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; outline: none;
  transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand-2); }
.field input[readonly] { background: #f7f9fa; color: var(--ink-2); }
.field .tip { font-size: 11.5px; color: var(--ink-3); }
.field textarea { resize: vertical; min-height: 60px; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(13, 32, 38, .45); display: flex;
  align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 60; overflow-y: auto;
  backdrop-filter: blur(1.5px);
}
.modal {
  background: #fff; border-radius: 12px; width: 780px; max-width: 100%;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .28); animation: rise .18s ease-out;
}
.modal.wide { width: 1000px; }
.modal.narrow { width: 460px; }
@keyframes rise { from { transform: translateY(8px); opacity: .6; } }
.modal-h {
  padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; background: #fff; z-index: 2; border-radius: 12px 12px 0 0;
}
.modal-h h3 { margin: 0; font-size: 15px; }
.modal-h .x { cursor: pointer; color: var(--ink-3); font-size: 20px; line-height: 1; padding: 2px 6px; }
.modal-h .x:hover { color: var(--ink); }
.modal-b { padding: 18px 20px; }
.modal-f {
  padding: 13px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end;
  gap: 10px; position: sticky; bottom: 0; background: #fff; border-radius: 0 0 12px 12px;
}

.sec-title {
  font-size: 12px; font-weight: 700; color: var(--brand); letter-spacing: .8px;
  padding-bottom: 8px; border-bottom: 1px dashed var(--line); margin: 18px 0 14px;
}
.sec-title:first-child { margin-top: 0; }

/* ---------- 试算面板 ---------- */
.calc-box { background: #f8fafb; border: 1px solid var(--line); border-radius: 9px; padding: 14px 16px; }
.calc-box .line { display: flex; justify-content: space-between; padding: 5px 0; font-size: 12.5px; color: var(--ink-2); }
.calc-box .line b { color: var(--ink); font-variant-numeric: tabular-nums; }
.calc-box .line.total { border-top: 1px dashed #cfd9de; margin-top: 6px; padding-top: 9px; font-size: 14px; }
.calc-box .line.total b { font-size: 19px; color: var(--brand); }

/* ---------- 详情 ---------- */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.detail-head h3 { margin: 0 0 6px; font-size: 17px; }
.meta-list { display: flex; gap: 20px; flex-wrap: wrap; color: var(--ink-2); font-size: 12.5px; margin-top: 8px; }
.meta-list span b { color: var(--ink); font-weight: 600; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs div {
  padding: 9px 15px; cursor: pointer; font-size: 13px; color: var(--ink-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs div.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 650; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: #16232a; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px;
  z-index: 100; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); opacity: 0; transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.err { background: var(--danger); }

.banner {
  display: flex; gap: 10px; align-items: flex-start; background: #fbf6ea; border: 1px solid #f0e2c6;
  color: #7d5a1c; padding: 10px 14px; border-radius: 8px; font-size: 12.5px; margin-bottom: 14px;
}
.banner b { font-weight: 700; }

.hbar { display: flex; align-items: center; gap: 8px; }
.hbar .grow { flex: 1; height: 6px; background: #eef2f4; border-radius: 4px; overflow: hidden; }
.hbar .grow i { display: block; height: 100%; background: var(--brand-2); border-radius: 4px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; font-size: 12.5px;
}

.mini-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mini-table th { text-align: left; color: var(--ink-3); font-weight: 550; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.mini-table td { padding: 7px 8px; border-bottom: 1px solid #f0f4f5; }
.mini-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

.split { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; align-items: start; }
@media (max-width: 1080px) {
  .split { grid-template-columns: 1fr; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .side { width: 64px; flex: 0 0 64px; }
  .side .logo b, .side .logo span, .nav a span.txt, .side .foot { display: none; }
  .nav a { justify-content: center; }
}
