/*
  Painel WiseTV — visual.
  Tema claro e escuro com as mesmas variáveis: "Sistema" segue o aparelho (prefers-color-scheme) e a escolha manual
  vira data-theme no <html>. Uma cor de destaque só (o laranja da marca), neutros grafite (cinza, sem bege nem azul) e cores de estado.
  Sem fontes externas (a CSP só aceita arquivos do próprio painel): fonte do sistema.
*/

/* ---------- Tema claro (padrão) ---------- */
:root {
  --bg: #f5f5f6;
  --surface: #ffffff;
  --surface-2: #f1f1f3;
  --surface-3: #e7e7ea;
  --field: #ffffff;
  --sidebar: #fafafa;
  --line: #e4e4e7;
  --line-strong: #d1d1d6;
  --text: #18181b;
  --text-2: #52525b;
  --text-3: #8b8b94;
  --accent: #ea580c;
  --accent-hover: #c94a09;
  --accent-ink: #ffffff;
  --accent-soft: rgba(234, 88, 12, .09);
  --accent-text: #c2410c;
  --ok: #1d8656;
  --ok-soft: rgba(29, 134, 86, .10);
  --warn: #9a5b00;
  --warn-soft: rgba(196, 124, 0, .12);
  --danger: #c2332f;
  --danger-soft: rgba(194, 51, 47, .09);
  --live: #d93636;
  --toast-bg: #18181b;
  --toast-text: #ffffff;
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, .06);
  --shadow: 0 1px 2px rgba(24, 24, 27, .05), 0 6px 20px -8px rgba(24, 24, 27, .13);
  --shadow-lg: 0 28px 70px -16px rgba(24, 24, 27, .3);
  --scrim: rgba(24, 24, 27, .42);
  color-scheme: light;

  --r-lg: 16px;
  --r: 12px;
  --r-sm: 10px;
  --r-xs: 6px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "SF Pro Display", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sidebar-w: 264px;
}

/* ---------- Tema escuro (pelo aparelho ou escolhido) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e10;
    --surface: #18181b;
    --surface-2: #1f1f23;
    --surface-3: #28282d;
    --field: #131315;
    --sidebar: #121214;
    --line: #27272a;
    --line-strong: #3b3b42;
    --text: #f4f4f5;
    --text-2: #b4b4bb;
    --text-3: #7c7c85;
    --accent: #fb923c;
    --accent-hover: #fdac6a;
    --accent-ink: #1a0d03;
    --accent-soft: rgba(251, 146, 60, .15);
    --accent-text: #fdba74;
    --ok: #4cc38a;
    --ok-soft: rgba(76, 195, 138, .13);
    --warn: #e7b24e;
    --warn-soft: rgba(231, 178, 78, .13);
    --danger: #f07171;
    --danger-soft: rgba(240, 113, 113, .12);
    --live: #ef4444;
    --toast-bg: #f4f4f5;
    --toast-text: #0e0e10;
    --shadow-sm: 0 1px 0 rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px -12px rgba(0, 0, 0, .6);
    --shadow-lg: 0 28px 70px -16px rgba(0, 0, 0, .75);
    --scrim: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e10;
  --surface: #18181b;
  --surface-2: #1f1f23;
  --surface-3: #28282d;
  --field: #131315;
  --sidebar: #121214;
  --line: #27272a;
  --line-strong: #3b3b42;
  --text: #f4f4f5;
  --text-2: #b4b4bb;
  --text-3: #7c7c85;
  --accent: #fb923c;
  --accent-hover: #fdac6a;
  --accent-ink: #1a0d03;
  --accent-soft: rgba(251, 146, 60, .15);
  --accent-text: #fdba74;
  --ok: #4cc38a;
  --ok-soft: rgba(76, 195, 138, .13);
  --warn: #e7b24e;
  --warn-soft: rgba(231, 178, 78, .13);
  --danger: #f07171;
  --danger-soft: rgba(240, 113, 113, .12);
  --live: #ef4444;
  --toast-bg: #f4f4f5;
  --toast-text: #0e0e10;
  --shadow-sm: 0 1px 0 rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 28px 70px -16px rgba(0, 0, 0, .75);
  --scrim: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* Logo: nome em tinta escura no claro, em branco no escuro. */
