:root {
  --bg: #EEF2EA;
  --card: #FFFFFF;
  --ink: #1E1612;
  --muted: #5F6A59;
  --muted2: #4C5647;
  --line: #EDF0E8;
  --line2: #D3DBCC;
  --green: #557F43;
  --green-dark: #3F6331;
  --green-soft: #E7EFDF;
  --orange: #F08A4B;
  --peach: #FBE3CF;
  --peach-ink: #6B2C0A;
  --mustard: #F6E3A1;
  --mustard-ink: #5C4300;
  --blue: #2B8BB5;
  --amber: #F2B544;
  --shadow: 0 4px 14px rgba(30, 22, 18, .06);
  --radius: 20px;
  --display: 'Epilogue', 'Plus Jakarta Sans', system-ui, sans-serif;
  --body: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--green-dark); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 8px; }

.app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; padding: 0 20px 120px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Cabeçalhos */
.top { padding: calc(env(safe-area-inset-top, 0px) + 22px) 0 14px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.top .sub { font-size: 13px; color: var(--muted); font-weight: 500; }
h1 { margin: 0; font-family: var(--display); font-size: 28px; font-weight: 800; letter-spacing: -0.6px; line-height: 1.1; }
h2 { margin: 0; font-family: var(--display); font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }
h3 { margin: 0; font-size: 15px; font-weight: 800; }
.back { display: flex; align-items: center; gap: 2px; padding-top: calc(env(safe-area-inset-top, 0px) + 14px); margin-left: -10px; }
.back a, .back button { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); background: none; border: 0; border-radius: 12px; }
.back span { font-size: 15px; font-weight: 700; color: var(--muted); }
.lead { font-size: 14px; color: var(--muted); margin: 4px 0 0; }

