/* O app do dono, no visual do HG Rega. Fontes: Figtree (texto) e Bricolage Grotesque (números e títulos), SIL OFL.
   Cores: todas em variáveis, logo abaixo. */
@font-face { font-family: "Figtree"; font-weight: 300 900; font-display: swap; src: url(/fontes/figtree.woff2) format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 200 800; font-display: swap; src: url(/fontes/bricolage.woff2) format("woff2"); }

[hidden] { display: none !important; }
/* As cores: o claro aqui; o escuro no bloco seguinte, quando data-tema="escuro" no <html> (o tema na tela: a escolha
   da pessoa, ou o do sistema no Automático; js/base.js). Só o que um navegador de 2019 entende. */
:root {
  color-scheme: light;
  --fundo: #f5f7f8;
  --superficie: #fff;
  --tinta: #0e1a22;
  --cinza: #4d5d68;
  --cinza-2: #5f6e78;
  --linha: #e4e9ed;
  --linha-2: #eef2f5;
  --apagado: #f1f4f6;
  --trilho: #e8edf0;
  --chave-off: #d3dce2;
  --escolhido: #fff;
  --acento: #12a8e0;
  --acento-claro: #e3f5fc;
  --acento-escuro: #0b7fb8;
  --sobre-acento: #0e1a22;
  --link: #0a6f99;
  --escuro: #0e1a22;
  --sobre-escuro: #fff;
  --aviso: #8a4b00;
  --aviso-claro: #fff1dc;
  --erro: #c62828;
  --erro-claro: #fdecea;
  --ok: #146b45;
  --ok-claro: #e5f6ee;
  --sombra: rgba(14, 26, 34, .08);
  --acento-anel: rgba(18, 168, 224, .18);            /* o anel do foco */
  --acento-meio: rgba(18, 168, 224, .55);            /* o que a regra liga, numa porta desligada */
  --abas: rgba(255, 255, 255, .96);
  --titulo: "Bricolage Grotesque", "Figtree", ui-sans-serif, system-ui, sans-serif;
  --borda: 0 1px 2px var(--sombra), inset 0 0 0 1px var(--linha);
  --foco: inset 0 0 0 2px var(--acento), 0 0 0 4px var(--acento-anel);
  --mola: cubic-bezier(.2, .8, .2, 1);
}
/* O escuro puxa para o verde da marca. */
:root[data-tema="escuro"] {
  color-scheme: dark;
  --fundo: #0c130f;
  --superficie: #141e18;
  --tinta: #e3ede6;
  --cinza: #a4b5aa;
  --cinza-2: #8a9c90;
  --linha: #253128;
  --linha-2: #1c271f;
  --apagado: #1b261f;
  --trilho: #19231c;
  --chave-off: #34453a;
  --escolhido: #2c3d31;
  --acento: #4cc38a;
  --acento-claro: #173424;
  --acento-escuro: #7fdcaa;
  --sobre-acento: #08160e;
  --link: #74d6a2;
  --escuro: #e3ede6;
  --sobre-escuro: #0c130f;
  --aviso: #f0b45c;
  --aviso-claro: #33260f;
  --erro: #ff7b72;
  --erro-claro: #3a1715;
  --ok: #6fdca5;
  --ok-claro: #15301f;
  --sombra: rgba(0, 0, 0, .4);
  --acento-anel: rgba(76, 195, 138, .18);
  --acento-meio: rgba(76, 195, 138, .55);
  --abas: rgba(20, 30, 24, .96);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; font: 16px/1.45 "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--tinta); background: var(--fundo); }
main { max-width: 480px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 24px) 20px 40px; }
body.com-abas main { padding-bottom: 120px; }
h1, h2, p { margin: 0; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sub { color: var(--cinza); font-size: 15px; }
.nota { color: var(--cinza-2); font-size: 13px; line-height: 1.4; }
.mt { margin-top: 12px; } .mt-g { margin-top: 22px; } .centro { text-align: center; }
.secao { margin: 24px 0 8px 4px; font-size: 15px; font-weight: 600; }
.cartao { background: var(--superficie); border-radius: 20px; box-shadow: var(--borda); }

/* botões */
button { font: inherit; color: inherit; cursor: pointer; }
.botao { display: flex; gap: 8px; justify-content: center; align-items: center; width: 100%; min-height: 54px; padding: 0 16px; border: 0;
         border-radius: 16px; font-size: 15px; font-weight: 600; text-decoration: none; color: var(--tinta);
         transition: transform .18s var(--mola), background-color .2s ease, box-shadow .2s ease, opacity .2s ease; }
.botao:active { transform: scale(.97); }
.botao:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.botao.escuro { background: var(--escuro); color: var(--sobre-escuro); }
.botao.acento { background: var(--acento); color: var(--sobre-acento); font-weight: 700;
                box-shadow: 0 10px 22px -12px var(--acento); }
.botao.cinza { background: var(--apagado); }
.botao.contorno { background: var(--superficie); box-shadow: var(--borda); }
.botao.vermelho { background: var(--erro); color: var(--sobre-escuro); }
.botao.baixo { min-height: 48px; border-radius: 14px; }
.botao svg.i { width: 18px; height: 18px; }
.dupla { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 10px; }
.dupla-igual { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dupla-igual .botao { min-height: 46px; border-radius: 12px; }
.link { background: none; border: 0; padding: 8px 0; color: var(--link); font-weight: 600; font-size: 15px; }
.link.perigo { color: var(--erro); min-height: 44px; }
.centro-bloco { display: block; margin: 14px auto 0; }
.voltar, .botao-topo { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 12px; background: none; color: var(--tinta); }
.botao-topo { color: var(--cinza-2); }
.botao-topo.tema svg.i { width: 20px; height: 20px; }
.marca .botao-topo.tema { margin-left: auto; margin-right: -10px; }
.canto { display: flex; justify-content: flex-end; margin: -10px -10px 0 0; }
.topo h1, .cabeca > div { flex: 1; min-width: 0; }   /* os botões do topo à direita */

/* formulários */
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 16px; }
input, select { width: 100%; height: 54px; margin-top: 6px; padding: 0 16px; border: 0; border-radius: 14px; font: inherit; font-size: 16px; color: var(--tinta);
                background: var(--superficie); box-shadow: var(--borda); transition: box-shadow .15s ease; }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: var(--foco); }
