/* Desenrola — estilos */
:root {
  --bg: #EAF0EF;
  --surface: #FFFFFF;
  --surface-2: #DCE6E4;
  --ink: #12201F;
  --muted: #536662;
  --line: #CBD8D5;
  --primary: #135D66;
  --primary-2: #0E4950;
  --on-primary: #FFFFFF;
  --accent: #E3A008;
  --accent-soft: #FBEFC8;
  --on-accent: #2A1F00;
  --danger: #B3402F;
  --ok: #2E7A55;
  --ring: rgba(19, 93, 102, .28);
  --prox-bg: #135D66; --on-prox: #FFFFFF;
  --radius: 16px;
  --font: 'Atkinson', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1615; --surface: #15211F; --surface-2: #1F2E2B; --ink: #E1ECE9; --muted: #96ADA8;
    --line: #2A3B38; --primary: #4DB6B0; --primary-2: #66C9C3; --on-primary: #052220;
    --accent: #F2B630; --accent-soft: #3A3114; --on-accent: #241A00; --danger: #F07D6B; --ok: #6CCB98;
    --ring: rgba(77, 182, 176, .35); color-scheme: dark;
    --prox-bg: #134A4F; --on-prox: #E6F2F0;
  }
}
:root[data-theme="dark"] {
  --bg: #0D1615; --surface: #15211F; --surface-2: #1F2E2B; --ink: #E1ECE9; --muted: #96ADA8;
  --line: #2A3B38; --primary: #4DB6B0; --primary-2: #66C9C3; --on-primary: #052220;
  --accent: #F2B630; --accent-soft: #3A3114; --on-accent: #241A00; --danger: #F07D6B; --ok: #6CCB98;
  --ring: rgba(77, 182, 176, .35); color-scheme: dark;
  --prox-bg: #134A4F; --on-prox: #E6F2F0;
}
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
html[data-fonte="grande"] { font-size: 18.5px; }
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  line-height: 1.45; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 18px; height: 18px; }
.ic.lg { width: 28px; height: 28px; }
[hidden] { display: none !important; }

/* ---------- Estrutura ---------- */
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; position: relative; }
.topo {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  display: flex; align-items: center; gap: 4px; min-height: 60px;
  padding: env(safe-area-inset-top) 8px 0 8px;
}
.topo h1 { font-size: 1.3rem; margin: 0 0 0 8px; flex: 1; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo.raiz h1 { margin-left: 8px; }
.ib {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; color: var(--ink);
}
.ib:active { background: var(--surface-2); }
main { padding: 4px 16px calc(96px + env(safe-area-inset-bottom)); }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.nav-in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.nav button {
  border: 0; background: none; padding: 9px 2px 8px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: .76rem; color: var(--muted); position: relative;
}
.nav button[aria-current="page"] { color: var(--primary); font-weight: 700; }
.nav button[aria-current="page"]::before {
  content: ''; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary);
}
.nav .badge { position: absolute; top: 4px; right: calc(50% - 22px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: .7rem; font-weight: 700; display: grid; place-items: center; padding: 0 5px; }

/* ---------- Tipografia e blocos ---------- */
h2 { font-size: 1.05rem; margin: 26px 0 10px; color: var(--muted); letter-spacing: 0; }
h2:first-child { margin-top: 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.sp { height: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 12px; }
.lead { font-size: 1.12rem; }
.saud { font-size: 1.65rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin: 6px 0 2px; }
.data { color: var(--muted); margin-bottom: 14px; }

/* ---------- Botões e campos ---------- */
.btn {
  border: 0; border-radius: 12px; min-height: 48px; padding: 0 18px; font-weight: 700; font-size: 1rem;
  background: var(--primary); color: var(--on-primary); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn.sec { background: var(--surface-2); color: var(--ink); }
.btn.lin { background: transparent; color: var(--primary); border: 1.5px solid var(--line); }
.btn.dang { background: transparent; color: var(--danger); border: 1.5px solid var(--line); }
.btn.acc { background: var(--accent); color: var(--on-accent); }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: .92rem; border-radius: 10px; }
.btn.full { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns > .btn { flex: 1 1 auto; }
input[type="text"], input[type="number"], input[type="search"], textarea, select {
  width: 100%; border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px 14px; min-height: 48px; font-size: 1rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.45; }
input:focus, textarea:focus, select:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
label.lbl { display: block; font-weight: 700; margin: 14px 0 6px; font-size: .95rem; }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 9px; min-height: 40px; font-weight: 700; font-size: .92rem; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 13px; font-size: .92rem; min-height: 38px;
}
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 700; }
.tag { display: inline-block; font-size: .78rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-weight: 700; vertical-align: middle; }
.tag.acc { background: var(--accent-soft); color: var(--ink); }

/* Pimentas */
.pim { display: inline-flex; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); height: 48px; align-items: center; padding: 0 4px; }
.pim button { border: 0; background: none; width: 30px; height: 40px; font-size: 1.15rem; padding: 0; filter: grayscale(1); opacity: .32; }
.pim button.on { filter: none; opacity: 1; }

