:root {
  --bg: #F4F7F6; --surface: #FFFFFF; --surface-2: #EDF2F1; --border: #D5DEDC; --input-border: #6F858D;
  --text: #12232B; --muted: #52646C; --primary: #136F57; --on-primary: #FFFFFF; --link: #0F6B52; --focus: #1B5688;
  --nav-bg: #102C3B; --nav-text: #E6EEF0; --nav-muted: #A9BCC4; --nav-active: #1B4558;
  --ok: #0B5D36; --ok-bg: #E3F4EA; --warn: #7A4B00; --warn-bg: #FFF1D6; --danger: #A3201A; --danger-bg: #FDEBE9; --info: #1B5688; --info-bg: #E6F0FA; --idle: #4A5A61; --idle-bg: #E8EDEC;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,44,59,.08), 0 2px 8px rgba(16,44,59,.06);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1A21; --surface: #112630; --surface-2: #17303C; --border: #24424F; --input-border: #7C939C;
    --text: #E6EEF0; --muted: #9DB0B8; --primary: #4CC3A0; --on-primary: #04251C; --link: #4CC3A0; --focus: #8CC3F2;
    --nav-bg: #08141A; --nav-active: #17303C;
    --ok: #7BE0A4; --ok-bg: #10301F; --warn: #F5C26B; --warn-bg: #33270C; --danger: #FF9B93; --danger-bg: #3A1613; --info: #8CC3F2; --info-bg: #12283D; --idle: #AFC0C6; --idle-bg: #1B3440;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  --bg: #0B1A21; --surface: #112630; --surface-2: #17303C; --border: #24424F; --input-border: #7C939C;
  --text: #E6EEF0; --muted: #9DB0B8; --primary: #4CC3A0; --on-primary: #04251C; --link: #4CC3A0; --focus: #8CC3F2;
  --nav-bg: #08141A; --nav-active: #17303C;
  --ok: #7BE0A4; --ok-bg: #10301F; --warn: #F5C26B; --warn-bg: #33270C; --danger: #FF9B93; --danger-bg: #3A1613; --info: #8CC3F2; --info-bg: #12283D; --idle: #AFC0C6; --idle-bg: #1B3440;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--link); } a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); color: var(--text); padding: 8px 12px; z-index: 100; } .skip:focus { left: 8px; top: 8px; }
.boot { padding: 40px 16px; color: var(--muted); text-align: center; }
h1 { font-size: 1.45rem; margin: 0 0 4px; line-height: 1.25; } h2 { font-size: 1.1rem; margin: 0 0 10px; } h3 { font-size: 1rem; margin: 0 0 8px; }
p { margin: 0 0 10px; } .muted { color: var(--muted); } .small { font-size: .85rem; } .mono { font-family: var(--mono); font-size: .86rem; word-break: break-all; }
/* shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.nav { background: var(--nav-bg); color: var(--nav-text); padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; text-decoration: none; color: var(--nav-text); }
.brand img { width: 34px; height: 34px; } .brand strong { display: block; font-size: 1.05rem; line-height: 1.1; } .brand span { font-size: .72rem; color: var(--nav-muted); }
.nav h2 { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--nav-muted); margin: 14px 10px 4px; }
.nav a.item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--nav-text); text-decoration: none; min-height: 40px; }
.nav a.item:hover { background: var(--nav-active); } .nav a.item[aria-current="page"] { background: var(--nav-active); box-shadow: inset 3px 0 0 #4CC3A0; font-weight: 600; }
.nav .count { margin-left: auto; background: #A3201A; color: #fff; border-radius: 999px; padding: 0 7px; font-size: .75rem; font-weight: 700; }
.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar .spacer { flex: 1; } .menu-btn { display: none; }
main { padding: 20px; max-width: 1280px; width: 100%; } 
.banner { padding: 10px 20px; font-weight: 600; } .banner.stop { background: var(--danger); color: #fff; } .banner.dev { background: var(--warn-bg); color: var(--warn); font-weight: 500; }
.banner a { color: inherit; }
/* controls */
button, .btn, input, select, textarea { font: inherit; color: inherit; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--input-border); background: var(--surface); cursor: pointer; text-decoration: none; }
button:hover, .btn:hover { background: var(--surface-2); }
button.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); font-weight: 600; } button.primary:hover { filter: brightness(1.08); }
button.danger { background: var(--danger); color: #fff; border-color: var(--danger); font-weight: 600; } button.ghost { border-color: transparent; background: transparent; }
button:disabled { opacity: .55; cursor: not-allowed; }
input, select, textarea { width: 100%; min-height: 40px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--input-border); background: var(--surface); }
textarea { min-height: 90px; font-family: var(--mono); font-size: .88rem; } label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 4px; }
.field { margin-bottom: 12px; } .field .hint { font-size: .82rem; color: var(--muted); margin-top: 3px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; } .check input { width: 18px; min-height: 18px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; } .grow { flex: 1; min-width: 160px; }
.grid { display: grid; gap: 14px; } .g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); } .g4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; }
/* cards + tables */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.stat .num { font-size: 1.9rem; font-weight: 700; line-height: 1.1; } .stat .lbl { color: var(--muted); font-size: .85rem; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; } th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; } th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; } tbody tr.click { cursor: pointer; } tbody tr.click:hover { background: var(--surface-2); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 8px; height: 8px; background: currentColor; display: inline-block; }
.b-ok { color: var(--ok); background: var(--ok-bg); } .b-ok::before { border-radius: 50%; }
.b-warn { color: var(--warn); background: var(--warn-bg); } .b-warn::before { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.b-danger { color: var(--danger); background: var(--danger-bg); } .b-danger::before { transform: rotate(45deg); }
.b-info { color: var(--info); background: var(--info-bg); } .b-info::before { border-radius: 2px; }
.b-idle { color: var(--idle); background: var(--idle-bg); } .b-idle::before { border-radius: 50%; background: transparent; border: 2px solid currentColor; width: 9px; height: 9px; }
pre { margin: 0; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; overflow: auto; max-height: 340px; font: .84rem/1.45 var(--mono); white-space: pre-wrap; word-break: break-word; }
.cmd { position: relative; margin: 6px 0; } .cmd pre { padding-right: 76px; } .cmd button { position: absolute; top: 6px; right: 6px; min-height: 30px; padding: 2px 10px; font-size: .8rem; }
.tl { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); } .tl li { position: relative; padding: 0 0 12px 14px; } .tl li::before { content: ""; position: absolute; left: -22px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid var(--surface); }
.tl li.bad::before { background: var(--danger); } .tl li.warn::before { background: #B26B00; }
.modal-back { position: fixed; inset: 0; background: rgba(5,15,20,.6); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--surface); border-radius: 12px; padding: 20px; width: min(520px, 100%); max-height: 90vh; overflow: auto; border: 1px solid var(--border); }
#toasts { position: fixed; right: 12px; bottom: 12px; display: grid; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 24px)); }
.toast { padding: 10px 14px; border-radius: 8px; background: var(--nav-bg); color: #fff; box-shadow: var(--shadow); } .toast.err { background: var(--danger); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; } .tabs a { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border); text-decoration: none; background: var(--surface); color: var(--text); } .tabs a[aria-current="page"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.login { max-width: 460px; margin: 8vh auto; padding: 0 16px; } .login .card { padding: 24px; }
.topo svg { width: 100%; height: auto; max-height: 560px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0; font-size: .85rem; }
kbd { font: .8rem var(--mono); padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; } .nav { position: fixed; inset: 0 auto 0 0; width: 276px; height: 100%; z-index: 40; transform: translateX(-102%); transition: transform .18s; } .nav.open { transform: none; }
  .menu-btn { display: inline-flex; } main { padding: 14px 16px; } .topbar { padding: 8px 16px; }
  th, td { padding: 8px 9px; } .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
