/*
 * css/app.css — Visual do sistema inteiro (tema escuro).
 *
 * Organização:
 *   1. Variáveis de cor e fonte (:root) — para mudar a identidade visual, altere aqui.
 *   2. Login · Casca (menu lateral, cabeçalho) · Componentes (botões, campos, cartões, tabelas, etiquetas, avatares)
 *   3. Janelas e avisos · Gráficos · Telas (players, aulas, ranges, chat, chamadas)
 *   4. Telas médias (até 1100px) e celular (até 760px)
 *   5. Ajustes adicionados nas versões seguintes (final do arquivo)
 *
 * Convenções de cor: verde (--felt) = positivo/ação principal · vermelho (--red) = negativo/erro ·
 * dourado (--gold) = destaque/chamadas · azul (--blue) = informação.
 */

/* ---------- 1. Variáveis (cores, raio, sombra, fonte) ---------- */
:root {
  --bg: #0e1113;
  --bg2: #13171a;
  --panel: #181d21;
  --panel2: #1e2429;
  --line: #262d33;
  --line2: #323b42;
  --text: #e6e9ec;
  --muted: #8a949d;
  --dim: #5f6a73;
  --felt: #2fbf71;
  --felt-d: #1f8a50;
  --felt-bg: rgba(47, 191, 113, .12);
  --gold: #e0b252;
  --gold-bg: rgba(224, 178, 82, .13);
  --red: #e5534b;
  --red-bg: rgba(229, 83, 75, .13);
  --blue: #4c8dff;
  --blue-bg: rgba(76, 141, 255, .13);
  --violet: #a77bf0;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--felt); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--felt); }
.neg { color: var(--red); }
.hidden { display: none !important; }

/* ---------- login ---------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1000px 600px at 70% -10%, rgba(47,191,113,.14), transparent 60%),
              radial-gradient(800px 500px at -10% 110%, rgba(224,178,82,.08), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 32px; box-shadow: var(--shadow); }
.login-card .brand { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.login-card .brand img { width: 44px; height: 44px; }
.login-card h1 { font-size: 20px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.login-card form { display: grid; gap: 14px; }
.login-err { color: var(--red); font-size: 13px; min-height: 18px; }

/* ---------- Casca: menu lateral (.side), cabeçalho (.top) e área da página (.page) ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; height: 100vh; }
.side { background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side .brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px 14px; }
.side .brand img { width: 32px; height: 32px; }
.side .brand b { font-size: 14px; display: block; line-height: 1.2; }
.side .brand small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.nav { padding: 6px 10px; display: grid; gap: 2px; overflow: auto; flex: 1; align-content: start; }
.nav .grp { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--muted); position: relative; }
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.on { background: var(--felt-bg); color: var(--text); }
.nav a.on svg { color: var(--felt); }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav .badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; border-radius: 10px; padding: 0 6px; min-width: 18px; text-align: center; line-height: 18px; }
.nav .live { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px var(--red-bg); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px transparent; } }
.me { border-top: 1px solid var(--line); padding: 12px; display: flex; gap: 10px; align-items: center; }
.me .who { flex: 1; min-width: 0; }
.me .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who small { color: var(--muted); }

.main { display: flex; overflow: hidden; flex-direction: column; min-width: 0; min-height: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 16px 28px; border-bottom: 1px solid var(--line); min-height: 66px; }
.top h1 { font-size: 19px; flex: 1; }
.top .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page { padding: 24px 28px 40px; overflow: auto; flex: 1; min-height: 0; }

/* ---------- Componentes reutilizáveis: botões (.btn), campos (.in), cartões (.card), indicadores (.kpi),
   tabelas (table.t), etiquetas (.tag), avatares (.av), barra de filtros (.toolbar), estado vazio (.empty) ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line2); background: var(--panel2); padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #46515a; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--felt); border-color: var(--felt); color: #06210f; font-weight: 600; }
.btn.primary:hover { background: #38d07f; }
.btn.danger { color: var(--red); }
.btn.danger.solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel2); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 6px; display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--panel2); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }

label.f { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.in, select.in, textarea.in { width: 100%; background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px; padding: 9px 11px; outline: none; color: var(--text); }
.in:focus { border-color: var(--felt); box-shadow: 0 0 0 3px var(--felt-bg); }
textarea.in { resize: vertical; min-height: 90px; line-height: 1.5; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.span2 { grid-column: span 2; }
.span3 { grid-column: 1 / -1; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card .hd { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card .hd h3 { font-size: 14px; flex: 1; }
.card .bd { padding: 18px; }
.cards { display: grid; gap: 18px; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cols-21 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.cols-12 { display: grid; grid-template-columns: 1fr 2fr; gap: 18px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi small { color: var(--muted); font-size: 12px; display: block; }
.kpi b { font-size: 22px; font-weight: 600; display: block; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .foot { color: var(--dim); font-size: 12px; margin-top: 4px; }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover { background: var(--panel2); }
table.t td.r, table.t th.r { text-align: right; }
.table-wrap { overflow: auto; }

.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 8px; border-radius: 20px; background: var(--panel2); color: var(--muted); white-space: nowrap; }
.tag.green { background: var(--felt-bg); color: var(--felt); }
.tag.red { background: var(--red-bg); color: var(--red); }
.tag.gold { background: var(--gold-bg); color: var(--gold); }
button.tag-toggle { border: 1px solid transparent; cursor: pointer; font: inherit; font-size: 12px; }
button.tag-toggle:hover { border-color: var(--line2); }
.tag.blue { background: var(--blue-bg); color: var(--blue); }

.av { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; position: relative; color: #0e1113; }
.av.lg { width: 56px; height: 56px; font-size: 19px; }
.av .dot { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--felt); border: 2px solid var(--bg2); }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person b { font-weight: 500; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .in { width: auto; }
.toolbar .grow { flex: 1; }
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 6px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--panel2); color: var(--text); }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg { width: 36px; height: 36px; color: var(--dim); margin-bottom: 10px; }
.empty b { display: block; color: var(--text); margin-bottom: 4px; font-weight: 500; }

/* Janelas (modal) e avisos no canto da tela (toast) */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal.wide { max-width: 860px; }
.modal .hd { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal .hd h2 { font-size: 16px; flex: 1; }
.modal .bd { padding: 20px 22px; overflow: auto; display: grid; gap: 14px; }
.modal .ft { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.modal .err { color: var(--red); font-size: 13px; margin-right: auto; align-self: center; }

#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 80; }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--felt); padding: 11px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 360px; animation: fade .2s; display: flex; gap: 10px; align-items: center; }
.toast.err { border-left-color: var(--red); }
.toast.call { border-left-color: var(--gold); }

/* Gráficos: altura fixa da área do Chart.js */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }

/* Ficha do player: cabeçalho, dados (.kv), abas (.tabs) e avaliações (.note) */
.profile-head { display: flex; gap: 16px; align-items: center; margin-bottom: 20px; }
.profile-head h2 { font-size: 20px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { border: 0; background: none; padding: 10px 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--text); border-color: var(--felt); }

.note { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--bg2); }
.note + .note { margin-top: 10px; }
.note .meta { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.note p { margin: 0; white-space: pre-wrap; line-height: 1.55; }
.stars { color: var(--gold); letter-spacing: 1px; }

/* Aulas: grade de cards, miniatura e player de vídeo 16:9 */
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.lesson-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; display: flex; flex-direction: column; transition: border-color .15s, transform .15s; }
.lesson-card:hover { border-color: var(--line2); transform: translateY(-2px); }
.lesson-thumb { aspect-ratio: 16/9; background: linear-gradient(135deg, #123d2a, #0e1113 70%); display: grid; place-items: center; position: relative; }
.lesson-thumb svg { width: 42px; height: 42px; color: rgba(255,255,255,.85); }
.lesson-thumb .tag { position: absolute; left: 10px; top: 10px; background: rgba(0,0,0,.55); color: #fff; }
.lesson-card .bd { padding: 14px 16px; display: grid; gap: 6px; }
.lesson-card h3 { font-size: 14px; line-height: 1.35; }
.lesson-card .meta { color: var(--muted); font-size: 12px; }
.video-wrap { background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; }
.video-wrap video, .video-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.prose { line-height: 1.65; white-space: pre-wrap; color: #cfd5da; }

/* Tabelas de range: lista lateral, matriz 13×13 (.matrix .c), legenda e pincéis do editor */
.range-layout { display: grid; grid-template-columns: 260px 1fr; gap: 18px; align-items: start; }
.range-list { display: grid; gap: 2px; }
.range-list .cat { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; padding: 12px 10px 4px; }
.range-list button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; color: var(--muted); cursor: pointer; display: flex; gap: 8px; align-items: center; }
.range-list button:hover { background: var(--panel); color: var(--text); }
.range-list button.on { background: var(--felt-bg); color: var(--text); }
.range-list .pos { margin-left: auto; font-size: 11px; color: var(--dim); }
.matrix { display: grid; grid-template-columns: repeat(13, 1fr); gap: 2px; user-select: none; max-width: 640px; }
.matrix .c { aspect-ratio: 1; display: grid; place-items: center; font-size: 12px; font-weight: 600; border-radius: 4px; background: #262c31; color: #8b949e; cursor: default; position: relative; overflow: hidden; }
.matrix.edit .c { cursor: crosshair; }
.matrix .c span { position: relative; z-index: 1; }
.matrix .c.pair { box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 14px 0; }
.legend .it { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.legend .sw { width: 14px; height: 14px; border-radius: 3px; }
.brushes { display: flex; gap: 6px; flex-wrap: wrap; }
.brushes button { display: flex; gap: 6px; align-items: center; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line2); background: var(--bg2); cursor: pointer; color: var(--muted); }
.brushes button.on { border-color: var(--text); color: var(--text); }
.brushes .sw { width: 12px; height: 12px; border-radius: 3px; }
/* Tags de ação das ranges (janela "Tags") */
.tag-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow: auto; }
.tag-row { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.tag-row .sw { width: 16px; height: 16px; border-radius: 4px; flex: none; }
.tag-row .dim { font-size: 12px; margin-left: auto; }
.tag-row .icon-btn { margin-left: 4px; }
.tag-row.editing { flex-wrap: wrap; gap: 6px; }
.tag-row.editing .tag-color { width: 44px; height: 34px; padding: 2px; flex: none; }
.tag-row.editing .tag-name { flex: 1 1 80px; min-width: 0; width: auto; }
.tag-row.editing .tag-base { width: auto; }

/* Chat: lista de salas (.chat-side), mensagens (.msgs) e campo de envio (.composer) */
.chat { display: grid; grid-template-columns: 250px 1fr; height: 100%; min-height: 0; }
.chat-side { border-right: 1px solid var(--line); overflow: auto; padding: 12px 8px; background: var(--bg2); }
.chat-side .grp { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; padding: 12px 10px 6px; }
.chat-side button { width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 8px; color: var(--muted); cursor: pointer; display: flex; gap: 10px; align-items: center; }
.chat-side button:hover { background: var(--panel); color: var(--text); }
.chat-side button.on { background: var(--panel2); color: var(--text); }
.chat-side button .badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; border-radius: 10px; padding: 0 6px; line-height: 18px; }
.chat-side .hash { width: 32px; height: 32px; border-radius: 8px; background: var(--panel2); display: grid; place-items: center; color: var(--muted); }
.chat-main { display: flex; flex-direction: column; min-height: 0; }
.chat-head { padding: 14px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.chat-head b { flex: 1; }
.msgs { flex: 1; overflow: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 2px; }
.msg { display: flex; gap: 12px; padding: 4px 0; }
.msg.cont { padding-top: 0; }
.msg.cont .av { visibility: hidden; height: 0; }
.msg .body { min-width: 0; flex: 1; }
.msg .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: baseline; margin-bottom: 2px; }
.msg .meta b { color: var(--text); font-size: 13px; font-weight: 600; }
.msg .txt { white-space: pre-wrap; word-wrap: break-word; line-height: 1.5; }
.day-sep { text-align: center; color: var(--dim); font-size: 12px; margin: 14px 0 8px; }
.typing { font-size: 12px; color: var(--muted); padding: 0 22px 4px; min-height: 18px; }
.composer { padding: 12px 22px 18px; display: flex; gap: 10px; }
.composer textarea { min-height: 44px; max-height: 160px; resize: none; }

/* Chamadas: faixa vermelha de chamada em andamento */
.call-banner { display: flex; align-items: center; gap: 14px; background: linear-gradient(90deg, rgba(229,83,75,.16), rgba(229,83,75,.04)); border: 1px solid rgba(229,83,75,.35); border-radius: var(--radius); padding: 14px 18px; }
.call-banner + .call-banner { margin-top: 10px; }
.call-banner .ic { width: 38px; height: 38px; border-radius: 50%; background: var(--red); display: grid; place-items: center; color: #fff; flex: none; }
.call-banner .ic svg { width: 18px; height: 18px; }
.call-banner .info { flex: 1; }
.call-banner .info small { color: var(--muted); display: block; }

/* ---------- 4. Telas médias: colunas lado a lado viram uma coluna ---------- */
@media (max-width: 1100px) {
  .cols-2, .cols-21, .cols-12 { grid-template-columns: 1fr; }
  .range-layout { grid-template-columns: 1fr; }
}
/* Elementos que só aparecem no celular (botão de menu, fundo escuro do menu aberto) e aviso "Sem conexão" */
.menu-btn, .scrim, .mobile-only { display: none; }
.menu-btn { position: relative; margin-left: -6px; }
.menu-btn .dotbadge { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); display: none; }
.menu-btn .dotbadge.on { display: block; }
body.offline .top::after { content: 'Sem conexão — tentando novamente…'; position: fixed; top: 10px; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; font-size: 12px; padding: 4px 12px; border-radius: 20px; z-index: 90; }
.shell { height: 100vh; height: 100dvh; }

/* ---------- Celular: menu lateral vira gaveta (abre pelo botão ☰), tudo em uma coluna,
   respeita as bordas seguras do iPhone (env(safe-area-inset-*)) ---------- */
@media (max-width: 760px) {
  html, body { font-size: 15px; overflow-x: hidden; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .cards, .cols-2, .cols-21, .cols-12, .range-layout { grid-template-columns: minmax(0, 1fr); }
  .cards > *, .card, .kpi { min-width: 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .side { display: flex; position: fixed; inset: 0 auto 0 0; width: 272px; max-width: 84vw; z-index: 60; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); padding-bottom: env(safe-area-inset-bottom); }
  .shell.nav-open .side { transform: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 55; }
  .menu-btn, .mobile-only { display: inline-grid; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .page { padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
  .top { padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); flex-wrap: wrap; gap: 8px; min-height: 56px; }
  .top h1 { font-size: 17px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top .actions { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .top .actions:empty { display: none; }
  .kpis { gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi b { font-size: 18px; }
  .chart-box { height: 240px; }
  .toolbar .in, .toolbar input.in { width: 100% !important; }
  .toolbar label { display: flex; gap: 6px; align-items: center; flex: 1; }
  .card .hd { flex-wrap: wrap; }
  .profile-head { gap: 12px; }
  .tabs { overflow-x: auto; }
  .tabs button { white-space: nowrap; }
  .kv { grid-template-columns: 110px 1fr; }
  .modal { max-height: calc(100dvh - 20px); }
  .overlay { padding: 10px; align-items: end; }
  .lesson-grid { grid-template-columns: 1fr; }
  .range-layout > .card:first-child { max-height: 240px; overflow: auto; }
  .matrix .c { font-size: 9px; border-radius: 2px; }
  .matrix { gap: 1px; }
  .chat { grid-template-columns: 1fr; position: relative; }
  .chat-side { display: none; }
  .chat.show-side .chat-side { display: block; position: absolute; inset: 0; z-index: 5; }
  .chat-head { padding: 10px 14px; flex-wrap: wrap; }
  .msgs { padding: 14px; }
  .composer { padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); }
  .typing { padding: 0 14px; }
  #toasts { left: 10px; right: 10px; bottom: 10px; }
  .toast { max-width: none; }
  table.t td { white-space: nowrap; }
  table.t td.muted { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
  .call-banner { flex-wrap: wrap; }
  .call-banner .info { min-width: 60%; }
}
/* ---------- 5. Ajustes das versões 1.1–1.3: matriz menor no editor, versão no menu, botão play nos cards ---------- */
.modal .matrix { max-width: 500px; }
.side .ver { font-size: 11px; color: var(--dim); padding: 0 16px 8px; }
.lesson-thumb .play { width: 54px; height: 54px; border-radius: 50%; background: rgba(0,0,0,.55); display: grid; place-items: center; }
.lesson-thumb .play svg { width: 22px; height: 22px; margin-left: 3px; }

/* ---------- Gravador de aulas (js/recorder.js) ---------- */
/* Barra flutuante no canto inferior esquerdo enquanto grava (os avisos ficam à direita). */
.rec-bar { position: fixed; left: 18px; bottom: 18px; z-index: 85; display: flex; align-items: center; gap: 12px; background: var(--panel2); border: 1px solid var(--red); border-radius: 12px; padding: 10px 12px 10px 14px; box-shadow: var(--shadow); }
.rec-bar .rec-info { display: grid; line-height: 1.25; }
.rec-bar .rec-info small { color: var(--muted); font-variant-numeric: tabular-nums; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); animation: rec-pulse 1.2s ease-in-out infinite; }
@keyframes rec-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
a.btn { color: inherit; text-decoration: none; }

/* ---------- Troca de idioma (js/i18n.js) ---------- */
.lang-switch { display: inline-flex; gap: 2px; padding: 2px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 999px; }
.lang-switch button { font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; color: var(--muted); background: transparent; border: 0; border-radius: 999px; padding: 4px 7px; cursor: pointer; }
.lang-switch button:hover { color: var(--text); }
.lang-switch button[aria-pressed="true"] { background: var(--felt); color: #06210f; }
.lang-switch button:focus-visible { outline: 2px solid var(--felt); outline-offset: 1px; }
.login-card { position: relative; }
.login-card > .lang-switch { position: absolute; top: 14px; right: 14px; }
.side .ver { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- Trainer de pré-flop (js/pages/trainer.js) ---------- */
.tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--text); border-color: var(--felt); }
.warn { color: var(--gold, #e0b252); }
.tag.pos { color: var(--felt); }
.tr-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.tr-side { display: grid; gap: 18px; }
.tr-spotline { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin-bottom: 12px; }
.tr-spotline span { color: var(--muted); font-size: 13px; }
/* mesa oval com três lugares: dois em cima, herói embaixo */
.tr-table { padding: 46px 8px 64px; }
.tr-felt { position: relative; height: 250px; border-radius: 140px; background: radial-gradient(ellipse at center, #1f7a4d 0%, #135235 70%, #0d3d27 100%); border: 10px solid #3a2a1c; box-shadow: inset 0 0 40px rgba(0,0,0,.45), 0 12px 30px rgba(0,0,0,.35); }
.tr-pot { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #d9f3e5; font-size: 13px; background: rgba(0,0,0,.25); padding: 4px 12px; border-radius: 20px; }
.tr-seat { position: absolute; display: grid; justify-items: center; gap: 4px; width: 150px; }
.tr-seat.tl { left: 12%; top: -40px; }
.tr-seat.tr { right: 12%; top: -40px; }
.tr-seat.bottom { left: 50%; bottom: -58px; transform: translateX(-50%); }
.tr-seat.folded { opacity: .45; }
.tr-plate { background: #0f1416; border: 1px solid var(--line2); border-radius: 10px; padding: 5px 14px; text-align: center; min-width: 110px; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.tr-plate b { display: block; font-size: 13px; }
.tr-plate b.tr-pos { font-size: 17px; font-weight: 800; letter-spacing: .04em; color: #f5a623; line-height: 1.25; } /* posição: maior, amarelo-laranja */
.tr-plate span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tr-seat.hero .tr-plate { border-color: var(--felt); }
.tr-status { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tr-status.act { color: #ffd58a; }
.tr-bet { position: absolute; font-size: 12px; font-weight: 600; color: #fff; background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.2); border-radius: 12px; padding: 1px 8px; }
.tr-seat.tl .tr-bet, .tr-seat.tr .tr-bet { bottom: -26px; }
.tr-seat.bottom .tr-bet { top: -24px; }
.tr-dealer { position: absolute; right: 2px; top: 18px; width: 22px; height: 22px; border-radius: 50%; background: #fff; color: #111; font-size: 12px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 2px 4px rgba(0,0,0,.4); }
.tr-cards { display: flex; gap: 4px; min-height: 30px; }
.tr-back { width: 22px; height: 30px; border-radius: 4px; background: repeating-linear-gradient(45deg, #8b2a2a 0 4px, #6e1f1f 4px 8px); border: 1px solid rgba(255,255,255,.35); }
.tr-card { display: grid; place-items: center; width: 34px; height: 46px; border-radius: 6px; background: #f7f7f2; color: var(--suit); font-weight: 800; line-height: 1; box-shadow: 0 3px 8px rgba(0,0,0,.45); }
.tr-card.big { width: 48px; height: 66px; font-size: 22px; }
.tr-card i { font-style: normal; font-size: .9em; }
.tr-card b { color: var(--suit); }
.tr-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px; }
.tr-act { min-width: 120px; justify-content: center; border-bottom: 3px solid var(--ac); font-weight: 600; }
.tr-act kbd, .tr-next kbd { font: 600 10px var(--mono, monospace); background: rgba(255,255,255,.08); border: 1px solid var(--line2); border-radius: 4px; padding: 1px 5px; color: var(--muted); }
.tr-act.picked { box-shadow: 0 0 0 2px var(--ac); }
.tr-act:disabled { cursor: default; opacity: 1; }
.tr-hint { text-align: center; margin: 16px 0 0; font-size: 13px; }
.tr-result { margin-top: 18px; border: 1px solid var(--line2); border-left: 4px solid var(--muted); border-radius: 10px; padding: 14px 16px; background: var(--panel2); }
.tr-result.pos { border-left-color: var(--felt); }
.tr-result.warn { border-left-color: #e0b252; }
.tr-result.neg { border-left-color: var(--red); }
.tr-verdict { display: grid; gap: 2px; margin-bottom: 12px; }
.tr-verdict b { font-size: 18px; }
.tr-result.pos .tr-verdict b { color: var(--felt); } .tr-result.warn .tr-verdict b { color: #e0b252; } .tr-result.neg .tr-verdict b { color: var(--red); }
.tr-verdict span { color: var(--muted); font-size: 13px; }
.tr-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 280px); gap: 18px; align-items: start; }
.tr-detail h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.tr-strat .row { display: grid; grid-template-columns: 120px 1fr 44px; gap: 10px; align-items: center; font-size: 13px; padding: 3px 0; }
.tr-strat .row.chosen .lbl { font-weight: 700; color: var(--text); }
.tr-strat .lbl { color: var(--muted); }
.tr-strat .bar, .tr-row .bar { height: 8px; border-radius: 4px; background: #262c31; overflow: hidden; display: block; }
.tr-strat .bar i, .tr-row .bar i { display: block; height: 100%; border-radius: 4px; }
.tr-row .bar i { background: var(--felt); }
.tr-strat b { text-align: right; font-variant-numeric: tabular-nums; }
.tr-mini .matrix { gap: 1px; }
.tr-mini .matrix .c { font-size: 7px; border-radius: 2px; }
.matrix .c.hl { outline: 2px solid #fff; outline-offset: -1px; z-index: 2; box-shadow: 0 0 0 3px rgba(255,255,255,.35); }
.tr-next { display: flex; justify-content: flex-end; margin-top: 12px; }
.tr-score { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.tr-score span { display: block; color: var(--muted); font-size: 12px; }
.tr-score b { font-size: 20px; font-variant-numeric: tabular-nums; }
.tr-spotlist { display: grid; gap: 8px; max-height: 330px; overflow: auto; margin-bottom: 12px; }
.tr-spotlist label, .tr-opt { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.tr-spotlist label span, .tr-opt { line-height: 1.35; }
.tr-spotlist small, .tr-opt small { display: block; color: var(--dim); font-size: 11.5px; }
.tr-opt { flex-wrap: wrap; margin-top: 8px; }
.tr-opt small { flex-basis: 100%; padding-left: 22px; }
.tr-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 44px; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; }
.tr-row small { display: block; color: var(--dim); font-size: 11.5px; }
.tr-row b { text-align: right; font-variant-numeric: tabular-nums; }
.tr-row.compact { grid-template-columns: 110px 44px; padding: 0; }
.tr-days { display: flex; gap: 6px; align-items: flex-end; height: 120px; }
.tr-days .d { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.tr-days .d i { width: 100%; max-width: 28px; background: var(--felt); border-radius: 4px 4px 0 0; }
.tr-days .d small { font-size: 10px; color: var(--dim); }
.tr-toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
@media (max-width: 980px) { .tr-layout { grid-template-columns: 1fr; } .tr-detail { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .tr-felt { height: 200px; border-width: 7px; }
  .tr-seat { width: 120px; }
  .tr-seat.tl { left: 0; } .tr-seat.tr { right: 0; }
  .tr-plate { min-width: 90px; padding: 4px 8px; }
  .tr-act { min-width: calc(50% - 5px); }
  .tr-strat .row { grid-template-columns: 96px 1fr 40px; }
}