/* ---------- Início ---------- */
.fio { margin: 4px 0 16px; }
.fio svg { width: 100%; height: auto; display: block; overflow: visible; }
.fio-tx { display: flex; justify-content: space-between; color: var(--muted); font-size: .9rem; margin-top: 2px; }
.prox { background: var(--prox-bg); color: var(--on-prox); border-radius: 20px; padding: 18px 18px 16px; }
.prox .de { opacity: .82; font-size: .92rem; margin-bottom: 4px; }
.prox .passo { font-size: 1.32rem; font-weight: 700; line-height: 1.25; margin-bottom: 14px; }
.prox .btn { background: var(--accent); color: var(--on-accent); }
.prox .btn.sec { background: rgba(255,255,255,.14); color: var(--on-prox); }
.resumo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.resumo button { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 10px 8px; text-align: left; min-height: 64px; }
.resumo b { display: block; font-size: 1.3rem; line-height: 1.1; }
.resumo span { font-size: .8rem; color: var(--muted); }
.ferr { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ferr li + li { border-top: 1px solid var(--line); }
.ferr button { width: 100%; border: 0; background: none; display: flex; align-items: center; gap: 14px; padding: 12px 14px; text-align: left; min-height: 64px; }
.ferr button:active { background: var(--surface-2); }
.ferr .ti-ic { width: 42px; height: 42px; border-radius: 12px; background: var(--surface-2); color: var(--primary); display: grid; place-items: center; flex: none; }
.ferr b { display: block; font-size: 1rem; }
.ferr small { color: var(--muted); font-size: .86rem; display: block; line-height: 1.3; }
.dica { border-left: 4px solid var(--accent); background: var(--surface); padding: 12px 14px; border-radius: 0 12px 12px 0; margin-top: 18px; }
.dica b { display: block; margin-bottom: 2px; font-size: .9rem; color: var(--muted); }
.instalar { display: flex; gap: 12px; align-items: center; }

/* ---------- Tarefas ---------- */
.add { display: flex; gap: 8px; align-items: stretch; }
.add input { flex: 1; min-width: 0; }
.add .btn { width: 48px; padding: 0; flex: none; }
.barra { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 6px; }
.tl, .tl ul { list-style: none; margin: 0; padding: 0; }
.tl > li { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin-top: 10px; padding: 4px 4px 4px 2px; }
.tl > li.estrela { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.tl ul { margin-left: 22px; border-left: 2px solid var(--line); padding-left: 2px; margin-bottom: 6px; }
.it { display: flex; align-items: flex-start; gap: 2px; min-height: 48px; }
.chk {
  width: 44px; height: 44px; flex: none; border: 0; background: none; display: grid; place-items: center; padding: 0;
}
.chk i { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--muted); display: grid; place-items: center; transition: background .15s ease, border-color .15s ease; }
.chk svg { width: 15px; height: 15px; stroke: var(--on-accent); stroke-width: 3; opacity: 0; }
.feito > .it .chk i { background: var(--accent); border-color: var(--accent); }
.feito > .it .chk svg { opacity: 1; }
.tx { flex: 1; min-width: 0; padding: 11px 2px 9px; border: 0; background: none; text-align: left; font-size: 1rem; line-height: 1.35; overflow-wrap: anywhere; }
.tl > li > .it > .tx { font-weight: 700; }
.feito > .it > .tx { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.tx .meta { display: block; font-weight: 400; font-size: .82rem; color: var(--muted); margin-top: 3px; text-decoration: none; }
.it .ib { width: 40px; height: 44px; border-radius: 10px; color: var(--muted); }
.it .ib.magic { color: var(--primary); }
.prog { height: 4px; border-radius: 2px; background: var(--surface-2); margin: 0 12px 8px 46px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s ease; }
.vazio { text-align: center; padding: 26px 12px; color: var(--muted); }
.vazio .ic { width: 44px; height: 44px; color: var(--primary); margin-bottom: 6px; }
.vazio b { display: block; color: var(--ink); font-size: 1.08rem; margin-bottom: 4px; }
.flash { animation: flash 1s ease; }
@keyframes flash { 0% { background: var(--accent-soft); } 100% { background: transparent; } }

/* ---------- Foco ---------- */
.foco { text-align: center; padding-top: 4px; }
.foco .tarefa { color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.nos { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin: 6px auto 18px; max-width: 320px; }
.nos i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); }
.nos i.ok { background: var(--accent); border-color: var(--accent); }
.nos i.at { border-color: var(--primary); background: var(--primary); transform: scale(1.25); }
.foco .passo { font-size: 1.7rem; font-weight: 700; line-height: 1.22; letter-spacing: -.01em; margin: 6px 4px 22px; min-height: 2.4em; overflow-wrap: anywhere; }
.relogio { position: relative; width: 196px; height: 196px; margin: 0 auto 10px; }
.relogio svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.relogio .tempo { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.6rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.relogio .tempo small { display: block; font-size: .85rem; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.foco .chips { justify-content: center; margin: 6px 0 14px; }
.foco .acoes { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 10px; }
.foco .acoes .btn { padding: 0 6px; font-size: .92rem; }
.pill {
  position: fixed; z-index: 25; right: 14px; bottom: calc(76px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--bg);
  border: 0; border-radius: 999px; padding: 10px 16px; font-weight: 700; display: flex; gap: 8px; align-items: center; font-variant-numeric: tabular-nums;
  box-shadow: 0 6px 18px rgba(0,0,0,.22);
}
.pill .ic { width: 18px; height: 18px; }

/* ---------- Listas genéricas ---------- */
.lista { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lista > li { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; min-height: 56px; }
.lista > li + li { border-top: 1px solid var(--line); }
.lista > li > button.tx { padding: 8px 0; }
.lista .chk { margin-left: -8px; }
.lista li.feito .tx { color: var(--muted); text-decoration: line-through; }
.lista li.feito .chk i { background: var(--accent); border-color: var(--accent); }
.lista li.feito .chk svg { opacity: 1; }

/* Despejo */
.grupo { margin-top: 16px; }
.grupo h3 { font-size: 1rem; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.grupo .lista li { min-height: 52px; }
.cx { width: 22px; height: 22px; accent-color: var(--primary); flex: none; }

/* Mensagens */
.saida { white-space: pre-wrap; background: var(--surface); border: 1.5px dashed var(--line); border-radius: 12px; padding: 14px; min-height: 80px; overflow-wrap: anywhere; }
.analise dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; }
.analise dt { color: var(--muted); }
.analise dd { margin: 0; font-weight: 700; }
.analise ul { margin: 6px 0 0; padding-left: 20px; }
.analise li { margin-bottom: 4px; }
.medidor { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 4px; }
.medidor i { display: block; height: 100%; background: var(--primary); }

/* Decidir */
.opcao .crit { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; }
.opcao .crit + .crit { border-top: 1px solid var(--line); }
.notas { display: flex; gap: 4px; }
.notas button { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; font-size: .9rem; padding: 0; }
.notas button.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.ranking .barra-r { height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin: 4px 0 12px; }
.ranking .barra-r i { display: block; height: 100%; background: var(--accent); }
.peso { display: inline-flex; gap: 2px; }
.peso button { border: 0; background: none; padding: 4px; font-size: 1rem; opacity: .3; }
.peso button.on { opacity: 1; }

/* Estimar */
.estim { text-align: center; padding: 22px 16px; }
.estim .faixa { font-size: 2.4rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }

/* Estudar */
.deck b { display: block; }
.cartao {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; min-height: 260px; padding: 26px 20px;
  display: flex; flex-direction: column; justify-content: center; text-align: center; font-size: 1.3rem; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere;
}
.cartao .verso { border-top: 2px dashed var(--line); margin-top: 18px; padding-top: 18px; font-weight: 400; font-size: 1.12rem; white-space: pre-wrap; }
.notas4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 14px; }
.notas4 .btn { flex-direction: column; gap: 0; min-height: 60px; padding: 4px; font-size: .92rem; }
.notas4 .btn small { font-weight: 400; font-size: .76rem; opacity: .85; }
.notas4 .n1 { background: var(--danger); color: #fff; }
.notas4 .n2 { background: var(--surface-2); color: var(--ink); }
.notas4 .n3 { background: var(--primary); color: var(--on-primary); }
.notas4 .n4 { background: var(--accent); color: var(--on-accent); }
.letras { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.letras span { width: 40px; height: 40px; border-radius: 10px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 700; font-size: 1.2rem; }
.frase { font-size: 1.3rem; font-weight: 700; line-height: 1.3; }

/* Chef */
.receita b { display: block; }
.ok-tx { color: var(--ok); font-weight: 700; }
.falta { color: var(--muted); font-size: .88rem; }
.passos { counter-reset: p; list-style: none; padding: 0; margin: 0; }
.passos li { counter-increment: p; position: relative; padding: 10px 0 10px 44px; min-height: 44px; }
.passos li + li { border-top: 1px solid var(--line); }
.passos li::before {
  content: counter(p); position: absolute; left: 0; top: 8px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface-2); color: var(--primary); display: grid; place-items: center; font-weight: 700;
}

/* Rotinas */
.rotina { margin-top: 14px; }
.rotina-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.rotina-h h3 { margin: 0; font-size: 1.1rem; }
.chama { font-size: .85rem; color: var(--muted); font-weight: 700; }

/* ---------- Sobreposições ---------- */
.ov { position: fixed; inset: 0; z-index: 50; background: rgba(5, 15, 14, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; }
.folha {
  background: var(--surface); width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
  max-height: 88vh; overflow: auto; animation: subir .2s ease;
}
.folha::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 12px; }
.folha h3 { margin: 2px 4px 12px; font-size: 1.15rem; }
.folha .menu { list-style: none; margin: 0 -8px; padding: 0; }
.folha .menu button { width: 100%; border: 0; background: none; display: flex; align-items: center; gap: 14px; padding: 12px; min-height: 52px; border-radius: 12px; text-align: left; font-size: 1rem; }
.folha .menu button:active { background: var(--surface-2); }
.folha .menu button.dang { color: var(--danger); }
.folha .menu .ic { color: var(--muted); }
.folha .menu button.dang .ic { color: var(--danger); }
.folha .btns { margin-top: 16px; }
.folha ul.ajuda { padding-left: 20px; margin: 0; }
.folha ul.ajuda li { margin-bottom: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes subir { from { transform: translateY(30px); opacity: .6; } }
.toast {
  position: fixed; left: 16px; right: 16px; margin: 0 auto; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 60;
  background: var(--ink); color: var(--bg); border-radius: 14px; padding: 12px 14px 12px 16px; display: flex; gap: 12px; align-items: center;
  max-width: 520px; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: subir .2s ease;
}
.toast span { flex: 1; }
.toast button { border: 0; background: none; color: var(--accent); font-weight: 700; padding: 6px 4px; }

/* Comemoração */
.festa { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.festa i { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: voar 900ms ease-out forwards; }
.festa i:nth-child(3n) { background: var(--primary); }
@keyframes voar { to { transform: translate(var(--x), var(--y)) scale(.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .festa { display: none; }
}
