/* Tema INVICTUS nas cores da PMMT: azul-marinho, verde e dourado.
   Claro por padrão; escuro pelo sistema ou pela escolha em Mais › Aparência (js/tema.js grava data-tema). */
:root {
  --marinho: #0f1f3d;
  --marinho-2: #1b3a6b;
  --verde: #1e5c2a;
  --dourado: #c9950c;
  --dourado-claro: #f2c94c;

  --primaria: #1b3a6b;
  --acento: #c9950c;
  --acento-forte: #8a6400;
  --acento-texto: #1a1300;
  --fundo: #eef2f8;
  --superficie: #ffffff;
  --superficie-2: #f3f5f9;
  --texto: #0f1f3d;
  --sutil: #5b6776;
  --borda: #d9dfe8;
  --sucesso: #1e7a35;
  --aviso: #b45309;
  --erro: #c0262d;
  --topo: #0f1f3d;
  --nav-fundo: #ffffff;
  --nav-ativo: #0f1f3d;
  --btn-fundo: #1b3a6b;
  --btn-fundo-hover: #0f1f3d;
  --btn-texto: #ffffff;
  --raio: 16px;
  --sombra: 0 1px 2px rgba(15, 31, 61, .06), 0 6px 18px rgba(15, 31, 61, .06);
  --nav-altura: 64px;
  --fonte-titulo: "Helvetica Neue", "Arial Black", Arial, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    --primaria: #f2c94c; --acento: #f2c94c; --acento-forte: #f2c94c; --acento-texto: #1a1300;
    --fundo: #08101e; --superficie: #111c30; --superficie-2: #18263f; --texto: #e8edf5; --sutil: #9aa8bd; --borda: #24344f;
    --sucesso: #34c759; --aviso: #f59e0b; --erro: #ff6b6b;
    --topo: #060c18; --nav-fundo: #060c18; --nav-ativo: #ffffff; --btn-fundo: #f2c94c; --btn-fundo-hover: #ffd96b; --btn-texto: #111111;
    --sombra: none; color-scheme: dark;
  }
}
:root[data-tema="escuro"] {
  --primaria: #f2c94c; --acento: #f2c94c; --acento-forte: #f2c94c; --acento-texto: #1a1300;
  --fundo: #08101e; --superficie: #111c30; --superficie-2: #18263f; --texto: #e8edf5; --sutil: #9aa8bd; --borda: #24344f;
  --sucesso: #34c759; --aviso: #f59e0b; --erro: #ff6b6b;
  --topo: #060c18; --nav-fundo: #060c18; --nav-ativo: #ffffff; --btn-fundo: #f2c94c; --btn-fundo-hover: #ffd96b; --btn-texto: #111111;
  --sombra: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--fundo);
  color: var(--texto);
}
a { color: var(--primaria); }
h1, h2, .grande, .stat-valor, .kpi-valor, .gps-valor { font-family: var(--fonte-titulo); }
h1 { font-size: 1.9rem; margin: .5rem 0 1rem; line-height: 1.05; font-weight: 900; text-transform: uppercase; letter-spacing: -.01em; }
h2 { font-size: .95rem; margin: 0 0 .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
h3 { font-size: .95rem; margin: .25rem 0 .5rem; color: var(--sutil); }
pre { white-space: pre-wrap; }
code { font-family: ui-monospace, Consolas, monospace; }
[hidden] { display: none !important; }

/* ---------- estrutura ---------- */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.topo {
  position: sticky; top: 0; z-index: 500;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem 1rem; padding-top: max(.6rem, env(safe-area-inset-top));
  background: var(--topo); color: #fff; border-bottom: 3px solid var(--dourado);
}
.marca { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.marca img { height: 30px; width: auto; }
.topo-dir { display: flex; align-items: center; gap: .5rem; font-size: .85rem; }
.topo-usuario { opacity: .85; }
.badge-offline, .badge-fila { background: var(--acento); color: var(--acento-texto); border-radius: 99px; padding: .1rem .6rem; font-weight: 600; font-size: .75rem; }

main {
  flex: 1; width: 100%; max-width: 1100px; margin: 0 auto;
  padding: 1rem 1rem calc(var(--nav-altura) + 1.5rem + env(safe-area-inset-bottom));
  outline: none;
}

.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 500;
  display: flex; justify-content: space-around;
  height: calc(var(--nav-altura) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--nav-fundo); border-top: 1px solid var(--borda);
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--sutil); text-decoration: none; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav a.ativo { color: var(--nav-ativo); }
.nav a.ativo svg { stroke: var(--acento); }
.nav a.ativo svg { stroke-width: 2.6; }

@media (min-width: 900px) {
  #app:not(.sem-shell) { padding-left: 220px; }
  .topo { margin-left: -220px; padding-left: 1.25rem; }
  .nav {
    top: 0; bottom: 0; right: auto; width: 220px; height: auto; flex-direction: column; justify-content: flex-start;
    padding: 4.5rem .75rem 1rem; border-top: 0; border-right: 1px solid var(--borda);
  }
  .nav a { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: .75rem; padding: .7rem .9rem; border-radius: 10px; font-size: .95rem; }
  .nav a.ativo { background: var(--superficie-2); }
  main { padding-bottom: 2rem; }
}

/* ---------- componentes ---------- */
.card {
  background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio);
  padding: 1rem 1.1rem; margin-bottom: 1rem; box-shadow: var(--sombra);
}
.sutil { color: var(--sutil); font-size: .9rem; }
.centro { text-align: center; }
.grande { font-size: 2.4rem; font-weight: 900; line-height: 1; text-transform: uppercase; letter-spacing: -.02em; }
.tag { display: inline-block; margin-left: .4rem; padding: 0 .5rem; border-radius: 99px; font-size: .72rem; font-weight: 700; background: color-mix(in srgb, var(--primaria) 14%, transparent); color: var(--primaria); vertical-align: middle; }
.tag-acento { background: var(--acento); color: var(--acento-texto); }
.tag-aviso { background: color-mix(in srgb, var(--aviso) 18%, transparent); color: var(--aviso); }
.tag-sucesso { background: color-mix(in srgb, var(--sucesso) 18%, transparent); color: var(--sucesso); margin-left: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 46px; padding: .55rem 1.2rem; border-radius: 99px; border: 1px solid var(--borda);
  background: transparent; color: var(--texto); font: inherit; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; font-size: .85rem; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--texto); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primario { background: var(--btn-fundo); border-color: var(--btn-fundo); color: var(--btn-texto); }
