/* ================= TOKENS ================= */
:root {
  --bg: #0A0B0F;
  --surface: #14161C;
  --surface-2: #1C1F27;
  --surface-3: #262A34;
  --line: rgba(255, 255, 255, .07);
  --text: #F3F4F6;
  --muted: #8C93A3;
  --faint: #5B6170;

  --accent: #C8F542;
  --accent-ink: #0A0B0F;
  --accent-text: #C8F542;
  --accent-soft: rgba(200, 245, 66, .13);
  --rest: #5AA9FF;
  --hydrate: #2DD4E6;
  --alert: #FF5A5F;
  --danger: #FF5A5F;

  --radius: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow: 0 12px 32px rgba(0, 0, 0, .35);
  --nav-h: 72px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #F3F4F7;
    --surface: #FFFFFF;
    --surface-2: #F0F2F6;
    --surface-3: #E3E6ED;
    --line: rgba(15, 20, 30, .08);
    --text: #0E1117;
    --muted: #626A79;
    --faint: #9AA1AF;
    --accent-text: #4D7C0F;
    --accent-soft: rgba(132, 184, 0, .16);
    --rest: #2F80ED;
    --hydrate: #0E9FB0;
    --alert: #E5383B;
    --danger: #E5383B;
    --shadow: 0 10px 28px rgba(20, 30, 50, .08);
    color-scheme: light;
  }
}

/* ================= BASE ================= */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 50% -10%, var(--accent-soft), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom));
}
body.locked { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .3; cursor: default; }
input, select {
  font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 12px 14px; min-width: 0;
  transition: border-color .15s, background .15s;
}
input:focus, select:focus { outline: none; border-color: var(--accent); background: var(--surface); }
input::placeholder { color: var(--faint); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { flex: none; display: block; }

main {
  max-width: 640px; margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px 0;
  animation: fade .25s var(--ease);
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

.page-head { padding: 12px 4px 16px; }
.page-head h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.page-head p { margin: 2px 0 0; color: var(--muted); }

.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }

.section-head { display: flex; justify-content: space-between; align-items: center; margin: 24px 4px 10px; }
.section-head h3 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }

/* ================= BOTÕES ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 13px 20px; font-weight: 700; letter-spacing: -.01em;
  transition: transform .12s var(--ease), filter .15s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-soft { background: var(--surface-2); color: var(--text); }
.btn-soft:hover { background: var(--surface-3); }
.btn-danger { background: var(--danger); color: #fff; }
.btn.sm { padding: 9px 14px; font-size: 14px; }
.btn-cta {
  width: 100%; padding: 17px; font-size: 17px; background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 10px 30px -8px color-mix(in srgb, var(--accent) 60%, transparent);
}

.link-btn {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: 0;
  color: var(--accent-text); font-weight: 600; padding: 6px 4px;
}
.link-btn.danger { color: var(--danger); }
.link-btn.center { display: flex; margin: 20px auto 0; }

.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: none; border: 0; color: var(--muted);
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }

/* ================= AVATAR / LINHAS ================= */
.avatar {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px;
  font-size: 13px; font-weight: 800; letter-spacing: -.02em;
  color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent);
}
.avatar.soft { --c: var(--accent-text); }

