/* =============================================================================
   Ponto · Pegoretti Clinic
   Sistema visual derivado da marca: espresso #3B2D00, bege #DBD7BD, marfim #FAF8F2.
   Regras que valem em todo o arquivo:
     · nenhum gradiente, nenhum brilho, nenhuma sombra colorida — hierarquia por
       cor de superfície, fio de 1 px e peso de tipo;
     · piso tipográfico de 12 px;
     · alvo de toque de 44 px;
     · claro e escuro têm conjuntos próprios de cor, nenhum é inversão do outro.
   ============================================================================= */

/* ---------- 1. tokens ------------------------------------------------------ */
:root {
  color-scheme: light;

  --brand:        #3B2D00;
  --on-brand:     #FFFFFF;
  --bege:         #DBD7BD;

  --bg:           #FAF8F2;
  --surface:      #FFFFFF;
  --surface-2:    #F3F0E6;
  --surface-3:    #EBE7D9;

  --line:         #E7E2D2;
  --line-forte:   #D3CBB4;

  --ink:          #241B00;
  --ink-2:        #4A3F22;
  --ink-3:        #6E6449;

  --ok:           #2F6B4F;
  --warn:         #8A4A00;
  --danger:       #9B2C2C;

  --ok-fundo:     #E8F0EA;
  --warn-fundo:   #F6EDE0;
  --danger-fundo: #F7E7E7;

  --f-display: 'Archivo', system-ui, -apple-system, sans-serif;
  --f-texto:   'Inter Tight', system-ui, -apple-system, sans-serif;
  --f-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;

  --gutter: 24px;
  --largura: 1180px;

  /* movimento — curto, discreto, sempre cancelável */
  --d-rapido: 120ms;
  --d-medio:  180ms;
  --e-saida:  cubic-bezier(.22, .61, .36, 1);
  --d-segurar: 620ms;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark;
    --brand: #DBD7BD; --on-brand: #14120C; --bege: #3A3423;
    --bg: #12100A; --surface: #1A1710; --surface-2: #221E15; --surface-3: #2A251A;
    --line: #302B1F; --line-forte: #453D2C;
    --ink: #F3F0E6; --ink-2: #CFC9B4; --ink-3: #9C947A;
    --ok: #7FBF9B; --warn: #E0A458; --danger: #E88A8A;
    --ok-fundo: #1B2A22; --warn-fundo: #2B2418; --danger-fundo: #2B1C1C;
  }
}

:root[data-theme="dark"] { color-scheme: dark;
  --brand: #DBD7BD; --on-brand: #14120C; --bege: #3A3423;
  --bg: #12100A; --surface: #1A1710; --surface-2: #221E15; --surface-3: #2A251A;
  --line: #302B1F; --line-forte: #453D2C;
  --ink: #F3F0E6; --ink-2: #CFC9B4; --ink-3: #9C947A;
  --ok: #7FBF9B; --warn: #E0A458; --danger: #E88A8A;
  --ok-fundo: #1B2A22; --warn-fundo: #2B2418; --danger-fundo: #2B1C1C;
}

