:root {
  --blue: #1f4e78;
  --blue-light: #eaf1f8;
  --red: #c0392b;
  --amber: #b7791f;
  --green: #1e7d4f;
  --line: #e3e8ef;
  --text: #1f2937;
  --muted: #6b7280;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: #f6f8fb;
  font-size: 14px;
}
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex: 0 0 220px; background: #fff; border-right: 1px solid var(--line);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 18px;
}
.brand { font-size: 17px; font-weight: 700; color: var(--blue); line-height: 1.4; }
.brand span { display: block; font-size: 11px; font-weight: 400; color: var(--muted); margin-top: 4px; }
nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  text-align: left; padding: 9px 12px; border-radius: 8px; border: 0; background: transparent;
  font-size: 14px; color: var(--text); cursor: pointer;
}
.nav-item:hover { background: var(--blue-light); }
.nav-item.active { background: var(--blue); color: #fff; }
.foot { margin-top: auto; font-size: 11px; color: var(--muted); }
main { flex: 1; padding: 26px 32px 60px; max-width: 1180px; }
h1 { font-size: 20px; margin: 0 0 14px; }
h2 { font-size: 15px; margin: 26px 0 10px; }
.view { display: none; }
.view.active { display: block; }
.hint { color: var(--muted); line-height: 1.7; margin: 0 0 14px; }
.panel {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 16px; margin-bottom: 16px; overflow: auto;
}
.form .row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; }
input, select, textarea {
  font: inherit; color: var(--text); padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; min-width: 170px;
}
textarea { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
button { font: inherit; cursor: pointer; border-radius: 8px; padding: 9px 16px; border: 1px solid transparent; }
button.primary { background: var(--blue); color: #fff; }
button.primary:hover { background: #17395a; }
button.ghost { background: #fff; border-color: var(--line); color: var(--text); }
button.ghost:hover { background: var(--blue-light); }
button.link { background: none; color: var(--red); padding: 4px 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: #f2f6fa; font-weight: 600; position: sticky; top: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.card .k { font-size: 12px; color: var(--muted); }
.card .v { font-size: 22px; font-weight: 700; margin-top: 6px; }
.toast {
  position: fixed; right: 24px; top: 20px; z-index: 99; max-width: 460px;
  padding: 12px 16px; border-radius: 10px; background: #1f2937; color: #fff; line-height: 1.6;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .25); white-space: pre-wrap;
}
.toast.error { background: var(--red); }
.toast.ok { background: var(--green); }
.hidden { display: none; }
.status { margin-top: 10px; line-height: 1.7; color: var(--muted); white-space: pre-wrap; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; }
.tag.red { background: #fdecea; color: var(--red); }
.tag.amber { background: #fdf3e3; color: var(--amber); }
.tag.green { background: #e8f5ee; color: var(--green); }
.tag.grey { background: #eef1f5; color: var(--muted); }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab { background: #fff; border: 1px solid var(--line); color: var(--text); }
.tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.kpis { display: flex; gap: 22px; flex-wrap: wrap; }
.kpis div { font-size: 13px; }
.kpis b { font-size: 16px; }
.banner { display: none; }
.banner.show {
  display: block; background: #fdf3e3; border: 1px solid #f0d9b5; color: #8a6100;
  border-radius: 10px; padding: 12px 16px; margin-bottom: 14px; line-height: 1.7;
}

/* ---------------------------------------------------------------- 入口页 */
.landing {
  display: none; min-height: 100vh; padding: 70px 32px; text-align: center;
}
body.mode-landing .landing { display: block; }
body.mode-landing .app { display: none; }
.landing h1 { font-size: 26px; margin-bottom: 6px; color: var(--blue); }
.landing > .hint { font-size: 14px; margin-bottom: 34px; }
.entry { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; }
.entry-card {
  display: block; width: 320px; text-align: left; text-decoration: none; color: var(--text);
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 24px;
  transition: all .15s;
}
.entry-card:hover { border-color: var(--blue); box-shadow: 0 10px 26px rgba(31,78,120,.13); transform: translateY(-2px); }
.entry-card .ico { font-size: 30px; }
.entry-card .t { font-size: 18px; font-weight: 700; margin: 10px 0 8px; color: var(--blue); }
.entry-card .d { font-size: 13px; color: var(--muted); line-height: 1.8; }
.hint.small { font-size: 12px; margin-top: 34px; }
.hint code { background: #eef1f5; padding: 1px 5px; border-radius: 4px; }

/* 长表格：固定高度、内部滚动、表头吸顶 */
.table-scroll {
  max-height: 58vh; overflow: auto; border: 1px solid var(--line);
  border-radius: 8px; background: #fff;
}
.table-scroll table { margin: 0; }
.table-scroll thead th {
  position: sticky; top: 0; z-index: 3;
  box-shadow: inset 0 -1px 0 var(--line);
}
.table-scroll tbody td:first-child,
.table-scroll thead th:first-child {
  position: sticky; left: 0; background: #fff; z-index: 2;
  box-shadow: inset -1px 0 0 var(--line);
}
.table-scroll thead th:first-child { background: #f2f6fa; z-index: 4; }
.table-scroll td { padding: 5px 8px; }
.table-scroll input, .table-scroll select { padding: 4px 8px; font-size: 13px; min-width: 0; }
.compact-hint { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 0 0 10px; }
details > summary { cursor: pointer; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.clickable { cursor: pointer; }
.clickable:hover { background: var(--blue-light); }
.clickable.on { background: #e8f1fa; }
.bad { color: var(--red); font-weight: 600; }
.good { color: var(--green); }
.nav-group {
  font-size: 12px; color: var(--muted); padding: 0 12px 8px;
}
.nav-group b { color: var(--blue); }
button.switch {
  margin-top: 14px; background: #fff; border: 1px solid var(--line); color: var(--muted);
  font-size: 12px; padding: 7px 12px;
}
button.switch:hover { background: var(--blue-light); color: var(--blue); }

/* ---------------------------------------------------------------- 登录页 */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: #f6f8fb;
}
.login-box {
  width: 340px; background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 30px 28px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 12px 30px rgba(31, 78, 120, .10);
}
.login-box h1 { font-size: 18px; margin: 0 0 4px; color: var(--blue); }
.login-box input { min-width: 0; }
.login-box button { width: 100%; }
#login-error { color: var(--red); min-height: 16px; }
