:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --text: #17212b;
  --muted: #687684;
  --border: #dde3ea;
  --accent: #2a9fd8;
  --accent-text: #ffffff;
  --accent-soft: #e3f2fb;
  --danger: #d6455d;
  --danger-soft: #fbe9ec;
  --ok: #2e9d5b;
  --warn: #b7791f;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1720;
    --surface: #17212b;
    --surface-2: #1f2c38;
    --text: #e6edf3;
    --muted: #8b9aa8;
    --border: #2a3947;
    --accent: #3fb0ea;
    --accent-text: #0b1218;
    --accent-soft: #1b3448;
    --danger: #ef6b80;
    --danger-soft: #3a1f27;
    --ok: #4cc27f;
    --warn: #e0a84a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }

a { color: var(--accent); }

/* --- layout --- */

.app { max-width: 1440px; margin: 0 auto; padding: 0 16px 48px; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 0 14px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 18px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center; font-size: 17px; font-weight: 700;
}
.brand small { color: var(--muted); font-weight: 450; font-size: 14px; }
.topbar .spacer { flex: 1; }
.whoami { color: var(--muted); font-size: 14px; }

/* the menu (docs/plans/2026-11-11-admin-nav.md): a rail + subsections on wide windows, «☰» and a tree on narrow ones */
.shell { display: flex; gap: 20px; align-items: flex-start; }
.page { flex: 1; min-width: 0; }
.nav-wide {
  display: flex; flex: none; position: sticky; top: 12px; max-height: calc(100vh - 24px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.nav-rail { width: 96px; padding: 8px 6px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-rail-item {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 0; background: none; border-radius: 10px; padding: 10px 2px 8px; cursor: pointer;
  color: var(--muted); font-size: 11.5px; font-weight: 550; line-height: 1.15; text-align: center; overflow-wrap: anywhere;
}
.nav-rail-item svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-rail-item:hover { background: var(--surface-2); color: var(--text); }
.nav-rail-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav-count {
  position: absolute; top: 4px; right: 12px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 600; display: grid; place-items: center;
}
.nav-rail-item[aria-current="page"] .nav-count { background: var(--surface); }
.nav-count.alarm, .nav-rail-item[aria-current="page"] .nav-count.alarm { background: var(--danger); color: #fff; }
.nav-sub { width: 220px; border-left: 1px solid var(--border); padding: 12px 8px; overflow-y: auto; }
.nav-sub-title { font-weight: 650; font-size: 16px; padding: 2px 10px 10px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; border-radius: 9px;
  padding: 8px 10px; cursor: pointer; text-align: left; color: var(--text); font-size: 14px;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.nav-label { flex: 1; min-width: 0; }
.nav-n { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-n.alarm { color: var(--danger); font-weight: 650; }
.nav-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--border); }
.nav-dot.ok { background: var(--ok); }
.nav-dot.bad { background: var(--danger); }
.muted.small.bad { color: var(--danger); }
.nav-bar { display: none; }
.nav-sheet { display: none; }
.nav-tree .nav-item.sub { padding-left: 39px; font-size: 13.5px; }

@media (max-width: 900px) {
  .nav-wide { display: none; }
  .nav-bar { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; }
  .nav-bar-title { font-weight: 650; font-size: 17px; min-width: 0; }
  .menu-btn { width: 38px; height: 38px; padding: 0; font-size: 18px; }
  .nav-sheet:not([hidden]) { display: flex; position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .35); }
  .nav-tree {
    width: min(300px, 86vw); height: 100%; overflow-y: auto; padding: 14px 8px;
    background: var(--surface); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px;
  }
}

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 220px; }
.toolbar select.input { width: auto; max-width: 100%; }

/* --- controls --- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface); padding: 7px 13px; border-radius: 9px;
  cursor: pointer; font-weight: 550; font-size: 14px; white-space: nowrap; text-decoration: none; color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--surface-2); }

.input, select.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 550; }
.hint { font-size: 13px; color: var(--muted); margin-top: 5px; }

.error { color: var(--danger); font-size: 14px; margin: 0 0 12px; min-height: 1em; }
.error:empty { display: none; }
label.field[hidden] { display: none; }

.banner {
  margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radius); font-size: 14px;
  background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--text);
}
.banner a { color: var(--accent); font-weight: 600; }

/* --- users --- */

.list > .row + .row, .list > .row + .details, .list > .details + .row { border-top: 1px solid var(--border); }

.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.row.clickable { cursor: pointer; }
.row.clickable:hover { background: var(--surface-2); }
.row.open { background: var(--surface-2); }
.row:first-child { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }

.avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 650; position: relative;
}
.avatar .avatar-photo {
  position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
}
.avatar .dot {
  position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--ok); border: 2px solid var(--surface);
}