textarea { display: block; width: 100%; margin-top: 6px; padding: 14px 16px; border: 0; border-radius: 14px; font: inherit; font-size: 16px;
           font-weight: 400; color: var(--tinta); background: var(--superficie); box-shadow: var(--borda); resize: vertical; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.formulario-solto { margin-top: 28px; }
.formulario-solto .botao { margin-top: 16px; }
.esqueci { display: block; margin: 4px 0 0 auto; min-height: 44px; font-size: 14px; }
.info-acento { margin-top: 4px; padding: 12px 14px; border-radius: 14px; background: var(--acento-claro); font-size: 14px; line-height: 1.4; animation: aparece .22s ease both; }
.erro-txt { color: var(--erro); font-size: 14px; font-weight: 600; }
.erro-txt:empty { display: none; }
.campo-senha { position: relative; display: block; }
.campo-senha input { padding-right: 56px; }
.ver-senha { position: absolute; right: 5px; top: 11px; display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: none; color: var(--cinza); }
.ver-senha[aria-pressed="true"] { color: var(--link); }
.ou { text-align: center; color: var(--cinza-2); font-size: 14px; margin: 14px 0 0; }
.regra { display: flex; align-items: center; gap: 6px; margin: -10px 0 16px; font-size: 13px; color: var(--cinza-2); }
.regra svg.i { width: 14px; height: 14px; stroke-width: 2.6; opacity: .25; transition: opacity .2s ease, color .2s ease; }
.regra.ok { color: var(--ok); } .regra.ok svg.i { opacity: 1; }

/* entrar */
.marca { display: flex; align-items: center; gap: 10px; margin-top: 44px; font-family: var(--titulo); font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.logo { width: 32px; height: 32px; border-radius: 50%; }
.selo-marca { margin-left: -2px; padding: 3px 8px; border-radius: 8px; background: var(--acento-claro); color: var(--link); font-family: "Figtree", sans-serif; font-size: 13px; font-weight: 700; letter-spacing: 0; }
.grande-titulo { margin: 52px 0 8px; font-family: var(--titulo); font-size: 36px; font-weight: 600; letter-spacing: -.025em; line-height: 1.1; }
.rodape-entrar { margin-top: 64px; text-align: center; color: var(--cinza); font-size: 15px; }
.rodape-entrar .link { font-size: 15px; font-weight: 700; padding: 0; }

/* cabeçalhos */
.topo { display: flex; align-items: center; gap: 8px; min-height: 52px; margin-bottom: 8px; }
.topo h1, .cabeca h1 { font-family: var(--titulo); font-size: 20px; font-weight: 600; line-height: 1.15; }
.topo .voltar { margin-left: -6px; }
h1.grande { font-size: 30px; letter-spacing: -.02em; }
.cabeca { display: flex; align-items: flex-end; gap: 4px; min-height: 56px; }
.cabeca h1 { font-size: 22px; letter-spacing: -.01em; }
.conexao { display: flex; align-items: center; gap: 7px; margin-top: 3px; font-size: 13px; color: var(--cinza); }
.barras rect { fill: var(--chave-off); transition: fill .3s ease; }
.barras rect.on { fill: var(--tinta); }
.nota-offline { margin-top: 10px; font-size: 14px; line-height: 1.4; color: var(--cinza); }

/* a lista de aparelhos */
.lista-aparelhos { display: grid; gap: 10px; }
.aparelho { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; border: 0; text-align: left; }
.aparelho .nome { font-weight: 700; font-size: 17px; }
.aparelho .seta { margin-left: auto; color: var(--cinza-2); }
.bolinha { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--acento-claro); color: var(--acento-escuro); flex: none; }
.bolinha.off { background: var(--apagado); color: var(--cinza-2); }
.bolinha.aviso { background: var(--aviso-claro); color: var(--aviso); }

/* linhas, chaves */
.lista-linhas { overflow: hidden; }
.lista-linhas > * + * { border-top: 1px solid var(--linha-2); }
.linha { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 60px; padding: 12px 16px; border: 0; background: none;
         text-align: left; text-decoration: none; color: var(--tinta); font-size: 16px; }
.linha .valor { margin-left: auto; color: var(--cinza); text-align: right; display: flex; align-items: center; gap: 7px; overflow-wrap: anywhere; }
.linha .seta { width: 18px; height: 18px; color: var(--cinza-2); }
.linha .valor + .seta { margin-left: 0; }
.linha.alta { min-height: 68px; }
.linha.alta > span { flex: 1; min-width: 0; line-height: 1.3; }
.linha.alta .seta { margin-left: auto; }
.acao-linha { color: var(--link); font-weight: 600; }
.acao-linha .seta { margin-left: auto; }
.rotulo { display: block; font-size: 13px; color: var(--cinza-2); }
.peso { display: block; font-weight: 400; }
.peso.forte { font-weight: 600; }
.campo-linha { margin: 0; font-size: 16px; font-weight: 400; cursor: text; }
.campo-linha input { flex: 1; min-width: 0; height: 40px; margin: 0; padding: 0; background: none; box-shadow: none; text-align: right; font-size: 16px; font-weight: 600; color: var(--link); }
.campo-linha input:focus { box-shadow: none; color: var(--tinta); }
.chave { position: relative; flex: none; width: 64px; height: 44px; margin: -8px -8px -8px auto; padding: 0; border: 0; background: none; }
.chave::before { content: ""; position: absolute; left: 6px; top: 6px; width: 52px; height: 32px; border-radius: 16px; background: var(--chave-off); transition: background-color .2s ease; }
.chave i { position: absolute; top: 9px; left: 9px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(14, 26, 34, .28);
           transition: left .2s var(--mola); }
.chave[aria-checked="true"]::before { background: var(--acento); }
.chave[aria-checked="true"] i { left: 29px; }
.chave:disabled { opacity: .45; cursor: not-allowed; }
.chave[aria-busy="true"] i { animation: pulsa-chave .9s ease-in-out infinite; }
@keyframes pulsa-chave { 50% { transform: scale(.8); } }
.segmento { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 4px; padding: 4px; border-radius: 14px; background: var(--trilho); }
.segmento button { height: 40px; padding: 0 4px; border: 0; border-radius: 10px; background: transparent; font-size: 14px; font-weight: 500;
                   transition: background-color .2s ease, box-shadow .2s ease; }
.segmento button[aria-checked="true"] { background: var(--escolhido); box-shadow: 0 1px 3px var(--sombra); font-weight: 700; }
.alarme { display: flex; gap: 12px; align-items: center; margin-top: 18px; padding: 14px; border-radius: 16px; background: var(--erro-claro); color: var(--erro); font-weight: 600; font-size: 14px; }
.alarme.aviso { background: var(--aviso-claro); color: var(--aviso); }
.bloco { display: block; padding: 16px; margin-top: 12px; }
.bloco .formulario-solto { margin-top: 12px; }
.email-grande { display: block; margin-top: 2px; font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.titulo-bloco { font-family: var(--titulo); font-size: 20px; font-weight: 600; }
.caixa-perigo { margin-top: 16px; padding: 16px; border-radius: 20px; background: var(--erro-claro); animation: aparece .25s ease both; }
.caixa-perigo b { font-size: 16px; }
.caixa-perigo .sub { margin-top: 4px; font-size: 14px; line-height: 1.4; }
.caixa-perigo .botao:not(.vermelho) { background: var(--superficie); }

/* o odômetro (js/base.js, odo): cada dígito é uma coluna 0–9 que rola até o lugar */
.odo { display: inline-flex; height: 1em; line-height: 1; overflow: hidden; }
.odo .d { position: relative; display: inline-block; }
.odo .d > span:first-child { visibility: hidden; }
.odo .col { position: absolute; left: 50%; top: 0; display: flex; flex-direction: column; align-items: center; transform: translate(-50%, 0);
            transition: transform .7s var(--mola); }

/* histórico */
.eventos { list-style: none; margin: 0; padding: 0 16px; }
.eventos li { display: flex; gap: 12px; align-items: center; padding: 12px 0; font-size: 15px; line-height: 1.35; }
.eventos li + li { border-top: 1px solid var(--linha-2); }
.eventos li.dia { padding: 14px 0 4px; font-size: 13px; font-weight: 600; color: var(--cinza-2); border: 0; }
.eventos li.dia + li { border-top: 0; }
.bolinha-ev { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--acento-claro); color: var(--acento-escuro); }
.bolinha-ev svg.i { width: 17px; height: 17px; }
.desligou .bolinha-ev { background: var(--apagado); color: var(--cinza-2); }
.alerta .bolinha-ev { background: var(--aviso-claro); color: var(--aviso); }
.ev-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ev-texto small { font-size: 13px; color: var(--cinza-2); }
.ev-texto small:empty { display: none; }
.eventos .quando { align-self: flex-start; margin-top: 2px; color: var(--cinza-2); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* adicionar, esperando */
.passos-cartao { margin: 22px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.passos-cartao li { display: flex; gap: 14px; padding: 14px 16px; border-radius: 20px; background: var(--superficie); box-shadow: var(--borda); }
.passos-cartao li > div { flex: 1; min-width: 0; }
.passos-cartao b { display: block; font-size: 16px; font-weight: 600; }
.passos-cartao p { margin-top: 2px; font-size: 14px; line-height: 1.4; color: var(--cinza); }
.num { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--escuro); color: var(--sobre-escuro); font-size: 14px; font-weight: 700; }
.esperando { text-align: center; padding-top: 60px; }
.esperando .logo { width: 64px; height: 64px; }
.esperando .grande-titulo { margin-top: 22px; }
.pulsa { animation: pulsa 1.6s ease-in-out infinite; }
@keyframes pulsa { 50% { transform: translateY(-6px) scale(1.05); } }

/* um tipo sem módulo: o estado como chega */
.estado-generico .valor { font-variant-numeric: tabular-nums; }

/* abas de baixo */
#abas { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
        padding: 8px max(28px, calc(50% - 212px)) max(18px, env(safe-area-inset-bottom)); background: var(--abas);
        box-shadow: 0 -1px 0 var(--linha); backdrop-filter: blur(8px); }
#abas a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; text-decoration: none; color: var(--cinza-2); font-size: 12px; font-weight: 500; }
#abas svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#abas a[aria-current="page"] { color: var(--tinta); font-weight: 700; }
#abas a[aria-current="page"] .cheio { fill: currentColor; }
#abas a[aria-current="page"] .vazado { stroke: var(--superficie); stroke-width: 1.9; }

/* aviso de baixo */
.toast { position: fixed; left: 50%; bottom: 104px; z-index: 30; display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100% - 32px);
         min-height: 52px; padding: 4px 16px; border-radius: 16px; background: var(--escuro); color: var(--sobre-escuro); font-size: 14px;
         box-shadow: 0 12px 30px rgba(14, 26, 34, .28); transform: translateX(-50%); animation: torrada .38s cubic-bezier(.2, .9, .25, 1.05) both; pointer-events: none; }
