/* ==========================================================================
   ADB Remote — viewer.css  (/legacy)
   Tema claro “premium” — paridade visual com as demais páginas.
   Ordem de carga: /theme.css → /style.css → /viewer.css (este vence).
   Cosmético apenas: nenhum ID, classe ou comportamento do viewer.js muda.
   ========================================================================== */

/* ==========================================================================
   1. Remap do tema escuro → claro
   style.css (compartilhado com o admin antigo) define um :root escuro.
   Redefinimos as MESMAS variáveis apontando para os tokens de theme.css.
   ========================================================================== */
:root {
  --bg: var(--c-bg);
  --bg-2: var(--c-bg-2);
  --panel: var(--c-surface);
  --panel-2: var(--c-surface-2);
  --panel-3: var(--c-surface-3);
  --line: var(--c-line-2);
  --line-soft: var(--c-line);
  --text: var(--c-ink);
  --muted: var(--c-muted);
  --muted-2: var(--c-muted); /* era --c-faint (2,58:1); placeholders/hints agora AA */
  --accent: var(--c-accent);
  --accent-2: var(--c-ok-2); /* em style.css é o verde de “online/ativo” */
  --danger: var(--c-err);
  --warn: var(--c-warn);
  --radius: var(--r-xl);
  --mono: var(--f-mono);
  --sans: var(--f-sans);
}

html { color-scheme: light; }
[hidden] { display: none !important; }

/* Correções de base: literais escuros que vivem dentro de style.css. */
button {
  border-radius: var(--r-md);
  transition:
    background var(--d-fast) var(--ease-out),
    border-color var(--d-fast) var(--ease-out),
    color var(--d-fast) var(--ease-out),
    box-shadow var(--d-fast) var(--ease-out),
    transform 60ms ease;
}
button:hover { border-color: #b9d4f4; }
button:active { transform: translateY(1px); }
input:focus, textarea:focus, select:focus { outline: none; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}
button.primary {
  /* pior stop do gradiente com branco ≥4,5:1 (AA) — #0a63ee → #054bb2 */
  background: linear-gradient(180deg, #0a63ee, #054bb2);
  border-color: var(--c-accent-2);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 9px 22px rgba(11, 99, 230, .22);
}
button.primary:hover {
  background: linear-gradient(180deg, #0a63ee, #054bb2);
  border-color: var(--c-accent-2);
  filter: brightness(1.04);
}
button.ghost { background: transparent; }
button.ghost:hover { background: var(--c-surface-3); color: var(--c-ink); }
button:disabled { opacity: .5; }

/* ==========================================================================
   2. Fundo, topbar glass, marca, papel, dispositivo e métricas
   ========================================================================== */
.viewer-body {
  min-height: 100dvh;
  background:
    radial-gradient(1000px 600px at 12% -8%, #e6f1ff 0%, rgba(230, 241, 255, 0) 60%),
    radial-gradient(900px 600px at 100% 0%, #f1ecff 0%, rgba(241, 236, 255, 0) 55%),
    var(--c-bg);
}

.v-top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--h-topbar);
  padding: 0 clamp(12px, 2vw, 20px);
  background: var(--c-glass-2);
  border-bottom: 1px solid var(--c-line);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
}
.v-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.v-brand .logo {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--c-accent-3), var(--c-accent-2));
  box-shadow: 0 8px 20px rgba(11, 107, 255, .25);
  font-size: 11px;
}
.v-brand-name { font-weight: 700; font-size: 14px; letter-spacing: -.2px; color: var(--c-ink); }
.v-role {
  font-size: var(--t-2xs);
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-accent-2);
  background: var(--c-accent-soft);
  border: 1px solid #d5e6ff;
  border-radius: var(--r-pill);
  padding: 3px 9px;
  white-space: nowrap;
}

.v-device {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 11px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .72);
  color: var(--c-ink-2);
  font-size: var(--t-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.v-device > span:not(.dot) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.dot {
  position: relative;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--c-faint);
  transition: background var(--d-med) var(--ease-out);
}
.dot.on { background: var(--c-ok-2); box-shadow: 0 0 0 4px rgba(18, 183, 106, .14); }
.dot.on::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(18, 183, 106, .5);
  animation: live-pulse 2.2s var(--ease-out) infinite;
}
.dot.off { background: var(--c-err); box-shadow: 0 0 0 4px rgba(217, 45, 32, .10); }

