:root { --bg: #0e0c1a; --card: #1a1730; --line: #2c2748; --ink: #f1effa; --dim: #a9a4c4; --brand: #7f77dd; --bad: #ff6b6b; --ok: #4cd08a; }
[hidden] { display: none !important; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.narrow { max-width: 420px; width: 100%; }
#login[hidden] { display: none; }
#login { min-height: 100vh; padding: 20px 16px; place-items: center; display: grid; }
h1 { margin: 0 0 4px; font-size: 24px; } h2 { margin: 0 0 10px; font-size: 18px; }
.muted { color: var(--dim); }
.error { color: var(--bad); min-height: 1.2em; margin: 6px 0 0; }
.error.ok { color: var(--ok); }
label { display: grid; gap: 4px; margin: 10px 0; }
input, select { background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font: inherit; }
button { background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
button.danger { background: transparent; border: 1px solid var(--bad); color: var(--bad); padding: 5px 10px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row input, .row select { flex: 1 1 140px; }
.code { text-transform: uppercase; letter-spacing: 4px; font-weight: 700; max-width: 140px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--dim); font-weight: 500; font-size: 13px; }
.house { border-top: 1px solid var(--line); padding: 10px 0; display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.house:first-child { border-top: 0; }
.house-box { border-top: 1px solid var(--line); } .house-box:first-child { border-top: 0; } .house-box .house { border-top: 0; }
.house-list { padding: 4px 0 14px; } .house-list .error { flex-basis: 100%; }
.house strong { min-width: 120px; }
.toggle { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.crash { border-top: 1px solid var(--line); padding: 8px 0; }
.crash pre { white-space: pre-wrap; word-break: break-word; color: var(--dim); font-size: 12px; margin: 4px 0 0; max-height: 140px; overflow: auto; }
.not-admin .admin-only { display: none; }
#login { gap: 16px; align-content: center; }
.tabs { display: flex; gap: 6px; margin: 12px 0 4px; }
.tab { background: transparent; border: 1px solid var(--line); color: var(--dim); flex: 1; }
.tab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.code-show { letter-spacing: 3px; font-size: 18px; }
.pairing #login-form .login-title { display: none; }

.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .5px; }
.state-approved { color: var(--ok); } .state-expired { color: var(--bad); } .state-trial { color: #f5c26b; }
td.actions { white-space: nowrap; } td.actions button { padding: 5px 10px; }

/* The administrator's panel: a menu on the left, one page at a time. */
#app { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
#app[hidden] { display: none; }
#side { background: var(--card); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; }
#side .brand { font-weight: 700; font-size: 18px; padding: 4px 10px 16px; }
#side a { color: var(--dim); text-decoration: none; padding: 9px 10px; border-radius: 8px; display: flex; gap: 10px; align-items: center; }
#side a:hover { background: var(--bg); color: var(--ink); }
#side a.on { background: rgba(127, 119, 221, .18); color: var(--ink); }
#side .ico { width: 18px; text-align: center; opacity: .8; }
.side-foot { margin-top: auto; display: grid; gap: 8px; padding: 10px; font-size: 13px; }
#page { padding: 22px 28px 40px; max-width: 1200px; width: 100%; display: grid; gap: 16px; align-content: start; }
.page-head { display: flex; gap: 12px; align-items: center; }
.page-head h1 { flex: 1; font-size: 22px; margin: 0; }
.page-head input { width: 280px; }
#page-body { display: grid; gap: 16px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 4px; }
.metric span { font-size: 13px; } .metric strong { font-size: 24px; font-weight: 600; }
.metric .warn, .warn-text { color: #f5c26b; } .metric .bad { color: var(--bad); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.pill { font-size: 12px; padding: 3px 9px; border-radius: 99px; white-space: nowrap; display: inline-block; }
.pill.ok { background: rgba(76, 208, 138, .15); color: var(--ok); }
.pill.warn { background: rgba(245, 194, 107, .15); color: #f5c26b; }
.pill.bad { background: rgba(255, 107, 107, .15); color: var(--bad); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #4a4566; }
.dot.on { background: var(--ok); }
.small { font-size: 13px; } .right { text-align: right; } .grow { flex: 1; }
table.tvs td:first-child { width: 18px; }
.actions-row td { background: var(--bg); border-radius: 8px; }
.row.wrap { flex-wrap: wrap; }
label.inline { white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; margin: 0; color: var(--dim); font-size: 13px; }
button.primary { background: var(--brand); color: #fff; }
button.ghost, button.danger, button.primary { padding: 6px 12px; font-size: 13px; }
a.button { display: inline-block; background: var(--brand); color: #fff; border-radius: 8px; padding: 9px 16px; text-decoration: none; font-weight: 600; }
.bar-row { display: grid; grid-template-columns: 80px 1fr 30px; gap: 10px; align-items: center; padding: 4px 0; }
.bar { background: var(--bg); border-radius: 99px; height: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); }
.log-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.log-row:first-child { border-top: 0; }
.acc-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; } .acc-head h2 { margin: 0; }
h3 { font-size: 13px; color: var(--dim); font-weight: 500; margin: 14px 0 6px; text-transform: none; }
.facts { display: grid; gap: 10px; background: var(--bg); border-radius: 10px; padding: 14px; }
.fact { display: grid; gap: 2px; }
.card pre { white-space: pre-wrap; word-break: break-word; color: var(--dim); font-size: 12px; max-height: 260px; overflow: auto; }
@media (max-width: 800px) {
  #app { grid-template-columns: 1fr; }
  #side { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 8px; gap: 4px; }
  #side .brand, #side .side-foot { display: none; }
  #side a { white-space: nowrap; }
  #page { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .page-head { flex-wrap: wrap; } .page-head input { width: 100%; }
  table.tvs th:nth-child(4), table.tvs td:nth-child(4), table.tvs th:nth-child(5), table.tvs td:nth-child(5) { display: none; }
}
