/* DeskGate console, styled after X: near-black, white text, one blue, pill buttons, thin borders.
   Dark is the default; html[data-theme="light"] switches. */
:root {
  color-scheme: dark;
  --bg: #000000;
  --surface: #000000;
  --surface-2: #16181c;
  --hover: rgba(231, 233, 234, 0.08);
  --inset: #000000;
  --fg: #e7e9ea;
  --fg-2: #c4c7ca;
  --muted: #71767b;
  --line: #2f3336;
  --line-strong: #3e4144;
  --accent: #1d9bf0;
  --accent-hover: #1a8cd8;
  --accent-soft: rgba(29, 155, 240, 0.12);
  --accent-fg: #ffffff;
  --ok: #00ba7c;
  --ok-soft: rgba(0, 186, 124, 0.14);
  --warn: #ffd400;
  --warn-soft: rgba(255, 212, 0, 0.12);
  --danger: #f4212e;
  --danger-soft: rgba(244, 33, 46, 0.12);
  --stage: #000000;
  --header: rgba(0, 0, 0, 0.72);
  --shadow: none;
  --ring: rgba(29, 155, 240, 0.4);
  --radius: 16px;
  --radius-sm: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f9f9;
  --hover: rgba(15, 20, 25, 0.06);
  --inset: #ffffff;
  --fg: #0f1419;
  --fg-2: #2f3336;
  --muted: #536471;
  --line: #eff3f4;
  --line-strong: #cfd9de;
  --accent: #1d9bf0;
  --accent-hover: #1a8cd8;
  --accent-soft: rgba(29, 155, 240, 0.1);
  --ok: #00ba7c;
  --ok-soft: rgba(0, 186, 124, 0.12);
  --warn: #b88a00;
  --warn-soft: rgba(255, 212, 0, 0.18);
  --danger: #f4212e;
  --danger-soft: rgba(244, 33, 46, 0.08);
  --stage: #eff3f4;
  --header: rgba(255, 255, 255, 0.85);
  --ring: rgba(29, 155, 240, 0.3);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; color: var(--fg); background: var(--bg); }