.v-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
body.pin-mode #v-full, body.pin-mode #v-rtt, body.pin-mode #v-kbps { display: none !important; }
.v-stat {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--t-xs);
  color: var(--c-muted);
  min-width: 52px;
  text-align: right;
}
#v-audio-level { min-width: 54px; text-align: center; }
.v-actions .ghost.small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 11px;
  font-size: var(--t-sm);
  font-weight: 650;
  border-color: transparent;
  background: transparent;
  color: var(--c-ink-2);
  border-radius: var(--r-md);
}
.v-top .ic { width: 16px; height: 16px; flex: 0 0 auto; }
/* áudio: rótulo é do viewer.js (emoji); fica neutro quando desligado */
#v-audio { filter: grayscale(1) opacity(.85); }
#v-audio.active { filter: none; }
.v-actions .ghost.small:hover {
  background: var(--c-surface-3);
  border-color: var(--c-line-2);
  color: var(--c-ink);
  transform: translateY(-1px);
}
.v-actions .ghost.small.on,
.v-actions .ghost.small.active {
  color: var(--c-accent-2);
  border-color: #bcd8ff;
  background: var(--c-accent-soft);
}
#v-settings-btn { font-size: 15px; }

#v-device-select {
  max-width: 220px;
  min-width: 110px;
  padding: 7px 10px;
  border: 1px solid var(--c-line-2);
  border-radius: var(--r-md);
  background: var(--c-surface);
  color: var(--c-ink);
  font: 650 var(--t-sm)/1.3 var(--f-sans);
}
#v-device-select:hover { border-color: #b9d4f4; }
#v-device-select:focus { border-color: #9dc6ff; box-shadow: var(--e-focus); }

/* ==========================================================================
   3. Palco do celular + cartão do PIN
   ========================================================================== */
.v-main { max-width: 1100px; margin: 0 auto; padding: 14px 16px 24px; }

.pin-card {
  width: 100%;
  max-width: 430px;
  margin: max(6dvh, 28px) auto 0;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-3xl);
  padding: 30px;
  box-shadow: var(--e-4);
  text-align: center;
}
.pin-card .logo { width: 50px; height: 50px; margin: 0 auto 14px; border-radius: 15px; font-size: 13px; }
.pin-card h1 { font-size: var(--t-3xl); letter-spacing: -.02em; margin: 8px 0; }
.pin-card > p { line-height: 1.55; }
.pin-card form { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.pin-card input {
  width: 100%;
  text-align: center;
  font-family: var(--f-mono);
  font-size: 25px;
  letter-spacing: .35em;
  padding: 12px 8px 12px 16px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-line-2);
  border-radius: var(--r-lg);
  color: var(--c-ink);
}
.pin-card input:focus { border-color: #9dc6ff; box-shadow: var(--e-focus); }
.pin-card button { padding: 11px; font-size: 14px; }
.pin-error { min-height: 20px; margin-top: 10px; color: var(--c-err); font-size: var(--t-sm); text-align: center; }
.pin-card .tiny { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--c-line); line-height: 1.5; }