.who { flex: 1; min-width: 0; }
.who .name { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.who .sub { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side { color: var(--muted); font-size: 13.5px; text-align: right; white-space: nowrap; }

.badge {
  font-size: 11.5px; font-weight: 650; padding: 1px 7px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent); letter-spacing: .01em; white-space: nowrap;
}
.badge.off { background: var(--danger-soft); color: var(--danger); }
.badge.muted { background: var(--surface-2); color: var(--muted); }
.badge.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.online { color: var(--ok); }

.details { padding: 4px 16px 16px 68px; background: var(--surface-2); }
.details h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 12px 0 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.actions select.input { width: auto; flex: 1 1 160px; }

.devices { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.device { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.device + .device { border-top: 1px solid var(--border); }
.device .sub { white-space: normal; }
.device .icon {
  flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--surface-2);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted);
}
.empty { color: var(--muted); padding: 22px 16px; text-align: center; }

/* --- invites --- */

.invite-form { padding: 16px; margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.invite-form label.field { margin: 0; flex: 1 1 180px; }

.toggle-old { margin-top: 12px; }

/* security tab */
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 4px 0 10px; }
.journal-toolbar { margin-top: 26px; }
.journal-toolbar .section-title { margin: 0; }
.row.event .sub.detail { white-space: normal; }
.blocked-title { margin-top: 26px; }
.row.connection { align-items: flex-start; }
.conn-device { font-weight: 450; color: var(--muted); }
.link-button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.link-button:hover { color: var(--accent); text-decoration: underline; }

/* addresses: a chip per address, its menu under it */
.addresses { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 4px; font-size: 13.5px; }
.addresses-label { color: var(--muted); }
.ip { display: inline-flex; align-items: center; gap: 5px; }
.ip-when { color: var(--muted); font-size: 12.5px; }
.ip-menu { position: relative; }
.ip-menu > summary {
  list-style: none; cursor: pointer; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--accent); border-bottom: 1px dashed currentColor;
}
.ip-menu > summary::-webkit-details-marker { display: none; }
.ip-menu-list {
  position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; min-width: 220px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  display: flex; flex-direction: column;
}
.ip-menu-list > button, .ip-menu-list > a {
  font: inherit; font-size: 14px; text-align: left; color: var(--text); background: none; border: 0;
  padding: 8px 10px; border-radius: 7px; cursor: pointer; text-decoration: none;
}
.ip-menu-list > button:hover, .ip-menu-list > a:hover { background: var(--surface-2); }
.device:has(.addresses) { align-items: flex-start; }
.ip-history { flex-basis: 100%; }
.ip-history > summary { cursor: pointer; color: var(--muted); }
.ip-history > div { padding: 3px 0 0 14px; }
.old-invites { margin-top: 10px; }

/* --- dialogs --- */