body { display: flex; flex-direction: column; min-height: 100vh; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus, select:focus, textarea:focus { outline: none; }
.icon { display: block; flex: none; width: 18px; height: 18px; }
.mono { font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace; font-size: 0.85em; }
[hidden] { display: none !important; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 4;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 56px; padding: 0 20px;
  background: var(--header);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mark { display: block; flex: none; color: var(--accent); }
.brand-name { font-weight: 800; font-size: 1.1rem; letter-spacing: -0.01em; }
.brand-sub { padding-left: 10px; border-left: 1px solid var(--line-strong); color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 4px; }
.who { display: inline-flex; align-items: center; gap: 8px; margin-right: 6px; color: var(--fg); font-size: 0.9rem; font-weight: 700; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who::before {
  content: attr(data-initial);
  display: inline-grid; place-items: center; flex: none;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 0.8rem; font-weight: 800; text-transform: uppercase;
}
.top .ghost {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border: 0; border-radius: 999px;
  background: transparent; color: var(--fg);
  font-size: 0.9rem; font-weight: 700;
}
.top .ghost:hover { background: var(--hover); }
#theme { width: 36px; padding: 0; justify-content: center; }
#theme .sun { display: none; }
html[data-theme="light"] #theme .sun { display: block; }
html[data-theme="light"] #theme .moon { display: none; }

/* Page */
.panel {
  width: min(440px, calc(100% - 32px));
  margin: 56px auto 40px; padding: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.panel.wide { width: min(1080px, calc(100% - 32px)); margin-top: 28px; padding: 0; background: transparent; border: 0; }
/* Admin pages use the whole width. */
.panel.wide.admin { width: 100%; max-width: none; margin: 0; }
.foot { margin-top: auto; padding: 20px 16px 24px; color: var(--muted); font-size: 0.8rem; text-align: center; }

h1 { margin: 0 0 6px; font-size: 1.45rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.25; }
h2 { margin: 0; font-size: 1.1rem; font-weight: 800; }
.lede { margin: 0 0 24px; color: var(--muted); font-size: 0.95rem; max-width: 72ch; }
.section-desc { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; max-width: 72ch; }
.sub-head { margin: 26px 0 0; padding-top: 18px; border-top: 1px solid var(--line); font-size: 0.95rem; font-weight: 800; }

/* Admin shell: menu on the left, one section on the right. */
.x-shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: calc(100vh - 56px - 64px); }
.x-nav {
  position: sticky; top: 56px; align-self: start;
  display: flex; flex-direction: column; gap: 2px;
  height: calc(100vh - 56px); padding: 14px 12px;
  border-right: 1px solid var(--line);
}
.x-nav-item {
  display: inline-flex; align-items: center; gap: 18px; width: fit-content; max-width: 100%;
  padding: 12px 22px 12px 14px;
  border: 0; border-radius: 999px;
  background: transparent; color: var(--fg);
  font-size: 1.15rem; font-weight: 400; text-align: left;
  transition: background 0.15s ease;
}
.x-nav-item .icon { width: 26px; height: 26px; }
.x-nav-item:hover { background: var(--hover); }
.x-nav-item.active { font-weight: 800; }
.x-nav-item.active .icon { stroke-width: 2.6; color: var(--accent); }
.x-nav-item.back { margin-top: auto; color: var(--muted); font-size: 1rem; }
.x-main { min-width: 0; padding: 0 28px 40px; }
.x-head {
  position: sticky; top: 56px; z-index: 2;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin: 0 -28px; padding: 18px 28px 14px;
  background: var(--header); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.x-head .lede { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Sign-in card */
.card-head { display: flex; align-items: center; gap: 12px; margin: 0 0 24px; }
.card-head .mark { width: 38px; height: 38px; }
.card-head strong { display: block; font-size: 1.05rem; font-weight: 800; }
.card-head span { display: block; color: var(--muted); font-size: 0.85rem; }
.trust {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: 24px -32px -32px; padding: 12px 16px;
  border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius);
  color: var(--muted); font-size: 0.8rem;
}
.trust .icon { width: 14px; height: 14px; }

/* Sections */
.block { margin-top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.block > .block-head, .block > h2 { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.block > .block-head > h2 { flex: none; }
.block > .block-head .section-desc { flex: 1 1 100%; }
.block > form, .block > .block-body, .block > .sheet-scroll, .block > .note, .block > .logo, .block > .users, .block > table, .block > .day,
.block > div:not(.block-head), .block > p, .block > dl { margin-left: 20px; margin-right: 20px; }
.block > form { padding-bottom: 20px; }
.block > .sheet-scroll { margin: 0; border: 0; border-radius: 0; }
.block > div > .sheet-scroll { margin: 0 -20px; border: 0; border-radius: 0; }
.block > .note { margin-top: 14px; }
.block > .note:last-child { margin-bottom: 20px; }
.block > .users:last-child { margin-bottom: 16px; }
.block > .logo { margin: 16px 20px 0; }
.block > div:last-child { margin-bottom: 20px; }
.block > div:has(> .sheet-scroll):last-child { margin-bottom: 0; }
.live-dot { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-size: 0.8rem; font-weight: 700; }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.banner {
  display: flex; align-items: center; gap: 10px;
  margin: 20px 0 0; padding: 14px 18px;
  border: 1px solid var(--warn); border-radius: var(--radius-sm);
  background: var(--warn-soft); color: var(--fg); font-size: 0.9rem;
}
.banner .icon { color: var(--warn); }

/* Lists */
.users { list-style: none; margin: 14px 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.users:empty { display: none; }
.users li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; padding: 10px 12px 10px 16px; border-top: 1px solid var(--line); font-size: 0.95rem; }
.users li:first-child { border-top: 0; }
.users li:hover { background: var(--hover); }
.users li span { min-width: 0; overflow-wrap: anywhere; }
.users li .sub, .sub { color: var(--muted); font-size: 0.85rem; }
.users li.empty { color: var(--muted); }
.users .row-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.avatar { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; text-transform: uppercase; }
.users li .who-cell { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; }
.users li .who-cell .sub { flex-basis: 100%; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; margin-left: 8px; padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 0.75rem; font-weight: 700; white-space: nowrap; vertical-align: 1px;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.ok::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { margin-left: 0; background: var(--danger-soft); color: var(--danger); }
.badge.plain { margin-left: 0; background: transparent; color: var(--fg-2); border: 1px solid var(--line-strong); }
.cert-line .badge, .service-line .badge { margin-left: 0; }

/* Forms */
label { display: block; margin: 18px 0 6px; color: var(--fg-2); font-size: 0.85rem; font-weight: 700; }
input, select, textarea {
  width: 100%; height: 44px; padding: 0 14px;
  border-radius: 6px; border: 1px solid var(--line-strong);
  background: var(--inset);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
textarea { height: auto; padding: 10px 14px; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.8rem; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
input[type="number"] { appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { appearance: none; margin: 0; }
input[type="file"] { height: auto; padding: 10px 12px; border-style: dashed; color: var(--muted); font-size: 0.9rem; }
input[type="file"]::file-selector-button {
  margin-right: 12px; height: 32px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: transparent; color: var(--fg); font: inherit; font-weight: 700; cursor: pointer;
}
label.check { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; color: var(--fg); font-size: 0.95rem; font-weight: 500; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; padding: 0; flex: none; accent-color: var(--accent); }
fieldset { margin: 20px 0 0; padding: 0; border: 0; min-width: 0; }
fieldset + fieldset { margin-top: 26px; }
legend { display: block; width: 100%; padding: 0 0 8px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 12px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.find { display: grid; grid-template-columns: minmax(0, 1fr) 200px auto; gap: 12px; align-items: end; margin: 20px 0 0; padding: 16px 20px 18px; border: 1px solid var(--line); border-radius: var(--radius); }
.find label { margin-top: 0; }
.find button { height: 44px; }

/* Switches */
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  margin: 0; padding: 14px 0;
  border-bottom: 1px solid var(--line);
  color: var(--fg); font-weight: 400; cursor: pointer;
}
form > .switch-row:first-child, .block-head + form > .switch-row:first-child { padding-top: 18px; }
.switch-text { display: grid; gap: 2px; min-width: 0; }
.switch-label { font-size: 0.98rem; font-weight: 700; }
.switch-desc { color: var(--muted); font-size: 0.85rem; line-height: 1.4; }
input.switch { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.switch-ui {
  position: relative; flex: none;
  width: 42px; height: 24px; border-radius: 999px;
  background: var(--line-strong);
  transition: background 0.15s ease;
}
.switch-ui::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}
input.switch:checked + .switch-ui { background: var(--accent); }
input.switch:checked + .switch-ui::after { transform: translateX(18px); }
input.switch:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
input.switch:disabled + .switch-ui { opacity: 0.5; }
.mini-switch { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--fg-2); font-size: 0.85rem; font-weight: 700; cursor: pointer; }
.mini-switch .switch-ui { width: 36px; height: 20px; }
.mini-switch .switch-ui::after { width: 14px; height: 14px; }
.mini-switch input.switch:checked + .switch-ui::after { transform: translateX(16px); }

.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented label { margin: 0; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span {
  display: inline-flex; align-items: center; height: 38px; padding: 0 18px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  color: var(--fg); font-size: 0.9rem; font-weight: 700;
}
.segmented span:hover { background: var(--hover); }
.segmented input:checked + span { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Buttons: pills, as on X. Primary is the blue one. */
.ghost, .secondary, .primary, .pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 20px;
  border-radius: 999px;
  font-size: 0.95rem; font-weight: 700; white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.primary .icon, .secondary .icon, .pill .icon { width: 16px; height: 16px; }
.primary { border: 0; background: var(--accent); color: var(--accent-fg); }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.secondary, .ghost { border: 1px solid var(--line-strong); background: transparent; color: var(--fg); }
.secondary:hover, .ghost:hover { background: var(--hover); }
.pill { height: 32px; padding: 0 14px; border: 1px solid var(--line-strong); background: transparent; color: var(--fg); font-size: 0.85rem; }
.pill:hover { background: var(--hover); }
.pill.danger, .users .pill:hover { border-color: rgba(244, 33, 46, 0.5); color: var(--danger); }
.pill.danger:hover { background: var(--danger-soft); }
.primary[data-armed="1"] { background: var(--danger); }
form > .primary, form > .secondary { margin-top: 22px; }
.panel:not(.wide) form > .primary { width: 100%; height: 46px; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 20px; }
.panel:not(.wide) .button-row .primary { flex: 1 1 auto; height: 46px; }
.panel:not(.wide) .button-row .secondary { height: 46px; }
.inline-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.inline-add > .secondary { height: 44px; margin: 0; }
.inline-add.three { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; }
.crumbs { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; font-size: 0.85rem; color: var(--muted); }
.crumbs button, button.link, .linkish { padding: 0; border: 0; background: none; color: var(--accent); font-weight: 700; }
.crumbs button:hover, button.link:hover, .linkish:hover { text-decoration: underline; }
.linkish { display: inline-flex; margin-top: 14px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .lede { margin-bottom: 0; }

/* Messages */
.error { color: var(--danger); margin: 10px 0 0; font-size: 0.9rem; }
.error:empty, .note:empty { display: none; }
.note { color: var(--muted); margin: 8px 0 0; font-size: 0.85rem; }
.note.saved { color: var(--ok); }
.warn-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 20px; color: var(--fg-2); }
.warn-note .icon { color: var(--warn); margin-top: 1px; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 14px 0 4px; }
.loading::before { content: ""; width: 16px; height: 16px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.output { margin-top: 12px; }
.output summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; font-weight: 700; }
pre, .output pre {
  max-height: 420px; overflow: auto; margin: 10px 0 0; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--fg-2);
  font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.78rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}

/* Facts (service and certificate) */
.service-line, .cert-line { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.cert-line strong { font-size: 1rem; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 20px; margin: 16px 0 0; font-size: 0.9rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.cert-card { margin-top: 4px; }

/* Authenticator setup. The QR code stays black on white in both themes so cameras read it. */
.qr { display: flex; justify-content: center; margin: 4px 0 8px; }
.qr img { display: block; max-width: 100%; height: auto; border-radius: var(--radius-sm); background: #fff; border: 1px solid var(--line); image-rendering: pixelated; }
.qr-link { margin: 0 0 12px; text-align: center; font-size: 0.85rem; }
.qr-link a { color: var(--accent); font-weight: 700; }
@media (hover: hover) and (pointer: fine) { .qr-link { display: none; } }
.manual { margin: 0 0 8px; }
.manual summary { cursor: pointer; color: var(--fg-2); font-size: 0.85rem; font-weight: 700; text-align: center; }
.manual[open] summary { margin-bottom: 10px; }
.manual .note { text-align: center; }
.secret { margin: 0 0 4px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px dashed var(--line-strong); font-family: ui-monospace, Consolas, monospace; font-size: 0.95rem; letter-spacing: 0.1em; text-align: center; word-break: break-all; }

/* Recent computers */
.recents { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px -32px -32px; padding: 18px 32px 24px; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.recents-label { flex: 1 0 100%; margin: 0 0 2px; color: var(--muted); font-size: 0.8rem; font-weight: 700; }
.recents button { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; font-size: 0.85rem; font-weight: 700; }
.recents button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.recents .icon { width: 14px; height: 14px; color: var(--muted); }

/* Stats and tables */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 20px 0 0; }
.stat { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 12px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); }
.stat-icon { grid-row: span 2; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.stat-icon .icon { width: 20px; height: 20px; }
.stat-label { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.stat strong { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat.live .stat-icon, .stat.ok .stat-icon { background: var(--ok-soft); color: var(--ok); }
.stat.ok strong { color: var(--ok); font-size: 1.25rem; }
.stat.alert .stat-icon { background: var(--danger-soft); color: var(--danger); }
.stat.alert strong { color: var(--danger); }
.sheet-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.sheet { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.sheet th, .sheet td { text-align: left; padding: 12px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.sheet tr:last-child td { border-bottom: 0; }
.sheet th { color: var(--muted); font-weight: 700; font-size: 0.8rem; }
.sheet td:first-child { font-weight: 700; }
.sheet tbody tr:hover td { background: var(--hover); }
.sheet td.empty { color: var(--muted); font-weight: 400; text-align: center; padding: 26px 14px; }
.day { margin: 0; padding: 12px 20px; font-size: 0.85rem; font-weight: 800; color: var(--fg); background: var(--surface-2); border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); }

/* Admin hub (older layout kept for safety) */
.admin-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }

/* Branding */
.brand-lockup { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 0 0 24px; padding: 0 0 20px; border-bottom: 1px solid var(--line); }
.logo { display: block; max-width: 220px; max-height: 72px; margin: 0 auto; object-fit: contain; }
.block > .logo { margin-left: 20px; max-height: 56px; }
.logo-text { margin: 0; text-align: center; font-weight: 700; color: var(--fg-2); }

/* Desktop session */
.stage { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; background: var(--stage); }
.stage-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; min-height: 54px; padding: 8px 14px; background: var(--bg); border-bottom: 1px solid var(--line); }
.stage-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.stage-name .icon { color: var(--accent); }
#stage-title { font-size: 0.95rem; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.stage-tools button { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--fg); font-size: 0.85rem; font-weight: 700; }
.stage-tools button:hover { background: var(--hover); }
.stage-tools .sep { width: 1px; margin: 4px; background: var(--line-strong); }
#close-session { color: #fff; border-color: transparent; background: var(--danger); }
#close-session:hover { filter: brightness(1.1); }
.stage-frame { flex: 1; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; }
canvas { background: #000; outline: none; touch-action: none; cursor: default; box-shadow: 0 0 0 1px var(--line); }
#stage-note, #stage-error { margin: 8px 14px 0; }

@media (max-width: 1000px) {
  .x-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .x-nav { padding: 12px 8px; align-items: center; }
  .x-nav-item { padding: 12px; }
  .x-nav-item span { display: none; }
}

@media (max-width: 720px) {
  .x-shell { grid-template-columns: 1fr; }
  .x-nav { position: sticky; top: 56px; z-index: 3; flex-direction: row; height: auto; padding: 6px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); background: var(--bg); }
  .x-nav-item.back { margin-top: 0; }
  .x-main { padding: 0 14px 32px; }
  .x-head { position: static; margin: 0 -14px; padding: 14px; }
  .row, .find, .pair, .inline-add, .inline-add.three { grid-template-columns: 1fr; }
  .panel { margin-top: 16px; padding: 24px 18px; }
  .trust { margin: 24px -18px -24px; }
  .recents { margin: 24px -18px -24px; padding: 16px 18px 20px; }
  .top { padding: 0 12px; }
  .brand-sub, .who { display: none; }
  .top .ghost .label { display: none; }
  .block > .block-head, .block > h2 { padding: 14px 16px; }
  .block > form, .block > .block-body, .block > .note, .block > .users, .block > div:not(.block-head), .block > p, .block > dl { margin-left: 16px; margin-right: 16px; }
  .stage-tools button .label { display: none; }
  .users li { flex-wrap: wrap; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