.v-stage-shell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(100dvh - 190px);
  min-height: 300px;
  max-height: 940px;
  padding: 12px;
  background:
    radial-gradient(620px 320px at 50% 0%, rgba(11, 107, 255, .06), rgba(11, 107, 255, 0) 70%),
    linear-gradient(180deg, #ffffff, #f6faff);
  border: 1px solid var(--c-line);
  border-radius: var(--r-3xl);
  box-shadow: var(--e-2);
  overflow: hidden;
}
/* dot-grid sutil atrás do aparelho */
.v-stage-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(16, 24, 40, .07) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}
.v-stage-shell:fullscreen {
  height: 100dvh;
  max-height: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: #000;
}
.v-stage-shell:fullscreen::before { display: none; }
.v-stage-shell:fullscreen .v-stage { border: 0; border-radius: 0; }
.v-stage {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--c-screen);
  border: 1px solid #d9e6f7;
  border-radius: var(--r-2xl);
  overflow: hidden;
  box-shadow:
    0 30px 80px rgba(11, 38, 82, .24),
    0 3px 10px rgba(16, 24, 40, .08),
    inset 0 1px 0 rgba(255, 255, 255, .16);
}
.v-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--c-screen);
  z-index: 1;
  opacity: 0;
  transition: opacity var(--d-med) var(--ease-out);
}
.v-poster.show { opacity: 1; }
#v-screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  display: block;
  z-index: 2;
  opacity: 0;
  transition: opacity var(--d-med) var(--ease-out);
}
.v-stage.has-frame #v-screen { opacity: 1; }
.v-touch { position: absolute; inset: 0; touch-action: none; cursor: crosshair; z-index: 3; }
body.v-readonly .v-touch { pointer-events: none; cursor: default; }
body.v-readonly #v-toolbar, body.v-readonly .v-text-panel { display: none !important; }
.v-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  display: block;
  z-index: 3;
  opacity: 0;
  transition: opacity var(--d-fast) var(--ease-out);
}
.v-stage.has-frame .v-canvas { opacity: 1; }
.v-stage.webcodecs #v-screen { display: none; }
.v-stage.webcodecs .v-touch { z-index: 4; }

.v-placeholder {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  color: #93a4ba;
  background:
    radial-gradient(420px 260px at 50% 38%, rgba(77, 141, 255, .14), rgba(77, 141, 255, 0) 70%),
    linear-gradient(180deg, rgba(5, 9, 16, .94), rgba(5, 9, 16, .9));
}
.v-placeholder p { color: #dbe7f5; font-size: var(--t-md); font-weight: 650; }
.v-placeholder small { color: #93a4ba; font-size: var(--t-2xs); }
.v-placeholder .spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid rgba(255, 255, 255, .16);
  border-top-color: #6aa8ff;
}

/* ==========================================================================
   4. Toolbar, dica, painel de teclado/texto e selo “somente visualização”
   ========================================================================== */
.v-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  margin: 12px auto 0;
  padding: 5px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--c-line);
  border-radius: var(--r-xl);
  box-shadow: var(--e-1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.v-toolbar button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px; /* altura ~37 px — paridade com a escala do sistema */
  font-size: var(--t-sm);
  font-weight: 650;
  background: transparent;
  border: 1px solid transparent;
  color: var(--c-ink-2);
  border-radius: var(--r-md);
}
.v-toolbar .ic { width: 15px; height: 15px; flex: 0 0 auto; }
.v-toolbar button:hover {
  background: var(--c-accent-soft);
  border-color: transparent;
  color: var(--c-accent-2);
}
.v-toolbar button.on { color: var(--c-accent-2); border-color: #bcd8ff; background: var(--c-accent-soft); }
.tool-sep { width: 1px; height: 22px; background: var(--c-line); margin: 0 4px; align-self: center; }
.v-hint { margin-top: 10px; text-align: center; color: var(--c-muted); font-size: var(--t-xs); }

.v-text-panel {
  max-width: 680px;
  margin: 14px auto 0;
  padding: 14px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-2xl);
  box-shadow: var(--e-2);
}
.v-text-panel textarea { margin-bottom: 8px; min-height: 54px; }
.v-text-panel textarea:focus, .v-ai-card textarea:focus { border-color: #9dc6ff; box-shadow: var(--e-focus); }
.v-text-panel .row { justify-content: flex-end; }
.v-text-actions { flex-wrap: wrap; align-items: center; gap: 8px; }
.v-text-actions .switch { margin-right: auto; }
#v-kb-hint { margin: 8px 0 0; line-height: 1.45; }
#v-keyboard.on { color: var(--c-accent-2); border-color: #bcd8ff; background: var(--c-accent-soft); }

.v-readonly {
  display: block;
  width: fit-content;
  margin: 12px auto 0;
  font-size: var(--t-2xs);
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--c-warn);
  border: 1px solid #f6d9ae;
  background: var(--c-warn-soft);
  border-radius: var(--r-pill);
  padding: 4px 10px;
}

/* ==========================================================================
   5. Toasts (feedback claro)
   ========================================================================== */