.btn-primario:hover { background: var(--btn-fundo-hover); border-color: var(--btn-fundo-hover); }
.btn-acento { background: var(--acento); border-color: var(--acento); color: var(--acento-texto); }
.btn-perigo { color: var(--erro); border-color: color-mix(in srgb, var(--erro) 40%, transparent); }
.btn-claro { background: rgba(255, 255, 255, .15); border-color: rgba(255, 255, 255, .35); color: #fff; }
.btn-link { border: 0; background: none; color: var(--primaria); padding-left: 0; padding-right: 0; min-height: 36px; text-transform: none; letter-spacing: 0; font-size: .95rem; }
.btn-bloco { width: 100%; }
.btn-grande { min-height: 56px; font-size: 1.1rem; }
.btn-pequeno { min-height: 34px; font-size: .85rem; padding: .25rem .75rem; }
.btn-icone { border: 0; background: none; color: var(--sutil); font-size: 1rem; cursor: pointer; min-width: 36px; min-height: 36px; border-radius: 8px; }
.btn-icone:hover { background: var(--fundo); color: var(--erro); }
.acoes, .acoes-rapidas { display: flex; flex-wrap: wrap; gap: .6rem; }
.acoes-rapidas { margin-bottom: 1rem; }
.acoes-rapidas .btn { flex: 1 1 200px; }

.campo { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .85rem; font-weight: 600; font-size: .9rem; }
.campo small { font-weight: 400; color: var(--sutil); }
input, select, textarea {
  font: inherit; color: var(--texto); background: var(--superficie-2);
  border: 1px solid var(--borda); border-radius: 12px; padding: .6rem .75rem; min-height: 44px; width: 100%;
}
input[type=range] { padding: 0; border: 0; accent-color: var(--primaria); }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--primaria); }
input:focus-visible, select:focus-visible, .btn:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--acento) 70%, transparent); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: .6rem; margin: .75rem 0; cursor: pointer; }
.grade-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 1rem; }
.campo-largo { grid-column: 1 / -1; }
.linha-form { display: flex; gap: .5rem; margin: .5rem 0; flex-wrap: wrap; }
.linha-form > input, .linha-form > select { flex: 1 1 180px; width: auto; }
.filtros { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filtros > input, .filtros > select { flex: 1 1 200px; width: auto; }

.alerta { border-radius: 10px; padding: .75rem 1rem; margin: .75rem 0; font-size: .92rem; }
.alerta p { margin: .25rem 0; }
.alerta-erro { background: color-mix(in srgb, var(--erro) 12%, transparent); color: var(--erro); }
.alerta-aviso { background: color-mix(in srgb, var(--acento) 16%, transparent); border: 1px solid color-mix(in srgb, var(--acento) 40%, transparent); }
.alerta-info { background: color-mix(in srgb, var(--primaria) 12%, transparent); }

.progresso { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--primaria) 14%, transparent); overflow: hidden; margin: .4rem 0; }
.progresso-barra { height: 100%; background: var(--acento); border-radius: 99px; transition: width .4s; }

