/* tracker · direção D — branco, Manrope, azul; tema escuro automático */
@font-face { font-family: Manrope; src: url('/manrope.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }

:root {
  --bg: #FFFFFF; --ink: #111318; --muted: #5C6370; --soft: #4A505B;
  --line: #E4E6EA; --track: #F1F2F4; --ring: #8A909A; --raise: #FFFFFF;
  --accent: #2456E6; --on-accent: #FFFFFF; --tint: #E9EEFD; --tint-ink: #1D3FAE;
  --part: #8FA8F2; --miss: #E4E6EA; --border: #C9CDD3;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318; --ink: #F2F3F5; --muted: #A0A6B1; --soft: #B4BAC4;
    --line: #2A2E36; --track: #1C1F26; --ring: #6E7582; --raise: #2A2E36;
    --accent: #7C9BF7; --on-accent: #0B1020; --tint: #1B2647; --tint-ink: #BFCDFC;
    --part: #3F5BB5; --miss: #2A2E36; --border: #3A3F4A;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Manrope, system-ui, -apple-system, sans-serif; font-size: 16px; line-height: 1.35; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
svg { display: block; flex: none; }

#app { max-width: 430px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; gap: 24px;
  padding: calc(28px + env(safe-area-inset-top)) calc(24px + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) calc(24px + env(safe-area-inset-left)); }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; }
.gap8 { gap: 8px; } .gap10 { gap: 10px; } .gap18 { gap: 18px; }

/* cabeçalho */
.head { display: flex; flex-direction: column; gap: 8px; }
.head-top { display: flex; align-items: center; justify-content: space-between; min-height: 20px; }
.eyebrow { font-size: 13px; font-weight: 500; color: var(--muted); }
.title { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; margin: 0; text-wrap: balance; }
.title.sm { font-size: 28px; }
.lede { font-size: 14px; color: var(--muted); margin: 0; }
.icon-btn { width: 44px; height: 44px; margin: -12px -10px -12px 0; display: flex; align-items: center; justify-content: center; color: var(--soft); border-radius: 12px; }
.back { align-self: flex-start; height: 44px; margin: -8px 0 -4px -4px; padding: 0 8px 0 0; display: flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; color: var(--soft); }

/* interruptor Hoje · Histórico */
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; padding: 3px; background: var(--track); border-radius: 12px; }
.seg > * { height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--soft); }
.seg > .on { background: var(--raise); color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); }

/* linhas das rotinas */
.rows > .row + .row { border-top: 1px solid var(--line); }
.row { padding: 18px 0; display: flex; flex-direction: column; gap: 12px; }
.rows > .row:first-child { padding-top: 4px; }
.rows > .row:last-child { padding-bottom: 4px; }
.row-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-title { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; display: inline-flex; align-items: center; gap: 4px; }
a.row-title { padding: 10px 0; margin: -10px 0; }
.row-title svg { color: var(--muted); }
.row-sub { font-size: 14px; color: var(--muted); }
.check { width: 48px; height: 48px; flex: none; border-radius: 50%; border: 2px solid var(--ring); background: var(--bg); color: var(--on-accent); display: flex; align-items: center; justify-content: center; transition: background .18s ease, border-color .18s ease, transform .12s ease; }
.check svg { opacity: 0; transform: scale(.6); transition: opacity .18s ease, transform .22s cubic-bezier(.2, 1.4, .4, 1); }
.check.on { background: var(--accent); border-color: var(--accent); }
.check.on svg { opacity: 1; transform: none; }
.check.stop { border-color: var(--accent); color: var(--accent); }
.check.stop svg { opacity: 1; transform: none; }
.check:active, .chip:active, .pill:active, .btn:active { transform: scale(.97); }
.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.chip { min-height: 60px; border-radius: 14px; border: 1.5px solid var(--ring); background: var(--bg); padding: 9px 14px; display: flex; flex-direction: column; justify-content: center; gap: 3px; transition: background .18s ease, border-color .18s ease, color .18s ease, transform .12s ease; }
.chip b { font-size: 14px; font-weight: 700; }
.chip span { font-size: 12px; font-weight: 500; }
.chip.on { border-color: var(--accent); background: var(--tint); color: var(--tint-ink); }
.chip.na { border-style: dashed; color: var(--muted); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1.5px solid var(--border); font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; transition: transform .12s ease; }
.pill.on { border-color: var(--accent); background: var(--tint); color: var(--tint-ink); font-weight: 700; }