#v-toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(400px, calc(100vw - 32px));
}
.toast {
  padding: 11px 14px;
  border: 1px solid var(--c-line);
  border-left: 3px solid var(--c-accent);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  color: var(--c-ink);
  font-size: var(--t-sm);
  box-shadow: var(--e-3);
  animation: v-toast-in var(--d-med) var(--ease-out);
}
.toast.error { border-color: #f4c7c3; border-left-color: var(--c-err); background: var(--c-err-soft); color: #8f1d16; }
.toast.ok { border-color: #b7e6c9; border-left-color: var(--c-ok); background: var(--c-ok-soft); color: #0b7a47; }
@keyframes v-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   6. Painel de arquivos
   ========================================================================== */
.v-files-panel {
  position: fixed;
  top: var(--h-topbar);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  overflow: auto;
  padding: 20px max(16px, calc((100vw - 1100px) / 2)) 44px;
  background:
    radial-gradient(1000px 600px at 12% -8%, #e6f1ff 0%, rgba(230, 241, 255, 0) 60%),
    var(--c-bg);
  animation: v-panel-in var(--d-slow) var(--ease-out);
}
@keyframes v-panel-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.v-files-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--c-line);
}
.v-files-head h2 { font-size: var(--t-2xl); letter-spacing: -.025em; }
.v-files-head p { margin-top: 4px; }
.v-files-path { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.v-files-path input {
  flex: 1 1 220px;
  min-width: 0;
  font-family: var(--f-mono);
  font-size: var(--t-sm);
  border-radius: var(--r-md);
  border-color: var(--c-line-2);
  background: var(--c-surface-2);
}
.v-files-path input:focus { border-color: #9dc6ff; box-shadow: var(--e-focus); }
.v-files-path button { flex: none; }
.v-files-list {
  border: 1px solid var(--c-line);
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--c-surface);
  box-shadow: var(--e-1);
}
.v-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px minmax(120px, auto);
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(20, 55, 110, .06);
  font-size: var(--t-sm);
  transition: background var(--d-fast) var(--ease-out);
}
.v-file-row:hover, .v-file-row:focus-within { background: var(--c-surface-2); }
.v-file-row:last-child { border-bottom: 0; }
.v-file-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.v-file-name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-file-name.dir .nm { color: var(--c-accent-2); cursor: pointer; font-weight: 600; }
.v-file-name.dir .nm:hover { text-decoration: underline; }
.v-file-size { color: var(--c-muted); font-family: var(--f-mono); font-size: var(--t-2xs); white-space: nowrap; }
.v-file-actions { display: flex; gap: 5px; justify-content: flex-end; }
.v-file-actions a, .v-file-actions button {
  font-size: var(--t-2xs);
  font-weight: 650;
  padding: 7px 9px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-line);
  background: var(--c-surface);
  color: var(--c-ink-2);
  text-decoration: none;
}
.v-file-actions a:hover, .v-file-actions button:hover {
  border-color: #b9d4f4;
  background: var(--c-accent-soft);
  color: var(--c-accent-2);
}
.v-files-progress { display: flex; align-items: center; gap: 10px; padding: 12px 2px; font-size: var(--t-sm); color: var(--c-muted); }
.v-files-progress progress {
  flex: 1;
  height: 8px;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: var(--c-surface-3);
  accent-color: var(--c-accent-2);
}
.v-files-progress progress::-webkit-progress-bar { background: var(--c-surface-3); border-radius: var(--r-pill); }
.v-files-progress progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--c-accent-3), var(--c-accent));
  border-radius: var(--r-pill);
}
.v-files-progress progress::-moz-progress-bar { background: var(--c-accent); border-radius: var(--r-pill); }
.v-files-progress span:first-child { max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-files-empty { padding: 18px; color: var(--c-muted); font-size: var(--t-sm); }

/* ==========================================================================
   7. Modais (dispositivos, IA, configurações)
   ========================================================================== */
.v-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 32, 64, .34);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.v-modal[hidden] { display: none; }
.v-modal-card {
  width: min(680px, 100%);
  max-height: min(88dvh, 920px);
  overflow: auto;
  padding: 22px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-3xl); /* paridade com o modal do /view (spec §4) */
  box-shadow: var(--e-4);
  animation: v-modal-in var(--d-slow) var(--ease-out);
}
@keyframes v-modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.992); }
  to { opacity: 1; transform: none; }
}
.v-modal-card h2 { margin: 0 0 3px; font-size: var(--t-2xl); letter-spacing: -.4px; }