.lista { list-style: none; margin: 0; padding: 0; }
.lista > li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem .75rem; padding: .7rem 0; border-bottom: 1px solid var(--borda); }
.lista > li > :first-child { flex: 1 1 auto; }
.lista > li:last-child { border-bottom: 0; }
.lista details { flex-basis: 100%; }
.lista-link { display: flex; flex-direction: column; flex: 1; color: inherit; text-decoration: none; }
.menu .lista-link { padding: .25rem 0; }
.menu .lista-link::after { content: "›"; position: absolute; right: 1.5rem; color: var(--sutil); }
.lista-simples { padding-left: 1.2rem; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-bottom: 1rem; }
.stat { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: .8rem .5rem; text-align: center; }
.stat-valor { color: var(--primaria); font-size: 1.9rem; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-rotulo { font-size: .7rem; color: var(--sutil); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
a.stat { color: inherit; text-decoration: none; }

.destaque { background: linear-gradient(140deg, var(--marinho-2) 0%, var(--marinho) 65%, #12351c 100%); color: #fff; border: 0; border-left: 5px solid var(--dourado); }
.destaque .btn-primario { background: var(--dourado-claro); border-color: var(--dourado-claro); color: #111; }
.destaque .sutil { color: rgba(255, 255, 255, .78); }
.destaque .progresso { background: rgba(255, 255, 255, .2); }
.destaque-topo { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.meta-linha { display: flex; justify-content: space-between; font-size: .95rem; }

.taf-resumo { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.taf-resultado { margin-top: .75rem; }
.selo { display: inline-block; padding: .1rem .65rem; border-radius: 99px; font-size: .8rem; font-weight: 700; color: #fff; }
.faixa-excelente { background: #15803d; }
.faixa-bom { background: #2563eb; }
.faixa-regular { background: #ca8a04; }
.faixa-insuficiente { background: #ea580c; }
.faixa-inapto { background: #b91c1c; }

.tabela-rolagem { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabela { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabela th, .tabela td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--borda); vertical-align: top; }
.tabela th { color: var(--sutil); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.tabela-compacta { font-size: .82rem; }
.tabela td.ok { color: var(--sucesso); font-weight: 700; }
tr.clicavel { cursor: pointer; }
tr.clicavel:hover { background: var(--fundo); }
tr.inativo { opacity: .55; }
tr.alerta-linha td { color: var(--erro); }
.paginacao { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1rem; }

.segmentado { display: flex; background: var(--fundo); border: 1px solid var(--borda); border-radius: 12px; padding: 3px; margin: .5rem 0 1rem; gap: 3px; overflow-x: auto; }
.segmentado button { flex: 1; border: 0; background: none; font: inherit; font-weight: 600; padding: .5rem .75rem; border-radius: 9px; color: var(--sutil); cursor: pointer; min-height: 40px; white-space: nowrap; }
.segmentado button.ativo { background: var(--superficie); color: var(--texto); box-shadow: var(--sombra); }
.segmentado-pequeno { max-width: 260px; }

.subnav { display: flex; gap: .25rem; border-bottom: 1px solid var(--borda); margin-bottom: 1rem; overflow-x: auto; }
.subnav a { padding: .6rem .9rem; text-decoration: none; color: var(--sutil); font-weight: 800; text-transform: uppercase; font-size: .8rem; letter-spacing: .05em; border-bottom: 3px solid transparent; white-space: nowrap; }
.subnav a.ativo { color: var(--texto); border-bottom-color: var(--acento); }
.titulo-linha { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.titulo-linha select { width: auto; min-width: 220px; }
.grade-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 1rem; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--superficie); border: 1px solid var(--borda); border-left: 5px solid var(--borda); border-radius: var(--raio); padding: .85rem 1rem; }
.kpi-ok { border-left-color: var(--sucesso); }
.kpi-alerta { border-left-color: var(--aviso); }
.kpi-rotulo { font-size: .8rem; color: var(--sutil); font-weight: 600; }
.kpi-valor { font-size: 1.8rem; font-weight: 800; }
.kpi-meta { font-size: .78rem; color: var(--sutil); }

/* gráficos */
.grafico { width: 100%; height: auto; display: block; }
.grafico-grade { stroke: var(--borda); stroke-width: 1; }
.grafico-eixo { fill: var(--sutil); font-size: 12px; }
.grafico-vazio { fill: var(--sutil); font-size: 14px; }
.barras { display: flex; flex-direction: column; gap: .45rem; }
.barras-linha { display: grid; grid-template-columns: 90px 1fr 52px; align-items: center; gap: .5rem; font-size: .85rem; }
.barras-trilho { position: relative; height: 16px; background: var(--fundo); border-radius: 6px; }
.barras-valor { height: 100%; border-radius: 6px; background: var(--primaria); min-width: 2px; }
.barras-meta { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--texto); opacity: .6; }
.barras-num { text-align: right; font-weight: 700; }

/* ranking */
.ranking { list-style: none; margin: 0; padding: 0; }
.ranking li { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--borda); }
.ranking li.eu { background: color-mix(in srgb, var(--acento) 18%, transparent); border-radius: 10px; padding-left: .4rem; padding-right: .4rem; }
.ranking .pos { font-weight: 800; color: var(--sutil); text-align: center; }
.ranking .progresso { height: 6px; }

/* plano */
.fase summary { display: flex; align-items: center; gap: .75rem; cursor: pointer; list-style: none; }
.fase summary::-webkit-details-marker { display: none; }
.fase-num { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--fundo); font-weight: 800; flex: 0 0 auto; }
.fase-atual { border-color: var(--acento); }
.fase-atual .fase-num { background: var(--acento); color: var(--acento-texto); }
.etapa { border-left: 3px solid var(--borda); padding: .25rem 0 .25rem .9rem; margin: .75rem 0; }
.etapa ul { margin: .35rem 0; padding-left: 1.1rem; }
.etapa-atual { border-left-color: var(--acento); background: color-mix(in srgb, var(--acento) 10%, transparent); border-radius: 0 10px 10px 0; }
.etapa-titulo { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; }

/* registrar / gps */
.gps-chamada { display: flex; align-items: center; gap: 1rem; text-decoration: none; color: inherit; border-color: var(--acento); }
.gps-chamada > span:last-child { display: flex; flex-direction: column; }
.gps-icone { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--acento); color: var(--acento-texto); font-size: 1.4rem; flex: 0 0 auto; }
.mapa { height: 300px; border-radius: var(--raio); overflow: hidden; margin-bottom: .75rem; background: var(--borda); z-index: 0; }
.mapa-vivo { height: 38vh; min-height: 220px; }
.gps-status { text-align: center; font-weight: 600; color: var(--sutil); margin-bottom: .5rem; min-height: 1.5em; }
.gps-painel { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: .75rem; }
.gps-bloco { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: .6rem .4rem; text-align: center; display: flex; flex-direction: column; }
.gps-bloco span { font-size: .75rem; color: var(--sutil); }
.gps-bloco-largo { grid-column: 1 / -1; }
.gps-valor { font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.gps-tempo { font-size: 2.6rem; }
.gps-botoes { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.gps-extra { display: flex; justify-content: center; margin: .75rem 0; }
.parciais { list-style: none; margin: 0; padding: 0; columns: 2; }
.parciais li { display: flex; justify-content: space-between; padding: .3rem .5rem; break-inside: avoid; font-variant-numeric: tabular-nums; }
.legenda-ritmo { display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--sutil); margin: -.25rem 0 .75rem; }
.legenda-gradiente { flex: 1; height: 8px; border-radius: 99px; background: linear-gradient(90deg, hsl(130, 80%, 42%), hsl(65, 80%, 42%), hsl(0, 80%, 42%)); }

/* perfil */
.perfil-cabeca { display: flex; align-items: center; gap: 1rem; }
.avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--marinho-2); color: #fff; overflow: hidden; border: 2px solid var(--dourado); font-weight: 900; font-size: 1rem; flex: 0 0 auto; text-decoration: none; }
.perfil-cabeca .avatar, .avatar-grande { width: 72px; height: 72px; font-size: 1.6rem; }
.menu li { position: relative; }

/* login / primeiro acesso */
.sem-shell { background: radial-gradient(130% 75% at 50% 0%, #1b3a6b 0%, #0f1f3d 45%, #08101e 100%); color-scheme: dark; }
.sem-shell main { padding-bottom: 2rem; }
.login, .primeiro { max-width: 420px; margin: 0 auto; padding-top: 2rem; }
.primeiro { max-width: 560px; }
.primeiro h1 { color: #fff; }
.passos { display: flex; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1rem; counter-reset: p; }
.passos li { flex: 1; counter-increment: p; font-size: .78rem; color: rgba(255, 255, 255, .7); border-top: 4px solid rgba(255, 255, 255, .25); padding-top: .4rem; }
.passos li::before { content: counter(p) ". "; }
.passos li.atual { color: #fff; border-color: var(--acento); font-weight: 700; }
.passos li.feito { color: #fff; border-color: #4ade80; }
.termo { max-height: 45vh; overflow: auto; background: var(--fundo); border-radius: 10px; padding: 1rem; font: .88rem/1.55 system-ui, sans-serif; }
.qr { display: block; margin: .5rem auto 1rem; background: #fff; border-radius: 10px; padding: 6px; }
.segredo { display: block; padding: .6rem; background: var(--fundo); border-radius: 8px; word-break: break-all; margin-bottom: 1rem; }
.codigos { columns: 2; font-size: 1.05rem; padding-left: 1.4rem; }
.senha-temp { font-size: 1.2rem; font-weight: 800; padding: .1rem .5rem; background: var(--superficie); border-radius: 6px; user-select: all; }
details summary { cursor: pointer; color: var(--primaria); font-weight: 600; margin: .4rem 0; }

/* carregando / toasts */
.splash { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; background: var(--marinho); color: #fff; }
.carregando { display: flex; align-items: center; gap: .6rem; color: var(--sutil); padding: 1rem 0; }
.splash .carregando { color: #fff; }
.spinner { width: 18px; height: 18px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
#toasts { position: fixed; left: 50%; bottom: calc(var(--nav-altura) + 1rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: .5rem; width: min(92vw, 420px); }
.toast { background: #262626; color: #fff; padding: .75rem 1rem; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); transition: opacity .4s, transform .4s; font-size: .92rem; }
.toast-sucesso { background: var(--sucesso); }
.toast-erro { background: var(--erro); }
.toast-aviso { background: var(--acento); color: var(--acento-texto); }
.toast.saindo { opacity: 0; transform: translateY(8px); }

@media (max-width: 420px) {
  .grande { font-size: 1.5rem; }
  .stat-valor { font-size: 1.25rem; }
  .gps-valor { font-size: 1.4rem; }
  .gps-tempo { font-size: 2.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* barras coloridas pela faixa do TAF */
.barras-valor.faixa-excelente { background: #15803d; }
.barras-valor.faixa-bom { background: #2563eb; }
.barras-valor.faixa-regular { background: #ca8a04; }
.barras-valor.faixa-insuficiente { background: #ea580c; }
.barras-valor.faixa-inapto { background: #b91c1c; }
@media (min-width: 900px) { .topo { z-index: 600; } }

/* ---------- login ---------- */
.login { padding-top: max(2.5rem, env(safe-area-inset-top)); }
.login-cabeca { text-align: center; color: #fff; margin-bottom: 1.75rem; }
.login-logo { display: block; width: min(300px, 80%); height: auto; margin: 0 auto 1.75rem; }
.login-slogan { font-family: var(--fonte-titulo); font-size: clamp(2.2rem, 11vw, 3.2rem); font-weight: 900; line-height: .95; text-transform: uppercase; letter-spacing: -.02em; margin: 0; }
.login-slogan span { color: var(--dourado-claro); display: block; }
.login-cabeca .login-sistema { margin: 1rem 0 .15rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; font-size: .8rem; }
.login-cabeca .sutil { margin: 0; font-size: .82rem; color: rgba(255, 255, 255, .78); }
.login-form { background: var(--superficie); border: 1px solid var(--borda); border-radius: 20px; padding: 1.5rem; box-shadow: 0 16px 40px rgba(0, 0, 0, .3); }
.login-form .btn-primario { margin-top: .5rem; min-height: 52px; font-size: .95rem; }
.login-rodape { text-align: center; font-size: .85rem; color: rgba(255, 255, 255, .75); margin-top: 1rem; }

/* ---------- comunidade ---------- */
.feed { display: flex; flex-direction: column; gap: .9rem; margin-bottom: 1rem; }
.pub { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: 1rem; }
.pub-cabeca { display: flex; align-items: center; gap: .75rem; margin-bottom: .6rem; }
.pub-cabeca .sutil { font-size: .8rem; }
.pub-autor { color: var(--texto); font-weight: 800; text-decoration: none; }
.pub-texto { margin: .25rem 0 .75rem; white-space: pre-wrap; word-break: break-word; }
.treino-pub { background: var(--superficie-2); border-radius: 12px; padding: .9rem 1rem; border-left: 4px solid var(--verde); }
.treino-pub-tipo { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--acento-forte); margin-bottom: .4rem; }
.treino-pub-numeros { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.treino-pub-numeros strong { display: block; font-family: var(--fonte-titulo); font-size: 1.6rem; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.treino-pub-numeros span { font-size: .68rem; color: var(--sutil); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.pub-acoes { display: flex; gap: .5rem; margin-top: .75rem; }
.btn-social { border: 0; background: var(--superficie-2); color: var(--texto); font: inherit; font-weight: 700; border-radius: 99px; padding: .35rem .9rem; min-height: 36px; cursor: pointer; }
.btn-social.ativo { color: #d92d4b; }
.btn-social-direita { margin-left: auto; color: var(--sutil); }
.comentarios { margin-top: .75rem; border-top: 1px solid var(--borda); padding-top: .6rem; }
.comentarios-lista { list-style: none; padding: 0; margin: 0 0 .5rem; display: flex; flex-direction: column; gap: .4rem; font-size: .92rem; }
.comentarios-lista a { color: var(--texto); text-decoration: none; }
.linha-envio { display: flex; gap: .5rem; align-items: center; }
.linha-envio > input, .linha-envio > select { flex: 1; width: auto; min-width: 0; }
.compositor textarea { resize: vertical; margin-bottom: .6rem; }
.compositor .sutil { margin: .5rem 0 0; font-size: .8rem; }
.vazio { text-align: center; padding: 1.5rem 1rem; display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.pessoas .pessoa { flex-wrap: nowrap; }
.pessoa { gap: .75rem !important; }
.pessoa-nome { flex: 1; display: flex; flex-direction: column; color: inherit; text-decoration: none; min-width: 0; }
.perfil-publico { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .3rem; margin-bottom: 1rem; }
.perfil-publico h1 { margin: .5rem 0 0; }
.perfil-publico p { margin: 0; }
.perfil-publico .acoes { margin-top: .6rem; justify-content: center; }
.perfil-publico .tag { margin-left: 0; }
.conversa-item { display: flex; align-items: center; gap: .75rem; color: inherit; text-decoration: none; width: 100%; }
.conversa-texto { flex: 1; min-width: 0; }
.conversa-topo { display: flex; justify-content: space-between; gap: .5rem; }
.conversa-previa { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversa-item.nao-lida strong, .conversa-item.nao-lida .conversa-previa { color: var(--texto); font-weight: 800; }
.contador { background: var(--dourado); color: #111; border-radius: 99px; min-width: 22px; padding: 0 .4rem; text-align: center; font-weight: 900; font-size: .8rem; }
.chat-cabeca { display: flex; align-items: center; gap: .6rem; margin-bottom: .75rem; }
.chat { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .5rem; }
.chat li { display: flex; flex-direction: column; align-items: flex-start; max-width: 80%; }
.chat li.minha { align-self: flex-end; align-items: flex-end; }
.balao { background: var(--superficie-2); padding: .55rem .85rem; border-radius: 18px 18px 18px 4px; white-space: pre-wrap; word-break: break-word; }
.chat li.minha .balao { background: var(--marinho-2); color: #fff; border-radius: 18px 18px 4px 18px; }
.chat .sutil { font-size: .7rem; margin-top: .15rem; }
.chat-envio { position: sticky; bottom: calc(var(--nav-altura) + .5rem + env(safe-area-inset-bottom)); background: var(--fundo); padding: .5rem 0; }
@media (min-width: 900px) { .chat-envio { bottom: .5rem; } }

/* ---------- perfil, foto e aparência ---------- */
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.perfil-foto { position: relative; display: inline-block; }
.perfil-foto .avatar { width: 112px; height: 112px; font-size: 2.4rem; border-width: 3px; }
.perfil-foto-botoes { display: flex; gap: .5rem; justify-content: center; margin-top: .6rem; flex-wrap: wrap; }
.perfil-topo { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .25rem; margin-bottom: 1rem; }
.perfil-topo h1 { margin: .6rem 0 0; }
.perfil-topo p { margin: 0; }
.medidas { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.medida { background: var(--superficie); border: 1px solid var(--borda); border-radius: 14px; padding: .75rem .85rem; }
.medida strong { display: block; font-family: var(--fonte-titulo); font-size: 1.5rem; font-weight: 900; color: var(--primaria); font-variant-numeric: tabular-nums; }
.medida span { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--sutil); }
.medida small { display: block; color: var(--sutil); font-size: .72rem; }
.medida-alerta strong { color: var(--aviso); }
.opcoes-check { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 1rem; }
.opcoes-check .check { margin: .4rem 0; font-weight: 500; }
.aviso-saude { border-left: 5px solid var(--aviso); }
.bloqueado-aviso { color: var(--erro); font-weight: 700; }
/* no escuro o botão principal já é dourado: o de destaque passa ao verde da PMMT */
@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) .btn-acento { background: #2e7d3e; border-color: #2e7d3e; color: #fff; }
}
:root[data-tema="escuro"] .btn-acento { background: #2e7d3e; border-color: #2e7d3e; color: #fff; }

/* ---------- instalador ---------- */
.convite-instalar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; background: var(--superficie); border: 1px solid var(--borda); border-left: 5px solid var(--dourado); border-radius: var(--raio); padding: .75rem 1rem; margin-bottom: 1rem; color: var(--texto); }
.convite-texto { display: flex; flex-direction: column; flex: 1 1 180px; }
.convite-texto span { font-size: .85rem; color: var(--sutil); }
.sem-shell .convite-instalar { max-width: 420px; margin: 0 auto 1rem; }
.passos-instalar { margin: .5rem 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: .45rem; }
.icone-ios { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border: 1px solid var(--borda); border-radius: 6px; font-size: .9em; }
.sem-shell main > h1, .sem-shell main > h2 { color: #fff; }
.sem-shell main > p.sutil { color: rgba(255, 255, 255, .78); }
.sem-shell main > .btn-link { color: var(--dourado-claro); }

/* login único com o VIRTUS */
.login-virtus { max-width: 420px; margin: 0 auto 1rem; }
.login-virtus .btn { min-height: 52px; }
.sem-shell .login-virtus .sutil { color: rgba(255, 255, 255, .8); margin: .6rem 0 0; }
