:root {
  --bg: #f4f5f7; --panel: #fff; --line: #e3e6ea; --text: #1c2330; --muted: #6b7684;
  --accent: #1f6feb; --ok: #1a8f4e; --err: #c8312e; --warn: #b7791f; --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 6px 12px; color: var(--text); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.danger { color: var(--err); border-color: #f1c4c2; }
button.small { padding: 3px 8px; font-size: 12px; }
button:disabled { opacity: .5; cursor: default; }
input, select { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: #fff; min-width: 0; }
input:focus, select:focus { outline: 2px solid #bcd3ff; border-color: var(--accent); }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }

#app { display: flex; min-height: 100vh; }
nav { width: 210px; background: #16202e; color: #cfd6df; padding: 18px 0; flex: none; }
nav .brand { padding: 0 18px 18px; font-weight: 700; color: #fff; font-size: 15px; letter-spacing: .3px; }
nav .brand small { display: block; color: #8593a5; font-weight: 400; font-size: 11px; margin-top: 2px; }
nav a { display: block; padding: 9px 18px; color: #cfd6df; }
nav a.active, nav a:hover { background: #22304380; color: #fff; }
nav .foot { margin-top: auto; padding: 18px; font-size: 12px; color: #8593a5; }
nav .foot a { display: inline; padding: 0; color: #cfd6df; }
main { flex: 1; padding: 22px 28px; min-width: 0; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 15px; margin: 0 0 10px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 140px; }
.row > .auto { flex: 0 0 auto; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 24px; font-weight: 600; margin-top: 4px; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
tr:hover td { background: #fafbfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge.Success, .badge.on { background: #e3f5ea; color: var(--ok); }
.badge.Error, .badge.off { background: #fbe4e3; color: var(--err); }
.badge.Cancelled { background: #eceff3; color: var(--muted); }
.badge.Pending { background: #fdf2dc; color: var(--warn); }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.toast { position: fixed; right: 20px; bottom: 20px; background: #16202e; color: #fff; padding: 10px 14px; border-radius: 8px; max-width: 420px; font-size: 13px; z-index: 50; }
.toast.err { background: var(--err); }
.modal-bg { position: fixed; inset: 0; background: #0006; display: flex; align-items: center; justify-content: center; z-index: 40; }
.modal { background: #fff; border-radius: 12px; padding: 20px; width: min(680px, 94vw); max-height: 90vh; overflow: auto; }
.modal h2 { margin-bottom: 14px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
pre { background: #f6f8fa; padding: 10px; border-radius: 6px; overflow: auto; font-size: 12px; max-height: 300px; }
.login { margin: 12vh auto; width: 340px; }
.login h1 { text-align: center; }
.login .row { flex-direction: column; }
.login .row > * { flex: none; }
.key { background: #fff8dc; border: 1px solid #f0d78c; padding: 10px; border-radius: 6px; word-break: break-all; }
.bar { display: flex; gap: 2px; align-items: flex-end; height: 70px; }
.bar div { flex: 1; background: #bcd3ff; border-radius: 2px 2px 0 0; min-height: 2px; }
.bar div:hover { background: var(--accent); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; }
@media (max-width: 760px) { #app { flex-direction: column; } nav { width: auto; display: flex; flex-wrap: wrap; padding: 8px; } nav .brand { width: 100%; } nav .foot { display: none; } main { padding: 14px 16px; } }