.row-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
}
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-main b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main small, .row-meta small { color: var(--muted); font-size: 13px; }
.row-meta { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.row-meta b { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ================= SEMANA ================= */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 16px; }
.wday {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 0 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  transition: background .15s, transform .12s var(--ease);
}
.wday:active { transform: scale(.95); }
.wday span { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.wday b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wday i { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.wday.has i { background: var(--accent-text); }
.wday.today { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.wday.sel { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.wday.sel span { color: var(--accent-ink); opacity: .7; }
.wday.sel.has i { background: var(--accent-ink); }

/* ================= HOME ================= */
.hero {
  position: relative; overflow: hidden; padding: 22px; border-radius: var(--radius);
  background:
    radial-gradient(90% 120% at 100% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    var(--surface);
  border: 1px solid var(--line);
}
.hero .eyebrow { color: var(--accent-text); }
.hero h2 { margin: 6px 0 18px; font-size: 26px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 20px; }
.hero-stats div { display: flex; flex-direction: column; padding: 12px; border-radius: 14px; background: color-mix(in srgb, var(--text) 5%, transparent); }
.hero-stats b { font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hero-stats span { font-size: 12px; color: var(--muted); }

.empty-card {
  text-align: center; padding: 32px 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.empty-ic {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text);
}
.empty-card h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.02em; }
.empty-card p { margin: 0 0 20px; color: var(--muted); }

/* ================= SESSÃO ================= */
.session {
  --phase: var(--muted);
  display: flex; flex-direction: column; gap: 12px; padding-bottom: 8px;
}
.session.phase-work { --phase: var(--accent-text); }
.session.phase-rest { --phase: var(--rest); }
.session.phase-hydrate { --phase: var(--hydrate); }
.session.alert { --phase: var(--alert); }
body.in-session { background: radial-gradient(120% 55% at 50% -10%, color-mix(in srgb, var(--phase, var(--accent)) 16%, transparent), transparent 60%), var(--bg); }
body.in-session:has(.phase-rest) { --phase: var(--rest); }
body.in-session:has(.phase-hydrate) { --phase: var(--hydrate); }
body.in-session:has(.phase-ready) { --phase: var(--faint); }
body.in-session:has(.alert) { --phase: var(--alert); }

.s-top { display: flex; align-items: center; gap: 14px; }
.s-progress { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.s-progress .bar { height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.s-progress .bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s var(--ease); }
.s-total { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }

.s-ex { text-align: center; }
.s-ex .eyebrow { color: var(--phase); }
.s-ex h2 { margin: 2px 0 0; font-size: 24px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }

.ring { position: relative; width: min(62vw, 236px); aspect-ratio: 1; margin: 0 auto; }
.ring > svg, .w-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--surface-3); stroke-width: 10; }
.ring-fg {
  fill: none; stroke: var(--phase); stroke-width: 10; stroke-linecap: round;
  transition: stroke-dashoffset .3s linear, stroke .3s;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--phase) 45%, transparent));
}
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.phase-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--phase); background: color-mix(in srgb, var(--phase) 14%, transparent);
}
.timer { font-size: clamp(48px, 15vw, 64px); font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1.05; }
.timer-sub { font-size: 13px; color: var(--muted); min-height: 18px; }
.phase-ready .timer { color: var(--faint); }

.session.alert .ring { animation: pulse-ring 1s var(--ease) infinite; }
.session.alert .timer, .session.alert .timer-sub { color: var(--alert); }
@keyframes pulse-ring {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}
.session.alert .ring::before {
  content: ""; position: absolute; inset: 6%; border-radius: 50%;
  background: color-mix(in srgb, var(--alert) 18%, transparent);
  animation: blink 1s steps(1, end) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.s-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
}
.tile-wide { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; padding: 10px 12px 10px 16px; }
.tile-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.tile-value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile-value small { font-size: 16px; color: var(--muted); font-weight: 700; }
.tile-row { display: flex; align-items: center; gap: 10px; }
.mini-btn {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-2); border: 0; color: var(--text); transition: background .15s, transform .1s;
}
.mini-btn:hover { background: var(--surface-3); }
.mini-btn:active { transform: scale(.9); }
.segs { display: flex; gap: 4px; width: 100%; }
.segs i { flex: 1; height: 5px; border-radius: 3px; background: var(--surface-3); }
.segs i.ok { background: var(--accent); }
.segs i.now { background: color-mix(in srgb, var(--accent) 45%, transparent); animation: blink 1s steps(1, end) infinite; }
.kg { display: flex; align-items: baseline; gap: 4px; }
.kg input {
  width: 86px; text-align: center; font-size: 24px; font-weight: 800; padding: 6px 4px;
  background: transparent; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.kg input:focus { background: var(--surface-2); }
.kg span { color: var(--muted); font-weight: 600; }

.s-controls { display: flex; align-items: center; justify-content: center; gap: 28px; margin-top: 4px; }
.fab {
  display: grid; place-items: center; width: 80px; height: 80px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 12px 34px -6px color-mix(in srgb, var(--accent) 65%, transparent);
  transition: transform .12s var(--ease), background .2s;
}
.fab:active { transform: scale(.93); }
.phase-work .fab { background: var(--text); color: var(--bg); box-shadow: 0 12px 34px -8px rgba(0, 0, 0, .5); }
.ctl {
  display: flex; flex-direction: column; align-items: center; gap: 6px; width: 64px;
  background: none; border: 0; color: var(--muted); font-size: 12px; font-weight: 600;
}
.ctl .ic { width: 52px; height: 52px; padding: 15px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); color: var(--text); box-sizing: border-box; }
.ctl:hover .ic { background: var(--surface-2); }
.ctl.danger .ic { color: var(--danger); }
.hint { margin: -2px 0 0; text-align: center; color: var(--muted); font-size: 14px; }