body:not(.com-abas) .toast { bottom: 24px; }
@keyframes torrada { from { transform: translate(-50%, 16px); opacity: 0; } }

/* folhas de baixo */
dialog.folha { width: 100%; max-width: 480px; margin: auto auto 0; padding: 8px 20px max(30px, env(safe-area-inset-bottom)); border: 0;
               border-radius: 28px 28px 0 0; background: var(--superficie); color: var(--tinta); box-shadow: 0 -16px 40px rgba(0, 0, 0, .18); }
dialog.folha::backdrop { background: rgba(14, 26, 34, .28); }
dialog.folha[open] { animation: sobe .46s cubic-bezier(.2, .9, .25, 1) both; }
dialog.folha[open]::backdrop { animation: aparece .25s ease both; }
dialog.folha textarea { background: var(--fundo); }
@keyframes sobe { from { transform: translateY(100%); } }
@keyframes aparece { from { opacity: 0; } }
.alca { display: block; width: 36px; height: 5px; margin: 0 auto 14px; border-radius: 3px; background: var(--linha); }
.folha h2 { font-family: var(--titulo); font-size: 24px; font-weight: 600; letter-spacing: -.01em; }
.folha .sub { margin-top: 4px; font-size: 14px; }

@media (max-width: 360px) { .segmento button { padding: 0 2px; font-size: 13px; letter-spacing: -.01em; white-space: nowrap; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
