/* EarHub • Earo Systems
   Conceito: painel de instrumentos de cabine. Céu claro de dia, cabine azul-marinho à noite.
   Cada computador é uma "faixa de voo" (strip) com o ID de 9 dígitos em fonte de instrumento. */

/* Fontes servidas pelo próprio EarHub (sem Google Fonts: o IP do visitante não sai daqui).
   Só o conjunto "latin", que cobre o português. Licença OFL em /fonts/LICENCA-FONTES.txt */
@font-face { font-family: "Sora"; font-style: normal; font-weight: 500 800; font-display: swap; src: url(/fonts/sora.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400 600; font-display: swap; src: url(/fonts/ibm-plex-sans.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-mono-400.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-mono-500.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-mono-600.woff2) format("woff2"); }

/* Aviso de lista parcial (muitos computadores) */
.list-more { margin: 12px 4px 0; font-size: 13.5px; }

/* Prévia: o servidor coloca "previa" ou "lancado" no <body> (EARHUB_PREVIA) */
body:not(.previa) .previa-only, body.previa .lancado-only { display: none !important; }

:root {
  --bg: #eef3f9;
  --bg-2: #e3eaf4;
  --surface: #ffffff;
  --surface-2: #f4f7fb;
  --line: #d6e0ec;
  --line-2: #bccbdd;
  --text: #0d1b2e;
  --muted: #586a85;
  --faint: #8a99b0;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --accent-soft: rgba(31, 111, 235, .1);
  --signal: #b86e00;
  --signal-soft: rgba(232, 150, 20, .14);
  --ok: #12996b;
  --ok-soft: rgba(18, 153, 107, .12);
  --red: #d23a4d;
  --stage: #070c14;
  --stage-line: #1c2a3f;
  --shadow: 0 1px 2px rgba(13, 27, 46, .06), 0 8px 24px rgba(13, 27, 46, .06);
  --shadow-lg: 0 24px 64px rgba(13, 27, 46, .22);
  --radius: 12px;
  --display: "Sora", "Segoe UI", system-ui, sans-serif;
  --body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #08111e; --bg-2: #0c1828; --surface: #0f1d31; --surface-2: #14253d; --line: #1e3150; --line-2: #2b4266;
    --text: #e6eef9; --muted: #92a5c2; --faint: #61769a;
    --accent: #4c9bff; --accent-ink: #04122a; --accent-soft: rgba(76, 155, 255, .14);
    --signal: #ffb547; --signal-soft: rgba(255, 181, 71, .13); --ok: #3ddc97; --ok-soft: rgba(61, 220, 151, .12); --red: #ff6b7a;
    --stage: #04080e; --stage-line: #17263b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); --shadow-lg: 0 24px 64px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #08111e; --bg-2: #0c1828; --surface: #0f1d31; --surface-2: #14253d; --line: #1e3150; --line-2: #2b4266;
  --text: #e6eef9; --muted: #92a5c2; --faint: #61769a;
  --accent: #4c9bff; --accent-ink: #04122a; --accent-soft: rgba(76, 155, 255, .14);
  --signal: #ffb547; --signal-soft: rgba(255, 181, 71, .13); --ok: #3ddc97; --ok-soft: rgba(61, 220, 151, .12); --red: #ff6b7a;
  --stage: #04080e; --stage-line: #17263b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); --shadow-lg: 0 24px 64px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 14.5px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); margin: 0; }
.mono { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
h2 { font-size: 28px; line-height: 1.15; }
h3 { font-size: 16px; }
h4 { font-size: 13px; color: var(--muted); font-family: var(--body); font-weight: 500; letter-spacing: 0; }

/* ---------- marca ---------- */
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; border-radius: 10px; }
.brand img { width: 34px; height: 34px; }
.brand-text { display: grid; line-height: 1.05; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -0.04em; }
.brand-name .ear { color: var(--accent); } /* "ear" (ouvir) + "hub" (central) */
.brand-sub { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.brand.big img { width: 44px; height: 44px; }
.brand.big .brand-name { font-size: 26px; }

/* ---------- botões e campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-2); background: var(--surface); padding: 9px 16px; border-radius: 9px; cursor: pointer; font-weight: 500; transition: background .15s, border-color .15s, transform .1s, filter .15s; white-space: nowrap; }
.btn:hover { border-color: var(--faint); background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); background: var(--accent); }
.btn.danger { color: var(--red); }
.btn.primary.danger-fill { background: var(--red); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; transform: none; filter: none; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.on { color: var(--accent); background: var(--accent-soft); }

input, select, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; outline: none; min-width: 0; }
textarea { resize: vertical; font: inherit; color: inherit; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label { color: var(--muted); font-size: 13px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); cursor: pointer; }
label.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.error { color: var(--red); min-height: 1.5em; margin: 2px 0 0; font-size: 13px; }
.hint { color: var(--faint); font-size: 12.5px; }
.ok-msg { margin: 4px 0 0; padding: 10px 12px; border-radius: 10px; font-size: 14px; line-height: 1.45; background: var(--ok-soft, #e3f7ee); color: var(--text); border: 1px solid color-mix(in srgb, var(--ok, #1f9d6b) 40%, transparent); }
.ok-msg[hidden] { display: none; }
#email-setup-form:not([hidden]), #email-setup-sent:not([hidden]), #email-setup-pw:not([hidden]) { display: grid; gap: 8px; }
.muted.small { font-size: 12.5px; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px));
  background:
    radial-gradient(900px 520px at 12% -10%, var(--accent-soft), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 39px, color-mix(in srgb, var(--line) 45%, transparent) 39px 40px),
    var(--bg); }
.auth-card { width: min(410px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 34px; box-shadow: var(--shadow-lg); }
.auth-card h1 { font-size: 24px; margin-top: 26px; }
.auth-card form { display: grid; gap: 8px; margin-top: 22px; }
.auth-card form .btn { margin-top: 10px; }
.auth-foot { color: var(--faint); font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; margin: 0; }

/* ---------- estrutura ---------- */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 28px; padding: 22px 14px; border-right: 1px solid var(--line); background: var(--bg-2); }
.rail > .brand { padding: 4px 8px; }
.rail nav { display: grid; gap: 2px; }
.rail nav button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 9px; background: none; color: var(--muted); cursor: pointer; text-align: left; font-weight: 500; }
.rail nav button:hover { background: var(--surface); color: var(--text); }
.rail nav button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.rail nav button.active svg { color: var(--accent); }
.rail-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 6px 0; border-top: 1px solid var(--line); }
.rail-actions { display: flex; gap: 2px; }
.me { display: flex; align-items: center; gap: 9px; min-width: 0; font-weight: 500; }
.me span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-family: var(--display); font-weight: 600; font-size: 13px; text-transform: uppercase; }
.sessions-pill { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: 11px; border: 1px solid color-mix(in srgb, var(--signal) 45%, transparent); background: var(--signal-soft); color: var(--text); cursor: pointer; text-align: left; }
.sessions-pill b { color: var(--signal); font-family: var(--mono); }
.pulse { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 0 color-mix(in srgb, var(--signal) 60%, transparent); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.main { min-width: 0; padding-block: 34px 64px; padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px)); }
.view { max-width: 1180px; margin: 0 auto; }
.view-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.view-head .muted { margin-top: 6px; }

