/* ═══════════════════════════════════════════════════════════════════════════
   Orkestria no celular — CONTEÚDO das páginas (mobile-paginas.css)
   dashboard, connections, query, lineage, admin e login.

   Divisão com o mobile.css (casca): lá ficam a sidebar escondida, as barras
   superior/inferior injetadas e o espaço reservado no body. Aqui fica só o que
   está DENTRO de cada página: o <header> próprio, grades, cartões, formulários,
   modais, tabelas. Nada aqui estiliza aside.sidebar nem as barras da casca.

   Regras que valem para o arquivo inteiro:
   - Tudo dentro de @media (max-width: 899.98px): no computador nada muda.
   - O Tailwind CDN injeta o <style> dele DEPOIS deste arquivo, então classe
     utilitária (.p-8, .grid-cols-4…) ganha de seletor de mesma especificidade.
     Por isso todo seletor aqui tem pelo menos duas classes/ids, ou um id.
   - O theme.css pinta o tema claro com !important e especificidade (0,3,2)
     (ex.: html[data-theme="light"] header.glass:not(.sidebar)). Onde é preciso
     vencer, o seletor daqui é mais específico E usa !important.
   - Cores do modelo aprovado (docs/modelo_mobile/orkestria-mobile.html), com
     prefixo --mp- para não colidir com os tokens da casca.
   - Cartões sólidos: no celular nada de backdrop-filter (custa bateria e
     rolagem no iPhone).
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 899.98px) {

  /* ── Tokens (escuro é o padrão; claro pelo data-theme) ───────────────────── */
  html {
    --mp-bg: #060A14;
    --mp-surface: #0C1324;
    --mp-surface-2: #121B31;
    --mp-line: rgba(150, 180, 225, 0.10);
    --mp-line-2: rgba(150, 180, 225, 0.20);
    --mp-fg: #E6EDF7;
    --mp-fg-2: #A3B1C6;
    --mp-fg-3: #74849D;
    --mp-aqua: #2EE6F0;
    --mp-primary: #19B3DD;
    --mp-on-primary: #03121F;
    --mp-shadow-edge: rgba(0, 0, 0, 0.55);
    --mp-font-display: 'Ubuntu', 'Segoe UI', system-ui, sans-serif;
    --mp-font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    --mp-gutter-l: max(16px, env(safe-area-inset-left, 0px));
    --mp-gutter-r: max(16px, env(safe-area-inset-right, 0px));
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  html[data-theme="light"] {
    --mp-bg: #F2F5F9;
    --mp-surface: #FFFFFF;
    --mp-surface-2: #EDF2F8;
    --mp-line: rgba(5, 25, 51, 0.10);
    --mp-line-2: rgba(5, 25, 51, 0.18);
    --mp-fg: #051933;
    --mp-fg-2: #3B5272;
    --mp-fg-3: #5F718B;
    --mp-aqua: #00729A;
    --mp-primary: #007CA6;
    --mp-on-primary: #FFFFFF;
    --mp-shadow-edge: rgba(5, 25, 51, 0.22);
  }

  /* Fundo liso do modelo, no lugar dos gradientes radiais. */
  html[data-theme] body {
    background: var(--mp-bg) !important;
    background-image: none !important;
    -webkit-tap-highlight-color: transparent;
  }

  /* ── Coluna principal (o <div> irmão da sidebar) ─────────────────────────
     flex-1 tem min-width:auto: uma tabela larga empurraria a página para o
     lado. min-width:0 deixa encolher até a tela; overflow-x:clip é a rede de
     segurança (clip, e não hidden, para não virar contêiner de rolagem).
     min-height:0 porque o body já estica a coluna: com min-h-screen + o
     espaço que a casca reserva no body, sobraria rolagem vazia no fim. */
  html body > div.flex-1.flex-col {
    min-width: 0;
    width: 100%;
    min-height: 0;
    overflow: visible;
    overflow-x: clip;
  }

  /* ── Cabeçalho próprio de cada página ────────────────────────────────────
     No computador é sticky com vidro. No celular quem fica fixa é a barra da
     casca; aqui o cabeçalho vira o título da tela, no fluxo, como o
     "view-head" do modelo (Ubuntu 26 px + subtítulo), e as ações descem para
     uma linha própria. O query.html tem background inline, daí o !important. */
  html[data-theme] body > div.flex-1 > header.glass {
    position: static;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 12px;
    padding: 18px var(--mp-gutter-r) 6px var(--mp-gutter-l);
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
  html body > div.flex-1 > header.glass h1 {
    font-family: var(--mp-font-display);
    font-size: 26px;
    line-height: 1.15;
    font-weight: 700;
    text-wrap: balance;
    overflow-wrap: anywhere;
  }
  html body > div.flex-1 > header.glass h1 + p {
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.4;
  }
  /* Linha de ações do cabeçalho: botões com 44 px de toque. */
  html body > div.flex-1 > header.glass > div:not(:first-child) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }
  html body > div.flex-1 > header.glass button {
    min-height: 44px;
    border-radius: 12px;
  }
  html body > div.flex-1 > header.glass button.w-9 {
    width: 44px;
  }
  html body > div.flex-1 > header.glass #btn-hoje {
    padding: 0 14px;
    font-size: 13px;
  }
  /* "Ctrl + Enter para executar" (query) não existe no celular. */
  html body > div.flex-1 > header.glass > div:has(> kbd) {
    display: none !important;   /* vence o display:flex da linha de ações */
  }

  /* ── Área de conteúdo ────────────────────────────────────────────────── */
  html body > div.flex-1 > main.flex-1 {
    padding: 12px var(--mp-gutter-r) 24px var(--mp-gutter-l);
    min-width: 0;
  }

  /* ── Cartões sólidos (sem vidro) ─────────────────────────────────────── */
  html body .glass-card,
  html body .glass:not(.sidebar) {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
  html:not([data-theme="light"]) body .glass-card {
    background: var(--mp-surface);
    border-color: var(--mp-line);
  }
  html:not([data-theme="light"]) body main .glass:not(.sidebar),
  html:not([data-theme="light"]) body .modal-overlay > .glass {
    background: var(--mp-surface);
  }
  /* Toque não tem hover: sem o "pulo" do cartão nem troca de fundo presa. */
  html[data-theme] body .glass-card:hover {
    transform: none !important;
  }
  html:not([data-theme="light"]) body .glass-card:hover {
    background: var(--mp-surface);
    border-color: var(--mp-line);
  }
  html body main .glass-card.p-6 { padding: 16px; }
  html body main .glass-card.p-5 { padding: 14px; }
  html body main .rounded-2xl.glass-card { border-radius: 20px; }

  /* Botão principal no tom do modelo (no lugar do gradiente índigo). */
  html[data-theme] body button.bg-gradient-to-r.from-indigo-600,
  html[data-theme] body button.bg-indigo-600 {
    background: var(--mp-primary) !important;
    background-image: none !important;
    color: var(--mp-on-primary) !important;
    box-shadow: none !important;
    min-height: 44px;
  }

  /* ── Campos: 16 px (o iOS dá zoom em fonte menor) e 44 px de altura ──── */
  html body input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
  html body select:not([multiple]),
  html body textarea:not([hidden]) {
    font-size: 16px;
  }
  html body input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
  html body select:not([multiple]) {
    min-height: 44px;
  }
  /* A dica "/" do busca.js é atalho de teclado físico. */
  html body .ork-cb-kbd { display: none; }

  /* ── Avisos (toast) acima da barra inferior da casca ─────────────────── */
  html body > .fixed.bottom-6.right-6,
  html body > #toast.fixed {
    left: var(--mp-gutter-l);
    right: var(--mp-gutter-r);
    bottom: calc(68px + env(safe-area-inset-bottom, 0px));
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  /* ── Modais: tela cheia ──────────────────────────────────────────────────
     São formulários com teclado. Em folha de baixo o teclado do iPhone cobre
     os botões; em tela cheia alinhada no topo o conteúdo rola e o iOS consegue
     levar o campo focado para a área visível. O z-index cobre as barras da
     casca: modal aberto é a tela inteira. */
  html body #modal.modal-overlay,
  html body #userModal.modal-overlay,
  html body #wsModal.modal-overlay {
    z-index: 1000;
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
  html body #modal.modal-overlay > div,
  html body #userModal.modal-overlay > div,
  html body #wsModal.modal-overlay > div {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none !important;        /* #modal tem max-height:92vh inline */
    border-radius: 0;
    border: 0;
    box-shadow: none !important;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  html:not([data-theme="light"]) body #userModal.modal-overlay > div,
  html:not([data-theme="light"]) body #wsModal.modal-overlay > div {
    background: var(--mp-surface) !important;   /* vence o rgba inline */
  }
  /* Respiro do entalhe/ilha e da barra de gestos. */
  html body #modal.modal-overlay > div > div:first-child {
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    padding-left: var(--mp-gutter-l);
    padding-right: var(--mp-gutter-r);
  }
  html body #userModal.modal-overlay > div,
  html body #wsModal.modal-overlay > div {
    padding: calc(12px + env(safe-area-inset-top, 0px)) var(--mp-gutter-r)
             calc(24px + env(safe-area-inset-bottom, 0px)) var(--mp-gutter-l);
  }
  /* Botão fechar (X): 44 px. */
  html body .modal-overlay button[onclick^="close"].w-8,
  html body .modal-overlay button[onclick^="close"].w-7 {
    width: 44px;
    height: 44px;
  }
  html body .modal-overlay h2,
  html body .modal-overlay h3 {
    font-family: var(--mp-font-display);
    font-size: 19px;
    line-height: 1.25;
  }
  html body .modal-overlay form button {
    min-height: 48px;
    font-size: 15px;
  }

  /* ═════════════════════ dashboard.html ═════════════════════ */
  /* Cartões de número: 2 colunas, rótulo menor para caber ao lado do ícone. */
  html body main .stat-card .tracking-widest,
  html body main .glass-card > .tracking-widest {
    letter-spacing: 0.06em;
    font-size: 11px;
    line-height: 1.25;
  }
  html body main .stat-card > .flex.justify-between {
    gap: 8px;
    align-items: flex-start;
  }
  html body main .stat-card > .flex.justify-between > span {
    text-align: right;
  }
  html body main .glass-card .text-3xl {
    font-size: 26px;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
  }
  html body main .grid.gap-6 { gap: 16px; }
  html body main.space-y-6 > :not([hidden]) ~ :not([hidden]) { margin-top: 16px; }
  html body main .grid.gap-4 { gap: 10px; }
  html body main h3.text-sm {
    font-size: 15px;
    line-height: 1.3;
  }
  #statusLegend.flex {
    flex-wrap: wrap;
    gap: 8px 16px;
  }
  /* Nomes de robô em mono, como no modelo. */
  #successRateBars .truncate,
  #neverRunList .truncate,
  #mostActiveList .truncate {
    font-family: var(--mp-font-mono);
    font-size: 12.5px;
    min-width: 0;
  }
  #successRateBars .max-w-xs { max-width: none; flex: 1 1 auto; }

  /* ═════════════════════ connections.html ═════════════════════ */
  /* "Nova Conexão": botão inteiro, 48 px. */
  html body > div.flex-1 > header.glass > button {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }
  /* Aviso "Como usar": o <pre> rola dentro dele, não a página. */
  html body main > .glass-card.border-l-4 {
    padding: 14px;
    gap: 12px;
  }
  html body main > .glass-card.border-l-4 > div {
    min-width: 0;
  }
  html body main > .glass-card.border-l-4 pre {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  /* Cartão de conexão: as 4 ações (testar, copiar, editar, remover) saem do
     canto e viram uma fileira de botões de 44 px no pé do cartão. O
     display:contents na 1ª linha deixa o nome e as ações virarem filhos
     diretos do cartão, e o order põe as ações por último. */
  #connList.grid { gap: 12px; }
  #connList > .glass-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    min-width: 0;
  }
  #connList > .glass-card > div:first-child { display: contents; }
  #connList > .glass-card > div:first-child > div:first-child { order: 1; min-width: 0; }
  #connList > .glass-card > div.space-y-2 { order: 2; min-width: 0; }
  #connList > .glass-card > div:first-child > div:last-child {
    order: 3;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
  #connList > .glass-card > div:first-child > div:last-child > button {
    width: auto;
    height: 44px;
    border-radius: 12px;
  }
  #connList > .glass-card > div:first-child > div:last-child > button svg {
    width: 18px;
    height: 18px;
  }
  #connList .font-semibold.text-sm {
    font-family: var(--mp-font-mono);
    font-weight: 500;
    font-size: 14px;
    overflow-wrap: anywhere;
  }
  /* Host/Banco: hosts da AWS são longos — quebram em vez de estourar. */
  #connList .space-y-2 > .flex {
    flex-wrap: wrap;
    row-gap: 2px;
    min-width: 0;
  }
  #connList .space-y-2 .mono,
  #connList .space-y-2 code {
    overflow-wrap: anywhere;
    min-width: 0;
  }
  #connList .space-y-2 .ml-2 { margin-left: 0; }

  /* Modal de conexão */
  #connForm > div.p-6 {
    padding: 16px var(--mp-gutter-r) 8px var(--mp-gutter-l);
  }
  #connForm > div.px-6 {
    padding: 0 var(--mp-gutter-r) calc(20px + env(safe-area-inset-bottom, 0px)) var(--mp-gutter-l);
  }
  /* 7 tipos: 3 por linha cabem sem cortar "PostgreSQL". */
  #connForm .grid.grid-cols-4 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  #connForm .type-btn {
    padding: 10px 4px;
    min-height: 76px;
  }
  #connForm .type-btn:hover { transform: none; }
  /* Usuário e senha um embaixo do outro. */
  #connForm #row-auth.grid {
    grid-template-columns: minmax(0, 1fr);
  }
  /* Olho da senha: alvo de 44 px. */
  #connForm button[onclick="togglePwd()"] {
    width: 44px;
    height: 44px;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  /* Rodapé: "Testar Conexão" inteiro em cima; Cancelar e Salvar dividem a
     linha de baixo. */
  #connForm > div.px-6 > div.flex.gap-3 {
    flex-wrap: wrap;
    gap: 10px;
  }
  #connForm #testModalBtn {
    order: -1;
    flex: 1 1 100%;
  }
  #connForm > div.px-6 > div.flex.gap-3 > button:not(#testModalBtn) {
    flex: 1 1 0;
    justify-content: center;
  }

  /* ═════════════════════ query.html ═════════════════════ */
  #runBtn.flex {
    justify-content: center;
    min-height: 48px;
    font-size: 15px;
  }
  #connBadge.flex { flex-wrap: wrap; padding-bottom: 0; }
  #connBadgeHost { overflow-wrap: anywhere; }
  /* Editor: 16 px (sem zoom do iOS) e altura boa para o polegar. */
  html body #sqlEditor {
    font-size: 16px;
    line-height: 1.5;
    min-height: 160px;
    padding: 12px;
  }
  #historyChips.flex > button {
    min-height: 44px;   /* área de toque mínima de 44 px (era 36) */
    max-width: 100%;
  }
  /* Exportar e o selo de 500 linhas na mesma faixa, com toque de 44 px. */
  #resultsPanel > div:first-child {
    padding: 12px 14px;
  }
  #exportBtn.flex { min-height: 44px; padding: 0 14px; font-size: 13px; }
  #exportMenu > button { min-height: 44px; font-size: 14px; }
  /* No claro o menu tem fundo escuro inline e o theme.css escurece o texto
     (slate-300 → navy): ficava ilegível. Aqui o fundo acompanha o tema.
     (No computador o defeito é o mesmo — ver relatório.) */
  html[data-theme="light"] body #exportMenu {
    background: #FFFFFF !important;
    border-color: rgba(5, 25, 51, 0.14) !important;
    box-shadow: 0 12px 32px rgba(5, 25, 51, 0.18) !important;
  }
  #errorDisplay.px-6 { padding: 14px; }

  /* Resultado: rola para o lado só dentro do contêiner, 1ª coluna fixa.
     A sombra na borda direita avisa que tem mais coluna: é o truque de
     background local/scroll — a "tampa" (local) anda com o conteúdo e cobre a
     sombra (scroll) quando a rolagem chega ao fim. */
  html body #tableWrap {
    max-height: min(480px, 62vh) !important;   /* inline: max-height:480px */
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    background:
      linear-gradient(to left, var(--mp-surface) 40%, transparent) right center / 28px 100% no-repeat local,
      radial-gradient(farthest-side at 100% 50%, var(--mp-shadow-edge), transparent) right center / 14px 100% no-repeat scroll;
  }
  html[data-theme="light"] body #tableWrap {
    background:
      linear-gradient(to left, #f0f7ff 40%, transparent) right center / 28px 100% no-repeat local,
      radial-gradient(farthest-side at 100% 50%, var(--mp-shadow-edge), transparent) right center / 14px 100% no-repeat scroll;
  }
  #tableWrap .result-table th,
  #tableWrap .result-table td {
    padding: 9px 12px;
  }
  #tableWrap .result-table td {
    font-size: 12.5px;
    max-width: 220px;
  }
  #tableWrap .result-table th:first-child,
  #tableWrap .result-table td:first-child {
    position: sticky;
    left: 0;
    box-shadow: 1px 0 0 var(--mp-line-2), 6px 0 8px -6px var(--mp-shadow-edge);
  }
  #tableWrap .result-table td:first-child {
    z-index: 1;
    background: var(--mp-surface);
  }
  #tableWrap .result-table th:first-child {
    z-index: 3;   /* acima das outras th (z 1) e da 1ª coluna */
  }
  html[data-theme="light"] #tableWrap .result-table td:first-child,
  html[data-theme="light"] #tableWrap .result-table tr:hover td:first-child {
    background: #f0f7ff !important;
  }
  html:not([data-theme="light"]) #tableWrap .result-table tr:hover td:first-child {
    background: var(--mp-surface);
  }

  /* ═════════════════════ lineage.html ═════════════════════ */
  /* No computador a coluna é h-screen com lista e grafo lado a lado. No
     celular a página rola: lista em cima (altura limitada, rola sozinha),
     grafo embaixo com altura fixa — o JS mede a área do grafo, então ela
     precisa de altura própria, que não dependa do SVG. */
  html body > div.flex-1.flex-col.h-screen {
    height: auto;
    overflow: visible;
    overflow-x: clip;
  }
  #statsBar.flex {
    flex-wrap: wrap;
    gap: 4px 12px;
    flex: 1 1 100%;
  }
  #btnReset.px-3,
  html body > div.flex-1.h-screen > header button[onclick="loadLineage()"] {
    min-height: 44px;
    padding: 0 16px;
    font-size: 13px;
    border-radius: 12px;
  }
  html body > div.flex-1.h-screen > header.glass + div.flex {
    flex-direction: column;
    flex: none;
    overflow: visible;
    gap: 12px;
    padding: 6px var(--mp-gutter-r) 24px var(--mp-gutter-l);
  }
  /* Lista de scripts */
  html body #lineagePanel,
  html body #lineagePanel.recolhido {
    width: 100%;
    max-height: 40vh;
    border: 1px solid var(--mp-line);
    border-radius: 16px;
    background: var(--mp-surface) !important;   /* rgba inline */
    transition: none;
  }
  html body #lineagePanel .painel-topo {
    padding: 8px;
  }
  html body #lineagePanel #listSearch {
    font-size: 16px;
    min-height: 44px;
  }
  html body #lineagePanel .painel-toggle {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }
  /* Recolher = fechar para cima (seta para cima aberta, para baixo fechada). */
  html body #lineagePanel .painel-toggle svg { transform: rotate(90deg); }
  html body #lineagePanel.recolhido .painel-toggle svg { transform: rotate(-90deg); }
  html body #lineagePanel.recolhido {
    flex-direction: row-reverse;
    align-items: center;
  }
  html body #lineagePanel.recolhido .painel-topo {
    border-bottom: 0;
    padding: 4px;
  }
  html body #lineagePanel.recolhido .painel-rotulo {
    flex: 1;
    writing-mode: horizontal-tb;
    transform: none;
    margin: 0;
    padding: 0 14px;
    line-height: 52px;
    min-height: 52px;
  }
  html body #lineagePanel .list-item {
    min-height: 44px;
    font-size: 13px;
    font-weight: 500;
    overflow-wrap: anywhere;
  }
  /* o "* { font-family: Inter }" da página pega o <span> de dentro */
  html body #lineagePanel .list-item,
  html body #lineagePanel .list-item * {
    font-family: var(--mp-font-mono);
  }
  /* Área do grafo: altura própria e o aviso "melhor no computador" no topo. */
  html body #lineagePanel + div.flex-1 {
    flex: none;
    height: max(340px, 58vh);
    border: 1px solid var(--mp-line);
    border-radius: 16px;
    background: var(--mp-surface);
  }
  html body #lineagePanel + div.flex-1::before {
    content: "O mapa completo fica melhor no computador. Aqui: toque num script da lista para filtrar, arraste e use dois dedos para zoom.";
    position: absolute;
    z-index: 5;
    top: 8px;
    left: 8px;
    right: 8px;
    padding: 9px 12px 9px 40px;
    border-radius: 12px;
    border: 1px solid var(--mp-line-2);
    background:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2374849D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='4' width='20' height='13' rx='2'/%3E%3Cpath d='M8 21h8M12 17v4'/%3E%3C/svg%3E") 12px 10px / 18px 18px no-repeat,
      var(--mp-surface-2);
    color: var(--mp-fg-2);
    font-size: 12.5px;
    line-height: 1.4;
    pointer-events: none;
  }
  /* Legenda: em vez da coluna de 10 linhas sobre o grafo, uma faixa
     compacta no rodapé da área. */
  html body #lineagePanel + div.flex-1 > .absolute.left-4.top-4 {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 8px 10px;
    font-size: 11px;
    border-radius: 12px;
    background: var(--mp-surface-2) !important;
    pointer-events: none;
  }
  html body #lineagePanel + div.flex-1 > .absolute.left-4.top-4 > div:first-child { display: none; }
  html body #lineagePanel + div.flex-1 > .absolute.left-4.top-4 > div.border-t { display: contents; }
  html body #lineagePanel + div.flex-1 > .absolute.left-4.top-4 .text-slate-600 { display: none; }
  html body #lineagePanel + div.flex-1 > .absolute.left-4.top-4 svg { width: 12px; height: 12px; }
  html body #lineagePanel + div.flex-1 > .absolute.left-4.top-4 .w-6 { width: 14px; }
  #tooltip.absolute { max-width: calc(100% - 16px); }

  /* ═════════════════════ admin.html ═════════════════════ */
  html body main > .flex.gap-2 > .tab-btn {
    flex: 1 1 0;
    min-height: 44px;
    font-size: 14px;
  }
  #panelUsers > .flex.justify-between button,
  #panelWorkspaces > .flex.justify-between button {
    min-height: 44px;
    padding: 0 14px;
    font-size: 13px;
  }
  #panelUsers > .flex.justify-between h2,
  #panelWorkspaces > .flex.justify-between h2 {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  /* Cartão de usuário: avatar + nome em cima; papel e ações numa linha de
     baixo (nome comprido não briga com os botões). */
  #usersList > .glass-card,
  #wsList > .glass-card {
    padding: 12px 14px;
    gap: 12px;
    min-width: 0;
  }
  #usersList > .glass-card {
    flex-wrap: wrap;
    row-gap: 6px;
  }
  #usersList > .glass-card > .flex-1,
  #wsList > .glass-card > .flex-1 {
    min-width: 0;
  }
  #usersList > .glass-card > .flex-1 > div:first-child,
  #wsList > .glass-card > .flex-1 > div:first-child {
    font-size: 15px;
    overflow-wrap: anywhere;
  }
  #usersList > .glass-card > .flex-shrink-0:last-child {
    flex: 1 1 100%;
    padding-left: 48px;
    gap: 4px;
  }
  #usersList > .glass-card > .flex-shrink-0:last-child > .badge {
    margin-right: auto;
  }
  #usersList > .glass-card button,
  #wsList > .glass-card > button {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }
  #usersList > .glass-card button svg,
  #wsList > .glass-card > button svg {
    width: 18px;
    height: 18px;
  }
  /* No claro o theme.css troca text-white por navy, e a letra do avatar
     (fundo índigo) sumia. (Mesmo defeito no computador — ver relatório.) */
  html[data-theme="light"] #usersList .bg-indigo-700.text-white {
    color: #FFFFFF !important;
  }
  #userForm > .flex.gap-3,
  #wsForm > .flex.gap-3 {
    padding-top: 8px;
  }

  /* ═════════════════════ login.html ═════════════════════
     A casca não monta barras aqui. Conteúdo alinhado no alto (e não no meio)
     para o botão "Entrar" ficar logo abaixo dos campos, acima do teclado; a
     página continua rolável se o teclado ainda cobrir. */
  html body.min-h-screen.items-center.justify-center:has(#loginForm) {
    align-items: flex-start;
    min-height: 100vh;
    min-height: 100dvh;
    padding: calc(56px + env(safe-area-inset-top, 0px)) var(--mp-gutter-r)
             calc(24px + env(safe-area-inset-bottom, 0px)) var(--mp-gutter-l);
  }
  #loginThemeBtn.fixed {
    top: calc(8px + env(safe-area-inset-top, 0px));
    right: max(8px, env(safe-area-inset-right, 0px));
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }
  html body .fade-up > .flex.mb-8 { margin-bottom: 20px; }
  html body .fade-up > .glass.p-8 {
    padding: 22px 18px;
    background: var(--mp-surface);
    border-color: var(--mp-line);
    box-shadow: none !important;
  }
  html body .fade-up > .glass.p-8 h2 {
    font-family: var(--mp-font-display);
    font-size: 22px;
  }
  #loginForm.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 14px; }
  #loginForm #username,
  #loginForm #password {
    min-height: 48px;
    font-size: 16px;
  }
  #loginForm #loginBtn {
    min-height: 48px;
    font-size: 16px;
  }
  /* No claro o theme.css pinta text-white de navy sobre o gradiente roxo. */
  html[data-theme="light"] #loginForm #loginBtn.text-white {
    color: #FFFFFF !important;
  }
  html body .fade-up > p.mt-5 { margin-top: 16px; }
}
