/* GN Training v7 — identidade da v5 (papel/tinta/lima, Bebas nos números) com DM Sans no texto. */
:root {
  --paper: #F3F0E8; --card: #FAF8F3; --bone: #E0DBD0; --bone2: #D2CCBF; --ink: #0D0D0D; --ink2: #2B2A27;
  --ash: #6F6B63; --ash2: #9E9A92; --lime: #C8F000; --red: #E0301E; --blue: #0066FF; --amber: #E08600; --purple: #7C5CFC; --green: #1E9E57;
  --deck: #0D0D0D; --deck-2: #1C1C1A; --deck-3: #2A2A27; --deck-ink: #F3F0E8; --deck-ash: #A3A097;
  --r-sm: 10px; --r-md: 14px; --r-lg: 18px; --r-xl: 22px;
  --font: 'DM Sans', system-ui, -apple-system, sans-serif; --num: 'Bebas Neue', 'DM Sans', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
html[data-theme="escuro"] {
  --paper: #111110; --card: #1A1918; --bone: #2C2B28; --bone2: #3A3935; --ink: #F3F0E8; --ink2: #D8D4CA;
  --ash: #A3A097; --ash2: #77746C; --red: #FF5A45; --blue: #4D94FF; --amber: #FFA733; --green: #3CC47A;
  --deck: #000; --deck-2: #161615; --deck-3: #262624; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --paper: #111110; --card: #1A1918; --bone: #2C2B28; --bone2: #3A3935; --ink: #F3F0E8; --ink2: #D8D4CA;
    --ash: #A3A097; --ash2: #77746C; --red: #FF5A45; --blue: #4D94FF; --amber: #FFA733; --green: #3CC47A;
    --deck: #000; --deck-2: #161615; --deck-3: #262624; color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--paper); color: var(--ink); height: 100dvh; overflow: hidden; overscroll-behavior: none; font-size: 15px; line-height: 1.4; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
input, select, textarea { font: inherit; color: inherit; }
svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

#app { display: flex; flex-direction: column; height: 100dvh; max-width: 520px; margin: 0 auto; }
#topbar { display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 16px 8px; flex-shrink: 0; }
.brand { font-family: var(--num); font-size: 24px; letter-spacing: .04em; }
.tb-date { flex: 1; font-size: 12px; font-weight: 600; color: var(--ash); text-transform: capitalize; }
.tb-right { display: flex; gap: 6px; align-items: center; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ash); }
.icon-btn:active { background: var(--bone); }
.sync-pill { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 99px; border: 1.5px solid var(--bone); font-size: 11px; font-weight: 700; color: var(--ash); letter-spacing: .03em; }
.sync-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ash2); }
.sync-pill.ok .dot { background: var(--green); } .sync-pill.syncing .dot { background: var(--amber); animation: pulse .8s infinite; }
.sync-pill.err .dot, .sync-pill.auth .dot { background: var(--red); } .sync-pill.offline .dot { background: var(--amber); }
@keyframes pulse { 50% { opacity: .35; } }
#liveBanner:empty { display: none; }
.live { margin: 0 16px 8px; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-md); background: var(--deck); color: var(--deck-ink); font-size: 13px; font-weight: 600; }
.live b { color: var(--lime); }
.live .btn { margin-left: auto; }

#page { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 0 24px; }
#bottomnav { display: flex; border-top: 1.5px solid var(--bone); padding: 4px 4px calc(4px + var(--safe-b)); background: var(--paper); flex-shrink: 0; }
.bn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: var(--ash2); font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; min-height: 52px; }
.bn.on { color: var(--ink); }
.bn.on svg { stroke-width: 2.2; }

