:root {
  --ground: #F6F7F9; --surface: #FFFFFF; --ink: #16181D; --muted: #5B6270; --line: #E3E6EB; --line-soft: #EEF0F3;
  --accent: #1F4FB8; --accent-ink: #163A8A; --accent-soft: #EAF0FB; --accent-faint: #F3F6FC;
  --warm: #C2570C; --warm-ink: #7A3A08; --warm-soft: #FFF4E8; --warm-line: #F1C99B; --ok: #1D6B3A; --bad: #A12A1F;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Hiragino Sans GB", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font-size: 14px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; } a:hover { color: var(--accent-ink); text-decoration: underline; }
h1 { margin: 0; font-size: 22px; } h2 { margin: 0; font-size: 16px; } p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 40px; color: var(--muted); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); } .small { font-size: 12px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* 布局 */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; color: var(--ink); }
.brand:hover { text-decoration: none; color: var(--ink); }
.top form { flex: 1 1 320px; max-width: 640px; display: flex; gap: 8px; }
.top .who { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); }
.shell { display: flex; flex-wrap: wrap; min-height: calc(100vh - 57px); }
.nav { flex: 1 1 200px; max-width: 220px; padding: 20px 12px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); border-right: 1px solid var(--line); }
.nav a { padding: 10px 12px; border-radius: 6px; color: var(--ink); }
.nav a:hover { background: var(--accent-faint); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav .sep { margin: 14px 12px 4px; font-size: 12px; color: var(--muted); }
main { flex: 999 1 560px; min-width: 0; padding: 24px; display: flex; flex-direction: column; gap: 16px; max-width: 1280px; }
@media (max-width: 760px) { .nav { max-width: none; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; } main { padding: 16px; } }

/* 组件 */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.dashed { border-style: dashed; border-color: #C9CED6; }
.row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.row > .grow { flex: 999 1 520px; min-width: 0; } .row > .side { flex: 1 1 280px; min-width: 0; max-width: 380px; }
.head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.kpi .v { font-family: var(--mono); font-size: 24px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px; border: 1px solid #C9CED6; background: var(--surface); border-radius: 6px; cursor: pointer; white-space: nowrap; color: var(--ink); }
.btn:hover { border-color: var(--accent); text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-ink); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.btn.danger { color: var(--bad); } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { min-height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid #C9CED6; background: var(--surface); cursor: pointer; }
.pill.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; background: #F1F2F5; color: #3B414C; font-size: 12px; margin-right: 4px; }
.tag.intent { background: var(--warm-soft); color: var(--warm-ink); }
input[type=text], input[type=search], input[type=number], input[type=password], input[type=date], select, textarea { height: 38px; padding: 0 10px; border: 1px solid #C9CED6; border-radius: 6px; background: var(--surface); width: 100%; }
textarea { height: auto; padding: 8px 10px; resize: vertical; }
label.f { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
label.f > * { font-weight: 400; }
label.chk { display: flex; gap: 8px; align-items: center; cursor: pointer; }
fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.note { padding: 10px 12px; border-radius: 6px; background: var(--accent-faint); border: 1px solid #C9D6F0; color: var(--accent-ink); }
.warn { padding: 10px 12px; border-radius: 6px; background: var(--warm-soft); border: 1px solid var(--warm-line); color: var(--warm-ink); }
.err { padding: 10px 12px; border-radius: 6px; background: #FDECEA; border: 1px solid #F3B8B1; color: var(--bad); }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.skel { height: 14px; border-radius: 4px; background: var(--line-soft); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr.sel td { background: var(--accent-faint); }
td .t { color: var(--ink); font-weight: 600; } td .sub { margin-top: 3px; font-size: 12px; color: var(--muted); }
mark { background: #FFE7C7; color: inherit; padding: 0 1px; }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 6px; z-index: 50; max-width: 420px; }

/* 图表 */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; border-bottom: 1px solid var(--line); padding: 0 4px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; min-width: 0; }
.bars .b span { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.bars .b i { display: block; width: 100%; max-width: 48px; border-radius: 3px 3px 0 0; background: var(--accent); }
.bars .b i.warm { background: var(--warm); }
.bars .b i.gray { background: #8A919C; }
.axis { display: flex; gap: 6px; padding: 0 4px; } .axis span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); min-width: 0; }
.group { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 100%; }
.group .b { flex: 0 1 24px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; } .legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.meter { height: 6px; border-radius: 3px; background: var(--line-soft); } .meter i { display: block; height: 6px; border-radius: 3px; background: var(--accent); }

/* 评论树 */
.cm { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.cm .meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px; }
.cm .meta b { color: var(--ink); }
.cm .body { white-space: pre-wrap; word-break: break-word; line-height: 1.6; }
.replies { margin-left: 14px; padding-left: 14px; border-left: 2px solid #DDE5F5; }
.op { padding: 0 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent-ink); }
.postbody { white-space: pre-wrap; word-break: break-word; line-height: 1.7; }
pre.raw { max-height: 420px; overflow: auto; background: #F7F8FA; border: 1px solid var(--line); border-radius: 6px; padding: 12px; font-size: 12px; }

/* 弹窗 */
.modal-bg { position: fixed; inset: 0; background: rgba(22, 24, 29, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 40; }
.modal { width: 100%; max-width: 560px; background: var(--surface); border-radius: 10px; padding: 24px; display: flex; flex-direction: column; gap: 14px; max-height: 90vh; overflow: auto; }

/* 登录 */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login .box { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 32px; display: flex; flex-direction: column; gap: 18px; }

/* 超长不可断行的标题、链接、正文（如测试帖、URL）自动断行，手机上不撑宽页面 */
h1, h2, td, .cm, .postbody, .card a, .head > * { overflow-wrap: anywhere; }