/* ---------- console: conectar por ID + leituras ---------- */
.console { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); margin-bottom: 26px; overflow: hidden; }
.connect-id { display: grid; gap: 8px; padding: 20px 22px; }
.connect-id label { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.connect-id-row { display: flex; gap: 10px; min-width: 0; }
.connect-id { min-width: 0; }
.connect-id input { flex: 1; width: 100%; min-width: 0; font-family: var(--mono); font-size: 26px; font-weight: 500; letter-spacing: .08em; padding: 8px 14px; font-variant-numeric: tabular-nums; background: var(--surface-2); }
.connect-id input::placeholder { color: var(--faint); opacity: .7; }
.readouts { display: grid; grid-template-columns: repeat(4, 1fr); border-left: 1px solid var(--line); background: var(--surface-2); }
.readout { display: grid; align-content: center; gap: 2px; padding: 16px 18px; border-left: 1px solid var(--line); }
.readout:first-child { border-left: 0; }
.r-val { font-family: var(--mono); font-size: 26px; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.1; }
.r-lbl { color: var(--muted); font-size: 12px; }
.readout.live .r-val { color: var(--signal); }
.readout:first-child .r-val { color: var(--ok); }

/* ---------- filtros ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 22px; }
.search { flex: 1 1 260px; max-width: 380px; }
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- faixas de computador ---------- */
.group { margin-bottom: 28px; }
.group-head { display: flex; align-items: baseline; gap: 12px; margin: 0 4px 10px; }
.group-head h3 { font-size: 15px; }
.group-head .count { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.strips { display: grid; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.strip { display: grid; grid-template-columns: 14px minmax(160px, 1.4fr) 140px minmax(0, 1.2fr) auto; align-items: center; gap: 16px; padding: 12px 14px 12px 16px; border-top: 1px solid var(--line); }
.strip:first-child { border-top: 0; }
.strip:hover { background: var(--surface-2); }
.lamp { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); opacity: .55; }
.strip.online .lamp { background: var(--ok); opacity: 1; box-shadow: 0 0 0 4px var(--ok-soft); }
.strip.busy .lamp { background: var(--signal); box-shadow: 0 0 0 4px var(--signal-soft); }
.s-name { min-width: 0; }
.s-name b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-name span { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-id { font-family: var(--mono); font-size: 14px; font-weight: 500; letter-spacing: .04em; font-variant-numeric: tabular-nums; color: var(--text); background: none; border: 0; padding: 4px 6px; margin-left: -6px; border-radius: 6px; cursor: pointer; text-align: left; }
.s-id:hover { background: var(--accent-soft); color: var(--accent); }
.s-tags { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag svg { width: 12px; height: 12px; }
.tag.key { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); }
.tag.live { color: var(--signal); border-color: color-mix(in srgb, var(--signal) 40%, transparent); background: var(--signal-soft); }
.s-actions { display: flex; align-items: center; gap: 6px; }
.s-actions .btn.primary { min-width: 92px; }

.empty { text-align: center; max-width: 480px; margin: 60px auto; display: grid; gap: 12px; justify-items: center; }
.empty p { color: var(--muted); margin: 0; }

/* ---------- tabelas ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; font-family: var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions .btn { margin-left: 6px; }
#user-table td.actions { white-space: normal; }
#user-table td.actions .btn { margin: 3px 0 3px 6px; }
.code { font-family: var(--mono); letter-spacing: .08em; background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: 7px; padding: 4px 9px; cursor: pointer; color: var(--text); }
.code:hover { border-color: var(--accent); color: var(--accent); }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { width: 260px; }
.steps { list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 0; margin: 0 0 20px; }
.steps li { counter-increment: step; display: grid; gap: 2px; padding: 14px 16px 14px 52px; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.steps li::before { content: counter(step); position: absolute; left: 16px; top: 14px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-family: var(--mono); font-size: 12px; font-weight: 600; }
.steps span { color: var(--muted); font-size: 13px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: grid; gap: 14px; box-shadow: var(--shadow); min-width: 0; }
.panel .table-wrap { box-shadow: none; border-radius: 9px; }
.stack { display: grid; gap: 10px; }
.stack > label { margin-bottom: -4px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.file-btn { justify-self: start; cursor: pointer; }
.file-btn:has(+ input:focus-visible) { box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }

/* ---------- empresa ---------- */
.rail-company { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-top: -14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 600; min-width: 0; }
.rail-company img { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; flex: none; }
.rail-company span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-head { display: grid; gap: 10px; }
.co-back { justify-self: start; padding-left: 0; }
.co-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.co-title img { width: 52px; height: 52px; object-fit: contain; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); padding: 4px; flex: none; }
.co-tabs { margin-bottom: 20px; flex-wrap: wrap; }
.logo-box { display: grid; place-items: center; height: 120px; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--surface-2); }
.logo-box img { max-width: 90%; max-height: 104px; object-fit: contain; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.dash-readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin-bottom: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.group-head .co-link { background: none; border: 0; padding: 0; font: inherit; font-size: 15px; font-weight: 600; color: var(--text); cursor: pointer; }
.group-head .co-link:hover { color: var(--accent); text-decoration: underline; }
.tfa-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* Ativação obrigatória das duas etapas (tela de login) */
.tfa-steps { margin: 0 0 6px; padding-left: 20px; display: grid; gap: 6px; color: var(--muted); font-size: 14.5px; }
.tfa-steps b { color: var(--text); }
#tfa-setup-pw:not([hidden]), #tfa-setup-qr:not([hidden]) { display: grid; gap: 8px; }
#tfa-setup-qr .tfa-qr { margin-bottom: 8px; }
#tfa-setup-code { font-family: var(--mono); font-size: 20px; letter-spacing: .3em; text-align: center; }
.tfa-qr { display: grid; justify-items: center; gap: 10px; }
.tfa-qr .qr { width: 220px; height: 220px; padding: 6px; background: #fff; border-radius: 10px; }
.tfa-qr .qr svg { width: 100%; height: 100%; display: block; }
/* O estilo geral dos ícones (só contorno) não pode valer para o QR code */
.tfa-qr .qr svg rect { fill: #fff; stroke: none; }
.tfa-qr .qr svg path { fill: #000; stroke: none; }
.tfa-secret { font-family: var(--mono); letter-spacing: .06em; text-align: center; word-break: break-all; background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: 8px; padding: 8px 10px; user-select: all; }
.tfa-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 14px; font-family: var(--mono); font-size: 15px; letter-spacing: .06em; background: var(--surface-2); border-radius: 10px; padding: 12px 16px; margin: 0; list-style: none; }
.tag.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.tag.plan { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); }

/* ---------- modal ---------- */
.modal-host { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px max(16px, env(safe-area-inset-right, 0px)) 20px max(16px, env(safe-area-inset-left, 0px)); background: rgba(5, 12, 22, .55); backdrop-filter: blur(3px); animation: fade .15s ease-out; }
.modal { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 22px; display: grid; gap: 16px; animation: rise .18s ease-out; }
.modal h3 { font-size: 18px; }
.modal-body { display: grid; gap: 12px; }
.modal-body p { margin: 0; color: var(--muted); }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.modal .field { display: grid; gap: 6px; }
.target { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); }
.target .lamp { flex: none; }
.target div { min-width: 0; }
.target b { display: block; }
.target span { font-family: var(--mono); color: var(--muted); font-size: 13px; letter-spacing: .04em; }
.pin { display: flex; gap: 8px; }
.pin input { flex: 1; font-family: var(--mono); font-size: 20px; letter-spacing: .2em; text-align: center; padding: 8px 10px; }
.note { font-size: 13px; color: var(--muted); padding: 10px 12px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); }
.note.key { color: var(--text); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- área de sessões ---------- */
.workspace { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-rows: auto 1fr; background: var(--stage); }
.ws-bar { display: flex; align-items: center; gap: 10px; padding: 8px max(10px, env(safe-area-inset-right, 0px)) 8px max(10px, env(safe-area-inset-left, 0px)); padding-top: max(8px, env(safe-area-inset-top, 0px)); background: var(--bg-2); border-bottom: 1px solid var(--line); }
.ws-brand { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; flex: none; }
.ws-brand img { width: 26px; height: 26px; }
.ws-tabs { display: flex; gap: 6px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.ws-tab { display: flex; align-items: center; gap: 9px; padding: 6px 6px 6px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; white-space: nowrap; color: var(--muted); }
.ws-tab.active { color: var(--text); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ws-tab .st { width: 7px; height: 7px; border-radius: 50%; background: var(--signal); }
.ws-tab .st.ok { background: var(--ok); }
.ws-tab .st.bad { background: var(--red); }
.ws-tab small { color: var(--faint); font-family: var(--mono); font-size: 11px; }
.ws-tab .x { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; border: 0; background: none; color: var(--faint); cursor: pointer; }
.ws-tab .x:hover { background: var(--surface-2); color: var(--red); }
.ws-tab .x svg { width: 14px; height: 14px; }
.ws-actions { display: flex; gap: 4px; }
.ws-stage { position: relative; min-height: 0; display: grid; }
.ws-stage.grid { grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); grid-auto-rows: minmax(260px, 1fr); gap: 8px; padding: 8px; overflow: auto; }

.sv { position: relative; display: none; grid-template-rows: auto 1fr; min-height: 0; background: var(--stage); }
.ws-stage:not(.grid) .sv.active { display: grid; }
.ws-stage.grid .sv { display: grid; border: 1px solid var(--stage-line); border-radius: 12px; overflow: hidden; }
.ws-stage.grid .sv.active { border-color: var(--accent); }
.ws-stage.grid .sv-stats { display: none; }
.sv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px 10px; background: var(--surface); border-bottom: 1px solid var(--line); }
.sv-title { display: flex; align-items: baseline; gap: 8px; font-weight: 600; margin-right: 10px; white-space: nowrap; overflow: hidden; min-width: 0; }
.sv-title small { color: var(--muted); font-weight: 400; font-family: var(--mono); font-size: 12px; }
.sv-mode { font-size: 11.5px; font-weight: 500; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.sv-mode.key { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.sv-bar .spacer { flex: 1; }
.sv-bar select { padding: 5px 8px; font-size: 12.5px; border-radius: 8px; }
.sv-stats { font-family: var(--mono); font-size: 11.5px; color: var(--faint); margin-right: 6px; white-space: nowrap; }
.sv-body { position: relative; overflow: hidden; display: grid; place-items: center; min-height: 0; outline: none; }
.sv-body.actual { overflow: auto; place-items: start; }
.sv canvas { display: block; background: #000; cursor: none; box-shadow: 0 0 0 1px var(--stage-line); }
.sv.viewonly canvas { cursor: default; }
.sv-cursor { position: absolute; width: 16px; height: 22px; pointer-events: none; display: none; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6));
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 22'%3E%3Cpath d='M1 1v17l4.5-4.2 3 6.7 3-1.4-3-6.4H15z' fill='%23ffb547' stroke='%23000' stroke-width='1.3' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat; }
.sv-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--stage) 88%, transparent); text-align: center; padding: 20px; color: #c9d6e8; }
.sv-overlay .box { display: grid; gap: 12px; justify-items: center; max-width: 360px; }
.sv-overlay .box b { color: #fff; font-family: var(--display); font-weight: 600; font-size: 17px; }
.sv-overlay .box .btn { color: var(--text); }
.sv-overlay .row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.spin { width: 28px; height: 28px; border: 3px solid #23354f; border-top-color: #4c9bff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.countdown { position: relative; width: 64px; height: 64px; }
.countdown svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.countdown circle { fill: none; stroke-width: 4; }
.countdown .track { stroke: #23354f; }
.countdown .bar { stroke: #ffb547; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.countdown span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); font-size: 18px; color: #fff; }
.sv-status { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); background: rgba(255, 181, 71, .16); color: #ffb547; border: 1px solid rgba(255, 181, 71, .4); padding: 6px 12px; border-radius: 99px; font-size: 13px; }

.menu { position: absolute; z-index: 95; min-width: 220px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; padding: 6px; box-shadow: var(--shadow-lg); }
.menu button { display: flex; width: 100%; justify-content: space-between; gap: 16px; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--surface-2); }
.menu button kbd { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.menu button.danger { color: var(--red); }

.toast { position: fixed; bottom: max(22px, env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); z-index: 100; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500; max-width: calc(100% - 32px); }

@media (max-width: 1100px) {
  .console { grid-template-columns: 1fr; }
  .readouts { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px max(14px, env(safe-area-inset-right, 0px)) 12px max(14px, env(safe-area-inset-left, 0px)); border-right: 0; border-bottom: 1px solid var(--line); }
  .rail nav { order: 3; width: 100%; grid-auto-flow: column; overflow-x: auto; }
  .rail nav button { padding: 8px 10px; justify-content: center; }
  .rail-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .rail-foot .me span:last-child { display: none; }
  .sessions-pill { order: 4; width: 100%; }
  .steps { grid-template-columns: 1fr; }
  .strip { grid-template-columns: 12px minmax(0, 1fr) auto; grid-template-areas: "l n a" "l i i" "l t t"; row-gap: 6px; }
  .strip .lamp { grid-area: l; align-self: start; margin-top: 6px; }
  .strip .s-name { grid-area: n; }
  .strip .s-id { grid-area: i; justify-self: start; }
  .strip .s-tags { grid-area: t; }
  .strip .s-actions { grid-area: a; }
  .readouts { grid-template-columns: repeat(2, 1fr); }
  .readout:nth-child(3) { border-left: 0; }
  .readout:nth-child(n+3) { border-top: 1px solid var(--line); }
  .inline-form input { width: 100%; }
  .inline-form { width: 100%; }
  .connect-id input { font-size: 20px; }
  .ws-stage.grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- páginas simples (404, privacidade) e rodapé ---------- */
.simple-page { max-width: 720px; margin: 0 auto; padding-block: 56px 32px; padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px)); display: grid; gap: 14px; align-content: start; }
.simple-page h1 { font-size: 30px; margin-top: 18px; }
.simple-page h2 { font-size: 19px; margin-top: 18px; }
.simple-page p, .simple-page li { color: var(--text); line-height: 1.65; margin: 0; }
.simple-page ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.simple-page .muted { color: var(--muted); }
.simple-page .code-404 { font-family: var(--mono); font-size: 84px; font-weight: 600; line-height: 1; color: var(--accent); margin: 28px 0 0; letter-spacing: -0.04em; }
.simple-page .code-404 + h1 { margin-top: 4px; }
.doc-page .table td { vertical-align: top; }
.site-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; padding: 18px max(16px, env(safe-area-inset-right, 0px)) max(18px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); color: var(--faint); font-size: 12.5px; }
.site-foot a { color: var(--muted); }
.site-foot.in-app { margin-top: 48px; border-top: 1px solid var(--line); }
.auth .site-foot { padding-bottom: 0; }
a.btn { text-decoration: none; }
