/* The console's whole design system, in one file. No framework, no CDN — the
   binary is the deployable, so nothing here may reach the network. */
:root {
  --bg: #0b0d10;
  --panel: #12151b;
  --panel-2: #171b23;
  --line: #232833;
  --text: #e8eaef;
  --muted: #8b93a3;
  --accent: #7cc7ff;
  --good: #6fd3a7;
  --warn: #f0b866;
  --bad: #ef7d7d;
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.sr {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
.top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; }
.mark {
  width: 18px; height: 18px; border-radius: 5px;
  background: linear-gradient(135deg, var(--accent), #b48cff);
}
.name { font-weight: 650; letter-spacing: .2px; }
.tag {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .12em; border: 1px solid var(--line);
  padding: 2px 7px; border-radius: 99px;
}
.auth { display: flex; align-items: center; gap: 8px; }
.auth input[type="password"] {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; width: 200px; font-family: var(--mono); font-size: 13px;
}
.auth input[type="password"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.remember { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
button {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 12px; font: inherit; cursor: pointer;
}
button:hover { border-color: var(--accent); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
main { padding: 20px; display: grid; gap: 16px; max-width: 1100px; margin: 0 auto; }
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
}
.panel h2 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.panel-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; flex: 0 0 auto; }
.range { display: flex; gap: 4px; margin-left: auto; }
.range button { padding: 4px 10px; font-size: 13px; }
.range button.on { background: var(--accent); color: #06121c; border-color: var(--accent); font-weight: 600; }
.lede { color: var(--muted); margin: 0 0 16px; max-width: 60ch; }
.figs { display: flex; gap: 28px; flex-wrap: wrap; }
figure { margin: 0; }
.num { font-family: var(--mono); font-size: 26px; font-weight: 600; letter-spacing: -.02em; display: block; }
figcaption { color: var(--muted); font-size: 12px; margin-top: 4px; display: block; }
.why { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.muted { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); }
.err { color: var(--bad); }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 180px 1fr 90px; gap: 10px; align-items: center; font-size: 13px; }
.bar .k { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .track { background: var(--panel-2); border-radius: 6px; height: 8px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--accent); border-radius: 6px; min-width: 2px; }
.bar .v { font-family: var(--mono); text-align: right; }
.bar.zero .fill { background: var(--line); }
.models { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.model {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
  font-family: var(--mono); font-size: 12px;
}
.model b { display: block; color: var(--text); }
.model span { color: var(--muted); }
.keys-row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.keys-row input {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; min-width: 200px;
}
.new-key {
  font-family: var(--mono); font-size: 13px; word-break: break-all;
  background: var(--panel-2); border: 1px solid var(--good);
  border-radius: 8px; padding: 10px 12px; margin: 0 0 12px;
}
.new-key b { color: var(--good); font-weight: 600; }
.mono { font-family: var(--mono); }
.revoked-key { color: var(--warn); }
code { font-family: var(--mono); font-size: 12px; background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }
.veil {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(3px);
}
.veil[hidden] { display: none; }
.veil-box {
  max-width: 420px; width: min(420px, calc(100vw - 48px));
  text-align: left; padding: 28px 30px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
}
.veil-box h2 { font-size: 18px; margin: 0 0 6px; }
.veil-box p { color: var(--muted); margin: 0 0 4px; }

/* The sign-in form. The fields stack, the button is the only solid control on
   the page, and the caller-key fallback hides behind a disclosure so a new
   operator sees one obvious way in. */
.veil-box .field {
  display: block; margin: 14px 0 5px;
  font-size: 12px; letter-spacing: .02em; text-transform: uppercase; color: var(--muted);
}
.veil-box input[type="text"], .veil-box input[type="password"] {
  width: 100%; box-sizing: border-box;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
  font: inherit; font-size: 14px;
}
.veil-box input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.veil-box button {
  width: 100%; margin-top: 16px; padding: 10px 14px;
  font: inherit; font-size: 14px; font-weight: 600;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-2); color: var(--text); cursor: pointer;
}
.veil-box button.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.veil-box button:hover { filter: brightness(1.1); }
.veil-box .fallback { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 14px; }
.veil-box .fallback summary { color: var(--muted); font-size: 13px; cursor: pointer; }
.veil-box .fallback input[type="password"] { margin-top: 8px; }
.veil-box .fallback button { width: auto; margin-top: 10px; padding: 7px 14px; font-weight: 500; }
.error {
  margin-top: 14px !important; padding: 9px 11px;
  background: color-mix(in srgb, var(--bad) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent);
  border-radius: 8px; color: var(--bad); font-size: 13px;
}
.error[hidden] { display: none; }

/* The header's signed-in state. */
.whoami { color: var(--muted); font-size: 13px; margin-right: 10px; }
.whoami[hidden] { display: none; }
.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.ghost[hidden] { display: none; }
.ghost:hover { background: var(--panel-2); }

/* --- People (FR-064..FR-072) ------------------------------------------------ */

/* A user row carries more than a bar chart's three columns: the identity, the
   role and status, and the controls. Widening the grid here rather than
   changing .bar keeps the chart sections untouched. */
.user-row { grid-template-columns: 200px 1fr 180px 260px; }
.user-row .user-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.user-row select {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 3px 6px; font: inherit; font-size: 12px;
}
.user-row button {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  border-radius: 6px; padding: 3px 9px; font: inherit; font-size: 12px; cursor: pointer;
}
.user-row button:hover { background: var(--panel-2); }

/* The role is a LABEL, not decoration: each role gets its own weight so an
   owner cannot be mistaken for a viewer at a glance. */
.role { padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); font-size: 11px; }
.role-viewer   { color: var(--muted); }
.role-operator { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.role-admin    { border-color: color-mix(in srgb, var(--accent) 70%, var(--line)); color: var(--accent); }
.role-owner    { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* A disabled account is dimmed but still LISTED: an operator asking "who has
   access" needs to see the closed ones too, or a closed door looks like no door. */
.disabled-user { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); padding: 1px 7px; border-radius: 999px; font-size: 11px; }

#users-unassigned { color: var(--muted); font-size: 13px; margin-top: 10px; }
#new-user-role { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font: inherit; font-size: 13px; }