.logo.on-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo.on-dark { display: block; }
  :root:not([data-theme="light"]) .logo.on-light { display: none; }
}
:root[data-theme="dark"] .logo.on-dark { display: block; }
:root[data-theme="dark"] .logo.on-light { display: none; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color .2s ease, color .2s ease;
  scrollbar-color: var(--line-strong) transparent;
}
body.no-scroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); color: var(--text); }
h1, h2, h3, h4 { text-wrap: balance; }
p { text-wrap: pretty; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.upper { text-transform: uppercase; }
.upper::placeholder { text-transform: none; }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Marca ---------- */
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img.logo { height: 22px; width: auto; }
.brand small {
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
}

/* ---------- Estrutura: menu lateral + conteúdo ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  z-index: 30;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 22px 20px 14px; }

.nav { flex: 1; display: grid; align-content: start; gap: 18px; padding: 8px 12px 16px; }
.nav-group { display: grid; gap: 2px; }
.nav-label { font-size: 11.5px; font-weight: 600; color: var(--text-3); letter-spacing: .04em; padding: 0 12px 6px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  font-weight: 550;
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.nav-item .icon { color: var(--text-3); transition: color .15s ease; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item:hover .icon { color: var(--text-2); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 650; }
.nav-item[aria-current="page"] .icon { color: var(--accent); }
.nav-item:active { transform: translateY(1px); }

.sidebar-foot { display: grid; gap: 12px; padding: 14px 12px 16px; border-top: 1px solid var(--line); }
.user { display: flex; align-items: center; gap: 12px; padding: 4px 8px; min-width: 0; }
.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  background: linear-gradient(140deg, #f4a60f, #f51561);
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: .02em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}
.user-text { display: grid; min-width: 0; line-height: 1.3; }
.user-text strong { font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-text span { font-size: 12.5px; color: var(--text-3); }
.nav-item.logout { color: var(--text-2); }
.nav-item.logout:hover { color: var(--danger); background: var(--danger-soft); }
.nav-item.logout:hover .icon { color: var(--danger); }

.theme-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.theme-switch button {
  border: 0;
  border-radius: 7px;
  padding: 6px 4px;
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.theme-switch button:hover { color: var(--text); }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }

.content { min-width: 0; display: flex; flex-direction: column; }
.mobilebar, .nav-close, .scrim { display: none; }

.icon-only {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.icon-only:hover { background: var(--surface-3); color: var(--text); }
.icon-only.nav-close { display: none; }

.page { width: 100%; max-width: 1120px; margin: 0 auto; padding: 40px 48px 104px; }
.page.enter > * { animation: rise .34s var(--ease) both; }
.page.enter > *:nth-child(2) { animation-delay: 30ms; }
.page.enter > *:nth-child(3) { animation-delay: 60ms; }
.page.enter > *:nth-child(4) { animation-delay: 90ms; }
.page.enter > *:nth-child(n+5) { animation-delay: 120ms; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-title { font: 650 28px/1.2 var(--font-display); letter-spacing: -.022em; margin: 0 0 8px; }
.section-lead { color: var(--text-2); margin: 0 0 32px; max-width: 72ch; font-size: 15px; }

.loading { display: grid; place-items: center; min-height: 70dvh; color: var(--text-3); }

/* ---------- Telas de entrada ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100dvh; }
.auth-art {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  padding: 44px 56px;
  color: #f4f4f5;
  background:
    radial-gradient(70% 55% at 12% 8%, rgba(244, 166, 15, .26), transparent 70%),
    radial-gradient(60% 60% at 92% 96%, rgba(245, 21, 97, .26), transparent 70%),
    #111113;
  overflow: hidden;
}
.auth-art::after {
  /* grão sutil para a superfície não ficar chapada */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
.auth-art > * { position: relative; z-index: 1; }
.auth-art .logo { height: 28px; width: auto; align-self: flex-start; }
.auth-art-copy { max-width: 30rem; }
.auth-art .eyebrow { margin: 0 0 14px; font-size: 13px; font-weight: 600; letter-spacing: .06em; color: rgba(255, 255, 255, .62); }
.auth-art h2 { margin: 0 0 28px; font: 650 34px/1.15 var(--font-display); letter-spacing: -.025em; }
.auth-art ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; color: rgba(255, 255, 255, .78); }
.auth-art li { position: relative; padding-left: 22px; }
.auth-art li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 7px; height: 7px; border-radius: 2px; background: linear-gradient(140deg, #f4a60f, #f51561); }

.auth-main { display: grid; grid-template-rows: auto 1fr; padding: 24px 32px 40px; background: var(--bg); }
.auth-top { justify-self: end; width: 228px; }
.auth-card { align-self: center; justify-self: center; width: min(400px, 100%); padding: 24px 0; }
.auth-logo { display: none; margin-bottom: 28px; }
.auth-logo .brand img.logo { height: 26px; }
.auth-card h1 { font: 650 30px/1.15 var(--font-display); letter-spacing: -.024em; margin: 0 0 8px; }
.auth-card p.lead { color: var(--text-2); margin: 0 0 28px; }

/* ---------- Formulários ---------- */
.field { display: grid; gap: 6px; margin-bottom: 18px; align-content: start; }
.field > input, .field > select, .field > textarea { align-self: start; }
.field label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 12.5px; color: var(--text-3); }

input[type=text], input[type=password], input[type=url], input[type=search], input[type=number], input[type=email], select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  line-height: 1.4;
  background: var(--field);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