.next-up {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
}
.next-up .avatar { width: 36px; height: 36px; border-radius: 11px; font-size: 12px; }
.next-up div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.next-up small { color: var(--muted); font-size: 12px; }
.next-up b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-up span { color: var(--muted); font-weight: 700; font-size: 14px; }

/* ================= CONCLUÍDO ================= */
.done { text-align: center; padding-top: 32px; }
.done-badge {
  width: 96px; height: 96px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 0 0 12px var(--accent-soft), 0 20px 50px -10px color-mix(in srgb, var(--accent) 60%, transparent);
  animation: pop .5s var(--ease);
}
@keyframes pop { from { transform: scale(.5); opacity: 0; } }
.done h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.done > p { margin: 4px 0 24px; color: var(--muted); }
.done .btn-cta { margin-top: 24px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.stat-grid.three { grid-template-columns: repeat(3, 1fr); margin-bottom: 20px; }
.stat-grid div {
  display: flex; flex-direction: column; padding: 14px; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--line); text-align: left;
}
.stat-grid b { font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-grid span { font-size: 12px; color: var(--muted); line-height: 1.3; }

/* ================= PLANO ================= */
.plan-head { padding: 4px 4px 14px; }
.plan-head .eyebrow { color: var(--accent-text); }
.title-input {
  width: 100%; padding: 4px 0; margin: 2px 0; background: transparent; border: 0; border-radius: 0;
  border-bottom: 2px solid transparent; font-size: 24px; font-weight: 800; letter-spacing: -.03em;
}
.title-input:focus { background: transparent; border-bottom-color: var(--accent); }
.plan-head p { margin: 0; font-size: 14px; }

.pcards { display: grid; gap: 10px; }
.pcard { padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); animation: fade .25s var(--ease); }
.pcard-head { display: flex; align-items: center; gap: 12px; }
.pcard-actions { display: flex; }
.pcard-fields { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.pf { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.pf > span:first-child { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.pf input { width: 100%; padding: 10px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.suffix { position: relative; display: block; }
.suffix input { padding-right: 26px; }
.suffix em { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 12px; color: var(--muted); pointer-events: none; }

.stepper {
  display: flex; align-items: center; justify-content: space-between; gap: 4px;
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 3px;
}
.stepper button {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: transparent; border: 0; color: var(--text); transition: background .15s;
}
.stepper button:hover { background: var(--surface-3); }
.stepper b { min-width: 28px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.add-tile {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 10px;
  padding: 18px; border-radius: var(--radius); border: 2px dashed color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 16px;
  transition: background .15s, transform .12s var(--ease);
}
.add-tile:active { transform: scale(.98); }
.plan-tools { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.select-pill {
  display: inline-flex; align-items: center; gap: 4px; padding-left: 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
.select-pill select { background: transparent; border: 0; padding: 10px 14px 10px 4px; font-weight: 600; font-size: 14px; color: var(--text); }

/* ================= HISTÓRICO ================= */
.hcards { display: grid; gap: 8px; }
.hcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.hcard summary { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; list-style: none; }
.hcard summary::-webkit-details-marker { display: none; }
.date-block {
  flex: none; width: 46px; height: 50px; border-radius: 13px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-text);
}
.date-block b { font-size: 19px; font-weight: 800; line-height: 1; }
.date-block small { font-size: 11px; font-weight: 700; text-transform: uppercase; }
.hlist { list-style: none; margin: 0; padding: 4px 14px 12px; border-top: 1px solid var(--line); }
.hlist li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.hlist li:last-child { border-bottom: 0; }
.hlist small { color: var(--muted); text-align: right; }

/* ================= AJUSTES ================= */
.group-title { margin: 22px 6px 8px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); cursor: default; }
.set-row:last-child { border-bottom: 0; }
label.set-row { cursor: pointer; }
.set-row.column { flex-direction: column; align-items: stretch; }
.set-text { display: flex; flex-direction: column; min-width: 0; }
.set-text b { font-weight: 600; }
.set-text small { color: var(--muted); font-size: 13px; }
.set-row .stepper { flex: none; min-width: 142px; }
.set-row .stepper b { min-width: 58px; }

.switch { position: relative; flex: none; width: 50px; height: 30px; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); transition: background .2s; pointer-events: none; }
.switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .2s var(--ease);
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; gap: 4px; background: var(--surface-2); border-radius: 14px; }
.segmented button { padding: 9px 4px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 160px; }
.inline-form select { flex: 0 1 auto; }
.footnote { text-align: center; color: var(--faint); font-size: 12px; margin: 24px 0 0; }

/* ================= NAVEGAÇÃO ================= */
.nav {
  position: fixed; z-index: 20; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; gap: 4px; padding: 6px; width: min(calc(100% - 24px), 420px);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow);
}
.nav:empty { display: none; }
.nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px;
  background: none; border: 0; border-radius: 20px; color: var(--muted); font-size: 11px; font-weight: 600;
  transition: color .15s, background .2s;
}
.nav button.active { color: var(--accent-ink); background: var(--accent); }

.mini {
  position: fixed; z-index: 19; left: 12px; right: 12px; margin: 0 auto; max-width: 420px;
  bottom: calc(var(--nav-h) + 22px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow);
  text-align: left; animation: fade .25s var(--ease);
}
.mini[hidden] { display: none; }
.mini { --phase: var(--faint); }
.mini.phase-work { --phase: var(--accent-text); }
.mini.phase-rest { --phase: var(--rest); }
.mini.phase-hydrate { --phase: var(--hydrate); }
.mini.alert { --phase: var(--alert); border-color: var(--alert); }
.mini-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--phase); box-shadow: 0 0 0 4px color-mix(in srgb, var(--phase) 25%, transparent); }
.mini.alert .mini-dot { animation: blink 1s steps(1, end) infinite; }
.mini-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mini-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.mini-text small { color: var(--phase); font-size: 12px; font-weight: 600; }
.mini-time { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 18px; }

