:root {
  --bg: #f5f6f8; --panel: #fff; --line: #e3e6eb; --text: #1f2329; --muted: #6b7280; --brand: #2f5bea;
  --ok: #1a7f37; --ok-bg: #e6f4ea; --bad: #c62828; --bad-bg: #fdecea; --warn: #9a6700; --warn-bg: #fff4d6;
  --busy: #4b5563; --busy-bg: #eef1f5; --done: #1d4ed8; --done-bg: #e7efff;
}
* { box-sizing: border-box; }
body { margin: 0; font: 13px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); }
a { color: var(--brand); }
button { font: inherit; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 4px 10px; cursor: pointer; }
button:hover { border-color: var(--brand); }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; background: #fff; }
textarea { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.layout { display: flex; min-height: 100vh; }
.nav { width: 176px; background: #111827; color: #cbd5e1; padding: 16px 0; flex-shrink: 0; }
.nav h1 { font-size: 16px; color: #fff; margin: 0 16px 16px; }
.nav h1 small { display: block; font-size: 11px; color: #94a3b8; font-weight: normal; }
.nav a { display: block; padding: 8px 16px; color: #cbd5e1; text-decoration: none; }
.nav a.active, .nav a:hover { background: #1f2937; color: #fff; }
.nav .me { margin: 16px; font-size: 12px; color: #94a3b8; }
.main { flex: 1; padding: 16px 20px; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; }
.panel h2 { font-size: 15px; margin: 0 0 10px; }
.panel h3 { font-size: 13px; margin: 12px 0 6px; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.grid { display: grid; gap: 12px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.kpi { background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.kpi b { display: block; font-size: 20px; }
.kpi span { color: var(--muted); font-size: 12px; }
table.t { border-collapse: collapse; width: 100%; }
table.t th, table.t td { border-bottom: 1px solid var(--line); padding: 5px 6px; text-align: left; vertical-align: top; }
table.t th { color: var(--muted); font-weight: normal; font-size: 12px; }
.pill { display: inline-block; padding: 0 7px; border-radius: 10px; font-size: 12px; line-height: 20px; white-space: nowrap; }
.s-ok, .s-warn.ok { background: var(--ok-bg); color: var(--ok); }
.s-bad { background: var(--bad-bg); color: var(--bad); }
.s-warn { background: var(--warn-bg); color: var(--warn); }
.s-busy { background: var(--busy-bg); color: var(--busy); }
.s-done { background: var(--done-bg); color: var(--done); }
.bar { height: 10px; background: #eef1f5; border-radius: 5px; position: relative; overflow: hidden; margin: 4px 0; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--brand); }
.bar .mark { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--bad); }
.bar .mark.high { background: var(--ok); }
.login { max-width: 360px; margin: 12vh auto; }
.login input { width: 100%; margin-bottom: 10px; padding: 8px 10px; }
.err { color: var(--bad); }
.toast { position: fixed; right: 20px; bottom: 20px; background: #111827; color: #fff; padding: 10px 14px; border-radius: 8px;
  max-width: 480px; z-index: 1000; white-space: pre-wrap; }
.toast.bad { background: var(--bad); }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 900; display: flex; align-items: flex-start;
  justify-content: center; padding-top: 8vh; }
.modal { background: #fff; border-radius: 10px; padding: 16px 18px; width: min(760px, 94vw); max-height: 84vh; overflow: auto; }
.modal h2 { margin-top: 0; font-size: 16px; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 96vw); background: #fff; z-index: 950;
  box-shadow: -4px 0 20px rgba(0,0,0,.15); padding: 16px; overflow: auto; }
.legend span { margin-right: 8px; }
.form-grid { display: grid; grid-template-columns: 140px 1fr; gap: 8px 10px; align-items: center; }
.form-grid input[type=text], .form-grid input[type=password], .form-grid input[type=number], .form-grid select { width: 100%; }
code, .mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.sheet-wrap { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px; overflow: auto; }
.jss_container td.c-ok { background: var(--ok-bg) !important; color: var(--ok); }
.jss_container td.c-bad { background: var(--bad-bg) !important; color: var(--bad); font-weight: 600; }
.jss_container td.c-warn { background: var(--warn-bg) !important; color: var(--warn); }
.jss_container td.c-busy { background: var(--busy-bg) !important; color: var(--busy); }
.jss_container td.c-done { background: var(--done-bg) !important; color: var(--done); }
.jss_container td.c-alert { box-shadow: inset 3px 0 0 var(--bad); }
.jss_container tbody td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jss_container td.c-reason { color: var(--bad) !important; }
.jss_container td .act { padding: 0 6px; font-size: 12px; margin-right: 3px; }
.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 6px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }
.chart { height: 240px; }