/* ---------- 2. base -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-texto);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.15;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
svg { display: block; }

::selection { background: var(--bege); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.wrap { width: 100%; max-width: var(--largura); margin: 0 auto; padding: 0 var(--gutter); }

.tela-leitor {
  position: fixed; top: -120px; left: 12px; z-index: 100;
  min-height: 44px; display: inline-flex; align-items: center;
  padding: 0 16px; border-radius: var(--r-md);
  background: var(--brand); color: var(--on-brand);
  font-size: 0.875rem; font-weight: 600;
}
.tela-leitor:focus { top: 12px; }

/* rótulo miúdo em caixa alta — a única vez que o sistema usa tracking positivo */
.rotulo {
  font-family: var(--f-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.numero { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

/* ---------- 3. topo -------------------------------------------------------- */
.topo {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topo .wrap { display: flex; align-items: center; gap: 20px; min-height: 68px; }

.marca { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; flex: none; }
.marca img { height: 26px; width: auto; }
.marca .logo-clara { display: none; }
:root[data-theme="dark"] .marca .logo-escura { display: none; }
:root[data-theme="dark"] .marca .logo-clara { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .marca .logo-escura { display: none; }
  :root:not([data-theme="light"]) .marca .logo-clara { display: block; }
}

.nav-topo { display: flex; gap: 2px; margin-left: 12px; }
.nav-topo a, .nav-topo button {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px;
  border: 0; border-radius: var(--r-md); background: transparent;
  color: var(--ink-2); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: color var(--d-rapido) var(--e-saida), background var(--d-rapido) var(--e-saida);
}
.nav-topo a:hover { color: var(--ink); background: var(--surface-2); }
.nav-topo a[aria-current="page"] { color: var(--ink); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-forte); }

.topo-acoes { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.botao-icone {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink-2);
  cursor: pointer;
  transition: background var(--d-rapido) var(--e-saida), color var(--d-rapido) var(--e-saida);
}
.botao-icone:hover { background: var(--surface-2); color: var(--ink); }

.avatar {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface-2); color: var(--ink);
  font-family: var(--f-display); font-size: 0.8125rem; font-weight: 600;
  cursor: pointer;
}

/* ---------- 4. botões ------------------------------------------------------ */
.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid var(--line-forte); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink);
  font-size: 0.9375rem; font-weight: 500;
  cursor: pointer;
  transition: background var(--d-rapido) var(--e-saida), border-color var(--d-rapido) var(--e-saida);
}
.botao:hover { background: var(--surface-2); }
.botao[disabled] { opacity: .5; cursor: not-allowed; }

.botao-solido { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.botao-solido:hover { background: var(--brand); filter: brightness(1.12); }

.botao-texto {
  min-height: 44px; padding: 0 8px;
  border: 0; background: transparent; color: var(--ink-2);
  font-size: 0.875rem; font-weight: 500; cursor: pointer;
}
.botao-texto:hover { color: var(--ink); }

.botao-perigo { color: var(--danger); border-color: var(--line-forte); }

/* ---------- 5. cartões e seções -------------------------------------------- */
.pagina { padding: 40px 0 96px; }
.pagina-cabeca { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; margin-bottom: 28px; }
.pagina-cabeca h1 { font-size: 2rem; }
.pagina-cabeca p { color: var(--ink-3); font-size: 0.9375rem; }
.pagina-cabeca .afastar { margin-left: auto; }

.cartao {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
}
.cartao-topo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
}
.cartao-topo h2 { font-size: 1.0625rem; letter-spacing: -0.014em; }
.cartao-topo .afastar { margin-left: auto; }

.fio { height: 1px; background: var(--line); border: 0; margin: 20px 0; }

/* ---------- 6. grade do painel --------------------------------------------- */
.grade { display: grid; gap: 20px; }
.grade-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grade-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grade-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grade-palco { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }

/* ---------- 7. números grandes --------------------------------------------- */
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi .rotulo { color: var(--ink-3); }
.kpi .valor {
  font-family: var(--f-display); font-size: 1.75rem; font-weight: 600;
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
}
.kpi .nota { font-size: 0.8125rem; color: var(--ink-3); }
.kpi .nota.ok { color: var(--ok); }
.kpi .nota.alerta { color: var(--warn); }

/* ---------- 8. etiquetas de estado ----------------------------------------- */
.etiqueta {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 28px; padding: 0 10px;
  border: 1px solid var(--line-forte); border-radius: 999px;
  background: var(--surface); color: var(--ink-2);
  font-size: 0.8125rem; font-weight: 500; white-space: nowrap;
}
.etiqueta::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.etiqueta.sem-ponto::before { display: none; }
.etiqueta.fora { color: var(--ink-3); }
.etiqueta.trabalhando { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); background: var(--ok-fundo); }
.etiqueta.intervalo { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); background: var(--warn-fundo); }
.etiqueta.encerrado { color: var(--ink-2); }

