/* Paleta: #98CE94 (verde) · #363543 (grafite) · #DEE9EE (gelo) · #5D54C1 (roxo) */
:root {
  --fundo: #eef3f6;
  --cartao: #ffffff;
  --painel: #DEE9EE;
  --texto: #363543;
  --suave: #7d7c8a;
  --linha: #e1e8ec;
  --acento: #5D54C1;
  --acento-claro: #e9e7f8;
  --acento-texto: #ffffff;
  --verde: #98CE94;
  --verde-claro: #e6f3e5;
  --verde-texto: #363543;
  --escuro: #363543;
  --escuro-texto: #ffffff;
  --alerta: #c25a3a;
  --alerta-claro: #f8e6df;
  --feito: #a3a9b3;
  --sombra: 0 1px 2px rgba(54, 53, 67, .05), 0 6px 18px rgba(54, 53, 67, .06);
  --raio: 20px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #23222c;
    --cartao: #363543;
    --painel: #2d2c38;
    --texto: #eef3f6;
    --suave: #a8a7b6;
    --linha: #45445a;
    --acento: #8f87e6;
    --acento-claro: #3d3a66;
    --acento-texto: #17162a;
    --verde: #98CE94;
    --verde-claro: #2f3d34;
    --verde-texto: #1f2a1e;
    --escuro: #17161f;
    --escuro-texto: #eef3f6;
    --alerta: #ec8e6d;
    --alerta-claro: #4a3029;
    --feito: #6f6e80;
    --sombra: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--fundo);
  color: var(--texto);
  font: 16px/1.45 "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.topo {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 16px 10px;
  background: var(--fundo);
}
.topo h1 { margin: 0; font-size: 1.5rem; letter-spacing: -.01em; }
.sync { width: 9px; height: 9px; border-radius: 50%; background: var(--feito); }
.sync.ok { background: var(--verde); }
.sync.salvando { background: #d9a531; }
.sync.offline { background: var(--alerta); }

main { padding: 0 16px 24px; max-width: 640px; margin: 0 auto; }

/* Navegação inferior */
.abas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  background: var(--cartao); border-top: 1px solid var(--linha);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.abas a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--suave); text-decoration: none; font-size: .75rem; padding: 4px 0;
}
.abas svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.abas a.ativa { color: var(--acento); font-weight: 600; }

/* Blocos comuns */
.cartao {
  background: var(--cartao); border-radius: var(--raio); box-shadow: var(--sombra);
  border: 1px solid var(--linha); padding: 16px; margin-bottom: 12px;
}
.cartao h2, .cartao h3 { margin: 0 0 4px; }
.cartao h2 { font-size: 1.15rem; }
.cartao h3 { font-size: 1rem; }
.rotulo { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); font-weight: 600; margin: 20px 0 8px; }
.rotulo:first-child { margin-top: 4px; }
.suave { color: var(--suave); font-size: .9rem; }
.linha-flex { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.selo { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--acento-claro); color: var(--acento); vertical-align: middle; }
.selo.alerta { background: var(--alerta-claro); color: var(--alerta); }
.vazio { text-align: center; color: var(--suave); padding: 32px 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--linha); background: var(--cartao); border-radius: 14px;
  padding: 10px 16px; min-height: 44px; font-weight: 600; text-decoration: none; color: var(--texto);
}
.btn.primario { background: var(--acento); border-color: var(--acento); color: var(--acento-texto); }
.btn.perigo { color: var(--alerta); }
.btn.largo { width: 100%; }
.btn.pequeno { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn-icone { border: 0; background: none; padding: 8px; color: var(--suave); min-width: 40px; min-height: 40px; border-radius: 8px; }
.acoes { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* Hoje */
.saudacao { margin: 0 0 16px; color: var(--suave); }
.cartao-link { display: block; text-decoration: none; color: inherit; }
.lista-mini { margin: 8px 0 0; padding: 0; list-style: none; color: var(--suave); font-size: .92rem; }
.lista-mini li { padding: 2px 0; }
.em-breve { opacity: .7; }

/* Treino */
.ficha-cartao .foco { color: var(--suave); }
.grupo { margin-bottom: 12px; }
.grupo-titulo { display: flex; align-items: center; gap: 8px; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); font-weight: 600; margin: 18px 0 6px; }
.grupo-titulo .dica { text-transform: none; letter-spacing: 0; font-weight: 400; }
.ex { padding: 14px 16px; }
.ex + .ex { border-top: 1px dashed var(--linha); }
.grupo .cartao { padding: 0; overflow: hidden; }
.ex-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.ex-nome { font-weight: 600; }
.ex-presc { color: var(--suave); font-size: .9rem; white-space: nowrap; }
.ex-nota { color: var(--suave); font-size: .85rem; margin-top: 4px; }
.ex-ultima { font-size: .82rem; color: var(--acento); margin-top: 4px; }
.ex.completo .ex-nome { color: var(--suave); }
.ex.opcional { background: repeating-linear-gradient(-45deg, transparent 0 8px, rgba(127,127,127,.04) 8px 16px); }

.series { margin-top: 10px; display: grid; gap: 6px; }
.serie { display: grid; grid-template-columns: 26px 1fr 1fr 48px; gap: 8px; align-items: center; }
.serie.sem-carga { grid-template-columns: 26px 1fr 48px; }
.serie-num { color: var(--suave); font-size: .85rem; text-align: center; }
.campo { position: relative; }
.campo input {
  width: 100%; min-height: 44px; border: 1px solid var(--linha); border-radius: 10px;
  background: var(--fundo); padding: 8px 36px 8px 10px; font-size: 1rem; font-variant-numeric: tabular-nums;
}
.campo span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--suave); font-size: .8rem; pointer-events: none; }
.check {
  width: 48px; height: 44px; border-radius: 12px; border: 1.5px solid var(--linha); background: var(--cartao);
  display: grid; place-items: center; color: var(--linha);
}
.check svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.check.on { background: var(--verde); border-color: var(--verde); color: var(--verde-texto); }
.serie.feita input { color: var(--suave); }
.check-unico { display: flex; align-items: center; gap: 10px; margin-top: 10px; }