/* ── blocos */
.sec { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ash); padding: 18px 16px 8px; display: flex; align-items: center; justify-content: space-between; }
.sec .link { font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--ink); font-weight: 700; }
.card { margin: 0 16px 10px; background: var(--card); border: 1.5px solid var(--bone); border-radius: var(--r-lg); padding: 14px; }
.card.tap:active { border-color: var(--bone2); }
.card.dark { background: var(--deck); border-color: var(--deck); color: var(--deck-ink); }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ash); } .small { font-size: 12px; } .tiny { font-size: 11px; }
.b { font-weight: 700; } .ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.num { font-family: var(--num); letter-spacing: .01em; line-height: 1; }
.h1 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.h2 { font-size: 16px; font-weight: 700; }
.stack > * + * { margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 34px; padding: 0 12px; border-radius: 99px; border: 1.5px solid var(--bone); font-size: 13px; font-weight: 600; color: var(--ash); display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 99px; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; background: var(--bone); color: var(--ash); white-space: nowrap; }
.tag.up { background: rgba(30,158,87,.14); color: var(--green); } .tag.down { background: rgba(224,48,30,.12); color: var(--red); }
.tag.warn { background: rgba(224,134,0,.14); color: var(--amber); } .tag.ink { background: var(--ink); color: var(--paper); }
.tag.hip { background: rgba(124,92,252,.14); color: var(--purple); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: var(--r-md); font-weight: 700; font-size: 14px; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn.ink { background: var(--ink); color: var(--paper); } .btn.lime { background: var(--lime); color: #0D0D0D; }
.btn.ghost { border: 1.5px solid var(--bone); color: var(--ink); } .btn.danger { color: var(--red); border: 1.5px solid var(--bone); }
.btn.full { width: 100%; } .btn.lg { height: 56px; font-size: 16px; border-radius: var(--r-lg); } .btn.sm { height: 34px; padding: 0 12px; font-size: 12px; border-radius: 10px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }

/* ── home */
.today { background: var(--deck); color: var(--deck-ink); border-radius: var(--r-xl); margin: 4px 16px 10px; padding: 18px; }
.today .kicker svg { display: inline-block; vertical-align: -1px; stroke-width: 2.6; }
.today .kicker { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--deck-ash); }
.today .title { font-size: 22px; font-weight: 700; margin: 4px 0 2px; letter-spacing: -.01em; }
.today .meta { font-size: 13px; color: var(--deck-ash); }
.today .btn.lime { margin-top: 14px; }
.today .alt { margin-top: 10px; display: flex; gap: 8px; }
.today .alt .btn { flex: 1; background: var(--deck-2); color: var(--deck-ink); height: 40px; font-size: 13px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; color: var(--ash); letter-spacing: .04em; }
.wd .box { width: 100%; height: 38px; border-radius: 10px; background: var(--bone); display: grid; place-items: center; font-size: 12px; color: var(--ash); font-weight: 700; }
.wd .box.t { background: var(--lime); color: #0D0D0D; } .wd .box.c { background: var(--deck); color: var(--amber); }
.wd .box.now { outline: 2px solid var(--red); outline-offset: -2px; color: var(--red); background: transparent; }
.wd .box svg { width: 14px; height: 14px; stroke-width: 2.4; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 16px; }
.stat { background: var(--card); border: 1.5px solid var(--bone); border-radius: var(--r-md); padding: 12px; }
.stat .v { font-family: var(--num); font-size: 30px; line-height: 1; }
.stat .l { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ash); margin-top: 4px; }
.ins { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--bone); }
.ins:first-child { border-top: 0; padding-top: 0; } .ins:last-child { padding-bottom: 0; }
.ins .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; background: var(--bone); }
.ins .ic svg { width: 16px; height: 16px; }
.ins .t { font-size: 13px; font-weight: 700; } .ins .d { font-size: 12px; color: var(--ash); margin-top: 2px; }
.ins .acts { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }

/* ── listas */
.list { margin: 0 16px 10px; background: var(--card); border: 1.5px solid var(--bone); border-radius: var(--r-lg); overflow: hidden; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--bone); min-height: 56px; width: 100%; text-align: left; }
.li:first-child { border-top: 0; }
button.li:active { background: var(--bone); }
.li .t { font-size: 14px; font-weight: 600; } .li .d { font-size: 12px; color: var(--ash); margin-top: 1px; }
.li .r { text-align: right; flex-shrink: 0; }
.li .chev { color: var(--ash2); width: 16px; height: 16px; flex-shrink: 0; }
.swatch { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-family: var(--num); font-size: 20px; flex-shrink: 0; }
.empty { padding: 22px 16px; text-align: center; color: var(--ash); font-size: 13px; }

/* ── barras de volume */
.vol { padding: 8px 0; }
.vol .hd { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 5px; }
.vol .track { position: relative; height: 10px; border-radius: 5px; background: var(--bone); overflow: hidden; }
.vol .band { position: absolute; top: 0; bottom: 0; background: rgba(30,158,87,.18); }
.vol .plan { position: absolute; top: 0; bottom: 0; left: 0; border-right: 2px solid var(--ink); }
.vol .done { position: absolute; top: 3px; bottom: 3px; left: 0; background: var(--ink); border-radius: 3px; }
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--ash); padding: 0 16px 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.spark { width: 84px; height: 28px; }
.spark path { stroke-width: 2; }

/* ── formulários */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ash); margin-bottom: 6px; }
.inp { width: 100%; height: 48px; padding: 0 14px; border-radius: var(--r-md); border: 1.5px solid var(--bone); background: var(--card); font-size: 16px; }
.inp:focus { outline: none; border-color: var(--ink); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stepper { display: flex; align-items: center; border: 1.5px solid var(--bone); border-radius: var(--r-md); height: 48px; overflow: hidden; background: var(--card); }
.stepper button { width: 48px; height: 100%; font-size: 22px; font-weight: 600; }
.stepper button:active { background: var(--bone); }
.stepper .v { flex: 1; text-align: center; font-family: var(--num); font-size: 26px; }
.switch { display: flex; align-items: center; justify-content: space-between; min-height: 48px; gap: 12px; }
.tgl { width: 50px; height: 30px; border-radius: 99px; background: var(--bone2); position: relative; flex-shrink: 0; transition: background .15s; }
.tgl::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.tgl.on { background: var(--ink); } .tgl.on::after { transform: translateX(20px); }
.note { font-size: 12px; color: var(--ash); line-height: 1.5; }
.callout { margin: 0 16px 10px; padding: 12px 14px; border-radius: var(--r-md); background: rgba(124,92,252,.08); border: 1px solid rgba(124,92,252,.2); font-size: 12px; line-height: 1.5; }

/* ── sheets */
#sheets .back { position: fixed; inset: 0; background: rgba(0,0,0,.42); z-index: 300; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
#sheets .sheet { background: var(--paper); width: 100%; max-width: 520px; max-height: 88dvh; border-radius: 24px 24px 0 0; display: flex; flex-direction: column; animation: up .2s cubic-bezier(.2,.8,.2,1); }
#sheets .back.full .sheet { max-height: 96dvh; height: 96dvh; }
.sheet-hd { display: flex; align-items: center; gap: 10px; padding: 14px 12px 8px 18px; flex-shrink: 0; }
.sheet-hd .h2 { flex: 1; min-width: 0; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 18px calc(22px + var(--safe-b)); }
.sheet-body .list, .sheet-body .card, .sheet-body .callout { margin-left: 0; margin-right: 0; }
.sheet-foot { display: flex; gap: 10px; padding: 10px 18px calc(12px + var(--safe-b)); border-top: 1.5px solid var(--bone); flex-shrink: 0; }
.sheet-foot .btn { flex: 1; }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }
@keyframes fade { from { opacity: 0; } }