dialog {
  border: 1px solid var(--border); border-radius: 16px; padding: 0; background: var(--surface); color: var(--text);
  width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
dialog::backdrop { background: rgba(10, 16, 22, .45); }
.dialog-body { padding: 22px; }
.dialog-body h2 { margin: 0 0 6px; font-size: 19px; }
.dialog-body p { margin: 0 0 14px; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* Space colors (the apps' accent inside a space). */
.space-dot { display: inline-block; border-radius: 50%; margin-right: 8px; vertical-align: -1px; }
.space-dot.none { display: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; padding: 0;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12);
}
.swatch:hover { transform: scale(1.08); }
.swatch.selected { border-color: var(--text); }

.secret { text-align: center; }
.qr { width: 220px; height: 220px; margin: 6px auto 12px; display: block; border-radius: 10px; background: #fff; padding: 6px; }
.code {
  font: 600 26px/1.2 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .08em;
  background: var(--surface-2); border-radius: 10px; padding: 10px; margin-bottom: 10px; user-select: all;
}
.link {
  font-size: 13px; color: var(--muted); word-break: break-all; background: var(--surface-2);
  border-radius: 8px; padding: 8px 10px; user-select: all; text-align: left;
}
.copy-row { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px;
  transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--danger); color: #fff; }

/* --- standalone pages (login, join, reset) --- */

.center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.panel { width: min(400px, 100%); padding: 28px 26px; }
.panel .brand { justify-content: center; margin-bottom: 6px; }
.panel h1 { font-size: 21px; text-align: center; margin: 14px 0 4px; }
.panel .lead { text-align: center; color: var(--muted); margin: 0 0 22px; }
.panel .btn.primary { width: 100%; padding: 10px; font-size: 15px; }
.done { text-align: center; }
.done .big { font-size: 40px; line-height: 1; margin-bottom: 8px; color: var(--ok); }
.facts { text-align: left; background: var(--surface-2); border-radius: 10px; padding: 12px 14px; margin: 16px 0; font-size: 14px; }
.facts div + div { margin-top: 4px; }
.facts b { font-weight: 600; }
.stack { display: grid; gap: 8px; }

/* --- overview --- */

main { transition: opacity .15s; }
main.loading { opacity: .55; pointer-events: none; }
.toolbar > .grow:empty { flex: 1; }

.segmented { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg {
  border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  font-weight: 550; font-size: 14px; color: var(--muted);
}
.seg:hover { color: var(--text); }
.seg[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; text-align: left; font: inherit; color: inherit;
  display: flex; flex-direction: column; justify-content: flex-start;
}
.tile.clickable { cursor: pointer; }
.tile.clickable:hover { border-color: var(--accent); }
.tile-label { font-size: 13px; color: var(--muted); font-weight: 550; }
.tile-value { font-size: 28px; font-weight: 650; line-height: 1.2; margin-top: 4px; }
.tile-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; margin-bottom: 16px; }
.stack-cards { display: grid; gap: 16px; align-content: start; }
.card-pad { padding: 16px; min-width: 0; }
.card-title { font-size: 15px; margin: 0; }
.card-sub { font-size: 13px; color: var(--muted); margin: 2px 0 12px; }
.card-title + .ranks, .card-title + .empty { margin-top: 10px; }

/* charts */
.chart { position: relative; }
.chart-svg { display: block; width: 100%; height: auto; outline: none; border-radius: 6px; }
.chart-svg:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft); }
.chart-svg .grid { stroke: var(--border); stroke-width: 1; }
.chart-svg .axis { stroke: var(--muted); stroke-opacity: .5; stroke-width: 1; }
.chart-svg .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-svg .bar { fill: var(--accent); pointer-events: none; }
.chart-svg .bar.hover { fill: color-mix(in srgb, var(--accent) 72%, var(--text)); }
.chart-svg .hit { fill: transparent; }
.chart-svg .hit:hover { fill: var(--surface-2); }

.tip {
  position: absolute; top: -4px; transform: translate(-50%, -100%); pointer-events: none; z-index: 2;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  border-radius: 8px; padding: 6px 10px; font-size: 13px; white-space: nowrap;
}
.tip.left { transform: translate(-12px, -100%); }
.tip.right { transform: translate(calc(-100% + 12px), -100%); }
.tip[hidden] { display: none; }
.tip-title { color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.tip-row { color: var(--muted); }
.tip-row b { color: var(--text); font-weight: 650; }
.tip-row.main { color: var(--text); }

.cal { display: block; width: 100%; max-width: 480px; height: auto; }
.cal text { fill: var(--muted); font-size: 9px; }
.cal .day.hover { stroke: var(--text); stroke-width: 1.5; }
.lv0 { fill: var(--surface-2); background: var(--surface-2); }
.lv1 { fill: color-mix(in srgb, var(--accent) 30%, var(--surface-2)); background: color-mix(in srgb, var(--accent) 30%, var(--surface-2)); }
.lv2 { fill: color-mix(in srgb, var(--accent) 55%, var(--surface-2)); background: color-mix(in srgb, var(--accent) 55%, var(--surface-2)); }
.lv3 { fill: color-mix(in srgb, var(--accent) 80%, var(--surface-2)); background: color-mix(in srgb, var(--accent) 80%, var(--surface-2)); }
.lv4 { fill: var(--accent); background: var(--accent); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 2px; }

.table-view { margin: -4px 0 16px; font-size: 14px; }
.table-view summary { cursor: pointer; color: var(--muted); padding: 4px 0; }
.table-view .table-scroll { max-height: 320px; overflow: auto; margin-top: 8px; }
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 7px 10px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
table.data tr:last-child td { border-bottom: 0; }
table.data th:not(:first-child), table.data td:not(:first-child) { text-align: right; }
table.data.clickable-rows tbody tr { cursor: pointer; }
table.data.clickable-rows tbody tr:hover { background: var(--surface-2); }

.ranks { display: grid; gap: 2px; }
.rank {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 9px;
  background: none; cursor: pointer; text-align: left; font: inherit; color: inherit;
}
.rank:hover { background: var(--surface-2); }
.rank-main { flex: 1; min-width: 0; display: grid; gap: 5px; }
.rank-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-value { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rank-value b { font-weight: 650; }
.rank-value small { display: block; color: var(--muted); font-size: 12px; }
.count-pill {
  min-width: 34px; padding: 2px 8px; border-radius: 99px; text-align: center; font-weight: 650;
  background: var(--accent-soft); color: var(--accent);
}
.count-pill.warn { background: var(--danger-soft); color: var(--danger); }
.chev { color: var(--muted); font-size: 18px; }
.empty.small { padding: 12px; }

.meter { display: block; height: 6px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: 99px; background: var(--accent); }

.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: 90px 1fr 44px; align-items: center; gap: 10px; font-size: 14px; }
.hbar .meter { height: 10px; }
.hbar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* --- users table --- */

.users-card { overflow: hidden; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.filter {
  border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 4px 11px;
  font-size: 13.5px; font-weight: 550; cursor: pointer; color: var(--text);
}
.filter:hover { background: var(--surface-2); }
.filter[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.filter .count { color: var(--muted); font-weight: 450; }
.filter[aria-pressed="true"] .count { color: inherit; opacity: .8; }

table.users { width: 100%; border-collapse: collapse; }
table.users th {
  text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 9px 12px;
  border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface);
}
table.users th.num, table.users td.num { text-align: right; }
table.users .sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
table.users .sort:hover, table.users th[aria-sort] .sort { color: var(--text); }
table.users td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
table.users tbody tr:last-child td { border-bottom: 0; }
table.users tr.clickable { cursor: pointer; }
table.users tr.clickable:hover, table.users tr.open { background: var(--surface-2); }
table.users tr.disabled .user-cell { opacity: .6; }
table.users tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
table.users .sub { color: var(--muted); font-size: 12.5px; }
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.user-cell .who .sub { white-space: nowrap; }
.chip {
  display: inline-block; font-size: 12.5px; padding: 1px 8px; border-radius: 99px; background: var(--surface-2);
  margin: 1px 4px 1px 0; white-space: nowrap;
}
.chip b { color: var(--warn); font-weight: 600; }
.muted { color: var(--muted); }
.days-cell { display: flex; align-items: center; gap: 8px; min-width: 90px; }
.days-cell .meter { width: 56px; flex: none; }

.avatar.small { width: 30px; height: 30px; font-size: 13px; }
.avatar.small .dot { width: 10px; height: 10px; }
.avatar.large { width: 56px; height: 56px; font-size: 22px; }

/* --- user card (side drawer) --- */

dialog.drawer {
  margin: 0 0 0 auto; width: min(580px, 100vw); max-width: 100vw; height: 100%; max-height: 100%;
  border: 0; border-left: 1px solid var(--border); border-radius: 0;
}
dialog.drawer[open] { animation: drawer-in .18s ease-out; }
@keyframes drawer-in { from { transform: translateX(32px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { dialog.drawer[open] { animation: none; } }
.drawer-body { height: 100%; overflow-y: auto; padding: 20px 22px 32px; }
.drawer-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.drawer-head h2 { margin: 2px 0 2px; font-size: 20px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.drawer-head .sub { color: var(--muted); font-size: 14px; }
.drawer-head .name { margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; }
.drawer-head .close { margin-left: auto; font-size: 16px; padding: 6px 10px; }
.drawer-body h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 20px 0 8px; }
.drawer-body .more { margin-top: 6px; }

.figs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fig { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.fig-value { font-size: 22px; font-weight: 650; line-height: 1.2; }
.fig-label { font-size: 13px; color: var(--text); }
.fig-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

@media (max-width: 640px) {
  .invite-form { flex-direction: column; align-items: stretch; }
  .details { padding-left: 16px; }
  .side { display: none; }
  .whoami { display: none; }
  .wide { display: none; }
  .toolbar .grow { flex-basis: 100%; }
  table.users .badge.muted { display: none; }
  table.users td { font-size: 13.5px; }
  table.users th, table.users td { padding: 9px 10px; }
  .user-cell { min-width: 0; }
  .drawer-body { padding: 16px 16px 28px; }
  .tile-value { font-size: 24px; }
  .hbar { grid-template-columns: 76px 1fr 36px; }
}

/* «ИИ» tab */
.state { font-size: 22px; }
.state.muted { color: var(--muted); }
.state.warn { color: var(--warn); }
.state.off { color: var(--danger); }
.tile .meter { margin-top: 8px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 12px 0 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.list.flat { border: 1px solid var(--border); border-radius: var(--radius); }
.row.compact { padding: 8px 12px; }
.job + .job { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; }
.job-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.job-head .muted { font-size: 13.5px; }
.job-phase { font-size: 14px; margin-top: 6px; }
.progress-line { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.progress-line .meter { flex: 1; }
.progress-line b { font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }
.meter.big { height: 10px; }
.meter.unknown .meter-fill { width: 30%; animation: meter-slide 1.4s ease-in-out infinite; }
@keyframes meter-slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
@media (prefers-reduced-motion: reduce) { .meter.unknown .meter-fill { animation: none; width: 100%; opacity: .35; } }
.cell-sub { color: var(--muted); font-size: 12px; }
.load-meter { margin-top: 6px; max-width: 320px; }
table.data.runs th:nth-child(-n+3), table.data.runs td:nth-child(-n+3) { text-align: left; }

/* «Что видела модель» (ai-request-log): the switch over «Последние задачи», the drawer with a run's requests. */
.request-log-bar { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; margin: 0 0 12px; }
.request-log-bar .row { margin: 0; }
dialog.drawer.wide { width: min(980px, 100vw); }
.req-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; }
.req-msg { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin: 0 0 8px; background: var(--surface); }
.req-msg.role-user { border-left: 3px solid var(--accent); }
.req-msg.role-assistant { border-left: 3px solid var(--muted); }
.req-msg.role-tool { background: var(--surface-2); }
.req-msg-head { font-size: 12px; color: var(--muted); font-weight: 600; }
.req-msg .prompt-text, .req-call .prompt-text, .req-fold .prompt-text { margin-top: 6px; max-height: 50vh; }
.req-fold { margin: 6px 0; }
.req-fold > summary { cursor: pointer; color: var(--text); font-size: 13px; overflow-wrap: anywhere; }
.req-before { border: 1px dashed var(--border); border-radius: 10px; padding: 8px 12px; margin: 0 0 8px; }
.req-before > summary { color: var(--muted); }
.req-before[open] > summary { margin-bottom: 8px; }
.req-call { margin-top: 6px; }
.req-call-name { font: 600 12px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; }
.req-error { color: var(--danger); }

/* «Промт» in «ИИ» (prompt-preview): the system message as the model gets it. */
.prompt-text {
  margin: 12px 0 0; padding: 12px; max-height: 60vh; overflow: auto; white-space: pre-wrap; word-break: break-word;
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  font: 12px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace;
}
