/* 脉知 运营后台 / 数据大屏 —— 视觉沿用原型的青绿体系，但代码是接口驱动的重写版 */
:root {
  --teal: #0b7e6c;
  --teal-2: #0fa58c;
  --teal-soft: #e6f4f1;
  --bg: #f4f7f6;
  --card: #ffffff;
  --ink: #12332c;
  --ink-2: #35564e;
  --muted: #7c8f87;
  --line: #e3eae7;
  --warn: #f59e0b;
  --danger: #ef4444;
  --ok: #22c55e;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(18, 51, 44, 0.06), 0 8px 24px rgba(18, 51, 44, 0.06);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 20% -10%, #d9efeb 0%, transparent 60%), var(--bg); }
.login-card { width: 380px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 28px; }
.login-card h1 { margin: 0 0 4px; font-size: 20px; letter-spacing: .5px; }
.login-card p.sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fbfdfc; outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--teal-2); background: #fff; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); transition: .15s; }
.btn:hover { border-color: var(--teal-2); color: var(--teal); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-2); border-color: var(--teal-2); color: #fff; }
.btn.danger { color: var(--danger); border-color: #f6d5d5; background: #fff7f7; }
.btn.danger:hover { background: #feecec; border-color: var(--danger); }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.login-card .btn.primary { width: 100%; justify-content: center; padding: 10px; }
.login-err { color: var(--danger); font-size: 13px; min-height: 20px; }

/* ---------- 外壳 ---------- */
.shell { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
.side { background: #0d2b26; color: #cfe3dd; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; }
.side .brand { display: flex; align-items: center; gap: 9px; padding: 4px 10px 16px; color: #fff; }
.side .brand b { font-size: 15px; letter-spacing: 1px; }
.side .brand i { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, #0fa58c, #3ac4b4); display: inline-block; }
.side .group { font-size: 11px; color: #6f8d86; padding: 12px 10px 6px; letter-spacing: 1px; }
.side a.nav { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 10px; border-radius: 9px; color: #cfe3dd; font-size: 13.5px; }
.side a.nav:hover { background: rgba(255, 255, 255, .06); text-decoration: none; }
.side a.nav.on { background: linear-gradient(90deg, rgba(15, 165, 140, .28), rgba(15, 165, 140, .06)); color: #fff; }
.side a.nav .badge { font-size: 11px; background: rgba(255, 255, 255, .12); border-radius: 20px; padding: 0 7px; }
.side .foot { margin-top: auto; padding: 10px; font-size: 12px; color: #6f8d86; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 22px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar h2 { margin: 0; font-size: 16px; }
.topbar .who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.content { padding: 20px 22px 40px; }

/* ---------- 卡片 / 网格 ---------- */
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1280px) { .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .g2, .g3, .g4, .g5 { grid-template-columns: 1fr; } .shell { grid-template-columns: 1fr; } .side { flex-direction: row; overflow: auto; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line); }
.card > header h3 { margin: 0; font-size: 14px; }
.card > header .hint { color: var(--muted); font-size: 12px; }
.card .body { padding: 16px; }
.card .body.tight { padding: 0; }

/* KPI */
.kpi { padding: 15px 16px; }
.kpi .label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 26px; font-weight: 700; letter-spacing: .5px; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.kpi .sub { color: var(--muted); font-size: 12px; }
.kpi .note { color: #9aa9a4; font-size: 11.5px; margin-top: 6px; line-height: 1.45; }
.kpi.na .value { color: #b9c6c2; }

/* ---------- 表格 ---------- */
.table-wrap { overflow: auto; max-height: 560px; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th, table.tb td { padding: 9px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.tb th { position: sticky; top: 0; background: #f7faf9; color: var(--muted); font-weight: 600; font-size: 12px; z-index: 2; }
table.tb tbody tr:hover { background: #f8fbfa; }
table.tb td.num { font-variant-numeric: tabular-nums; }
table.tb td.wrap { white-space: normal; min-width: 200px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 13px; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11.5px; background: var(--teal-soft); color: var(--teal); }
.tag.warn { background: #fff5e5; color: #b47100; }
.tag.danger { background: #feecec; color: var(--danger); }
.tag.gray { background: #f1f4f3; color: var(--muted); }
.tag.ok { background: #e9f8ef; color: #15803d; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.toolbar input, .toolbar select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.toolbar .grow { flex: 1; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button { padding: 7px 13px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); }
.tabs button.on { background: var(--teal); border-color: var(--teal); color: #fff; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 10px 14px; color: var(--muted); font-size: 12.5px; }

/* ---------- 图表 ---------- */
.spark { width: 100%; height: 34px; display: block; }
.bars-h { display: grid; gap: 8px; }
.bars-h .row { display: grid; grid-template-columns: 88px 1fr 56px; align-items: center; gap: 10px; font-size: 12.5px; }
.bars-h .track { height: 9px; border-radius: 20px; background: #eef3f1; overflow: hidden; }
.bars-h .fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--teal-2), var(--teal)); }
.bars-h .val { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.meter { display: flex; align-items: baseline; gap: 6px; }
.meter .n { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- 弹窗 / toast ---------- */
.mask { position: fixed; inset: 0; background: rgba(8, 26, 22, .42); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { width: min(560px, 100%); max-height: 86vh; overflow: auto; background: #fff; border-radius: 14px; box-shadow: 0 24px 60px rgba(8, 26, 22, .28); }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal header h3 { margin: 0; font-size: 15px; }
.modal .body { padding: 18px; }
.modal { display:flex; flex-direction:column; overflow:hidden; }
.modal .body { overflow:auto; min-height:0; }
.modal header,.modal footer { flex-shrink:0; }
.modal footer { background:white; }
.risk-banner { padding:14px 16px; background:#fff0ef; border:1px solid #f3c8c5; color:#a63b36; border-radius:10px; margin-bottom:16px; line-height:1.8; }
.success-banner { padding:14px; background:#e6f6ee; color:#147857; border-radius:10px; }
.ack-check { display:block; margin-top:16px; line-height:1.8; }
.ack-check input { width:auto; margin-right:8px; }
.actions { white-space:nowrap; }
.actions .btn { margin-right:6px; }
.batch-toolbar { padding:12px; background:#eaf6f1; border-radius:8px; margin-bottom:12px; }
.batch-toolbar[hidden] { display:none; }
.subitem-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:12px; }
.subitem-col { background:#f7faf8; border:1px solid #e6eee9; border-radius:10px; padding:12px; }
.subitem-col h4 { margin:0 0 12px; color:#137e69; }
.subitem { padding:10px 0; border-bottom:1px solid #e4ece7; }
.subitem b { display:block; font-size:13px; }
.subitem em { color:#0c8871; font-style:normal; }
.subitem p { font-size:12px; line-height:1.7; }
.subitem small,.note { color:#788c83; line-height:1.8; }
.pending-items { margin-top:16px; padding:14px; background:#f1f4f3; border-radius:8px; font-size:12px; color:#657c71; }
.pending-items p { margin:6px 0; }
.report-nlg p { white-space:pre-wrap; line-height:1.9; font-size:13px; }
.organ-row { display:grid; grid-template-columns:50px 1fr 110px; gap:12px; align-items:center; margin:12px 0; font-size:13px; }
.organ-track { height:10px; background:#e9efec; border-radius:10px; overflow:hidden; }
.organ-track i { display:block; height:100%; border-radius:10px; }
.organ-row em { font-style:normal; color:#6a7f75; text-align:right; }
input.invalid { border-color:#d44e54!important; background:#fff1f1!important; }
button:disabled { opacity:.45; cursor:not-allowed; }
@media(max-width:1200px) {.subitem-grid {grid-template-columns:repeat(2,minmax(0,1fr))} }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }
.modal .kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; font-size: 13px; }
.modal .kv dt { color: var(--muted); }
.modal .kv dd { margin: 0; }
#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 80; }
#toast .t { background: #12332c; color: #fff; padding: 9px 16px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); animation: pop .18s ease-out; }
#toast .t.err { background: #7f1d1d; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.loading { padding: 32px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 大屏 ---------- */
body.screen { background: #04121a; color: #d8ecea; overflow: hidden; }
.screen-stage { position: fixed; inset: 0; display: flex; flex-direction: column; padding: 18px 22px 14px; gap: 14px; }
.screen-head { display: flex; align-items: center; justify-content: space-between; }
.screen-head .title { display: flex; align-items: center; gap: 12px; }
.screen-head h1 { margin: 0; font-size: 24px; letter-spacing: 3px; font-weight: 600;
  background: linear-gradient(180deg, #eafffb, #54cfc0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.screen-head .meta { font-size: 12px; color: #5f8f8b; }
.screen-head .right { display: flex; align-items: center; gap: 14px; font-size: 12px; color: #6fa8a3; }
.pill { padding: 3px 10px; border-radius: 20px; border: 1px solid rgba(58, 196, 180, .3); color: #6fd6c8; font-size: 11.5px; }
.s-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.s-kpi { position: relative; padding: 14px 16px; border-radius: 12px; border: 1px solid rgba(58, 196, 180, .18);
  background: linear-gradient(180deg, rgba(14, 52, 62, .85), rgba(8, 32, 42, .85)); overflow: hidden; }
.s-kpi:before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(58, 196, 180, .75), transparent); }
.s-kpi .label { font-size: 12.5px; color: #7fb4ae; }
.s-kpi .value { font-size: 30px; font-weight: 700; letter-spacing: 1px; margin: 4px 0 2px;
  color: #eafffb; font-variant-numeric: tabular-nums; }
.s-kpi .value small { font-size: 12px; color: #6fa8a3; margin-left: 4px; font-weight: 500; }
.s-kpi .sub { font-size: 12px; color: #6fa8a3; }
.s-kpi.na .value { color: #3f6360; }
.s-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 1.15fr 1.15fr .9fr; grid-template-rows: 1fr 1fr; gap: 12px; }
.s-panel { border: 1px solid rgba(58, 196, 180, .16); border-radius: 12px;
  background: linear-gradient(180deg, rgba(11, 42, 52, .82), rgba(6, 26, 34, .82)); padding: 12px 14px; min-height: 0;
  display: flex; flex-direction: column; }
.s-panel h3 { margin: 0 0 10px; font-size: 13.5px; color: #9fdbd2; font-weight: 600; letter-spacing: .5px;
  display: flex; align-items: center; justify-content: space-between; }
.s-panel h3 span.hint { font-size: 11px; color: #55807c; font-weight: 400; letter-spacing: 0; }
.s-panel .s-body { flex: 1; min-height: 0; overflow: auto; }
.s-panel .s-body::-webkit-scrollbar { width: 6px; }
.s-panel .s-body::-webkit-scrollbar-thumb { background: rgba(58, 196, 180, .2); border-radius: 6px; }
.s-bars { display: grid; gap: 9px; }
.s-bars .row { display: grid; grid-template-columns: 74px 1fr 52px; gap: 9px; align-items: center; font-size: 12px; color: #a8d8d2; }
.s-bars .track { height: 8px; border-radius: 20px; background: rgba(58, 196, 180, .12); overflow: hidden; }
.s-bars .fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, #1f8f83, #52d6c4); }
.s-bars .val { text-align: right; font-variant-numeric: tabular-nums; color: #d6f4ef; }
.s-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.s-kv .cell { padding: 9px 10px; border-radius: 9px; background: rgba(58, 196, 180, .07); border: 1px solid rgba(58, 196, 180, .12); }
.s-kv .cell .k { font-size: 11.5px; color: #6fa8a3; }
.s-kv .cell .v { font-size: 18px; font-weight: 700; color: #eafffb; font-variant-numeric: tabular-nums; }
.s-list { display: grid; gap: 7px; font-size: 12px; color: #a8d8d2; }
.s-list .it { display: flex; justify-content: space-between; gap: 10px; padding: 6px 8px; border-radius: 8px; background: rgba(58, 196, 180, .05); }
.s-list .it time { color: #55807c; font-family: var(--mono); font-size: 11px; }
.s-na { display: grid; place-items: center; height: 100%; color: #4d7a76; font-size: 12.5px; text-align: center; line-height: 1.7; }
.s-foot { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: #4d7a76; }
@media (max-width: 1400px) { .s-kpis { grid-template-columns: repeat(3, 1fr); } .s-grid { grid-template-columns: 1fr 1fr; } }
