/* Plano do Sono de Bolso: identidade do dia (azul-violeta, Manrope + Inter, ondas, pílulas).
   À noite, os mesmos tokens viram âmbar sobre preto (.noite), como no modo Agora. */
:root {
  --fundo: #F8F7FB; --superficie: #FFFFFF; --lavanda: #ECECF8; --borda: #E0E2EF;
  --texto: #101B47; --texto-2: #414866; --texto-3: #71778D;
  --primaria: #514BE5; --primaria-hover: #433DD1; --sobre-primaria: #FFFFFF;
  --gradiente: linear-gradient(135deg, #6559F0 0%, #4845DA 100%);
  --gradiente-neural: linear-gradient(135deg, #7559F6 0%, #546DFF 50%, #77B8EF 100%);
  --missao: linear-gradient(140deg, #2A2E8F 0%, #514BE5 55%, #6E8BF5 100%);
  --sucesso: #1F7A52; --alerta-fundo: #FFF6E5; --alerta-texto: #7A4B00; --alerta-borda: #F2D7A6;
  --font-h: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-b: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
.noite {
  --fundo: #000000; --superficie: #0B0803; --lavanda: #1A1207; --borda: #3A2911;
  --texto: #C49048; --texto-2: #8C6431; --texto-3: #6E4F27;
  --primaria: #C49048; --primaria-hover: #C49048; --sobre-primaria: #000000;
  --gradiente: #1A1207; --gradiente-neural: #6B4A1C; --missao: #1A1207;
  --sucesso: #C49048; --alerta-fundo: #1A1207; --alerta-texto: #C49048; --alerta-borda: #3A2911;
  --logo-stroke: #8C6431;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fundo); color: var(--texto); }
body { font: 16px/1.55 var(--font-b); -webkit-font-smoothing: antialiased; min-height: 100dvh; }
h1, h2, h3, p, ul, ol { margin: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--primaria); outline-offset: 3px; border-radius: 10px; }
[hidden] { display: none !important; }

.app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) 18px 0; }
.topo { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.marca { width: 34px; height: 30px; }
.topo-nome { font: 700 18px/1 var(--font-h); letter-spacing: -.01em; }
.topo-agora { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-size: 13.5px; font-weight: 500;
  color: var(--texto-2); border: 1px solid var(--borda); border-radius: 999px; padding: 6px 12px; background: var(--superficie); }
.topo-agora svg { width: 15px; height: 15px; }
.aviso-noite { margin-top: 12px; border: 1px solid var(--borda); border-radius: 14px; padding: 10px 14px; font-size: 13.5px; color: var(--texto-2); }
.aviso-noite a { font-weight: 600; color: var(--texto); }

.tela { flex: 1; padding: 18px 0 110px; display: flex; flex-direction: column; }
.titulo { font: 700 25px/1.2 var(--font-h); letter-spacing: -.015em; outline: none; }
.sub { font-size: 14.5px; color: var(--texto-2); margin-top: 6px; }
.rotulo { font-size: 12px; color: var(--texto-3); font-weight: 500; }
.pilula { display: inline-block; font-size: 12px; font-weight: 600; color: var(--primaria); background: var(--lavanda); padding: 4px 10px; border-radius: 999px; }
.linha-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pilha { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }

.cartao { background: var(--superficie); border: 1px solid var(--borda); border-radius: 20px; padding: 16px 18px; }
.cartao h2 { font: 700 17px/1.3 var(--font-h); }
.cartao p { font-size: 14px; color: var(--texto-2); margin-top: 4px; line-height: 1.5; }
.cartao--link { display: block; text-decoration: none; }
.cartao--alerta { background: var(--alerta-fundo); border-color: var(--alerta-borda); }
.cartao--alerta h2, .cartao--alerta p { color: var(--alerta-texto); }
.missao { position: relative; overflow: hidden; border-radius: 22px; padding: 18px 18px 20px; background: var(--missao); color: #fff; }
.noite .missao { color: var(--texto); border: 1px solid var(--borda); }
.missao small { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.missao h2 { font: 700 20px/1.25 var(--font-h); margin: 6px 0 4px; max-width: 92%; }
.missao p { font-size: 13.5px; opacity: .92; line-height: 1.45; max-width: 92%; }
.missao .onda { position: absolute; right: -18px; bottom: -14px; width: 140px; height: 125px; opacity: .22; --logo-stroke: #fff; }
.missao .porque { border-color: rgba(255,255,255,.25); color: inherit; }
.missao .porque a, .missao .porque ul { color: inherit; opacity: .9; }
.missao .feito { margin-top: 14px; background: rgba(255,255,255,.16); color: inherit; border: 1px solid rgba(255,255,255,.35); }
.noite .missao .feito { background: transparent; border-color: var(--borda); }

.botao { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; width: 100%; border: 0; border-radius: 999px;
  background: var(--gradiente); color: var(--sobre-primaria); font-weight: 600; font-size: 15.5px; cursor: pointer; text-decoration: none; }
.noite .botao { border: 1px solid #6B4A1C; color: var(--texto); }
.botao--leve { background: transparent; color: var(--primaria); border: 1px solid var(--borda); }
.botao:disabled { opacity: .6; cursor: default; }
.rodape { margin-top: 22px; display: flex; flex-direction: column; gap: 8px; }

.opcao { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 12px 16px; text-align: left; cursor: pointer;
  border-radius: 18px; border: 1.5px solid var(--borda); background: var(--superficie); font-size: 15px; color: var(--texto); }
.opcao[aria-pressed="true"] { border-color: var(--primaria); background: var(--lavanda); }
.progresso { height: 6px; border-radius: 999px; background: var(--lavanda); overflow: hidden; margin-top: 14px; }
.progresso i { display: block; height: 100%; background: var(--gradiente-neural); border-radius: 999px; transition: width .25s; }
.voltar { background: none; border: 0; color: var(--texto-2); font-size: 14px; padding: 8px 0; cursor: pointer; align-self: flex-start; }

.sn { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--borda); font-size: 14.5px; }
.sn:last-child { border-bottom: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-width: 46px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--borda); background: var(--superficie); font-size: 13.5px; cursor: pointer; color: var(--texto-2); }
.chip[aria-pressed="true"] { background: var(--primaria); border-color: var(--primaria); color: var(--sobre-primaria); }

.campo-linha { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--borda); }
.campo-linha:last-child { border-bottom: 0; }
.campo-linha label, .campo-linha > span { font-size: 14.5px; color: var(--texto-2); }
.campo-linha input, .campo-linha select { border: 1px solid var(--borda); border-radius: 12px; background: var(--superficie); padding: 8px 10px;
  font: 700 16px/1.2 var(--font-h); color: var(--texto); min-width: 110px; }
.campo-bloco { padding: 12px 0; border-bottom: 1px solid var(--borda); }
.campo-bloco > span { display: block; font-size: 14.5px; color: var(--texto-2); margin-bottom: 8px; }
.erro { color: #B42318; font-size: 14px; margin-top: 10px; }
.noite .erro { color: var(--texto); }

.linha-tempo { display: flex; flex-direction: column; margin-top: 12px; }
.lt { display: grid; grid-template-columns: 56px 14px 1fr; gap: 10px; }
.lt time { font: 700 15px/1.2 var(--font-h); padding-top: 1px; }
.lt .eixo { position: relative; min-height: 48px; }
.lt .eixo::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: -6px; width: 2px; background: var(--lavanda); }
.lt:last-child .eixo::before { display: none; }
.lt .eixo::after { content: ""; position: absolute; left: 1px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--gradiente-neural); }
.lt p { font-size: 14px; color: var(--texto); padding-bottom: 12px; margin: 0; }
.lt p span { display: block; font-size: 12.5px; color: var(--texto-3); }

.numeros { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.numeros .cartao { padding: 12px 14px; }
.numeros b { display: block; font: 800 23px/1.15 var(--font-h); margin-top: 2px; }
.barras { display: flex; align-items: flex-end; gap: 8px; height: 110px; margin-top: 12px; }
.barras div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; }
.barras i { width: 100%; border-radius: 8px 8px 4px 4px; background: var(--gradiente-neural); min-height: 4px; }
.barras i.vazia { background: var(--lavanda); }
.barras span { font-size: 11px; color: var(--texto-3); }

.porque { margin-top: 12px; font-size: 13px; color: var(--texto-2); border-top: 1px solid var(--borda); padding-top: 10px; }
.porque summary { cursor: pointer; list-style: none; font-weight: 500; }
.porque summary::-webkit-details-marker { display: none; }
.porque p { margin-top: 6px; }
.porque ul { margin-top: 6px; padding-left: 16px; display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--texto-3); }

.abas { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 4px;
  padding: 8px 12px max(10px, env(safe-area-inset-bottom)); background: var(--superficie); border-top: 1px solid var(--borda); }
.abas a { flex: 1; max-width: 120px; text-align: center; text-decoration: none; font-size: 13.5px; font-weight: 500; color: var(--texto-3); padding: 10px 6px; border-radius: 14px; }
.abas a[aria-current="page"] { color: var(--primaria); background: var(--lavanda); font-weight: 600; }

/* Preparo da noite (higiene do sono) */
.prep { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--borda); }
.prep:last-child { border-bottom: 0; }
.prep h3 { font: 700 15px/1.3 var(--font-h); margin: 0; color: var(--texto); }
.prep p { margin: 4px 0 0; font-size: 14px; line-height: 1.5; color: var(--texto-2); }
.check { width: 44px; height: 44px; margin: -8px 0 0 -8px; border: 0; background: transparent; cursor: pointer; position: relative; flex: none; }
.check::before { content: ""; position: absolute; inset: 9px; border-radius: 9px; border: 2px solid var(--borda); background: var(--superficie); transition: background .15s, border-color .15s; }
.check[aria-checked="true"]::before { background: var(--primaria); border-color: var(--primaria); }
.check[aria-checked="true"]::after { content: ""; position: absolute; left: 17px; top: 13px; width: 7px; height: 13px; border: solid var(--sobre-primaria); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.check:focus-visible::before { outline: 2px solid var(--primaria); outline-offset: 2px; }

/* Check-in semanal */
.evolucao { margin-top: 10px; }
.ev { display: grid; grid-template-columns: 1fr auto 24px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--borda); font-size: 14px; color: var(--texto-2); }
.ev:last-child { border-bottom: 0; }
.ev b { font: 700 14.5px/1.2 var(--font-h); color: var(--texto); white-space: nowrap; }
.ev em { font-style: normal; font-weight: 800; text-align: center; color: var(--texto-3); }
.ev--melhor em { color: var(--sucesso); }
.ev--pior em { color: var(--alerta-texto); }
.so-leitor { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.abas a[hidden] { display: none; }
.abas a { padding-left: 2px; padding-right: 2px; }