/* ---------- 9. tabelas ----------------------------------------------------- */
.tabela-area { overflow-x: auto; margin: 0 -4px; }
.tabela { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.tabela caption {
  text-align: left; padding-bottom: 12px;
  font-size: 0.8125rem; color: var(--ink-3);
}
.tabela th {
  text-align: left; font-weight: 600; color: var(--ink-3);
  font-family: var(--f-mono); font-size: 0.75rem;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 10px 12px; border-bottom: 1px solid var(--line-forte); white-space: nowrap;
}
.tabela td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabela tbody tr:last-child td { border-bottom: 0; }
.tabela tbody tr:hover { background: var(--surface-2); }
.tabela .num { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.tabela .forte { font-weight: 600; }
.tabela .apagado { color: var(--ink-3); }
.tabela .hoje { font-weight: 600; }

/* ---------- 10. formulários ------------------------------------------------ */
.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.campo label { font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); }
.campo .ajuda { font-size: 0.8125rem; color: var(--ink-3); }

.entrada, .selecao {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line-forte); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink);
  font-size: 1rem;
  transition: border-color var(--d-rapido) var(--e-saida);
}
.entrada:hover, .selecao:hover { border-color: var(--ink-3); }
.entrada:focus, .selecao:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.entrada::placeholder { color: var(--ink-3); }
.selecao { appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
                    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.campo-duplo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- 11. aba de seções ---------------------------------------------- */
.segmentado {
  display: inline-flex; gap: 2px; padding: 3px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-2);
}
.segmentado button, .segmentado a {
  display: inline-flex; align-items: center;
  min-height: 40px; padding: 0 14px;
  border: 0; border-radius: var(--r-sm); background: transparent;
  color: var(--ink-2); font-size: 0.875rem; font-weight: 500; cursor: pointer;
  white-space: nowrap;
  transition: background var(--d-rapido) var(--e-saida), color var(--d-rapido) var(--e-saida);
}
.segmentado button:hover, .segmentado a:hover { color: var(--ink); }
.segmentado button[aria-selected="true"], .segmentado a[aria-current="page"] {
  background: var(--surface); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-forte);
}

/* ---------- 12. gráficos --------------------------------------------------- */
.grafico { width: 100%; height: auto; display: block; }
.grafico .eixo { stroke: var(--line); stroke-width: 1; }
.grafico .barra { fill: var(--brand); }
.grafico .barra-suave { fill: var(--bege); }
.grafico .rotulo-eixo { fill: var(--ink-3); font-family: var(--f-mono); font-size: 12px; }
.grafico .marcador { fill: var(--danger); }
.grafico-legenda { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: 0.8125rem; color: var(--ink-3); }
.grafico-legenda span { display: inline-flex; align-items: center; gap: 6px; }
.grafico-legenda i { width: 10px; height: 10px; border-radius: 2px; background: var(--brand); }
.grafico-legenda i.suave { background: var(--bege); }

/* ---------- 13. palco da batida -------------------------------------------- */
.palco { display: flex; flex-direction: column; gap: 24px; }
.relogio {
  font-family: var(--f-mono); font-variant-numeric: tabular-nums;
  font-size: 3.25rem; font-weight: 500; letter-spacing: -0.04em; line-height: 1;
}
.relogio small { font-size: 1rem; color: var(--ink-3); letter-spacing: 0; margin-left: 6px; }
.saudacao { font-size: 1.5rem; letter-spacing: -0.025em; }
.saudacao b { font-weight: 600; }

.acoes-batida { display: flex; flex-wrap: wrap; gap: 12px; }