input:hover, select:hover, textarea:hover { border-color: var(--text-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
select {
  appearance: none;
  padding-right: 36px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b847c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
}
textarea { resize: vertical; line-height: 1.5; }
/* Campo de arquivo: o <input> fica escondido (mas acessível) dentro da caixa "Escolher arquivo ou arraste aqui". */
.file-pick {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 10px 14px;
  background: var(--field);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.file-pick:hover, .file-pick.drag { border-color: var(--accent); background: var(--accent-soft); }
.file-pick:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-pick > .icon { color: var(--accent); flex: none; }
.file-pick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.file-text { display: grid; gap: 1px; min-width: 0; font-size: 14px; }
.file-text strong { font-weight: 650; color: var(--text); }
.file-or { color: var(--text-3); font-weight: 400; }
.file-name { color: var(--text-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pick.has-file { border-style: solid; }
.file-pick.has-file .file-name { color: var(--text); font-weight: 600; }
/* Caixas e opções desenhadas aqui (o padrão do navegador ganhava um contorno quadrado em volta da bolinha). */
input[type=checkbox], input[type=radio] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  flex: none;
  margin: 0;
  display: inline-grid;
  place-content: center;
  border: 1.5px solid var(--line-strong);
  background: var(--field);
  cursor: pointer;
  transition: border-color .15s var(--ease), background-color .15s var(--ease), box-shadow .15s var(--ease);
}
input[type=radio] { border-radius: 50%; }
input[type=checkbox] { border-radius: 5px; }
input[type=radio]::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(0);
  transition: transform .15s var(--ease);
}
input[type=checkbox]::before {
  content: "";
  width: 10px;
  height: 10px;
  background: var(--accent-ink);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  transform: scale(0);
  transition: transform .15s var(--ease);
}
input[type=radio]:checked { border-color: var(--accent); }
input[type=checkbox]:checked { border-color: var(--accent); background: var(--accent); }
input[type=radio]:checked::before, input[type=checkbox]:checked::before { transform: scale(1); }
input[type=checkbox]:hover, input[type=radio]:hover { border-color: var(--accent); }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
input[type=checkbox]:disabled, input[type=radio]:disabled { opacity: .5; cursor: default; }
.check { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 14px; margin: 4px 0 14px; cursor: pointer; }
.radios { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin: 4px 0 10px; }
.radios .check { margin: 0; }

.error { color: var(--danger); font-size: 13.5px; margin: 4px 0 12px; min-height: 1em; }
.error:empty { margin: 0; min-height: 0; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  /* Sem sombra externa: todo botão ocupa exatamente a sua caixa (o laranja não parece maior que os outros). */
  box-shadow: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .08s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: transparent; }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 32px; min-height: 32px; padding: 0; font-size: 16px; }
.btn.block { width: 100%; min-height: 44px; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn.on { background: var(--ok-soft); border-color: transparent; color: var(--ok); cursor: default; box-shadow: none; }
.btn.waiting { background: var(--warn-soft); border-color: transparent; color: var(--warn); cursor: default; box-shadow: none; }
button.link { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font: inherit; font-weight: 600; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions.start { justify-content: flex-start; }

/* ---------- Cartões ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 6px; font: 650 16.5px/1.3 var(--font-display); letter-spacing: -.01em; }
.card h3 + form, .card h3 + .row-form, .card h3 + .grid-form { margin-top: 16px; }
.card .explain, .explain { margin: 0 0 16px; color: var(--text-2); font-size: 14px; max-width: 78ch; }
.card .status { margin: 0 0 16px; padding: 10px 14px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--text-2); font-size: 14px; }
.card .status.ok { background: var(--ok-soft); color: var(--ok); }
.card > form > .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.code-card {
  display: flex;
  align-items: center;
  gap: 16px 24px;
  flex-wrap: wrap;
  background: radial-gradient(120% 160% at 100% 0%, var(--accent-soft), transparent 55%), var(--surface);
}
.code-card .label { font-size: 13px; color: var(--text-2); font-weight: 600; margin-bottom: 2px; }
.code-card .code { font: 700 30px/1.1 var(--mono); letter-spacing: .12em; color: var(--text); }
.code-card .explain { flex: 1 1 280px; margin: 0; }
.code-card .web-link { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.code-card .web-link-main { min-width: 0; }
.code-card .web-link a { font: 600 14px/1.4 var(--mono); color: var(--accent-text); word-break: break-all; }

/* Aparelhos: filtro por tipo e link direto do player web em cada cartão */
.type-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.type-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: 14px; cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease); }
.type-chip:hover { color: var(--text); background: var(--surface-2); }
.type-chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.type-chip .count { font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.type-chip.on .count { background: rgba(255, 255, 255, .22); color: inherit; }
.dev-link { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 12px; padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: var(--r-sm); background: var(--surface-2); }
.dev-link-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 320px; }
.dev-link-url { font-size: 13px; color: var(--accent-text); word-break: break-all; }
.dev-link-actions { display: flex; gap: 8px; }
.dev-hint { flex: 1 1 100%; margin: 0; font-size: 12.5px; color: var(--text-3); }

.row-form { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 12px 14px; align-items: end; }
.row-form .field { margin: 0; }
.row-form.four { grid-template-columns: 1fr 1fr 1.4fr auto; }
.row-form.code-form { grid-template-columns: minmax(0, 320px) auto; justify-content: start; }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; align-items: start; }
.grid-form .full { grid-column: 1 / -1; }

.owner-picker { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.owner-picker label { font-weight: 600; color: var(--text-2); font-size: 14px; }
.owner-picker select { width: auto; min-width: 260px; }

/* ---------- Listas ---------- */
.list {
  display: grid;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
}
.item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  transition: background-color .15s ease;
}
.item:first-child { border-top: 0; }
.item:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.item .order { display: grid; gap: 4px; }
.item .main { min-width: 0; }
.item .title { font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item .sub { color: var(--text-2); font: 13px/1.45 var(--mono); overflow-wrap: anywhere; margin-top: 2px; }
.item .meta { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.item .client { color: var(--text); font-size: 14px; margin-top: 2px; }
.item .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.item.off > .main, .item.off > .order { opacity: .55; }
/* Aparelho desligado é o normal: o selo Offline e o ponto cinza já dizem; botões e acessos ficam legíveis. */
.item.device.off > .main { opacity: 1; }
.item.editing { grid-template-columns: 1fr; background: var(--surface-2); }
.item.editing .title { font-weight: 650; margin-bottom: 14px; }
.item.two-col { grid-template-columns: minmax(0, 1fr) auto; }
.item.device .title { font-size: 15px; }
.item ul.notes { margin: 8px 0 0; padding-left: 18px; color: var(--text-2); font-size: 14px; }
.item a.btn { text-decoration: none; }
.list-title { font-size: 13px; font-weight: 650; color: var(--text-2); letter-spacing: .02em; margin: 28px 0 10px; }
/* Aparelhos: cada um no seu cartão, com espaço entre eles (nada de cartões colados). */
.list.devices { gap: 16px; background: none; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
.list.devices > .item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.list.devices > .item:hover { background: var(--surface); border-color: var(--line-strong); }
/* Desconectados minimizados ficam mais juntos (uma lista de linhas). */
.list.devices > .item.mini + .item.mini { margin-top: -8px; }

.empty {
  text-align: center;
  color: var(--text-2);
  padding: 44px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.empty::before {
  content: "";
  display: block;
  width: 40px;
  height: 40px;
  margin: 0 auto 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* ---------- Selos ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  padding: 1px 8px;
  border-radius: var(--r-xs);
  white-space: nowrap;
}
.pill.on { background: var(--ok-soft); color: var(--ok); }
.pill.off { background: var(--surface-3); color: var(--text-3); }
.pill.on::before, .pill.off::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.admin { background: var(--accent-soft); color: var(--accent-text); }
.pill.pending { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.code { background: var(--surface-3); color: var(--text); font-family: var(--mono); letter-spacing: .08em; }
.pill.version { background: var(--surface-3); color: var(--text-2); }
.pill.version.old { background: var(--warn-soft); color: var(--warn); }
.pill.watch { color: #fff; }
.pill.watch.live { background: var(--live); }
.pill.watch.movie { background: var(--accent-soft); color: var(--accent-text); }
.pill.watch.series { background: var(--warn-soft); color: var(--warn); }

/* ---------- Aparelhos ---------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  display: grid;
  gap: 4px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.stat strong { font: 650 30px/1.1 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--text-2); font-size: 13.5px; }
.stat:nth-child(1) strong { color: var(--ok); }
.stat:nth-child(2) strong { color: var(--accent-text); }
.field.search { margin: 8px 0 4px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.watching { display: flex; align-items: center; gap: 8px; margin: 6px 0 4px; flex-wrap: wrap; font-size: 14px; }
.watching .what { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.watching .detail { font-weight: 400; color: var(--text-2); }
.watching .when { color: var(--text-3); font-size: 13px; }
.watching.idle { color: var(--text-3); font-size: 13px; }
/* Cartão do aparelho: cabeçalho com ações, "Agora" e acessos lado a lado, dados com rótulo, último erro. */
.item.device { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 18px 20px; }
.dev-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.dev-id { display: flex; align-items: flex-start; gap: 12px; min-width: 0; flex: 1 1 320px; }
.dev-id > .dot { margin-top: 8px; }
.dev-name { min-width: 0; display: grid; gap: 2px; }
.dev-label-name { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.dev-head .actions { flex: 0 1 auto; justify-content: flex-end; }
.dev-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 12px; align-items: start; }
.dev-grid > :only-child { grid-column: 1 / -1; }
.dev-panel, .dev-grid > .accesses {
  margin: 0;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  display: grid;
  gap: 8px;
  align-content: start;
}
.dev-label { font-size: 12px; font-weight: 650; color: var(--text-3); letter-spacing: .02em; }
.dev-panel .watching { margin: 0; }
.dev-login { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13.5px; color: var(--text-2); }
.dev-k { font-size: 12.5px; color: var(--text-3); }
.dev-panel .provision { margin: 2px 0 0; }
.dev-facts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0; padding-top: 12px; border-top: 1px dashed var(--line); }
.dev-facts > div { display: flex; align-items: baseline; gap: 6px; min-width: 0; max-width: 100%; }
.dev-facts dt { font-size: 12px; color: var(--text-3); font-weight: 600; }
.dev-facts dd { margin: 0; font-size: 13px; color: var(--text-2); max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-error { margin: 0; padding: 9px 12px; border-radius: var(--r-sm); background: var(--danger-soft); color: var(--danger); font-size: 13px; overflow-wrap: anywhere; }
.device-error strong { font-weight: 650; margin-right: 8px; }
.device-error-text { color: var(--text-2); }
.device-error summary { cursor: pointer; list-style-position: inside; }
.device-error pre { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 11.5px/1.5 var(--mono); color: var(--text-2); max-height: 260px; overflow: auto; }
.icon.small { width: 16px; height: 16px; }
.provision { margin: 8px 0 2px; font-size: 13px; padding: 8px 12px; border-radius: var(--r-sm); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.provision.pending { background: var(--warn-soft); color: var(--warn); }
.provision.ok { background: var(--ok-soft); color: var(--ok); }
.provision.bad { background: var(--danger-soft); color: var(--danger); }

.accesses { margin: 0; }

/* Cartão do aparelho: "Agora" sempre à vista; o resto abre pelos botões (uma parte por vez). */
.dev-now { margin: 0; }
.dev-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
/* Desconectado minimizado: uma linha; clicar abre o cartão inteiro. */
.item.device.mini { padding: 0; }
.dev-mini {
  display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; width: 100%; min-width: 0;
  padding: 12px 20px; background: none; border: 0; border-radius: inherit; color: inherit; font: inherit;
  text-align: left; cursor: pointer;
}
.dev-mini:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.dev-mini:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dev-mini-id { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.dev-mini .dev-label-name { font-weight: 650; font-size: 14px; }
.dev-mini-meta { flex: 1 1 220px; min-width: 0; color: var(--text-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-mini-open { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-size: 13px; font-weight: 600; }
.dev-mini-open .icon, .dev-min .icon { width: 16px; height: 16px; }
.dev-min { display: inline-flex; align-items: center; gap: 4px; }
.dev-tab { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: 13px; cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease); }
.dev-tab:hover { color: var(--text); border-color: var(--line-strong); }
.dev-tab.on { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); }
.dev-tab.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.dev-tab.danger.on { background: var(--danger-soft); }
.dev-pane > .accesses, .dev-pane > .browsers, .dev-pane > .dev-facts {
  padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); display: grid; gap: 8px; margin: 0;
}
.dev-pane > .dev-facts { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.dev-pane > .dev-link { margin: 0; }
.access-cred { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; }
.access-cred .mono { font: 600 13px/1.4 var(--mono); color: var(--text); overflow-wrap: anywhere; }
.access-pass.none { color: var(--text-3); font-weight: 500; font-family: inherit; }
.browser-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); flex-wrap: wrap; }
.browser-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.browser-meta { margin-left: auto; font-size: 12.5px; color: var(--text-3); }
.access { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); }
.access.current { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.access-main { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.access-server { font-weight: 650; font-size: 14px; }
.access-user { font: 13px/1.4 var(--mono); color: var(--text-2); overflow-wrap: anywhere; }
.access-meta { font-size: 12px; color: var(--text-3); }
.access-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.access-actions .btn { min-width: 76px; }
.access-actions .pill.on { min-width: 76px; justify-content: center; padding: 5px 10px; font-size: 12.5px; }
.access-actions .btn.icon { min-width: 32px; width: 32px; padding: 0; }

/* ---------- Mensagens ---------- */
.picker { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; margin-bottom: 10px; background: var(--surface-2); }
.picker-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.picker-bar input { flex: 1 1 220px; width: auto; }
.pick-list { display: grid; gap: 4px; max-height: 340px; overflow: auto; }
.pick { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); cursor: pointer; transition: border-color .15s ease; }
.pick:hover { border-color: var(--line-strong); }
.pick-main { display: grid; min-width: 0; flex: 1; }
.pick-main span { color: var(--text-3); font-size: 13px; overflow-wrap: anywhere; }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 4px; }
/* Mensagens enviadas: por dia, com a barrinha de quantos já leram e o apagar discreto. */
.msg-day-title { font-size: 12px; font-weight: 650; color: var(--text-3); text-transform: none; margin: 18px 0 8px; }
.msg-day:first-child .msg-day-title { margin-top: 0; }
.msg-day .list { margin-bottom: 0; }
.msg-read { height: 4px; border-radius: 4px; background: var(--surface-3); margin-top: 8px; max-width: 260px; overflow: hidden; }
.msg-read span { display: block; height: 100%; background: var(--ok); border-radius: inherit; }
.msg-item .icon-btn { width: 34px; height: 34px; }
.msg-item .icon-btn .icon { width: 18px; height: 18px; }
.icon-btn.danger-hover:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }
.msg-more { display: flex; margin: 14px auto 0; }
/* Quadrinhos de status (Integrações → Futebol). */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.tile { display: grid; gap: 2px; align-content: start; padding: 12px 14px; background: var(--surface-2); border-radius: var(--r-sm); min-width: 0; }
.tile-label { font-size: 12px; color: var(--text-3); font-weight: 600; }
.tile strong { font-size: 17px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-sub { font-size: 12.5px; color: var(--text-2); }
.tile-bar { display: block; height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.tile-bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
/* "Saiba mais" recolhido. */
.more-info { margin-top: 8px; }
.more-info > summary { cursor: pointer; color: var(--text-2); font-size: 13.5px; font-weight: 600; width: fit-content; }
.more-info > summary:hover { color: var(--text); }
.more-info[open] > summary { margin-bottom: 8px; }
.more-info p { margin: 6px 0; }
.more-info.tech { margin: 4px 0 18px; padding: 10px 14px; background: var(--surface-2); border-radius: var(--r-sm); }
.more-info.tech .actions { margin-top: 10px; }
@media (max-width: 960px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Arrastar para reordenar (servidores e campeonatos em destaque). */
.drag-handle { display: inline-grid; place-items: center; width: 24px; height: 32px; color: var(--text-3); cursor: grab; flex: none; border-radius: 6px; }
.drag-handle:hover { color: var(--text); background: var(--surface-3); }
.drag-handle .icon { width: 18px; height: 18px; stroke-width: 3; }
.dragging { opacity: .45; }
.drop-before { box-shadow: inset 0 3px 0 var(--accent); }
.drop-after { box-shadow: inset 0 -3px 0 var(--accent); }
.item .order { grid-template-columns: auto auto; grid-template-rows: auto auto; align-items: center; }
.item .order > .drag-handle { grid-row: 1 / span 2; }
.league-tools .icon-btn { width: 32px; height: 32px; color: var(--text-2); font-size: 16px; }
@media (hover: none), (max-width: 720px) { .drag-handle { display: none; } }

/* ---------- Atualizações ---------- */
.upload-row { display: flex; align-items: center; gap: 12px; margin: 6px 0; }
progress.upload { flex: 1 1 auto; height: 8px; accent-color: var(--accent); }

/* ---------- Minha conta: renovação ---------- */
.renew-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; }
.renew-preview { display: block; width: 100%; max-height: 260px; object-fit: contain; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 12px; }
.renew-preview.empty { display: grid; place-items: center; height: 160px; color: var(--text-3); font-size: 13px; padding: 0; }
.renew-preview.empty::before { content: none; }

/* ---------- Minha conta: logo de abertura ---------- */
.splash-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.splash-stage {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  border-radius: var(--r);
  background: #000;
  border: 1px solid var(--line);
  overflow: hidden;
}
/* Mesmo tamanho do app: até metade da largura e 40% da altura da tela. */
.splash-stage img { max-width: 50%; max-height: 40%; object-fit: contain; }
.splash-stage img.splash-default { max-width: 38%; opacity: .9; }
.splash-caption { margin: 8px 0 0; font-size: 12.5px; color: var(--text-3); }
.spec-list { margin: 0 0 18px; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 14px; color: var(--text-2); }
.spec-list li { position: relative; padding-left: 16px; }
.spec-list li::before { content: ""; position: absolute; left: 0; top: .6em; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); }
.spec-list strong { color: var(--text); font-weight: 650; }
.splash-notes { display: grid; gap: 6px; }
.splash-notes:empty { display: none; }
.splash-note { margin: 0; padding: 8px 12px; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--warn); font-size: 13.5px; }
.splash-note.bad { background: var(--danger-soft); color: var(--danger); }
.splash-notes + .error { margin-top: 10px; }
@media (max-width: 860px) { .splash-grid { grid-template-columns: 1fr; } }

/* ---------- Integrações: seletor de campeonatos ---------- */
.sub-title { margin: 24px 0 10px; font: 650 15px/1.3 var(--font-display); }
.league-picker { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.picker-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.picker-head .sub-title { margin: 0; }
.picker-count { font-size: 12.5px; font-weight: 600; color: var(--text-3); white-space: nowrap; }
.picker-hint { margin: 4px 0 14px; font-size: 13.5px; color: var(--text-2); }
.picker-empty { margin: 0; font-size: 13.5px; color: var(--text-3); }
.picker-toggle { margin-top: 12px; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-3);
  font-size: 14px;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.icon-btn:disabled { opacity: .3; cursor: default; }

.league-rows { list-style: none; margin: 0; padding: 0; display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.league-rows li { display: flex; align-items: center; gap: 12px; padding: 7px 8px 7px 12px; border-top: 1px solid var(--line); }
.league-rows li:first-child { border-top: 0; }
.league-pos { display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 7px; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.league-name { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; font-size: 14px; font-weight: 600; }
.league-name small { font-size: 12.5px; font-weight: 400; color: var(--text-3); }
.league-tools { display: flex; gap: 2px; }

.league-chosen { display: flex; flex-wrap: wrap; gap: 6px; }
.league-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 2px 2px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; font-weight: 550; }

.picker-add { display: grid; gap: 12px; margin-top: 12px; padding: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); }
.picker-add[hidden] { display: none; }
.picker-results { display: grid; gap: 8px; }
.picker-k { margin: 0; font-size: 12px; font-weight: 650; color: var(--text-3); }
.league-suggest { display: flex; flex-wrap: wrap; gap: 6px; }
.suggest {
  padding: 5px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.suggest:hover { border-style: solid; border-color: var(--accent); color: var(--text); background: var(--surface); }
.league-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px; max-height: 330px; overflow: auto; padding-right: 2px; }
.league-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s ease;
}
.league-result:hover:not(:disabled) { border-color: var(--line-strong); }
.league-result-name { display: grid; min-width: 0; font-size: 13.5px; font-weight: 600; }
.league-result-name small { font-size: 12px; font-weight: 400; color: var(--text-3); }
.league-result-mark { font-size: 12px; font-weight: 650; color: var(--accent-text); white-space: nowrap; }
.league-result.on { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.league-result.on .league-result-mark { color: var(--ok); }
.league-result:disabled { opacity: .55; cursor: default; }
.league-result:disabled .league-result-mark { color: var(--text-3); }
.picker-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.picker-dirty { font-size: 12.5px; font-weight: 600; color: var(--warn); }
.picker-dirty::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: currentColor; vertical-align: middle; }

/* ---------- Cabeçalho com ação, barra de busca, revendedores ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head > div { flex: 1 1 360px; min-width: 0; }
.page-head .section-lead { margin-bottom: 0; }
.page-head > .btn { flex: none; margin-top: 2px; }
.toolbar { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.search-box { position: relative; flex: 1 1 300px; max-width: 520px; }
.search-box .icon { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-box input { padding-left: 38px; }
.toolbar-count { font-size: 13px; font-weight: 600; color: var(--text-3); white-space: nowrap; }
.item.reseller-row { grid-template-columns: auto minmax(0, 1fr) auto; }
.item.reseller-row .meta { margin-top: 3px; }
.item.reseller-row .meta .mono { color: var(--text-2); letter-spacing: .04em; }
.resellers-none { margin-top: 12px; }
dialog.modal.wide { width: min(680px, calc(100vw - 32px)); }
.dlg-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 2px 0 20px; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; color: var(--text-2); }
.dlg-summary .avatar { width: 34px; height: 34px; font-size: 12.5px; }
.dlg-summary strong { color: var(--text); font-weight: 650; }
.dlg-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.dlg-section h4 { margin: 0 0 10px; font-size: 14px; font-weight: 650; }
.dlg-section .hint { margin: 10px 0 0; }
@media (max-width: 720px) {
  .page-head > .btn { width: 100%; }
  .item.reseller-row { grid-template-columns: auto minmax(0, 1fr); }
  .item.reseller-row .actions { grid-column: 1 / -1; }
}

/* ---------- Janela (dialog) ---------- */
dialog.modal {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 24px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}
dialog.modal[open] { animation: pop .22s var(--ease); }
dialog.modal::backdrop { background: var(--scrim); backdrop-filter: blur(3px); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.modal-head h3 { margin: 0; font: 650 18px/1.3 var(--font-display); letter-spacing: -.01em; }
dialog .explain { color: var(--text-2); font-size: 14px; margin: 0 0 16px; }
dialog .hint { color: var(--text-3); font-size: 12.5px; margin: 0 0 8px; }
dialog .actions { display: flex; gap: 8px; flex-wrap: wrap; }
dialog .warn, .warn { background: var(--warn-soft); color: var(--warn); border-radius: var(--r-sm); padding: 10px 14px; font-size: 13.5px; margin: 0 0 16px; }

/* ---------- Aviso flutuante ---------- */
#toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  max-width: min(420px, calc(100vw - 40px));
  padding: 13px 18px 13px 38px;
  border-radius: var(--r);
  background: var(--toast-bg);
  color: var(--toast-text);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
}
#toast::before { content: ""; position: absolute; left: 16px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--ok); }
#toast.bad::before { background: var(--danger); }
#toast.show { animation: toast-in .3s var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Telas menores ---------- */
@media (max-width: 1100px) {
  .page { padding: 32px 32px 96px; }
}

@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    transform: translateX(-104%);
    transition: transform .28s var(--ease);
    box-shadow: var(--shadow-lg);
    z-index: 50;
  }
  .layout.nav-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .25s ease; }
  .layout.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .icon-only.nav-close { display: inline-grid; }
  .mobilebar {
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 20;
    height: 58px;
    padding: 0 12px;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .mobilebar .brand img.logo { height: 20px; }
  .mobilebar-title { margin-left: auto; padding-right: 6px; font-weight: 650; font-size: 14px; color: var(--text-2); }
  .page { padding: 24px 20px 88px; }
  .section-title { font-size: 24px; }
  .section-lead { margin-bottom: 24px; }

  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .auth-logo { display: block; }
  .auth-main { padding: 20px 20px 32px; }
}

@media (max-width: 960px) {
  .dev-grid { grid-template-columns: minmax(0, 1fr); }
}

/* "Mais" do cartão do aparelho: só no celular (no computador cabem todos os botões). */
.more-actions { display: none; position: relative; }
.more-actions > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.more-actions > summary::-webkit-details-marker { display: none; }
.more-actions > summary .icon { width: 18px; height: 18px; }
.more-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 200px; display: grid; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg);
}
.more-item { text-align: left; padding: 10px 12px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.more-item:hover { background: var(--surface-2); }
.more-item.danger { color: var(--danger); }
/* Cartão do código recolhido (celular). */
.code-fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.code-fold > summary::-webkit-details-marker { display: none; }
.code-fold > summary h3 { margin: 0; }
.code-fold > summary::after { content: ""; width: 9px; height: 9px; flex: none; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg); margin: -4px 4px 0 0; transition: transform .15s ease; }
.code-fold[open] > summary::after { transform: rotate(225deg); margin-top: 4px; }
.code-fold[open] > summary { margin-bottom: 12px; }

@media (max-width: 720px) {
  .row-form, .row-form.four, .row-form.code-form, .grid-form { grid-template-columns: 1fr; }
  .dev-head .actions > .btn:not(:first-child) { display: none; }
  .dev-head .actions > .more-actions { display: block; }
  .type-filter { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -16px; padding-right: 16px; }
  .type-filter::-webkit-scrollbar { display: none; }
  .type-chip { flex: none; }
  .mobilebar-title { opacity: 0; transition: opacity .2s ease; }
  body.scrolled .mobilebar-title { opacity: 1; }
  .dev-mini { padding: 12px 16px; }
  .item.device { padding: 16px; }
  .dev-head .actions { justify-content: flex-start; width: 100%; }
  .row-form .btn { width: 100%; }
  .card { padding: 20px; }
  .item { grid-template-columns: minmax(0, 1fr); padding: 14px 16px; }
  .item.two-col { grid-template-columns: minmax(0, 1fr); }
  .item .order { display: flex; }
  .item .actions { justify-content: flex-start; }
  .code-card .code { font-size: 26px; }
  .owner-picker select { width: 100%; min-width: 0; }
  .renew-grid { grid-template-columns: 1fr; }
  .auth-top { width: 100%; }
}

@media (max-width: 560px) {
  .stats { gap: 8px; }
  .stat { padding: 12px; }
  .stat strong { font-size: 22px; }
  .stat span { font-size: 12px; }
  .access { flex-wrap: wrap; }
  .access-actions { width: 100%; justify-content: flex-end; }
  #toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

/* Atualizações: para quem vai a versão (todos ou aparelhos escolhidos com busca). */
.audience { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 6px; margin: 4px 0 0; min-width: 0; }
.audience legend { padding: 0 6px; font-size: 13px; font-weight: 650; color: var(--text-2); }
.audience .check { margin: 2px 0 10px; }
.audience-picker { margin: 4px 0 12px; }
.device-picker { display: grid; gap: 10px; min-width: 0; }
.device-picker .search-box { max-width: none; }
.device-results { display: grid; grid-template-columns: minmax(0, 1fr); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); max-height: 320px; overflow: auto; }
.device-results-hint { margin: 0; padding: 12px 14px; font-size: 13.5px; color: var(--text-3); }
.device-result { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
.device-result:first-child { border-top: 0; }
.device-result.on { background: var(--accent-soft); }
.device-result-main { flex: 1; min-width: 0; }
.device-result-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-result-meta { font-size: 12.5px; color: var(--text-3); margin-top: 2px; overflow-wrap: anywhere; }
.device-result-warn { font-size: 12.5px; color: var(--warn); margin-top: 4px; }
.device-result .btn { flex: none; min-width: 84px; }
.picked-box { display: grid; gap: 8px; }
.picked-count { font-size: 13px; font-weight: 600; color: var(--text-2); }
.picked { display: flex; flex-wrap: wrap; gap: 8px; }
.picked:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px 5px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--text); max-width: 100%; }
.chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip small { color: var(--text-3); font-size: 12px; }
.chip.ok { background: var(--ok-soft); border-color: transparent; }
.chip.ok small { color: var(--ok); }
.chip.muted { color: var(--text-3); padding-right: 12px; }
.chip-x { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text-3); cursor: pointer; }
.chip-x:hover { background: var(--danger-soft); color: var(--danger); }
.release-audience { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; font-size: 13.5px; color: var(--text-2); }
.release-audience .chip { padding-right: 12px; }
.release-audience-label { font-weight: 600; color: var(--text-3); }
.item.release { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.item.release > .actions { justify-content: flex-start; padding-top: 12px; border-top: 1px dashed var(--line); }
.item.release .notes { margin-top: 10px; }
.chip { white-space: nowrap; }
/* Celular: o texto usa a largura toda e o botão vai para a linha de baixo. */
@media (max-width: 560px) {
  .device-result { flex-wrap: wrap; row-gap: 8px; }
  .device-result-main { flex: 1 1 calc(100% - 34px); }
  .device-result .btn { margin-left: 22px; }
}

/* Atualizações: APK hospedado (link para instalar à mão). */
.link-row { display: flex; align-items: center; gap: 10px; min-width: 0; margin-top: 8px; }
.link-url { flex: 1; min-width: 0; padding: 9px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); font: 13px/1.4 var(--mono); color: var(--text); overflow-wrap: anywhere; user-select: all; }
.link-row .btn { flex: none; }
.link-box { margin-top: 18px; padding: 14px 16px; border-radius: var(--r); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.link-box-label { font-size: 13px; font-weight: 650; color: var(--accent-text); }
.link-box-label span { font-weight: 500; color: var(--text-2); }
.hosted-list { display: grid; margin-top: 18px; border-top: 1px solid var(--line); }
.hosted-item { padding: 14px 0; border-bottom: 1px solid var(--line); display: grid; gap: 2px; }
.hosted-item .title { font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.hosted-item .sub { color: var(--text-3); font-size: 13px; }
.hosted-item .actions { margin-top: 10px; }
.copy-buffer { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
