:root { --bg:#0f1720; --panel:#182430; --panel2:#1f2d3a; --line:#24313d; --fg:#e6edf3; --muted:#8b98a5;
  --green:#3fb950; --amber:#d29922; --red:#f85149; }
* { box-sizing:border-box; }
body { font-family:Segoe UI,Roboto,Arial,sans-serif; margin:0; background:var(--bg); color:var(--fg); }
a { color:#58a6ff; text-decoration:none; } a:hover { text-decoration:underline; }
main { padding:20px; max-width:1200px; margin:0 auto; }
h2 { font-size:18px; margin:22px 0 8px; }
.hint { color:var(--muted); font-size:13px; margin:2px 0 10px; }
.updated { color:var(--muted); font-size:12px; margin-bottom:12px; }

.topbar { display:flex; align-items:center; justify-content:space-between; padding:12px 20px;
  background:var(--panel2); border-bottom:1px solid var(--line); }
.brand { font-weight:700; letter-spacing:.3px; }
nav a { margin-right:16px; color:var(--fg); }
nav .who { color:var(--muted); margin-right:12px; }
nav .logout { color:var(--amber); }

.tiles { display:flex; flex-wrap:wrap; gap:12px; }
.tile { background:var(--panel); border:1px solid var(--line); border-left:4px solid var(--muted);
  border-radius:10px; padding:12px 16px; min-width:230px; }
.tile.on { border-left-color:var(--green); } .tile.off { border-left-color:var(--red); }
.tname { font-weight:600; } .tstat { font-size:12px; color:var(--muted); }
.tile.on .tstat { color:var(--green); } .tile.off .tstat { color:var(--red); }
.tmeta { font-size:12px; color:var(--muted); margin-top:4px; }

.cards { display:flex; gap:12px; margin-bottom:8px; }
.card { background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:12px 18px; }
.card b { font-size:24px; display:block; }

table { border-collapse:collapse; width:100%; background:var(--panel); border-radius:10px; overflow:hidden; margin-bottom:8px; }
th,td { padding:9px 12px; text-align:left; border-bottom:1px solid var(--line); font-size:14px; }
th { background:var(--panel2); color:var(--muted); font-weight:600; }
td.u { font-weight:600; }
.empty { color:var(--muted); }
.count { font-size:13px; color:var(--muted); font-weight:400; }
.count.green { color:var(--green); } .count.amber { color:var(--amber); }

.badge { padding:2px 9px; border-radius:12px; font-size:12px; font-weight:600; }
.b-ACTIVE { background:#12331d; color:var(--green); }
.b-IDLE { background:#33290f; color:var(--amber); }
.b-DISCONNECTED { background:#2a2f36; color:var(--muted); }
.e-LOGIN { background:#12331d; color:var(--green); }
.e-LOGOFF { background:#3a1d1d; color:var(--red); }
.e-DISCONNECT { background:#2a2f36; color:var(--muted); }
.e-RECONNECT,.e-SHELL_START { background:#12283a; color:#58a6ff; }
.e-ACTIVE { background:#12331d; color:var(--green); } .e-IDLE { background:#33290f; color:var(--amber); }
.btn { padding:3px 10px; border:1px solid var(--line); border-radius:6px; background:var(--panel2); color:var(--fg); font-size:12px; cursor:pointer; }
.btn:hover { background:#2d4052; border-color:#4a5d70; text-decoration:none; }
.btn.primary { background:#238636; border-color:#238636; color:#fff; font-weight:600; }
.btn.primary:hover { background:#2ea043; border-color:#2ea043; }

.shots { display:flex; flex-wrap:wrap; gap:12px; margin-bottom:8px; }
.shot { position:relative; width:300px; height:180px; background:#0b1119; border:1px solid var(--line);
  border-radius:8px; overflow:hidden; display:block; }
.shot img { width:100%; height:100%; object-fit:cover; display:block; }
.shot .thumb { position:absolute; inset:0; background-size:cover; background-position:center top;
  background-repeat:no-repeat; background-color:#0b1119; }
.shot.noimg .thumb { display:none; }
.rows { margin-top:18px; }
.rows summary { cursor:pointer; color:var(--muted); font-size:13px; padding:6px 0; }
.closed-h { margin-top:22px; }
.shot .shot-label { position:absolute; left:0; right:0; bottom:0; padding:4px 8px; font-size:12px;
  background:rgba(0,0,0,.6); color:#fff; }
.shot .shot-none { display:none; position:absolute; inset:0; align-items:center; justify-content:center;
  color:var(--muted); font-size:13px; }
.shot.noimg img { display:none; }
.shot.noimg .shot-none { display:flex; }
.shot .shot-badge { position:absolute; left:6px; top:6px; padding:2px 8px; border-radius:10px;
  font-size:11px; font-weight:700; background:rgba(0,0,0,.62); color:#fff; letter-spacing:.2px; }
.sb-ACTIVE { color:#3fb950; } .sb-IDLE { color:#d29922; }
.sb-DISCONNECTED { color:#8b949e; } .sb-OFFLINE { color:#f85149; } .sb-CLOSED { color:#f0883e; }
.shot.st-IDLE img { opacity:.85; }
.shot.st-CLOSED img { filter:grayscale(.6); opacity:.55; }
.shot.stale img { opacity:.7; }
.shot.offline { border-color:#5a2a2a; }
.shot.offline img { filter:grayscale(1); opacity:.4; }
.shot.noimg .shot-none { color:#f85149; }
/* closed / logged-out tile: solid orange, centered "Session closed" + time */
.shot.closed { background:#e8792e; border-color:#c96a1f; }
.shot-closed { position:absolute; inset:0; display:flex; flex-direction:column;
  align-items:center; justify-content:center; text-align:center; color:#fff; gap:5px; padding:10px; }
.shot-closed b { font-size:17px; font-weight:700; letter-spacing:.3px; }
.shot-closed .sc-time { font-size:13px; opacity:.95; }
.shot-closed .sc-user { font-size:12px; opacity:.85; margin-top:8px; }

.ok-banner { background:#12331d; color:#3fb950; border:1px solid #1c5a2f; border-radius:8px;
  padding:10px 14px; margin:12px 0; font-weight:600; }
.settings-form { max-width:820px; }
.setting-row { display:grid; grid-template-columns:230px 200px 1fr; gap:14px; align-items:center;
  padding:12px 0; border-bottom:1px solid var(--line); }
.setting-row label { font-weight:600; color:var(--fg); }
.setting-row input, .setting-row select { padding:7px 9px; background:var(--panel2); color:var(--fg);
  border:1px solid var(--line); border-radius:6px; font-size:14px; }
.setting-help { color:var(--muted); font-size:12.5px; }
.setting-help b { color:var(--fg); }
.btn-save { margin-top:18px; background:#238636; color:#fff; border:0; border-radius:6px;
  padding:10px 22px; font-size:15px; font-weight:600; cursor:pointer; }
.btn-save:hover { background:#2ea043; }
@media (max-width:720px){ .setting-row { grid-template-columns:1fr; gap:6px; } }

.live-toolbar { display:flex; justify-content:flex-end; margin-bottom:10px; }
.btn.refresh { cursor:pointer; background:#238636; color:#fff; border:0; padding:8px 18px; font-size:14px; font-weight:600; }
.btn.refresh:hover { background:#2ea043; text-decoration:none; }
.btn.refresh:disabled { opacity:.6; cursor:default; }

.login-body { display:flex; align-items:center; justify-content:center; height:100vh; }
.login-card { background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:28px;
  width:300px; display:flex; flex-direction:column; gap:12px; }
.login-card .brand { text-align:center; margin-bottom:6px; }
.login-card input { padding:10px; border-radius:8px; border:1px solid var(--line); background:var(--bg); color:var(--fg); }
.login-card button { padding:10px; border-radius:8px; border:0; background:#238636; color:#fff; font-weight:600; cursor:pointer; }
.login-card .err { color:var(--red); font-size:13px; text-align:center; }