/* ================= GAVETA / DIÁLOGO ================= */
#overlay { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
#overlay.open { pointer-events: auto; }
.backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); animation: fade-in .2s; }
@keyframes fade-in { from { opacity: 0; } }

.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 640px; height: min(88dvh, 820px);
  display: flex; flex-direction: column; gap: 12px; padding: 8px 16px 0;
  background: var(--bg); border-radius: 28px 28px 0 0; border: 1px solid var(--line); border-bottom: 0;
  animation: slide-up .32s var(--ease);
}
@keyframes slide-up { from { transform: translateY(100%); } }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 0 auto; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sheet-head h3 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.sheet-head small { color: var(--muted); }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--accent-ink); color: var(--accent); font-size: 12px; }
.search { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: 14px; background: var(--surface-2); color: var(--muted); }
.search input { flex: 1; background: transparent; padding: 13px 0; border: 0; }
.search input:focus { background: transparent; }
.search:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.gchips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; flex: none; }
.gchips::-webkit-scrollbar { display: none; }
.gchip { flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 600; font-size: 14px; }
.gchip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.sheet-body { flex: 1; overflow-y: auto; margin: 0 -16px; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.pick-row { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-radius: 14px; transition: background .15s; }
.pick-row.added { background: var(--accent-soft); }
.toggle {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 0;
  background: var(--surface-2); color: var(--accent-text); transition: transform .12s var(--ease), background .15s;
}
.toggle:active { transform: scale(.88); }
.toggle.on { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.custom-box { margin-top: 16px; padding: 16px; border-radius: var(--radius-md); background: var(--surface); border: 1px dashed var(--line); display: grid; gap: 10px; }

/* Centralizado com margin:auto (e não transform), para não brigar com a animação de entrada */
.dialog {
  position: absolute; inset: 0; margin: auto; height: fit-content; max-height: calc(100% - 40px); overflow-y: auto;
  width: min(calc(100% - 40px), 360px);
  padding: 22px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: pop .25s var(--ease);
}
.dialog h3 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.dialog p { margin: 6px 0 0; color: var(--muted); }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 20px; }
.dialog-actions.stacked { grid-template-columns: 1fr; }
.btn-danger-soft { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.hcard-foot { display: flex; justify-content: flex-end; padding: 0 10px 10px; }

.toast {
  position: fixed; z-index: 60; left: 50%; top: calc(16px + env(safe-area-inset-top));
  transform: translate(-50%, -200%); opacity: 0; visibility: hidden; padding: 12px 18px; border-radius: 999px;
  background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px; box-shadow: var(--shadow);
  transition: transform .3s var(--ease), opacity .3s, visibility .3s; pointer-events: none; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

/* ================= RESPONSIVO ================= */
@media (max-width: 420px) {
  .pcard-fields { grid-template-columns: 1fr 1fr; }
  .page-head h1 { font-size: 27px; }
}
@media (min-width: 720px) {
  .page-head h1 { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .session.alert .ring::before { animation: none; }
}

/* ================= MODO RELÓGIO ================= */
/* Relógio sempre escuro: mais contraste e menos bateria em telas OLED */
body.watch {
  --surface: #14161C; --surface-2: #1C1F27; --surface-3: #262A34; --line: rgba(255, 255, 255, .07);
  --text: #F3F4F6; --muted: #8C93A3; --faint: #5B6170; --accent-text: #C8F542;
  --rest: #5AA9FF; --hydrate: #2DD4E6; --alert: #FF5A5F;
  color-scheme: dark; color: var(--text);
  padding: 0; font-size: 13px; background: #000;
}
body.watch main { padding: 0; max-width: none; min-height: 100dvh; display: grid; place-items: center; }
body.watch .fab { width: 54px; height: 54px; }

.w-home { width: 100%; display: flex; flex-direction: column; align-items: center; text-align: center; padding-bottom: 18vmin; }
.w-hero { min-height: 100dvh; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4vmin 12vmin 3vmin; }
.w-day { display: flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; font-size: 12px; }
.w-arrow { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--text); }
.w-title { font-size: 19px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin-top: 6px; color: #fff; overflow-wrap: anywhere; }
.w-sub { color: #C3C8D2; font-size: 13px; margin-bottom: 8px; }
.w-scroll { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--muted); font-size: 11px; font-weight: 600; }
.w-list { list-style: none; margin: 0; padding: 0 12vmin; width: 100%; display: grid; gap: 6px; text-align: left; }
.w-list li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 14px; background: var(--surface); border-left: 3px solid var(--c); }
.w-num { flex: none; width: 20px; color: var(--muted); font-weight: 800; font-size: 13px; text-align: center; }
.w-ex-text { min-width: 0; display: flex; flex-direction: column; }
.w-ex-text b { font-size: 14px; font-weight: 700; line-height: 1.2; color: #fff; }
.w-ex-text small { font-size: 12px; color: #C3C8D2; }
.w-exit { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; padding: 10px 16px; border: 0; border-radius: 999px; background: var(--surface-2); color: #C3C8D2; font-size: 12px; font-weight: 600; }

.w-session { --phase: var(--faint); position: relative; width: 100vmin; height: 100vmin; }
.w-session.phase-work { --phase: var(--accent); }
.w-session.phase-rest { --phase: var(--rest); }
.w-session.phase-hydrate { --phase: var(--hydrate); }
.w-session.alert { --phase: var(--alert); }
.w-ring { position: absolute; inset: 0; }
.w-ring .ring-track, .w-ring .ring-fg { stroke-width: 9; }
.w-center { position: absolute; inset: 14%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 1px; }
.w-phase { color: var(--phase); font-weight: 800; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.w-ex { font-size: 13px; font-weight: 700; line-height: 1.15; max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.w-meta { color: var(--muted); font-size: 11px; }
.w-session .timer { font-size: 15vmin; margin: 2px 0 4px; }
.w-session.alert .timer { color: var(--alert); animation: blink 1s steps(1, end) infinite; }
.w-controls { display: flex; align-items: center; gap: 10px; }
.w-small { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--text); }
.w-session.phase-work .fab { background: #fff; color: #000; }
body.watch .done { padding: 10%; }
body.watch .done-badge { width: 48px; height: 48px; margin-bottom: 8px; box-shadow: none; }
body.watch .done h1 { font-size: 16px; }
body.watch .done .stat-grid { gap: 4px; }
body.watch .done .stat-grid div { padding: 6px; }
body.watch .done .stat-grid b { font-size: 14px; }
body.watch .done .btn-cta { margin-top: 8px; padding: 10px; font-size: 14px; }
body.watch .done > p { margin-bottom: 8px; }

/* ================= SINCRONIZAÇÃO COM O RELÓGIO ================= */
.sync-code {
  display: flex; justify-content: center; align-items: center; gap: 14px; padding: 16px 8px;
  border-radius: var(--radius-md); background: var(--surface-2);
  font-size: 38px; font-weight: 800; letter-spacing: .18em; font-variant-numeric: tabular-nums;
  color: var(--accent-text); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.sync-code span { width: 2px; height: 30px; background: var(--line); }
.center-text { text-align: center; }
.with-ic { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.inline-form .grow { flex: 1 1 auto; }

/* batimentos no histórico (treinos feitos no relógio) */
.hr-line { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.hr-line .ic { color: #FF4D6D; }
.hr-line b { color: var(--text); }
