:root {
  --bg: #f5f6f8; --panel: #ffffff; --text: #1b1f24; --muted: #5d6673; --border: #dde1e6;
  --accent: #d6402f; --accent-ink: #ffffff; --ok: #1f8a4c; --warn: #b26a00; --bad: #c0352b; --info: #2a62c9;
  --row-hover: #f0f2f5; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171b; --panel: #1c2026; --text: #e7eaee; --muted: #9aa4b1; --border: #2d333b;
    --accent: #ef5a48; --row-hover: #232830; --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif; }
a { color: var(--info); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--border); background: var(--panel); border-radius: 6px; padding: 6px 12px; }
button:hover { background: var(--row-hover); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:hover { filter: brightness(1.05); }
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
button.small { padding: 3px 8px; font-size: 12px; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
input, select, textarea { border: 1px solid var(--border); background: var(--panel); border-radius: 6px; padding: 7px 10px; min-width: 0; }
label { display: block; font-weight: 600; margin: 10px 0 4px; }
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
nav.side { background: var(--panel); border-right: 1px solid var(--border); padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; padding: 4px 10px 16px; }
.brand .logo { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 14px; }
nav.side a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--text); text-decoration: none; }
nav.side a.active, nav.side a:hover { background: var(--row-hover); }
nav.side a.active { font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
nav.side .spacer { flex: 1; }
nav.side .who { color: var(--muted); font-size: 12px; padding: 8px 10px; word-break: break-all; }
main { padding: 24px 28px; max-width: 1280px; width: 100%; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.stat .v { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; background: color-mix(in srgb, var(--panel) 92%, var(--border)); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--row-hover); }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; border: 1px solid currentColor; white-space: nowrap; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); } .pill.info { color: var(--info); } .pill.off { color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.dot.online { background: var(--ok); } .dot.in_session { background: var(--accent); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.login { max-width: 380px; margin: 10vh auto; }
.login .card { padding: 24px; }
.login input { width: 100%; }
.login button { width: 100%; margin-top: 16px; }
.error { color: var(--bad); margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 20px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 8px 0; }
dialog { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); color: var(--text); padding: 20px; max-width: 560px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog .buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.code { font-family: ui-monospace, Consolas, monospace; background: var(--row-hover); padding: 10px; border-radius: 6px; word-break: break-all; user-select: all; }
#toast { position: fixed; bottom: 20px; right: 20px; background: var(--text); color: var(--panel); padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 420px; }
#toast.show { opacity: 1; }
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  nav.side { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--border); }
  nav.side .spacer, nav.side .who { display: none; }
  main { padding: 16px; }
}

td .mono { white-space: nowrap; }
