/* Operator console.
 *
 * Two grounds and one accent. The neutrals carry a slight blue cast so they sit with the accent
 * rather than beside it; a pure grey next to a blue reads as unconsidered. Semantic colour --
 * green for granted, red for control and for refusals -- is kept separate from the accent, so
 * "this is interactive" and "this is dangerous" never look like the same thing.
 */

:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --bg-sunken: #f1f4f8;
  --rail: #12161f;
  --rail-fg: #aab3c4;
  --rail-fg-active: #ffffff;
  --fg: #141821;
  --muted: #566072;
  --faint: #8791a3;
  --line: #dbe0e8;
  --line-soft: #e7ebf1;
  --panel: #ffffff;
  --accent: #1f6feb;
  --accent-soft: #e8f0fe;
  --accent-fg: #ffffff;
  --warn-bg: #fff7e8;
  --warn-line: #dfa53f;
  --warn-fg: #6a4a08;
  --ok: #12784a;
  --ok-soft: #e6f4ec;
  --bad: #b3261e;
  --bad-soft: #fdeceb;

  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 5%), 0 1px 3px rgb(16 24 40 / 8%);
  --shadow-md: 0 4px 12px rgb(16 24 40 / 8%), 0 1px 3px rgb(16 24 40 / 6%);

  --rail-w: 92px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1219;
    --bg-sunken: #090b10;
    --rail: #0a0c12;
    --rail-fg: #79839a;
    --rail-fg-active: #ffffff;
    --fg: #e7eaf0;
    --muted: #97a1b3;
    --faint: #69738a;
    --line: #232936;
    --line-soft: #1a1f29;
    --panel: #151924;
    --accent: #5a9bff;
    --accent-soft: #16233b;
    --accent-fg: #06101f;
    --warn-bg: #2a2109;
    --warn-line: #7a5c14;
    --warn-fg: #f0d79a;
    --ok: #4ac48a;
    --ok-soft: #10261c;
    --bad: #ff7b72;
    --bad-soft: #2a1412;
    --shadow-sm: none;
    --shadow-md: none;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1219; --bg-sunken: #090b10; --rail: #0a0c12; --rail-fg: #79839a;
  --rail-fg-active: #ffffff; --fg: #e7eaf0; --muted: #97a1b3; --faint: #69738a;
  --line: #232936; --line-soft: #1a1f29; --panel: #151924; --accent: #5a9bff;
  --accent-soft: #16233b; --accent-fg: #06101f; --warn-bg: #2a2109;
  --warn-line: #7a5c14; --warn-fg: #f0d79a; --ok: #4ac48a; --ok-soft: #10261c;
  --bad: #ff7b72; --bad-soft: #2a1412; --shadow-sm: none; --shadow-md: none;
}
:root[data-theme="light"] {
  --bg: #ffffff; --bg-sunken: #f1f4f8; --rail: #12161f; --rail-fg: #aab3c4;
  --rail-fg-active: #ffffff; --fg: #141821; --muted: #566072; --faint: #8791a3;
  --line: #dbe0e8; --line-soft: #e7ebf1; --panel: #ffffff; --accent: #1f6feb;
  --accent-soft: #e8f0fe; --accent-fg: #ffffff; --warn-bg: #fff7e8;
  --warn-line: #dfa53f; --warn-fg: #6a4a08; --ok: #12784a; --ok-soft: #e6f4ec;
  --bad: #b3261e; --bad-soft: #fdeceb;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 5%), 0 1px 3px rgb(16 24 40 / 8%);
  --shadow-md: 0 4px 12px rgb(16 24 40 / 8%), 0 1px 3px rgb(16 24 40 / 6%);
}

* { box-sizing: border-box; }

/* `hidden` must win.
 *
 * The browser implements it as `[hidden] { display: none }`, which any class selector setting
 * `display` outranks. That is how the sign-in overlay -- `position: fixed`, covering everything --
 * stayed on screen after a successful sign-in and made a working login look like a dead button.
 *
 * Declared once, here, so no future rule can quietly beat it. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg-sunken);
  color: var(--fg);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line-soft); margin: 1.1rem 0; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Icons are stroked, never filled: one rule so a new icon cannot arrive styled differently. */
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ Brand */