/* Componentes */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 14px 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.label { font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: .6px; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.section-title { margin: 22px 0 10px; }

.chip { height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--line2); background: var(--card); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 8px; }
.chip .dot { width: 8px; height: 8px; border-radius: 4px; background: var(--green); }
.chip[aria-pressed="false"] .dot { background: var(--line2); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips .chip { height: 38px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.btn { min-height: 48px; border: 0; border-radius: 16px; padding: 0 18px; font-weight: 800; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:active { background: var(--green-dark); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line2); font-weight: 700; }
.btn-link { background: none; border: 0; color: var(--muted2); font-weight: 700; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; }
.btn-block { width: 100%; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

.tag { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 8px; display: inline-block; white-space: nowrap; }
.tag-mustard { background: var(--mustard); color: var(--mustard-ink); }
.tag-peach { background: var(--peach); color: var(--peach-ink); }
.tag-green { background: var(--green-soft); color: var(--green-dark); }
.tag-orange { background: var(--orange); color: var(--ink); }

/* Anéis */
.ring-card { padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; }
.ring-card .rl { font-size: 12px; color: var(--muted); font-weight: 600; }

/* Água */
.water { display: flex; align-items: center; gap: 12px; }
.water .bar { height: 8px; border-radius: 4px; background: #E4E9DF; overflow: hidden; }
.water .bar i { display: block; height: 100%; background: var(--blue); border-radius: 4px; }

/* Linha do tempo */
.timeline { display: flex; flex-direction: column; }
.tl-row { display: flex; gap: 14px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; width: 24px; flex: 0 0 24px; }
.tl-dot { width: 22px; height: 22px; border-radius: 11px; border: 2px solid #B7C2AE; background: var(--bg); display: flex; align-items: center; justify-content: center; flex: 0 0 22px; }
.tl-dot.done { background: var(--green); border-color: var(--green); }
.tl-dot.skip { background: #B7C2AE; border-color: #B7C2AE; }
.tl-dot.now { border: 3px solid var(--green); background: #fff; }
.tl-line { width: 2px; flex: 1; background: var(--line2); min-height: 14px; }
.tl-line.done { background: var(--green); }
.tl-body { flex: 1; min-width: 0; padding-bottom: 14px; }
.tl-link { display: block; text-decoration: none; color: inherit; border-radius: 12px; padding: 0 2px; min-height: 44px; }
.tl-time { font-size: 12px; color: var(--muted); font-weight: 700; }
.tl-name { font-size: 15px; font-weight: 700; }
.tl-name.past { color: var(--muted); }
.tl-sum { font-size: 12px; color: var(--muted); }
.now-card { border: 2px solid var(--green); box-shadow: 0 6px 18px rgba(85, 127, 67, .16); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.items { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.items .it { display: flex; justify-content: space-between; gap: 12px; }
.items .it span:first-child { font-weight: 600; }
.items .it span:last-child { color: var(--muted); text-align: right; }
.swapped { color: var(--green-dark) !important; }

.opts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.opt { height: 48px; border-radius: 14px; border: 1px solid var(--line2); background: var(--card); font-family: var(--display); font-weight: 800; font-size: 17px; }
.opt[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }

/* Listas */
.list { display: flex; flex-direction: column; overflow: hidden; }
.li { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 50px; padding: 8px 16px; border: 0; border-bottom: 1px solid var(--line); background: var(--card); text-align: left; width: 100%; text-decoration: none; color: var(--ink); }
.li:last-child { border-bottom: 0; }
.li .nm { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.li > .nm { flex: 1 1 auto; min-width: 0; }
.li .qt { color: var(--muted2); font-size: 14px; text-align: right; flex: 0 0 auto; white-space: nowrap; }
.li .qt.wrap { white-space: normal; max-width: 52%; flex-shrink: 1; }
.li .row .qt.wrap { max-width: none; }
.li .sub { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.li.sel { background: var(--green-soft); }
.li .chev { color: var(--muted); flex: 0 0 auto; }
.check { width: 22px; height: 22px; border-radius: 11px; background: var(--green); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 22px; }

.recipe { background: var(--peach); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; }
.recipe .rk { font-size: 12px; font-weight: 800; color: var(--peach-ink); letter-spacing: .6px; display: flex; align-items: center; gap: 8px; }
.recipe .rt { font-family: var(--display); font-size: 19px; font-weight: 800; color: #3D1C08; }
.recipe p { margin: 0; font-size: 14px; color: #4F2A14; line-height: 1.5; }

.note { background: var(--green-soft); border-radius: 16px; padding: 12px 14px; font-size: 13px; color: var(--muted2); }
.note strong { color: var(--ink); }
.alert { background: var(--peach); color: #4F2A14; border-radius: 16px; padding: 12px 14px; font-size: 13px; font-weight: 600; display: flex; gap: 10px; align-items: flex-start; }

.search { width: 100%; height: 48px; border-radius: 14px; border: 1px solid var(--line2); background: var(--card); padding: 0 16px; font-size: 15px; }

/* Semana */
.bars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.vbar { padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.vbar .track { width: 100%; height: 112px; background: var(--line); border-radius: 14px; display: flex; align-items: flex-end; overflow: hidden; }
.vbar .fill { width: 100%; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; min-height: 30px; }
.vbar .cap { font-size: 12px; font-weight: 700; color: var(--muted2); text-align: center; }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; text-align: center; }
.days .d { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); font-weight: 700; }
.days .c { width: 34px; height: 34px; border-radius: 17px; background: var(--line); display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--ink); font-weight: 800; }
.days .c.full { background: var(--green); color: #fff; }
.days .c.part { background: #A9C49A; }
.days .c.today { box-shadow: 0 0 0 3px var(--orange); }

textarea { width: 100%; border: 1px solid var(--line2); border-radius: 14px; background: var(--bg); padding: 12px; font-size: 15px; resize: vertical; min-height: 72px; }
input[type="time"] { min-height: 44px; border: 1px solid var(--line2); border-radius: 12px; padding: 0 10px; background: var(--card); font-size: 15px; }

.switch { position: relative; width: 52px; height: 32px; flex: 0 0 52px; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; background: var(--line2); border-radius: 16px; transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 13px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--orange); outline-offset: 2px; }

.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card); font-weight: 800; font-size: 18px; }
.stepper output { min-width: 64px; text-align: center; font-weight: 800; }

details.acc { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
details.acc summary { list-style: none; min-height: 54px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; font-weight: 800; cursor: pointer; }
details.acc summary::-webkit-details-marker { display: none; }
details.acc summary::after { content: "+"; font-size: 22px; color: var(--muted); font-weight: 600; }
details.acc[open] summary::after { content: "−"; }
details.acc .acc-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; color: var(--muted2); line-height: 1.55; }
details.acc .acc-body p { margin: 0; }

/* Navegação */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid #E2E8DD; padding: 6px 6px calc(env(safe-area-inset-bottom, 0px) + 8px); z-index: 10; }
nav.tabs .in { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
nav.tabs a { min-height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; border-radius: 12px; }
nav.tabs a[aria-current="page"] { color: var(--green-dark); font-weight: 800; }

.toast[hidden] { display: none; }
.chip { white-space: nowrap; }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 14px; font-size: 14px; font-weight: 600; z-index: 20; width: max-content; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.2); display: flex; align-items: center; gap: 12px; }
.toast button { background: none; border: 0; color: var(--amber); font-weight: 800; min-height: 32px; }

.foot { margin-top: 28px; font-size: 12px; color: var(--muted); text-align: center; }
.empty { text-align: center; padding: 24px 12px; color: var(--muted); font-size: 14px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
