/* Carga Boa - responsivo das telas reais + tema + boca da mascote.
   Carregado depois do CSS de base.html. Nada aqui esconde a rolagem global. */

html { -webkit-text-size-adjust: 100%; }
body { min-width: 0; }
main, .card, form, fieldset, .stats, .stat, .options { min-width: 0; }

/* Cabecalho: logo, navegacao e seletor de tema convivem sem sobreposicao. */
header { flex-wrap: wrap; gap: 12px; row-gap: 8px; }
header .logo { min-width: 0; flex: 1 1 auto; max-width: 100%; }
header .logo svg { height: 30px; width: auto; max-width: 100%; display: block; }
header nav { flex: 0 1 auto; min-width: 0; gap: 10px; font-size: 13px; }
header nav a, header nav button { white-space: nowrap; }
header nav a, header nav button, .cb-theme select { min-height: 44px; }
header nav a, header nav button { display: inline-flex; align-items: center; }
header nav a.cb-user { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 14ch; line-height: 44px; }

.cb-theme { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.cb-theme__label { font-size: 12px; color: var(--cal); }
.cb-theme select { font-size: 13px; padding: 8px 10px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); color: var(--fg); font-family: inherit; }
/* Textos e numeros nao estouram a largura da tela. */
h1, h2, h3 { overflow-wrap: normal; word-break: normal; hyphens: none; }
h1 { font-size: clamp(19px, 5.2vw, 22px); line-height: 1.4; }
.stat b { white-space: nowrap; }
.stat b[style] { white-space: normal; overflow-wrap: anywhere; }
.options label { min-width: 0; line-height: 1.5; }
.options label b { white-space: nowrap; }
input, select, textarea { max-width: 100%; min-width: 0; }
input:not([type=checkbox]):not([type=radio]), textarea { font-size: 16px; }
input[type=checkbox], input[type=radio] { flex-shrink: 0; min-width: 16px; min-height: 16px; }
.btn { min-height: 44px; line-height: 1.4; overflow-wrap: normal; }
.muted { line-height: 1.55; }
code, pre { overflow-wrap: anywhere; word-break: break-word; }
pre { max-width: 100%; white-space: pre-wrap; }

/* Tabelas largas rolam dentro do proprio cartao (.scroll), sem empurrar a pagina. */
.scroll { max-width: 100%; overflow: auto; overscroll-behavior-inline: contain; }
.scroll table { min-width: 480px; }
table td, table th { overflow-wrap: anywhere; }
table td:last-child:not(:only-child) { white-space: nowrap; }
/* Boca da mascote de recarga: trilho + preenchimento real (SOC) + cauda decorativa. */
.cb-mouth-track { stroke: #C9D3CE; }
.cb-mouth-fill { stroke: #123B31; stroke-dasharray: 0 100; transition: stroke-dasharray .5s ease; }
.cb-mouth-tail { stroke: #F6B40E; stroke-dasharray: 12 100; }
.cb-soc[aria-hidden="true"] .cb-mouth-tail { display: none; }

@media (prefers-reduced-motion: reduce) {
  .cb-mouth-tail { display: none !important; }
  .cb-mouth-fill { transition: none; }
}

@media (max-width: 480px) {
  main { padding: 16px 14px; }
  .card { padding: 14px; }
  header { padding: 12px 14px; }
  header nav { font-size: 12px; gap: 9px; }
  header .logo svg { height: 26px; }
  header nav a.cb-user { max-width: 10ch; }
  .cb-theme__label { display: none; }
  .options[style*="repeat(4"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
  .stat b[style*="font-size:16px"] { font-size: 14px !important; }
}

@media (max-width: 340px) {
  header nav { font-size: 11px; gap: 8px; }
  header .logo svg { height: 24px; }
  header nav a.cb-user { max-width: 8ch; }
}

/* Navegação do painel do operador (A1) */
.cb-admin-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.cb-admin-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line); color: var(--fg); text-decoration: none; font-weight: 700; font-size: 14px; }
.cb-admin-nav a[aria-current="page"] { background: var(--cerrado); color: var(--cal); border-color: var(--cerrado); }
.cb-chart { display: block; min-width: 520px; }

/* Barra de progresso do consumo (T3) */
.cb-progress { width: 100%; height: 14px; margin: 4px 0 10px; accent-color: var(--cerrado); }

/* Folha do QR Code para impressão (A5) */
.cb-qr-sheet { background: #fff; color: #262B29; border: 1px solid var(--line); border-radius: 14px; padding: 24px; max-width: 520px; margin: 0 auto; text-align: center; }
.cb-qr-sheet h1 { margin-top: 0; color: #123B31; }
.cb-qr { background: #fff; padding: 12px; display: flex; justify-content: center; }
.cb-qr svg { width: min(86vw, 340px); height: auto; }
.cb-qr-url { font-size: 12px; color: #5A6A64; overflow-wrap: anywhere; margin: 4px 0; }
.cb-qr-price { font-family: var(--f-display); font-size: 24px; color: #123B31; margin: 8px 0; }
.cb-qr-sheet ol { text-align: left; max-width: 380px; margin: 12px auto; }
.cb-qr-sheet .muted { color: #5A6A64; }

@media print {
  header, .help, .no-print { display: none !important; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .cb-qr-sheet { border: 0; max-width: none; border-radius: 0; }
  @page { size: A5; margin: 12mm; }
}