.v-devices-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.v-device-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  background: var(--c-surface-2);
  transition:
    border-color var(--d-fast) var(--ease-out),
    background var(--d-fast) var(--ease-out),
    box-shadow var(--d-fast) var(--ease-out);
}
.v-device-row:hover { border-color: #cbdff8; background: var(--c-surface); box-shadow: var(--e-1); }
.v-device-row .meta { min-width: 0; }
.v-device-row .meta strong { display: block; font-size: var(--t-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-device-row .meta span { color: var(--c-muted); font-size: var(--t-2xs); }
.v-device-row input {
  width: 100%;
  margin-top: 6px;
  padding: 7px 9px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-line-2);
  background: var(--c-surface);
  color: var(--c-ink);
  font-size: var(--t-sm);
}
.v-device-row input:focus { border-color: #9dc6ff; box-shadow: var(--e-focus); }
.v-device-row .state { font-size: var(--t-2xs); font-weight: 800; letter-spacing: .04em; }
.v-device-row .state.online { color: var(--c-ok-strong); /* #0e9f5b ficava em 3,4:1 */ }
.v-device-row .state.offline { color: var(--c-err); }
.v-device-row .row { flex-wrap: wrap; justify-content: flex-end; }
.v-device-row .row button { padding: 8px 11px; font-size: var(--t-xs); } /* alvo ≥32 px */

/* IA — missão */
.v-ai-card textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 80px;
  padding: 11px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-line-2);
  background: var(--c-surface);
  color: var(--c-ink);
  font-size: var(--t-sm);
  line-height: 1.45;
}
.v-ai-label { display: block; margin: 12px 0 6px; font-weight: 700; font-size: var(--t-md); }
.v-ai-actions { align-items: center; justify-content: flex-start; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.v-ai-steps { color: var(--c-muted); font-size: var(--t-sm); display: inline-flex; align-items: center; gap: 6px; }
.v-ai-steps input {
  width: 64px;
  padding: 7px 6px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-line-2);
  background: var(--c-surface);
  color: var(--c-ink);
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--t-sm);
  text-align: center;
}
.v-ai-steps input:focus { border-color: #9dc6ff; box-shadow: var(--e-focus); }
.v-ai-status {
  margin: 12px 0;
  padding: 10px 12px;
  min-height: 38px;
  border-radius: var(--r-md);
  border: 1px solid #d5e6ff;
  background: var(--c-accent-soft);
  color: #22508f;
  font-size: var(--t-sm);
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--e-inset);
  transition:
    background var(--d-med) var(--ease-out),
    border-color var(--d-med) var(--ease-out),
    color var(--d-med) var(--ease-out);
}
/* cor por fase — viewer.js marca data-phase (cosmético) */
.v-ai-status[data-phase="done"] { border-color: #b7e6c9; background: var(--c-ok-soft); color: #0b7a47; }
.v-ai-status[data-phase="stopped"] { border-color: #f6d9ae; background: var(--c-warn-soft); color: var(--c-warn); }
.v-ai-status[data-phase="error"] { border-color: #f4c7c3; background: var(--c-err-soft); color: #8f1d16; }
/* log da IA: mono, marcadores no texto (🧠 ▶ ✓ ✅ ⛔ ❌) e cor por fase */
.v-ai-log {
  min-height: 120px;
  max-height: 320px;
  overflow: auto;
  padding: 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-line);
  background: #f8fbff;
  font: 11.5px/1.55 var(--f-mono);
  color: var(--c-ink-2);
  font-variant-numeric: tabular-nums;
}
.v-ai-log:empty::before {
  content: "O log da missão aparece aqui.";
  display: block;
  padding: 4px;
  color: var(--c-muted);
  font: 12px/1.5 var(--f-sans);
}
.v-ai-log .entry {
  position: relative;
  padding: 3px 0 3px 11px;
  border-bottom: 1px solid rgba(20, 55, 110, .05);
  word-break: break-word;
}
.v-ai-log .entry::before {
  content: "";
  position: absolute; left: 0; top: 5px; bottom: 5px; width: 2px;
  border-radius: 2px; background: var(--c-line-3);
}
.v-ai-log .entry.thought { color: #4a5b73; }
.v-ai-log .entry.thought::before { background: var(--c-violet); }
.v-ai-log .entry.action { color: #0b7a47; }
.v-ai-log .entry.action::before { background: var(--c-ok-2); }
.v-ai-log .entry.error { color: var(--c-err); }
.v-ai-log .entry.error::before { background: var(--c-err); }
.v-ai-log .entry.done { color: #0b7a47; font-weight: 750; }
.v-ai-log .entry.done::before { background: var(--c-ok); }
#v-ai-btn.on { color: var(--c-accent-2); border-color: #bcd8ff; background: var(--c-accent-soft); }
#v-devices-btn.on { color: var(--c-accent-2); border-color: #bcd8ff; background: var(--c-accent-soft); }

/* Configurações / instalação */
.v-settings-section { margin: 18px 0; padding-top: 8px; border-top: 1px solid var(--c-line); }
.v-settings-section:first-of-type { border-top: 0; }
.v-settings-section h3 { margin: 8px 0 6px; font-size: 14px; }
.v-settings-section p { margin: 6px 0; color: var(--c-ink-2); font-size: var(--t-sm); line-height: 1.5; }
.v-settings-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.v-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  text-decoration: none;
  font-size: var(--t-sm);
  font-weight: 700;
  transition:
    filter var(--d-fast) var(--ease-out),
    border-color var(--d-fast) var(--ease-out),
    background var(--d-fast) var(--ease-out),
    color var(--d-fast) var(--ease-out);
}
.v-download.primary {
  background: linear-gradient(180deg, #0a63ee, #054bb2);
  border: 1px solid var(--c-accent-2);
  color: #fff;
  box-shadow: 0 9px 22px rgba(11, 99, 230, .22);
}
.v-download.primary:hover { filter: brightness(1.04); }
.v-download.ghost { border: 1px solid var(--c-line-2); background: var(--c-surface); color: var(--c-ink-2); }
.v-download.ghost:hover { border-color: #b9d4f4; background: var(--c-surface-3); color: var(--c-ink); }
.v-settings-steps { margin: 8px 0 0 18px; padding: 0; color: var(--c-ink-2); font-size: var(--t-sm); line-height: 1.55; }
.v-settings-steps li { margin: 7px 0; }

/* ==========================================================================
   8. Responsivo (sem overflow horizontal em 1440/1280/390)
   ========================================================================== */
@media (max-width: 720px) {
  .v-top { height: 54px; padding: 0 12px; gap: 8px; }
  .v-brand-name { display: none; }
  .v-device { max-width: 44vw; font-size: var(--t-xs); padding: 5px 9px; }
  .v-stat { display: none; }
  .v-main { padding: 10px 10px 20px; }
  .v-stage-shell { height: calc(100dvh - 168px); padding: 8px; border-radius: var(--r-xl); }
  .v-stage { border-radius: var(--r-lg); }
  .v-toolbar button { padding: 8px 10px; font-size: var(--t-xs); }
  .v-toolbar .tool-sep { display: none; }
  .v-hint { font-size: var(--t-2xs); }
  .pin-card { margin-top: 4dvh; padding: 24px; }
  .v-files-panel { top: 54px; padding: 14px 10px 34px; }
  .v-file-row { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 12px; }
  .v-file-size { display: none; }
}
@media (max-width: 700px) {
  .v-role { display: none; }
  .v-top { gap: 6px; }
  .v-actions { gap: 3px; }
  .v-actions .ghost.small { padding: 8px 7px; } /* alvos ≥32 px no mobile */
  .v-brand { gap: 6px; }
}
@media (max-width: 620px) {
  .v-device > span:not(.dot) { display: none; }
  #v-device-select { max-width: 180px; min-width: 96px; }
}
@media (max-width: 460px) {
  .v-top { padding: 0 10px; }
  .v-actions .ghost.small { padding: 8px 7px; }
  .v-device { padding: 4px 8px; }
  #v-device-select { max-width: 132px; min-width: 84px; padding: 7px 8px; }
}