/* ── toasts — a notificação nunca rouba toque: o dedo atravessa o texto; só o botão de ação dela é clicável */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + var(--safe-b)); z-index: 500; display: flex; flex-direction: column; gap: 8px; align-items: center; width: calc(100% - 32px); max-width: 480px; pointer-events: none; }
.toast { pointer-events: none; display: flex; align-items: center; gap: 12px; background: var(--ink); color: var(--paper); padding: 10px 10px 10px 16px; border-radius: 14px; font-size: 13px; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.25); animation: up .2s; min-height: 44px; }
.toast.err { background: var(--red); color: #fff; }
.toast .btn { height: 32px; background: var(--lime); color: #0D0D0D; pointer-events: auto; }

/* ── sessão */
#session { position: fixed; inset: 0; z-index: 200; background: var(--paper); display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; }
.ss-hd { display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) 10px 8px; flex-shrink: 0; }
.ss-hd .ttl { flex: 1; min-width: 0; }
.ss-hd .ttl .n { font-weight: 700; font-size: 15px; } .ss-hd .ttl .m { font-size: 11px; color: var(--ash); font-weight: 600; }
.ss-prog { height: 3px; background: var(--bone); margin: 0 16px; border-radius: 2px; overflow: hidden; flex-shrink: 0; }
.ss-prog i { display: block; height: 100%; background: var(--ink); transition: width .3s; }
.ss-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px 12px 16px; }
.exc { background: var(--card); border: 1.5px solid var(--bone); border-radius: var(--r-lg); margin-bottom: 10px; overflow: hidden; }
.exc.cur { border-color: var(--ink); }
.exc.done { opacity: .72; }
.exc-hd { display: flex; align-items: flex-start; gap: 10px; padding: 12px 8px 8px 12px; }
.exc-idx { width: 26px; height: 26px; border-radius: 8px; background: var(--bone); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ash); flex-shrink: 0; }
.exc.cur .exc-idx { background: var(--ink); color: var(--lime); }
.exc.done .exc-idx { background: var(--ink); color: var(--lime); }
.exc-n { font-weight: 700; font-size: 14px; line-height: 1.25; }
.exc-m { font-size: 11px; color: var(--ash); margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.srow { display: grid; grid-template-columns: 26px 1fr 1.2fr 34px; align-items: center; gap: 8px; padding: 0 12px; min-height: 46px; border-top: 1px solid var(--bone); width: 100%; text-align: left; font-size: 14px; }
.srow .i { font-size: 12px; font-weight: 700; color: var(--ash2); text-align: center; }
.srow .prev { font-size: 12px; color: var(--ash); }
.srow .val { font-weight: 600; }
.srow .ck { width: 28px; height: 28px; border-radius: 8px; border: 1.5px solid var(--bone2); display: grid; place-items: center; justify-self: end; }
.srow.done .ck { background: var(--ink); border-color: var(--ink); color: var(--lime); }
.srow.done .ck svg { width: 14px; height: 14px; stroke-width: 2.6; }
.srow.cur { background: rgba(200,240,0,.14); }
.srow.cur .i { color: var(--ink); }
.srow.cur .ck { border-color: var(--ink); }
.srow.drop .i { color: var(--amber); }
.srow:active { background: var(--bone); }
.exc-add { display: flex; justify-content: center; border-top: 1px solid var(--bone); }
.exc-add button { height: 40px; font-size: 12px; font-weight: 700; color: var(--ash); width: 100%; }

.deck { flex-shrink: 0; background: var(--deck); color: var(--deck-ink); border-radius: 22px 22px 0 0; padding: 10px 14px calc(12px + var(--safe-b)); }
.strip { display: flex; align-items: center; gap: 8px; height: 38px; border-radius: 12px; background: var(--deck-2); padding: 0 6px 0 12px; position: relative; overflow: hidden; }
.strip .fill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(200,240,0,.14); pointer-events: none; }
.strip .txt { position: relative; flex: 1; font-size: 13px; font-weight: 600; color: var(--deck-ash); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip .txt b { font-family: var(--num); font-size: 20px; color: var(--lime); font-weight: 400; letter-spacing: .02em; vertical-align: -1px; margin-right: 4px; }
.strip .txt b.over { color: var(--amber); }
.strip button { position: relative; height: 28px; padding: 0 10px; border-radius: 8px; background: var(--deck-3); font-size: 12px; font-weight: 700; color: var(--deck-ink); }
.dk-hd { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 8px; min-height: 40px; }
.dk-hd .n { font-size: 15px; font-weight: 700; line-height: 1.2; }
.dk-hd .m { font-size: 11px; color: var(--deck-ash); margin-top: 3px; font-weight: 600; }
.dk-hd .m .up { color: var(--lime); } .dk-hd .m .down { color: #FF8A7A; }
.dk-hd .swap { height: 32px; padding: 0 10px; border-radius: 9px; background: var(--deck-2); font-size: 12px; font-weight: 700; flex-shrink: 0; }
.dk-steps { display: grid; grid-template-columns: 1.15fr 1fr; gap: 8px; }
.dstep { display: flex; align-items: center; height: 58px; border-radius: 14px; background: var(--deck-2); overflow: hidden; }
.dstep button { width: 46px; height: 100%; font-size: 13px; font-weight: 700; color: var(--deck-ink); flex-shrink: 0; }
.dstep button:active { background: var(--deck-3); }
.dstep .mid { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; }
.dstep input { width: 100%; background: transparent; border: 0; text-align: center; font-family: var(--num); font-size: 30px; color: var(--deck-ink); line-height: 1; padding: 0; outline: none; }
.dstep .u { font-size: 9px; font-weight: 700; color: var(--deck-ash); letter-spacing: .1em; margin-top: 1px; }
.dk-rir { display: flex; align-items: center; gap: 6px; margin-top: 8px; height: 34px; }
.dk-rir .l { font-size: 11px; font-weight: 700; color: var(--deck-ash); letter-spacing: .06em; width: 34px; }
.dk-rir button { flex: 1; height: 34px; border-radius: 9px; background: var(--deck-2); font-size: 13px; font-weight: 700; color: var(--deck-ash); }
.dk-rir button.on { background: var(--deck-ink); color: var(--deck); }
.dk-go { margin-top: 10px; width: 100%; height: 58px; border-radius: 16px; background: var(--lime); color: #0D0D0D; font-size: 17px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; transition: opacity .15s; }
.dk-go svg { width: 20px; height: 20px; stroke-width: 2.6; }
.dk-go.locked { opacity: .45; }
.dk-go.fin { background: var(--deck-ink); color: var(--deck); }
.dk-done { text-align: center; padding: 18px 0 4px; }

/* ── abas internas, macros, refeições, IA */
.seg { display: flex; gap: 4px; margin: 4px 16px 4px; padding: 4px; border-radius: var(--r-md); background: var(--bone); }
.seg button { flex: 1; height: 36px; border-radius: 10px; font-size: 13px; font-weight: 700; color: var(--ash); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.link { font-weight: 700; color: var(--ink); }
.macro { padding: 6px 0; }
.macro .hd { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 5px; }
.macro .track { height: 10px; border-radius: 5px; background: var(--bone); overflow: hidden; }
.macro .track i { display: block; height: 100%; background: var(--ink); border-radius: 5px; transition: width .3s; }
.daynav { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 6px; font-size: 15px; text-transform: capitalize; }
.thumb { width: 44px; height: 44px; border-radius: 12px; background: var(--bone); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; color: var(--ash); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.ai-out { font-size: 13px; line-height: 1.55; }
label.btn { cursor: pointer; }

/* toasts sobem para o topo no treino e com folha aberta: nunca ficam por cima do CONCLUIR nem do Salvar */
body:has(#session:not([hidden])) #toasts, body:has(#sheets .back) #toasts { top: calc(64px + var(--safe-t)); bottom: auto; }