/* o gesto: 620 ms de pressão contínua */
.segurar-area { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.segurar {
  position: relative; width: 176px; height: 176px;
  border: 0; border-radius: 50%; padding: 0;
  background: transparent; cursor: pointer;
  touch-action: none; -webkit-tap-highlight-color: transparent;
  transition: transform var(--d-rapido) var(--e-saida);
}
.segurar:active { transform: scale(.985); }
.segurar svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.segurar .trilha { fill: none; stroke: var(--line-forte); stroke-width: 2; }
.segurar .anel {
  fill: none; stroke: var(--brand); stroke-width: 2; stroke-linecap: round;
  stroke-dasharray: var(--perimetro, 540);
  stroke-dashoffset: var(--perimetro, 540);
}
.segurar[data-estado="carregando"] .anel { transition: stroke-dashoffset var(--d-segurar) linear; stroke-dashoffset: 0; }
.segurar[data-estado="pronto"] .anel { stroke-dashoffset: 0; stroke: var(--ok); }

.segurar-nucleo {
  position: absolute; inset: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border-radius: 50%; background: var(--brand); color: var(--on-brand);
}
.segurar-nucleo b { font-family: var(--f-display); font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
.segurar-nucleo small { font-family: var(--f-mono); font-size: 0.75rem; letter-spacing: 0.06em; opacity: .82; }
.segurar-dica { font-size: 0.8125rem; color: var(--ink-3); text-align: center; max-width: 30ch; }

/* ---------- 14. comprovante ------------------------------------------------ */
.comprovante { border: 1px solid var(--line-forte); border-radius: var(--r-lg); padding: 20px; background: var(--surface); }
.comprovante-topo { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; color: var(--ok); font-size: 0.8125rem; font-weight: 600; }
.comprovante-nsr {
  font-family: var(--f-mono); font-size: 2.25rem; font-weight: 500;
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1;
}
.comprovante-selo {
  font-family: var(--f-mono); font-size: 0.75rem; color: var(--ink-3);
  word-break: break-all; margin-top: 6px;
}
.comprovante-linhas { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.comprovante-linhas div { display: flex; flex-direction: column; gap: 2px; }
.comprovante-linhas .rotulo { font-size: 0.75rem; }
.comprovante-linhas b { font-family: var(--f-mono); font-size: 0.9375rem; font-weight: 500; }

/* ---------- 15. linha do tempo do dia -------------------------------------- */
.timeline { position: relative; padding: 28px 0 8px; }
.timeline-trilho {
  position: relative; height: 10px; border-radius: 999px;
  background: var(--surface-3); overflow: hidden;
}
.timeline-trecho { position: absolute; top: 0; bottom: 0; }
.timeline-trecho.trabalho { background: var(--brand); }
.timeline-trecho.pausa { background: var(--bege); }
.timeline-horas { display: flex; justify-content: space-between; margin-top: 8px; font-family: var(--f-mono); font-size: 0.75rem; color: var(--ink-3); }
.timeline-marcas { position: relative; height: 26px; margin-top: 10px; }
.timeline-marca { position: absolute; transform: translateX(-50%); font-family: var(--f-mono); font-size: 0.75rem; color: var(--ink-3); white-space: nowrap; }

/* ---------- 16. mapa de calor ---------------------------------------------- */
.mapa { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.mapa-celula { aspect-ratio: 1; border-radius: var(--r-sm); background: var(--surface-3); position: relative; }
.mapa-celula[data-nivel="1"] { background: color-mix(in srgb, var(--brand) 22%, var(--surface)); }
.mapa-celula[data-nivel="2"] { background: color-mix(in srgb, var(--brand) 45%, var(--surface)); }
.mapa-celula[data-nivel="3"] { background: color-mix(in srgb, var(--brand) 70%, var(--surface)); }
.mapa-celula[data-nivel="4"] { background: var(--brand); }
.mapa-celula[data-vazio="1"] { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.mapa-legenda { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 0.75rem; color: var(--ink-3); }
.mapa-legenda i { width: 12px; height: 12px; border-radius: 3px; background: var(--surface-3); }

/* ---------- 17. avisos ----------------------------------------------------- */
.avisos { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.aviso {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid var(--line-forte); background: var(--surface); color: var(--ink);
  font-size: 0.875rem;
}
.aviso.erro { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); background: var(--danger-fundo); color: var(--danger); }
.aviso.ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); background: var(--ok-fundo); color: var(--ok); }

/* ---------- 18. estados ---------------------------------------------------- */
.vazio { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 28px 0; }
.vazio h3 { font-size: 1rem; }
.vazio p { color: var(--ink-3); font-size: 0.875rem; max-width: 46ch; }

.esqueleto { background: var(--surface-3); border-radius: var(--r-sm); height: 14px; animation: pulsar 1.4s ease-in-out infinite; }
@keyframes pulsar { 0%, 100% { opacity: 1 } 50% { opacity: .55 } }

/* ---------- 19. gaveta ----------------------------------------------------- */
.veu { position: fixed; inset: 0; z-index: 50; background: color-mix(in srgb, var(--ink) 32%, transparent); opacity: 0; pointer-events: none; transition: opacity var(--d-medio) var(--e-saida); }
.veu[data-aberta="true"] { opacity: 1; pointer-events: auto; }

.gaveta {
  position: fixed; z-index: 51; top: 0; right: 0; bottom: 0;
  width: min(440px, 100vw);
  display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform var(--d-medio) var(--e-saida);
}
.gaveta[data-aberta="true"] { transform: translateX(0); }
.gaveta[hidden] { display: none; }
.gaveta-topo { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.gaveta-topo h2 { font-size: 1.0625rem; }
.gaveta-topo .afastar { margin-left: auto; }
.gaveta-corpo { padding: 20px; overflow-y: auto; flex: 1; }
.gaveta-pe { padding: 16px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- 20. entrada / login -------------------------------------------- */
.entrada-tela { min-height: 100dvh; display: grid; grid-template-columns: 1fr 1fr; }
.entrada-marca {
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 40px; background: var(--brand); color: var(--on-brand);
}
/* O painel é a única peça grande de marca: aqui vai o SELO, não o logotipo horizontal. O wordmark
   esticado em 34 px de altura sobre um painel inteiro vira letreiro. O selo é aplicado como máscara
   e pintado com `currentColor`, então acompanha `--on-brand` sem precisar de um arquivo por tema. */
.selo-marca {
  display: block; width: 64px; height: 64px;
  background-color: currentColor;
  -webkit-mask: url('./brand/selo.png') center / contain no-repeat;
  mask: url('./brand/selo.png') center / contain no-repeat;
}
.entrada-marca h1 { font-size: 2.5rem; color: var(--on-brand); letter-spacing: -0.03em; max-width: 16ch; }
.entrada-marca p { opacity: .78; font-size: 0.9375rem; max-width: 34ch; margin-top: 14px; }
.entrada-marca footer { font-family: var(--f-mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; opacity: .7; }

.entrada-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.entrada-caixa { width: 100%; max-width: 380px; }
.entrada-caixa h2 { font-size: 1.5rem; margin-bottom: 6px; }
.entrada-caixa p { color: var(--ink-3); font-size: 0.9375rem; margin-bottom: 28px; }
.entrada-erro { font-size: 0.875rem; color: var(--danger); margin-bottom: 12px; min-height: 20px; }

/* ---------- 21. abas inferiores -------------------------------------------- */
.abas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: none; gap: 2px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
}
.abas a {
  flex: 1; min-width: 0; min-height: 52px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-3); font-size: 0.75rem; font-weight: 500;
  border-radius: var(--r-md);
  transition: color var(--d-rapido) var(--e-saida);
}
.abas a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.abas svg { width: 20px; height: 20px; }

/* ---------- 22. faixa offline ---------------------------------------------- */
.faixa-offline { display: none; align-items: center; gap: 10px; padding: 10px var(--gutter); background: var(--warn-fundo); color: var(--warn); font-size: 0.875rem; border-bottom: 1px solid var(--line); }
body[data-offline="true"] .faixa-offline { display: flex; }

/* ---------- 23. ajustes de tela estreita -----------------------------------
   Ficam no fim de propósito: precisam vencer as definições base por ordem de
   cascata, sem depender de especificidade. */
@media (max-width: 900px) {
  .grade-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grade-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grade-palco { grid-template-columns: minmax(0, 1fr); }
  .entrada-tela { grid-template-columns: 1fr; }
  .entrada-marca { display: none; }
  .pagina-cabeca h1 { font-size: 1.75rem; }
}

@media (max-width: 760px) {
  :root { --gutter: 16px; }
  .abas { display: flex; }
  body { padding-bottom: 76px; }

  .nav-topo { display: none; }
  .topo .wrap { gap: 10px; }
  .topo-acoes { margin-left: auto; }
  .marca img { height: 22px; }

  .pagina { padding: 24px 0 72px; }
  .pagina-cabeca { margin-bottom: 20px; }
  .cartao { padding: 18px; border-radius: var(--r-md); }
  .grade-2, .grade-3, .grade-4 { grid-template-columns: minmax(0, 1fr); }
  .campo-duplo { grid-template-columns: 1fr; }
  .relogio { font-size: 2.5rem; }
  .saudacao { font-size: 1.25rem; }
  .segurar { width: 152px; height: 152px; }
  .segurar-nucleo b { font-size: 0.9375rem; }
  .comprovante-linhas { grid-template-columns: 1fr; }
  .avisos { bottom: 88px; left: 16px; right: 16px; max-width: none; }
  .menu-conta { right: 8px; left: 8px; width: auto; }
}

@media (max-width: 400px) {
  .pagina-cabeca h1 { font-size: 1.5rem; }
  .relogio { font-size: 2.25rem; }
  .tabela { font-size: 0.8125rem; }
  .tabela th, .tabela td { padding: 10px 8px; }
}

/* ---------- 24. utilitários ------------------------------------------------- */
/* escondido na tela, presente no leitor de tela */
.so-leitor {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* menu da conta, pendurado no avatar */
.menu-conta {
  position: absolute; top: calc(100% + 6px); right: var(--gutter); z-index: 45;
  width: 268px; padding: 8px;
  background: var(--surface); border: 1px solid var(--line-forte); border-radius: var(--r-md);
  box-shadow: 0 12px 32px -18px color-mix(in srgb, var(--ink) 55%, transparent);
}
.menu-conta[hidden] { display: none; }
.menu-conta-topo {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px 14px; margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.menu-conta-topo b { font-family: var(--f-display); font-size: 0.9375rem; }
.menu-conta-topo span { font-size: 0.8125rem; color: var(--ink-3); overflow-wrap: anywhere; }
.menu-conta-topo .etiqueta { align-self: flex-start; margin-top: 4px; color: var(--ink-2); }
.menu-conta a, .menu-conta button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 44px; padding: 0 12px;
  border: 0; border-radius: var(--r-sm); background: transparent;
  color: var(--ink-2); font-size: 0.875rem; font-weight: 500; text-align: left; cursor: pointer;
}
.menu-conta a:hover, .menu-conta button:hover { background: var(--surface-2); color: var(--ink); }

/* a tabela irmã do gráfico — mesmos números, para quem prefere ler linha a linha */
.dados-do-grafico { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.dados-do-grafico summary {
  display: list-item; cursor: pointer;
  min-height: 32px; padding: 6px 0;
  font-size: 0.8125rem; color: var(--ink-3); font-weight: 500;
}
.dados-do-grafico summary:hover { color: var(--ink); }
.dados-do-grafico .tabela-area { max-height: 320px; overflow-y: auto; margin-top: 8px; }

/* ---------- 25. movimento reduzido ----------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