.sessao-topo { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.progresso { height: 6px; background: var(--linha); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.progresso > div { height: 100%; background: var(--verde); border-radius: 99px; transition: width .3s; }

.hist { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--linha); gap: 12px; }
.hist:last-child { border-bottom: 0; }
.evo { display: grid; grid-template-columns: 1fr 90px auto; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--linha); text-decoration: none; color: inherit; }
.evo:last-child { border-bottom: 0; }
.evo svg { width: 90px; height: 28px; }
.evo .delta { font-variant-numeric: tabular-nums; font-size: .9rem; text-align: right; white-space: nowrap; }
.sobe { color: var(--acento); font-weight: 600; }

/* Timer de descanso */
.timer {
  position: fixed; left: 8px; right: 8px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 20;
  max-width: 624px; margin: 0 auto;
  background: var(--escuro); color: var(--escuro-texto); border-radius: 22px; padding: 12px 16px 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.timer-barra { height: 4px; background: rgba(127,127,127,.35); border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
#timer-progresso { height: 100%; background: var(--verde); width: 100%; }
.timer-linha { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.timer-rotulo { font-size: .8rem; opacity: .75; }
.timer-tempo { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.timer-botoes { display: flex; gap: 6px; }
.timer-botoes button { border: 0; border-radius: 10px; padding: 10px 10px; min-height: 44px; background: rgba(127,127,127,.25); color: inherit; font-weight: 600; }
.timer-botoes button.primario { background: var(--acento); color: var(--acento-texto); }
.timer.fim { background: var(--verde); color: var(--verde-texto); }

/* Lista */
.segmento { display: grid; grid-template-columns: 1fr 1fr; background: var(--painel); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.segmento a { text-align: center; padding: 8px; border-radius: 9px; text-decoration: none; color: var(--suave); font-weight: 600; font-size: .92rem; }
.segmento a.ativa { background: var(--cartao); color: var(--texto); box-shadow: var(--sombra); }
.busca { display: flex; gap: 8px; margin-bottom: 12px; }
.busca input { flex: 1; min-height: 46px; border: 1px solid var(--linha); border-radius: 12px; background: var(--cartao); padding: 8px 14px; }
.busca .btn { min-width: 46px; padding: 0 14px; font-size: 1.3rem; }
.secao { margin-bottom: 10px; }
.secao .cartao { padding: 4px 0; }
.item { display: flex; align-items: center; gap: 12px; padding: 0 8px 0 16px; min-height: 48px; }
.item + .item { border-top: 1px solid var(--linha); }
.item-nome { flex: 1; padding: 12px 0; border: 0; background: none; text-align: left; }
.bolinha { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--linha); flex: none; display: grid; place-items: center; color: transparent; }
.bolinha svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.item.marcado .bolinha { background: var(--verde); border-color: var(--verde); color: var(--verde-texto); }
.item.carrinho .item-nome { text-decoration: line-through; color: var(--feito); }
.item.carrinho .bolinha { background: var(--feito); border-color: var(--feito); color: var(--fundo); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { border: 1px solid var(--linha); background: var(--cartao); border-radius: 99px; padding: 6px 12px; font-size: .88rem; }
.chip:active { background: var(--acento-claro); }
.rodape-fixo { position: sticky; bottom: calc(72px + env(safe-area-inset-bottom)); padding-top: 8px; }

/* Modal */
dialog {
  border: 0; border-radius: 18px; padding: 20px; width: min(92vw, 460px);
  background: var(--cartao); color: var(--texto); box-shadow: 0 16px 48px rgba(0,0,0,.3);
}
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog h2 { margin: 0 0 14px; font-size: 1.15rem; }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-size: .85rem; color: var(--suave); }
.form input, .form select, .form textarea {
  min-height: 44px; border: 1px solid var(--linha); border-radius: 12px; background: var(--fundo); padding: 8px 12px; color: var(--texto); font-size: 1rem;
}
.form textarea { min-height: 180px; resize: vertical; }
.form .duas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form .check-linha { display: flex; align-items: center; gap: 8px; color: var(--texto); font-size: .95rem; }
.form .check-linha input { min-height: auto; width: 20px; height: 20px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 30;
  background: var(--escuro); color: var(--escuro-texto); padding: 10px 16px; border-radius: 14px; font-size: .92rem;
  display: flex; gap: 14px; align-items: center; max-width: calc(100vw - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.toast button { border: 0; background: none; color: var(--verde); font-weight: 700; padding: 4px; }
body.com-timer main { padding-bottom: 110px; }
body.com-timer .toast { bottom: calc(170px + env(safe-area-inset-bottom)); }

/* Toques da paleta */
.topo h1 { font-weight: 800; }
.cartao h2 { font-weight: 800; letter-spacing: -.01em; }
.selo.verde { background: var(--verde-claro); color: #3f7a3b; }
@media (prefers-color-scheme: dark) { .selo.verde { color: var(--verde); } }
.cartao.escuro { background: var(--escuro); color: var(--escuro-texto); border-color: var(--escuro); }
.cartao.escuro .suave, .cartao.escuro .foco { color: rgba(255,255,255,.7); }
.cartao.escuro .btn:not(.primario) { background: rgba(255,255,255,.1); border-color: transparent; color: var(--escuro-texto); }
.icone-quadro { width: 44px; height: 44px; border-radius: 14px; background: var(--verde); color: var(--verde-texto); display: grid; place-items: center; flex: none; }
.icone-quadro svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cab-icone { display: flex; gap: 12px; align-items: center; }
.grupo .cartao, .secao .cartao { background: var(--cartao); }
.ex-ultima { color: var(--acento); font-weight: 600; }

/* Anotações */
.notas textarea, .nota-ex input {
  width: 100%; border: 1px solid var(--linha); border-radius: 12px; background: var(--fundo); padding: 10px 12px; color: var(--texto); font-size: .95rem;
}
.notas textarea { min-height: 110px; resize: vertical; }
.nota-ex { margin-top: 8px; }
.nota-ex summary { list-style: none; cursor: pointer; font-size: .85rem; color: var(--acento); font-weight: 600; display: inline-block; padding: 4px 0; }
.nota-ex summary::-webkit-details-marker { display: none; }
.nota-ex[open] summary { margin-bottom: 6px; }
.nota-salva { font-size: .85rem; color: var(--texto); background: var(--painel); border-radius: 10px; padding: 8px 10px; margin-top: 6px; }
a.hist { text-decoration: none; color: inherit; }

/* Quantidade na lista */
.qtd { flex: none; font-size: .82rem; font-weight: 700; color: var(--acento); background: var(--acento-claro); border: 0; border-radius: 99px; padding: 4px 10px; }
.qtd.vazia { background: none; color: var(--feito); font-weight: 600; }
.item.carrinho .qtd { opacity: .5; }

/* Em tela larga, alinha o topo com o conteúdo */
.topo { padding-left: max(16px, calc((100% - 640px) / 2 + 16px)); padding-right: max(16px, calc((100% - 640px) / 2 + 16px)); }

/* Rotina da casa */
.item-sub { display: block; font-size: .8rem; color: var(--suave); margin-top: 1px; }
.item.tarefa .item-nome { padding: 10px 0; }
.item.tarefa.feita .item-nome { color: var(--feito); text-decoration: line-through; }
.item.tarefa.feita .item-sub { text-decoration: none; }
.item.tarefa.feita .bolinha { background: var(--verde); border-color: var(--verde); color: var(--verde-texto); }
.st { flex: none; font-size: .74rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.st.atrasada { background: var(--alerta-claro); color: var(--alerta); }
.st.hoje { background: var(--acento-claro); color: var(--acento); }
.st.logo { background: #fbf0d0; color: #8a6511; }
.st.ok { background: var(--verde-claro); color: #3f7a3b; }
.st.neutro { background: var(--painel); color: var(--suave); }
@media (prefers-color-scheme: dark) {
  .st.logo { background: #4a3f1f; color: #f2cf73; }
  .st.ok { color: var(--verde); }
}
.cartao > .item { margin: 0 -8px 0 -16px; }
.chip.ativo { background: var(--acento); border-color: var(--acento); color: var(--acento-texto); }
.dias-semana { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dias-semana .dia { display: block; }
.dias-semana .dia input { position: absolute; opacity: 0; pointer-events: none; }
.dias-semana .dia span { display: grid; place-items: center; min-height: 40px; border-radius: 10px; border: 1px solid var(--linha); background: var(--fundo); color: var(--texto); font-size: .8rem; font-weight: 600; cursor: pointer; }
.dias-semana .dia input:checked + span { background: var(--acento); border-color: var(--acento); color: var(--acento-texto); }
.dias-semana .dia input:focus-visible + span { outline: 2px solid var(--acento); outline-offset: 2px; }