/* nota de ontem */
.note { border-radius: 14px; background: var(--track); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.note p { margin: 0; font-size: 14px; font-weight: 600; }
.note .pill { background: var(--bg); }

/* rodapé de Hoje */
.foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.cap { font-size: 12px; font-weight: 500; color: var(--muted); }
.week { display: flex; gap: 6px; }
.week > div { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.sq { width: 26px; height: 26px; border-radius: 7px; background: var(--miss); }
.sq.l2 { background: var(--accent); } .sq.l1 { background: var(--part); } .sq.ln { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.sq.today { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }
.big { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.right { text-align: right; }

/* passos (detalhe, confirmação) */
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.group-head b { font-size: 15px; font-weight: 700; }
.group-head span, .group-head button { font-size: 13px; color: var(--muted); }
.group-head button { font-weight: 700; color: var(--accent); min-height: 44px; margin: -14px 0; }
.step { width: 100%; min-height: 60px; display: flex; align-items: center; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.step.tall { min-height: 72px; padding: 12px 0; }
.box { width: 28px; height: 28px; flex: none; border-radius: 8px; border: 2px solid var(--ring); background: var(--bg); color: var(--on-accent); display: flex; align-items: center; justify-content: center; transition: background .15s ease, border-color .15s ease; }
.box svg { opacity: 0; }
.step.on .box { background: var(--accent); border-color: var(--accent); }
.step.on .box svg { opacity: 1; }
.step-name { flex: 1; min-width: 0; font-size: 17px; font-weight: 600; display: flex; flex-direction: column; gap: 2px; }
.step-name small { font-size: 13px; font-weight: 400; color: var(--muted); }
.step-note { font-size: 13px; color: var(--muted); }
.btn { min-height: 56px; width: 100%; border-radius: 16px; background: var(--accent); color: var(--on-accent); font-size: 16px; font-weight: 800; display: flex; align-items: center; justify-content: center; transition: transform .12s ease, background .18s ease; }
.btn.done { background: var(--tint); color: var(--tint-ink); }
.btn.ghost { min-height: 48px; background: none; color: var(--ink); border: 1px solid var(--border); border-radius: 12px; font-size: 14px; font-weight: 700; }
.btn.danger { color: #C4321F; }
@media (prefers-color-scheme: dark) { .btn.danger { color: #FF9B8A; } }
.link-center { min-height: 44px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; color: var(--soft); }

/* histórico */
.cal-head { display: flex; align-items: baseline; justify-content: space-between; }
.cal-head b { font-size: 15px; font-weight: 700; }
.cal-head span { font-size: 13px; color: var(--muted); }
.cal { display: grid; grid-template-rows: repeat(7, 10px); grid-auto-flow: column; grid-auto-columns: 10px; gap: 3px; justify-content: start; overflow: hidden; }
.cal i { border-radius: 2.5px; background: var(--miss); }
.cal i.l2 { background: var(--accent); } .cal i.l1 { background: var(--part); } .cal i.ln { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.legend { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2.5px; background: var(--miss); }
.legend i.l2 { background: var(--accent); } .legend i.l1 { background: var(--part); }
.legend .end { margin-left: auto; }
.hr { height: 1px; background: var(--line); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sec-head b { font-size: 15px; font-weight: 700; }
.sec-head span { font-size: 14px; color: var(--muted); }
.plot { display: flex; gap: 10px; }
.axis { height: 72px; display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--muted); }
.dots { flex: 1; height: 72px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); }
.dots > div { display: flex; justify-content: center; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.bar-row { display: flex; align-items: center; gap: 12px; min-height: 20px; }
.bar-row > span:first-child { width: 110px; flex: none; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row > div { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.bar { height: 6px; min-width: 6px; border-radius: 3px; background: var(--accent); }
.bar.zero { background: var(--miss); }
.empty { font-size: 14px; color: var(--muted); margin: 0; }

/* rotinas e editor de passo */
.list-label { font-size: 13px; font-weight: 700; color: var(--muted); padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.item { min-height: 52px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.item b { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; }
.item span { font-size: 13px; color: var(--muted); }
.item svg { color: var(--ring); }
.item.add b { color: var(--accent); font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label, .field .label { font-size: 13px; font-weight: 700; color: var(--muted); }
.input { height: 52px; width: 100%; border-radius: 12px; border: 1.5px solid var(--border); background: var(--bg); padding: 0 14px; font-size: 16px; font-weight: 600; }
.input:focus { outline: none; border-color: var(--accent); }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.days button { height: 44px; border-radius: 12px; border: 1.5px solid var(--border); font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.days button.on { border-color: var(--accent); background: var(--tint); color: var(--tint-ink); }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.err { font-size: 14px; font-weight: 600; color: #C4321F; margin: 0; }
@media (prefers-color-scheme: dark) { .err { color: #FF9B8A; } }
.version { font-size: 12px; color: var(--muted); text-align: center; }

/* aviso temporário */
#toast { position: fixed; left: 0; right: 0; bottom: calc(20px + env(safe-area-inset-bottom)); display: flex; justify-content: center; pointer-events: none; padding: 0 16px; z-index: 10; }
#toast > div { pointer-events: auto; max-width: 398px; width: 100%; min-height: 52px; padding: 6px 8px 6px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); animation: rise .22s cubic-bezier(.2, .9, .3, 1); }
#toast button { min-height: 40px; padding: 0 12px; font-weight: 800; color: var(--bg); text-decoration: underline; text-underline-offset: 3px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