.brand { display: flex; align-items: center; gap: 0.55rem; }
.brand-mark {
  width: 20px; height: 20px; border-radius: 6px;
  background: linear-gradient(140deg, var(--accent), #7c4dff);
  flex: none;
}
.brand-name { font-weight: 650; letter-spacing: -0.015em; }
.brand-large { margin-bottom: 0.7rem; }
.brand-large .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
.brand-large .brand-name { font-size: 1.45rem; }

/* ------------------------------------------------------------------ Shell */

.shell {
  height: 100%;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
}

/* --- rail --------------------------------------------------------------- */

.rail {
  background: var(--rail);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0.85rem 0.5rem 0.7rem;
  gap: 0.25rem;
}
.rail-brand { display: grid; place-items: center; padding: 0.3rem 0 0.9rem; }

.rail-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.6rem 0.25rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--rail-fg);
  font: 500 0.68rem/1.2 inherit;
  text-align: center;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.rail-item svg { width: 20px; height: 20px; }
.rail-item:hover { background: rgb(255 255 255 / 7%); color: #fff; }
.rail-item.active { background: rgb(255 255 255 / 11%); color: var(--rail-fg-active); }
.rail-item.active::before {
  content: "";
  position: absolute;
  left: -0.5rem;
  top: 50%;
  translate: 0 -50%;
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.rail-badge {
  position: absolute;
  top: 0.35rem;
  right: 0.6rem;
  min-width: 1.15em;
  padding: 0 0.3em;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: 600 0.62rem/1.5 ui-monospace, monospace;
  font-style: normal;
}

.rail-spacer { flex: 1; }
.rail-foot { display: grid; place-items: center; padding-top: 0.5rem; }
.rail-foot .pill { font-size: 0.6rem; text-align: center; line-height: 1.3; }

/* --- main --------------------------------------------------------------- */

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: none;
}
.topbar-title h1 { font-size: 1.05rem; }
.topbar-title p { font-size: 0.8rem; color: var(--faint); margin-top: 0.1rem; }
.topbar-right { display: flex; align-items: center; gap: 0.8rem; }

.whoami {
  font-size: 0.84rem;
  color: var(--muted);
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  font: 600 0.68rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.status[data-state="connecting"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.status[data-state="established"] { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.status[data-state="error"] { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }

.pill {
  font: 600 0.66rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 0.3rem 0.5rem;
  border-radius: 999px;
  background: rgb(255 255 255 / 8%);
  color: var(--rail-fg);
  word-break: break-all;
}
.pill.ok { color: var(--ok); background: var(--ok-soft); }
.pill.bad { color: var(--bad); background: var(--bad-soft); }

.count {
  font: 600 0.68rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 0.22rem 0.42rem;
  border-radius: 999px;
  background: var(--bg-sunken);
  color: var(--muted);
}

.banner {
  position: relative;
  background: var(--warn-bg);
  border-bottom: 1px solid var(--warn-line);
  color: var(--warn-fg);
  padding: 0.6rem 2.5rem 0.6rem 1.25rem;
  font-size: 0.8rem;
  flex: none;
}
.banner-close {
  position: absolute; top: 50%; right: 0.7rem; translate: 0 -50%;
  margin: 0; padding: 0 0.35rem; border: 0; background: transparent;
  color: inherit; font-size: 1.2rem; line-height: 1; cursor: pointer;
}

/* --- views -------------------------------------------------------------- */

.view { display: none; flex: 1; min-height: 0; }
.view.active { display: flex; flex-direction: column; }

.split {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 340px;
  gap: 1px;
  background: var(--line);
}
@media (max-width: 1240px) {
  .split { grid-template-columns: 290px minmax(0, 1fr); }
  .drawer { display: none; }
}
@media (max-width: 900px) {
  :root { --rail-w: 68px; }
  .rail-item span { display: none; }
  .split { grid-template-columns: 1fr; grid-auto-rows: min-content; }
  .sidebar { max-height: 45vh; }
}

.scroll { flex: 1; min-height: 0; overflow-y: auto; }
.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

/* ------------------------------------------------------------------ Controls */

button {
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-fg);
  font: 600 0.83rem system-ui, sans-serif;
  cursor: pointer;
  transition: filter 120ms ease;
}
button:hover:not(:disabled) { filter: brightness(1.07); }
button:disabled { opacity: 0.42; cursor: not-allowed; }

button.secondary {
  background: var(--panel);
  color: var(--fg);
  border-color: var(--line);
}
button.secondary:hover:not(:disabled) { background: var(--bg-sunken); filter: none; }

button.ghost {
  background: transparent; color: var(--muted); border-color: transparent;
  padding: 0.3rem 0.5rem; font-size: 0.78rem;
}
button.ghost:hover:not(:disabled) { background: var(--bg-sunken); filter: none; }

button.danger-button { background: transparent; color: var(--bad); border-color: var(--bad); }
button.danger-button:hover:not(:disabled) { background: var(--bad-soft); filter: none; }
button.wide { width: 100%; }

.icon-button {
  display: grid; place-items: center;
  width: 30px; height: 30px; padding: 0;
  background: transparent; color: var(--muted); border-color: var(--line);
  border-radius: 8px;
}
.icon-button svg { width: 15px; height: 15px; }
.icon-button:hover:not(:disabled) { background: var(--bg-sunken); color: var(--fg); filter: none; }

label {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0.9rem 0 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

input[type="text"], input[type="password"], input[type="search"], select, textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font: 0.84rem ui-monospace, SFMono-Regular, Menlo, monospace;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--accent); }
select { font-family: inherit; }
textarea { resize: vertical; min-height: 5rem; }

.row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-top: 0.9rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

/* ------------------------------------------------------------------ Cards */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.card-head h2 { font-size: 1rem; }
.card-head p { margin-top: 0.4rem; font-size: 0.86rem; color: var(--muted); max-width: 62ch; }
.card > .card-head + * { margin-top: 1.1rem; }

.steps {
  margin: 0.9rem 0 0;
  padding-left: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.86rem;
  color: var(--muted);
}
.steps strong { color: var(--fg); font-weight: 600; }
.steps code {
  background: var(--bg-sunken);
  padding: 0.1em 0.35em;
  border-radius: 5px;
  word-break: break-all;
}

/* ------------------------------------------------------------------ Sidebar */

.sidebar {
  background: var(--panel);
  padding: 0.9rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; }
.sidebar-title { display: flex; align-items: center; gap: 0.5rem; }
.sidebar-title h2 { font-size: 0.88rem; }

.search-wrap { position: relative; }
.search-icon {
  position: absolute; left: 0.6rem; top: 50%; translate: 0 -50%;
  width: 14px; height: 14px; color: var(--faint); pointer-events: none;
}
.search { margin: 0; padding-left: 1.9rem; font-family: inherit; font-size: 0.84rem; }

.device-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.device-list .empty {
  padding: 2rem 0.4rem; font-size: 0.82rem; color: var(--faint); text-align: center;
}
.device-list .empty.bad { color: var(--bad); }

.device {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.device:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.device.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.device.offline { opacity: 0.55; }

.device-top { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.65rem 0.7rem 0.5rem; }

.dot {
  flex: none; width: 8px; height: 8px; margin-top: 0.38rem;
  border-radius: 999px; background: var(--faint);
}
.device.online .dot { background: var(--ok); }
.dot.live {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent);
}

.device-body { flex: 1; min-width: 0; }
.device-name {
  font-size: 0.88rem; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.device-meta {
  font-size: 0.7rem; color: var(--faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 0.1rem;
}

.chips { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.chip {
  font: 600 0.63rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 0.22rem 0.38rem;
  border-radius: 5px;
  background: var(--bg-sunken);
  color: var(--muted);
  border: 1px solid var(--line-soft);
  white-space: nowrap;
}
.chip.granted { color: var(--ok); background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.chip.hot { color: var(--bad); background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }

.device-caps { padding: 0 0.7rem 0.55rem 1.9rem; }

.device-actions {
  display: flex; gap: 0.4rem; padding: 0.55rem 0.7rem;
  border-top: 1px solid var(--line-soft); background: var(--bg-sunken);
}
.device-actions button { flex: 1; padding: 0.35rem 0.4rem; font-size: 0.76rem; }

.device-ask {
  padding: 0.6rem 0.7rem 0.7rem; border-top: 1px solid var(--line-soft);
  display: none; flex-direction: column; gap: 0.35rem;
}
.device.asking .device-ask { display: flex; }
.ask-title {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 600;
}
.ask-row {
  display: flex; align-items: center; gap: 0.45rem; font-size: 0.78rem;
  color: var(--fg); margin: 0; text-transform: none; letter-spacing: 0; font-weight: 400;
  cursor: pointer;
}
.ask-row input { width: auto; margin: 0; accent-color: var(--accent); }
.ask-row.unavailable { opacity: 0.42; cursor: not-allowed; }
.device-ask > button { margin-top: 0.35rem; }

.advanced {
  margin-top: auto;
  border-top: 1px solid var(--line-soft);
  padding-top: 0.7rem;
}
.advanced summary { cursor: pointer; font-size: 0.78rem; color: var(--muted); }
.advanced-note { font-size: 0.74rem; color: var(--faint); margin-top: 0.5rem; }
.advanced button { margin-top: 0.8rem; width: 100%; }

/* ------------------------------------------------------------------ Stage */

.stage { background: var(--bg-sunken); padding: 1.1rem; min-width: 0; overflow: auto; }

.placeholder {
  height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.5rem; text-align: center; color: var(--muted);
}
.placeholder-art { color: var(--line); margin-bottom: 0.5rem; }
.placeholder-art svg { width: 92px; height: 62px; stroke-width: 2; }
.placeholder h2 { font-size: 1.05rem; color: var(--fg); }
.placeholder p { font-size: 0.86rem; max-width: 36rem; }
.placeholder-note { font-size: 0.79rem; color: var(--faint); }

.session { display: flex; flex-direction: column; gap: 0.65rem; height: 100%; }

.session-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.8rem; flex-wrap: wrap;
  padding: 0.6rem 0.75rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.session-identity { display: flex; align-items: center; gap: 0.55rem; min-width: 0; flex-wrap: wrap; }
.session-device { font-weight: 650; font-size: 0.92rem; }
.session-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.switch {
  display: inline-flex; align-items: center; gap: 0.45rem; margin: 0;
  padding: 0.34rem 0.6rem; border: 1px solid var(--line); border-radius: 8px;
  font-size: 0.79rem; color: var(--fg); text-transform: none; letter-spacing: 0;
  font-weight: 500; cursor: pointer;
}
.switch input { width: auto; margin: 0; accent-color: var(--bad); }
.switch:has(input:checked) { border-color: var(--bad); color: var(--bad); background: var(--bad-soft); }
.switch:has(input:disabled) { opacity: 0.42; cursor: not-allowed; }

.select-wrap {
  display: inline-flex; align-items: center; gap: 0.45rem; margin: 0;
  text-transform: none; letter-spacing: 0;
}
.select-label { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.select-wrap select { width: auto; padding: 0.32rem 0.5rem; font-size: 0.79rem; }

.screen-wrap {
  position: relative; flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  background: #05070b;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
canvas { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
canvas:focus { outline: none; }
/* Crosshair rather than `cursor: none`. Hiding the pointer only makes sense once the host's own
   cursor is drawn into the frame, and it is not yet -- so hiding it just loses the pointer. */
.screen-wrap.controlling { border-color: var(--bad); box-shadow: inset 0 0 0 2px var(--bad); }
.screen-wrap.controlling canvas { cursor: crosshair; }

.screen-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.8rem;
  background: rgb(5 7 11 / 78%);
  color: #e8ecf3;
  font: 0.86rem ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center; padding: 1rem;
}
.spinner {
  width: 22px; height: 22px; border-radius: 999px;
  border: 2px solid rgb(255 255 255 / 18%);
  border-top-color: var(--accent);
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { rotate: 360deg; } }

.stats {
  display: flex; flex-wrap: wrap; gap: 1.1rem;
  font: 0.74rem ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--faint);
  padding: 0 0.2rem;
  font-variant-numeric: tabular-nums;
}
.stats span:empty { display: none; }

/* ------------------------------------------------------------------ Drawer */

.drawer { background: var(--panel); display: flex; flex-direction: column; min-height: 0; }

.tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.tab {
  flex: 1; margin: 0; padding: 0.7rem 0.3rem;
  border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  background: transparent; color: var(--muted);
  font-size: 0.78rem; font-weight: 600;
}
.tab:hover { background: var(--bg-sunken); filter: none; color: var(--fg); }
.tab.active { color: var(--fg); border-bottom-color: var(--accent); }
.tab .badge {
  display: inline-block; min-width: 1.15em; margin-left: 0.35rem; padding: 0 0.28em;
  border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-size: 0.65rem;
}

.tab-panel { display: none; padding: 0.9rem; overflow-y: auto; }
.tab-panel.active { display: block; }

.drawer-empty {
  font-size: 0.82rem; color: var(--faint); text-align: center; padding: 2rem 0.5rem;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem;
  background: var(--panel);
}
.panel + .panel { margin-top: 0.8rem; }
.panel h3 { font-size: 0.85rem; }
.panel-note { font-size: 0.75rem; color: var(--faint); margin-top: 0.45rem; }
.panel button { margin-top: 0.65rem; }
.panel textarea { margin-top: 0.5rem; }

.verify { border-color: var(--warn-line); background: color-mix(in srgb, var(--warn-bg) 40%, var(--panel)); }
.verify.verified { border-color: var(--ok); background: color-mix(in srgb, var(--ok-soft) 55%, var(--panel)); }
.verify p { font-size: 0.81rem; color: var(--muted); margin-top: 0.45rem; }
.verify .sas { color: var(--warn-fg); }
.verify.verified .sas { color: var(--ok); }

.sas {
  font: 700 2.1rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.16em;
  text-align: center;
  padding: 0.85rem 0;
  font-variant-numeric: tabular-nums;
}

.danger { border-color: var(--bad); border-width: 2px; background: color-mix(in srgb, var(--bad-soft) 40%, var(--panel)); }
.danger h3 { color: var(--bad); }
.danger p { font-size: 0.81rem; margin-top: 0.45rem; }

dl { margin: 0.9rem 0 0; font-size: 0.77rem; }
dt { color: var(--faint); text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.66rem; margin-top: 0.6rem; font-weight: 600; }
dd { margin: 0.15rem 0 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }

.clip { font-size: 0.8rem; }

.dropzone {
  margin-top: 0.6rem;
  padding: 1.3rem 0.6rem;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  font-size: 0.79rem;
  color: var(--muted);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  transition: border-color 120ms ease, color 120ms ease;
}
.dropzone svg { width: 22px; height: 22px; color: var(--faint); }
.dropzone.over { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.dropzone.over svg { color: var(--accent); }
.dropzone[aria-disabled="true"] { opacity: 0.42; cursor: not-allowed; }

.offer-list, .transfer-list {
  list-style: none; margin: 0.6rem 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.offer-list .empty, .transfer-list .empty {
  font-size: 0.77rem; color: var(--faint); text-align: center; padding: 0.8rem 0;
}
.offer {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.6rem; border: 1px solid var(--line); border-radius: 8px;
}
.offer-body { flex: 1; min-width: 0; }
.offer-name { font-size: 0.79rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.offer-size { font-size: 0.69rem; color: var(--faint); font-family: ui-monospace, monospace; }
.offer button { margin: 0; padding: 0.28rem 0.55rem; font-size: 0.72rem; }

.transfer { border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 0.6rem; font-size: 0.77rem; }
.transfer-head { display: flex; justify-content: space-between; gap: 0.5rem; }
.transfer-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfer-state { font-size: 0.69rem; color: var(--faint); font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.transfer.done .transfer-state { color: var(--ok); }
.transfer.failed .transfer-state { color: var(--bad); }
.bar { margin-top: 0.4rem; height: 4px; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); width: 0; transition: width 180ms ease; }

/* ------------------------------------------------------------------ Deploy */

.deploy-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 780px) { .deploy-grid { grid-template-columns: 1fr; } }

.deploy-form > button { margin-top: 1.1rem; }

.toggles { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.3rem; }
.toggle {
  display: flex; align-items: flex-start; gap: 0.6rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  margin: 0; text-transform: none; letter-spacing: 0; font-weight: 400;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.toggle:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.toggle input { width: auto; margin: 0.2rem 0 0; accent-color: var(--accent); flex: none; }
.toggle-body { display: flex; flex-direction: column; gap: 0.1rem; }
.toggle-name { font-size: 0.84rem; font-weight: 600; color: var(--fg); }
.toggle-why { font-size: 0.75rem; color: var(--muted); }

.deploy-out { border-left: 1px solid var(--line-soft); padding-left: 1.5rem; }
@media (max-width: 780px) { .deploy-out { border-left: 0; padding-left: 0; } }

.command {
  display: flex; align-items: stretch; gap: 0.5rem;
  margin-top: 0.3rem;
}
.command code {
  flex: 1; min-width: 0;
  padding: 0.6rem 0.7rem;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.76rem;
  line-height: 1.5;
  word-break: break-all;
  color: var(--fg);
}
.command button { margin: 0; flex: none; align-self: flex-start; }

.fingerprint {
  margin-top: 1.1rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--warn-line);
  background: var(--warn-bg);
  color: var(--warn-fg);
  border-radius: var(--radius);
}
.fingerprint-label {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700;
}
.fingerprint-value {
  font: 700 1.1rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.06em;
  margin: 0.3rem 0 0.5rem;
  word-break: break-all;
}
.fingerprint p { font-size: 0.76rem; }
.fingerprint code { background: rgb(0 0 0 / 8%); padding: 0.05em 0.3em; border-radius: 4px; }

.upload {
  display: inline-flex; align-items: center;
  margin: 0; padding: 0.5rem 0.9rem;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel);
  font: 600 0.83rem system-ui, sans-serif; color: var(--fg);
  text-transform: none; letter-spacing: 0;
  cursor: pointer;
}
.upload:hover { background: var(--bg-sunken); }

/* ------------------------------------------------------------------ Log */

.log {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  font: 0.75rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
}
.log li {
  padding: 0.28rem 0;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  gap: 0.6rem;
}
.log li:last-child { border-bottom: 0; }
.log li.bad { color: var(--bad); }
.log li.good { color: var(--ok); }
.log time { color: var(--faint); flex: none; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ Sign-in */

.signin {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(90% 70% at 15% 0%, color-mix(in srgb, var(--accent) 10%, transparent) 0%, transparent 60%),
    var(--bg-sunken);
  z-index: 10;
  overflow-y: auto;
}

.signin-panel {
  width: 100%;
  max-width: 58rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
  gap: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
@media (max-width: 760px) {
  .signin-panel { grid-template-columns: 1fr; }
  .signin-aside { display: none; }
}

.signin-card { padding: 2rem; }
.signin-lead { margin: 0 0 1.4rem; color: var(--muted); font-size: 0.9rem; }
.signin-card > button { width: 100%; margin-top: 1.1rem; }
.signin-card .enrol button, .signin-card #pinBlock button { width: 100%; }

.signin-aside {
  padding: 2rem;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 9%, var(--panel)), var(--panel));
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.signin-aside h2 { font-size: 0.9rem; }
.signin-aside p { font-size: 0.83rem; color: var(--muted); }
.signin-aside-note {
  margin-top: auto;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  font-size: 0.76rem !important;
  color: var(--faint) !important;
}

.signin-note { margin-top: 0.9rem; font-size: 0.77rem; color: var(--faint); }
.signin-error {
  margin-top: 1rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--bad);
  background: var(--bad-soft);
  border-radius: 8px;
  color: var(--bad);
  font-size: 0.81rem;
}
.signin-warning {
  margin-top: 1rem;
  padding: 0.6rem 0.7rem;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn-fg);
  border-radius: 8px;
  font-size: 0.78rem;
}

.enrol {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.7rem 0.8rem;
}
.enrol summary { cursor: pointer; font-size: 0.82rem; color: var(--muted); }
