/* Candeia — rotina é liberdade.
   Identidade: Verde Folha, Verde Sálvia, Madeira, Sol e Areia; tipografia Sora. */

@font-face {
  font-family: "Sora";
  src: url("fonts/sora.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Sora";
  src: url("fonts/sora-ext.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* paleta da marca */
  --folha: #2E5E3B;   /* equilíbrio e foco */
  --salvia: #8EA37A;  /* calma e bem-estar */
  --madeira: #A67C52; /* aconchego e estabilidade */
  --sol: #F7C968;     /* energia e motivação */
  --areia: #E9E1D6;   /* leveza e clareza */

  /* base */
  --bg: #F4EFE7;
  --surface: #FFFFFF;
  --surface-2: #EFE8DD;
  --text: #1E2B22;
  --muted: #69705F;
  --line: #E4DCCF;

  --accent: var(--folha);
  --accent-text: #FFFFFF;
  --accent-soft: #E3EADB;
  --event: #8A6236;
  --event-soft: #F1E6D9;
  --warn: #8A5D00;
  --warn-soft: #FCF1D6;
  --danger: #B23A2A;

  /* fundos suaves dos períodos */
  --tint-manha: #FCEFCB;
  --tint-tarde: #F2E4D4;
  --tint-noite: #E5EBDF;
  --ink-manha: #A86F00;
  --ink-tarde: #8A6236;
  --ink-noite: #2E5E3B;

  /* cartão principal, cheio por tipo */
  --now-routine: var(--folha);
  --now-event: var(--madeira);
  --now-task: #4F6F45;
  --now-prep: var(--sol);
  --on-strong: #FFFFFF;
  --on-sol: #3A2A00;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgb(30 43 34 / 0.04), 0 10px 28px rgb(30 43 34 / 0.06);
  --font: "Sora", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121A15; --surface: #1A241D; --surface-2: #223026; --text: #EEF0E8; --muted: #A5AE9C; --line: #2A372E;
    --accent: #A9C48F; --accent-text: #14200F; --accent-soft: #233322;
    --event: #D8B48C; --event-soft: #33291E; --warn: #F7C968; --warn-soft: #3A3018; --danger: #FF8A73;
    --tint-manha: #3A3018; --tint-tarde: #33291E; --tint-noite: #233322;
    --ink-manha: #F7C968; --ink-tarde: #D8B48C; --ink-noite: #A9C48F;
    --now-routine: #2E5E3B; --now-event: #8C6844; --now-task: #3F5A37;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121A15; --surface: #1A241D; --surface-2: #223026; --text: #EEF0E8; --muted: #A5AE9C; --line: #2A372E;
  --accent: #A9C48F; --accent-text: #14200F; --accent-soft: #233322;
  --event: #D8B48C; --event-soft: #33291E; --warn: #F7C968; --warn-soft: #3A3018; --danger: #FF8A73;
  --tint-manha: #3A3018; --tint-tarde: #33291E; --tint-noite: #233322;
  --ink-manha: #F7C968; --ink-tarde: #D8B48C; --ink-noite: #A9C48F;
  --now-routine: #2E5E3B; --now-event: #8C6844; --now-task: #3F5A37;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) 16px calc(96px + env(safe-area-inset-bottom));
}

main { max-width: 720px; margin: 0 auto; padding-top: 16px; outline: none; }

h1, h2 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
h1 { font-size: 1.7rem; font-weight: 700; }
h2 { font-size: 1.12rem; font-weight: 600; }
p { margin: 0; }

.stack, .col { display: grid; gap: 14px; align-content: start; }
.now-layout { display: grid; gap: 14px; }

.ico { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- navegação ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabs a {
  display: grid; justify-items: center; gap: 2px; padding: 8px 4px;
  text-decoration: none; color: var(--muted); font-size: 0.74rem; font-weight: 600; border-radius: 16px;
}
.tabs a .ico { width: 24px; height: 24px; }
.tabs a[aria-current] { color: var(--accent); }
.tabs a[aria-current] .ico { stroke-width: 2.1; }

@media (min-width: 760px) {
  body { padding-bottom: 32px; padding-top: 0; }
  .tabs {
    position: sticky; top: 0; bottom: auto;
    display: flex; justify-content: center; gap: 6px;
    border-top: 0; border-bottom: 1px solid var(--line);
    margin: 0 -16px; padding: 10px 16px;
  }
  .tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 18px; font-size: 0.9rem; border-radius: 999px; }
  .tabs a .ico { width: 20px; height: 20px; }
  .tabs a[aria-current] { background: var(--accent-soft); }
  main { padding-top: 28px; }
}

@media (min-width: 1100px) {
  main { max-width: 1040px; }
  .now-layout { grid-template-columns: 1.6fr 1fr; align-items: start; }
}

/* ---------- cartões ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: grid; gap: 10px;
}

.eyebrow {
  margin: 0; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted);
}
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }

/* saudação: "Olá, João" */
.hello { display: flex; align-items: center; gap: 12px; margin: 4px 4px 16px; }
.hello .ico { width: 34px; height: 34px; color: #E9A93A; stroke-width: 1.6; }
.hello strong { display: block; font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; }
.hello span { color: var(--muted); font-size: 0.9rem; }

/* Cartão principal: cheio de cor, pra bater o olho e saber o que é. */
.now {
  position: relative; overflow: hidden;
  padding: 26px 22px 22px; gap: 14px; border: 0;
  background: var(--surface); color: var(--text);
}
.now > * { position: relative; z-index: 1; }
.now-title { font-size: clamp(1.9rem, 7vw, 2.9rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.12; overflow-wrap: anywhere; }
.now-sub { display: grid; gap: 8px; color: var(--muted); font-size: 1rem; }
.now-sub p { margin: 0; }
.why { font-style: italic; }

.now.kind-routine, .now.kind-event, .now.kind-task { color: var(--on-strong); box-shadow: 0 16px 36px rgb(30 43 34 / 0.18); }
.now.kind-routine { background: linear-gradient(150deg, #3A6F48, var(--now-routine) 60%); }
.now.kind-event { background: linear-gradient(150deg, #B88C60, var(--now-event) 60%); }
.now.kind-task { background: linear-gradient(150deg, #5F8155, var(--now-task) 60%); }
.now.kind-prep { background: linear-gradient(150deg, #FAD889, var(--now-prep) 60%); color: var(--on-sol); box-shadow: 0 16px 36px rgb(140 100 0 / 0.18); }
.now:is(.kind-routine, .kind-event, .kind-task) .eyebrow,
.now:is(.kind-routine, .kind-event, .kind-task) .now-sub { color: rgb(255 255 255 / 0.85); }
.now.kind-prep .eyebrow, .now.kind-prep .now-sub { color: rgb(58 42 0 / 0.78); }

/* marca discreta no canto */
.now:not(.kind-free)::after {
  content: ""; position: absolute; right: -26px; bottom: -30px; width: 150px; height: 150px; opacity: 0.12; z-index: 0;
  background: url("logo-claro.svg") center / contain no-repeat; pointer-events: none;
}
.now.kind-prep::after { background-image: url("logo.svg"); opacity: 0.14; }
.now.kind-free { border: 1px solid var(--line); }

.now .progress { background: rgb(255 255 255 / 0.25); }
.now .progress span { background: #FFFFFF; }
.now.kind-prep .progress { background: rgb(58 42 0 / 0.15); }
.now.kind-prep .progress span { background: var(--on-sol); }
.now .week-dots i { border-color: currentColor; }
.now .week-dots i.on { background: currentColor; }

.now:is(.kind-routine, .kind-event, .kind-task) .btn.primary { background: #FFFFFF; color: var(--folha); border-color: #FFFFFF; }
.now:is(.kind-routine, .kind-event, .kind-task) .btn.ghost { color: #FFFFFF; border-color: rgb(255 255 255 / 0.5); }
.now.kind-prep .btn.primary { background: var(--folha); color: #FFFFFF; border-color: var(--folha); }
.now.kind-prep .btn.ghost { color: var(--on-sol); border-color: rgb(58 42 0 / 0.35); }

.next { position: relative; padding-left: 22px; }
.next::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 4px; border-radius: 0 4px 4px 0; background: var(--madeira); }
.next h2 { font-size: 1.2rem; }
.next.soon { background: var(--warn-soft); }
.next.soon::before { background: var(--sol); }

.offer { background: var(--accent-soft); border-color: transparent; }
.offer .eyebrow { color: var(--accent); }

.actions, .row { display: flex; gap: 10px; align-items: center; }
.wrap { flex-wrap: wrap; }
.row input { flex: 1; min-width: 0; }

/* ---------- minhas rotinas (resumo) ---------- */
.my-routines { display: grid; gap: 10px; }
.my-routines-head { display: flex; justify-content: space-between; align-items: center; padding: 0 4px; }
.routine-row {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 14px; align-items: center;
  padding: 12px 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line);
  text-decoration: none; color: var(--text); box-shadow: var(--shadow);
}
.routine-row:hover { border-color: var(--salvia); }
.routine-row strong { font-weight: 600; }
.routine-row .small { color: var(--muted); }
.routine-row .progress { margin-top: 6px; height: 6px; }
.routine-row .chev { color: var(--muted); }
.period { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; }
.period .ico { width: 24px; height: 24px; }
.period[data-kind="manha"] { background: var(--tint-manha); color: var(--ink-manha); }
.period[data-kind="tarde"] { background: var(--tint-tarde); color: var(--ink-tarde); }
.period[data-kind="noite"] { background: var(--tint-noite); color: var(--ink-noite); }

/* ---------- botões e campos ---------- */
.btn {
  appearance: none; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--text); font: inherit; font-weight: 600;
  padding: 11px 20px; border-radius: 999px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(0.97); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.ghost { background: transparent; }
.btn.big { font-size: 1.05rem; padding: 14px 32px; min-height: 56px; }
.btn.small { padding: 6px 14px; min-height: 36px; font-size: 0.86rem; }
.btn.danger { color: var(--danger); }
.btn:focus-visible, .check:focus-visible, .day:focus-visible, .tabs a:focus-visible, .icon-btn:focus-visible,
.chip-btn:focus-visible, .option:focus-visible, .link:focus-visible, .routine-row:focus-visible {
  outline: 3px solid var(--sol); outline-offset: 2px;
}

input, textarea, select {
  font: inherit; color: var(--text); background: var(--surface-2);
  border: 1.5px solid transparent; border-radius: var(--radius-sm); padding: 10px 14px;
  min-height: 46px; width: 100%;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
textarea { resize: vertical; line-height: 1.5; }
textarea.mono { font-size: 0.86rem; font-family: ui-monospace, Consolas, monospace; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--salvia); background: var(--surface); }
label { display: grid; gap: 6px; font-size: 0.88rem; font-weight: 500; color: var(--muted); }
label.inline { display: inline-flex; align-items: center; gap: 8px; }
label.inline select { width: auto; }

.link { color: var(--accent); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }
.link.more { appearance: none; border: 0; background: none; font: inherit; font-size: 0.92rem; cursor: pointer; padding: 8px 6px; }

.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--folha); border-radius: 99px; transition: width 0.3s; }

/* ---------- foco ---------- */
.focus .eyebrow { color: var(--event); }
.focus .timer { font-size: 3rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.focus.on { background: var(--event-soft); }

/* ---------- listas ---------- */
.mini-list, .timeline, .tasks, .step-edit, .steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.mini-list li { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mini-list li:last-child { border-bottom: 0; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; min-width: 3.2em; }

.timeline li { display: flex; gap: 14px; padding: 12px 14px; border-radius: var(--radius-sm); }
.timeline li div { display: grid; }
.timeline li.past { opacity: 0.45; }
.timeline li.live { background: var(--accent-soft); }

.tasks li { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.tasks li span { flex: 1; }
.tasks li.done span { text-decoration: line-through; color: var(--muted); }

.check {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  border: 2px solid var(--line); background: var(--surface); cursor: pointer; padding: 0;
  display: inline-grid; place-items: center;
}
.check[aria-pressed="true"] { background: var(--folha); border-color: var(--folha); }
.check[aria-pressed="true"]::after { content: "✓"; color: #FFFFFF; font-weight: 700; }

.icon-btn {
  border: 0; background: transparent; color: var(--muted); font-size: 1.3rem;
  width: 40px; height: 40px; border-radius: 12px; cursor: pointer; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--event-soft); color: var(--event); padding: 5px 12px; border-radius: 99px; font-size: 0.82rem; font-weight: 600; }
.chip.ok { background: var(--accent-soft); color: var(--accent); vertical-align: middle; }

.page-head { display: grid; gap: 4px; padding: 0 4px; }
.page-head h1 { font-size: 1.9rem; }
.page-head p::first-letter { text-transform: uppercase; }

/* ---------- rotinas ---------- */
.routine-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.routine-title { display: flex; align-items: center; gap: 12px; }
.routine.empty { background: var(--surface-2); box-shadow: none; border-style: dashed; }

.steps { gap: 12px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; }
.steps li .check { margin-top: 2px; }
.step-body { display: grid; gap: 2px; }
.step-text { font-weight: 600; }
.steps li.done .step-text { text-decoration: line-through; color: var(--muted); }
.week { color: var(--accent); font-weight: 600; margin-top: 2px; }

.week-dots { display: inline-flex; gap: 4px; vertical-align: middle; margin-right: 4px; }
.week-dots i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--salvia); }
.week-dots i.on { background: var(--accent); border-color: var(--accent); }

.ideas { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.ideas .tasks li { gap: 8px; }
.add-step { display: grid; gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; }

.time-field { display: grid; gap: 6px; max-width: 220px; }
.days { display: flex; gap: 5px; flex-wrap: wrap; }
.day {
  width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--line);
  background: var(--surface-2); color: var(--muted); font: inherit; font-weight: 600; cursor: pointer;
}
.day[aria-pressed="true"] { background: var(--folha); border-color: var(--folha); color: #fff; }

.step-edit li { display: flex; align-items: flex-start; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.step-fields { display: grid; gap: 6px; flex: 1; min-width: 0; }
.step-fields input:not(:first-child) { font-size: 0.9rem; min-height: 40px; }
.step-tools { display: grid; gap: 2px; }

/* ---------- ajustes e avisos ---------- */
.howto { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; color: var(--muted); }
.howto strong { color: var(--text); }

.hint { background: var(--accent-soft); border-color: transparent; }
.hint.warn { background: var(--warn-soft); }
.status-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.warn-text { color: var(--warn); }

/* aviso no topo: usa a largura toda (com margem), centralizado */
.toast {
  position: fixed; left: 16px; right: 16px; margin: 0 auto; width: fit-content; max-width: 520px;
  top: calc(12px + env(safe-area-inset-top)); z-index: 10; pointer-events: none;
  background: var(--folha); color: #FFFFFF; text-align: center; line-height: 1.4;
  padding: 12px 18px; border-radius: 16px;
  font-weight: 500; box-shadow: 0 12px 30px rgb(0 0 0 / 0.2);
}
@media (min-width: 760px) { .toast { top: 72px; } }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- montar a rotina ---------- */
body.building { padding-bottom: 32px; }
body.building .tabs { display: none; }

.builder { min-height: calc(100dvh - 48px); display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: minmax(0, 1fr); gap: 20px; max-width: 560px; margin: 0 auto; }
.builder-top { display: grid; grid-template-columns: minmax(72px, auto) minmax(0, 1fr) minmax(72px, auto); gap: 10px; align-items: center; min-height: 44px; }
.builder-top > :last-child { justify-self: end; }
.dots { display: flex; gap: 4px; justify-content: center; min-width: 0; }
.dots span { flex: 1 1 0; max-width: 18px; height: 5px; border-radius: 99px; background: var(--line); }
.dots span.on { background: var(--folha); }
.builder-body { display: grid; gap: 16px; align-content: start; padding-top: 4vh; }
.builder-foot {
  display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap;
  position: sticky; bottom: 0; background: var(--bg);
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); margin-bottom: -32px;
}
.builder-foot .btn.big { flex: 1 1 200px; }

/* marca na boas-vindas */
.brand { display: grid; justify-items: start; gap: 4px; margin-bottom: 10px; }
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand img { width: 62px; height: 62px; }
.brand-name { font-size: 2.4rem; font-weight: 600; letter-spacing: -0.035em; color: var(--folha); line-height: 1; }
.brand-tag { font-size: 0.68rem; font-weight: 500; letter-spacing: 0.32em; text-transform: uppercase; color: var(--muted); padding-left: 74px; }
.tagline { display: grid; gap: 12px; color: var(--muted); font-size: 1.05rem; }
.tagline::after { content: ""; width: 34px; height: 3px; border-radius: 3px; background: var(--sol); }

.b-q { font-size: clamp(1.6rem, 6vw, 2.15rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
.b-hint { color: var(--muted); font-size: 1rem; }
.b-habit {
  justify-self: start; background: var(--accent-soft); color: var(--accent);
  font-weight: 600; padding: 6px 14px; border-radius: 999px; margin: 0;
}
.builder-body input:not([type="time"]) { font-size: 1.05rem; min-height: 54px; }

.examples { display: grid; gap: 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn {
  appearance: none; font: inherit; font-size: 0.9rem; font-weight: 500; cursor: pointer; text-align: left;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 999px; min-height: 40px;
}
.chip-btn:hover { border-color: var(--salvia); }
.chip-btn[aria-pressed="true"] { background: var(--folha); border-color: var(--folha); color: #FFFFFF; }
.chip-btn[aria-pressed="true"]::before { content: "✓ "; font-weight: 700; }

.options { display: grid; gap: 10px; }
.option {
  appearance: none; font: inherit; color: var(--text); text-align: left; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; display: grid; grid-template-columns: auto 1fr; column-gap: 14px; row-gap: 2px; align-items: center;
  box-shadow: var(--shadow);
}
.option .period { grid-row: span 2; }
.option strong { font-size: 1.08rem; font-weight: 600; letter-spacing: -0.01em; }
.option > span:not(.period) { color: var(--muted); font-size: 0.9rem; }
.option:hover { border-color: var(--salvia); }
.option[aria-pressed="true"] { border-color: var(--folha); background: var(--accent-soft); }
.option.radio { grid-template-columns: 1fr; }

.picked { display: grid; gap: 4px; }

.notif-preview {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: 14px 16px; box-shadow: 0 12px 30px rgb(30 43 34 / 0.10);
}
.notif-preview img { width: 40px; height: 40px; border-radius: 10px; }
.notif-preview div { display: grid; }
.notif-preview span { color: var(--muted); font-size: 0.9rem; }

.summary h2 { font-size: 1.4rem; }

/* ---------- telas de comemoração ---------- */
.celebrate {
  position: fixed; inset: 0; z-index: 20; overflow-y: auto;
  background: var(--bg);
  padding: calc(18px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
  display: grid; place-items: center;
}
.celebrate[hidden] { display: none; }
body.celebrating { overflow: hidden; }
.cel-inner { width: min(420px, 100%); display: grid; justify-items: center; text-align: center; gap: 14px; animation: cel-in 0.35s ease-out; }
.cel-brand { display: flex; align-items: center; gap: 8px; color: var(--folha); font-weight: 600; font-size: 1.25rem; letter-spacing: -0.02em; }
.cel-brand img { width: 30px; height: 30px; }
.cel-art { width: min(300px, 78vw); height: auto; margin: 4px 0 -4px; }
.cel-title { font-size: clamp(1.9rem, 8vw, 2.4rem); font-weight: 700; letter-spacing: -0.03em; color: var(--text); }
.cel-sub { color: var(--muted); font-size: 1.05rem; max-width: 30ch; }
.cel-item {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  background: var(--surface-2); border-radius: 18px; padding: 14px 18px; margin-top: 4px;
}
.cel-item > span:last-child { display: grid; }
.cel-item strong { font-weight: 600; }
.cel-item > span:last-child > span { color: var(--muted); font-size: 0.86rem; }
.cel-icon { width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--salvia) 30%, var(--surface)); color: var(--folha); }
.cel-icon .ico { width: 24px; height: 24px; stroke-width: 2; }
.cel-foot { display: grid; justify-items: center; gap: 12px; color: var(--muted); max-width: 32ch; margin-top: 4px; }
.cel-foot::after { content: ""; width: 34px; height: 3px; border-radius: 3px; background: var(--sol); }
.cel-inner .btn.big { width: 100%; margin-top: 6px; }

/* a planta cresce devagar ao abrir */
.cel-art .sun { animation: sun-in 0.6s ease-out both; transform-box: fill-box; transform-origin: center; }
.cel-art .rays { animation: rays-in 0.8s ease-out 0.2s both; transform-box: fill-box; transform-origin: center; }
.cel-art .leaf path { transform-box: fill-box; transform-origin: left center; animation: leaf-grow 0.55s cubic-bezier(0.2, 1.2, 0.4, 1) both; animation-delay: calc(0.15s + var(--d, 0s)); }
.cel-art .badge { transform-box: fill-box; transform-origin: center; animation: badge-pop 0.45s cubic-bezier(0.2, 1.5, 0.4, 1) both; animation-delay: calc(0.3s + var(--d, 0s)); }
@keyframes cel-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes sun-in { from { opacity: 0; transform: scale(0.85); } to { opacity: 0.92; transform: scale(1); } }
@keyframes rays-in { from { opacity: 0; transform: rotate(-12deg) scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes leaf-grow { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes badge-pop { from { transform: scale(0); } to { transform: scale(1); } }

.cel-art .flower, .cel-art .bud { transform-box: fill-box; transform-origin: center; animation: pop-in 0.4s ease-out both; animation-delay: var(--d, 0.4s); }
.cel-art .flower.bloom { animation: bloom 0.7s cubic-bezier(0.2, 1.4, 0.4, 1) both; animation-delay: 0.75s; }
@keyframes pop-in { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bloom { from { transform: scale(0) rotate(-60deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* confetes por cima, sem atrapalhar o toque */
.celebrate .confetti { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.celebrate .confetti i {
  position: absolute; top: -14px; width: 9px; height: 14px; border-radius: 50% 0; opacity: 0.95;
  animation-name: fall; animation-timing-function: cubic-bezier(0.3, 0.6, 0.6, 1); animation-fill-mode: forwards;
}
.celebrate .confetti i:nth-child(3n) { width: 8px; height: 8px; border-radius: 50%; }
@keyframes fall { to { transform: translateY(110vh) rotate(560deg); opacity: 0.9; } }

.switch { display: flex; align-items: center; gap: 12px; color: var(--text); font-size: 0.95rem; font-weight: 500; cursor: pointer; }
.switch input { width: 22px; height: 22px; min-height: 0; accent-color: var(--folha); flex: none; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .cel-inner, .cel-art .sun, .cel-art .rays, .cel-art .leaf path, .cel-art .badge, .cel-art .flower, .cel-art .bud { animation: none; }
  .celebrate .confetti { display: none; }
}

/* ---------- faixa de dias ---------- */
.week-strip { display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px; align-items: center; gap: 2px; }
.week-strip .icon-btn { width: 36px; }
.days-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.day-pill {
  appearance: none; font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--surface);
  border-radius: 16px; padding: 8px 0 6px; display: grid; justify-items: center; gap: 1px; color: var(--text);
}
.day-pill .wd { font-size: 0.68rem; color: var(--muted); font-weight: 500; }
.day-pill .dn { font-size: 1rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.day-pill .dot { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.day-pill .dot.on { background: var(--madeira); }
.day-pill.is-today { border-color: var(--salvia); }
.day-pill[aria-pressed="true"] { background: var(--folha); border-color: var(--folha); color: #FFFFFF; }
.day-pill[aria-pressed="true"] .wd { color: rgb(255 255 255 / 0.8); }
.day-pill[aria-pressed="true"] .dot.on { background: var(--sol); }
.day-pill:focus-visible { outline: 3px solid var(--sol); outline-offset: 2px; }

.did { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.did li { display: flex; align-items: center; gap: 12px; }
.small-period { width: 34px; height: 34px; }
.small-period .ico { width: 18px; height: 18px; }
.link-card { display: flex; justify-content: space-between; align-items: center; text-decoration: none; color: var(--accent); font-weight: 600; }

/* ---------- caderno ---------- */
.moods { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.mood {
  appearance: none; font: inherit; cursor: pointer; border: 1.5px solid var(--line); background: var(--surface);
  border-radius: 16px; padding: 10px 2px 8px; display: grid; justify-items: center; gap: 4px; color: var(--muted);
}
.mood .ico { width: 30px; height: 30px; stroke-width: 1.5; }
.mood span { font-size: 0.66rem; font-weight: 500; line-height: 1.2; text-align: center; }
.mood:hover { border-color: var(--salvia); }
.mood[data-mood="5"] { --m: var(--folha); }
.mood[data-mood="4"] { --m: var(--salvia); }
.mood[data-mood="3"] { --m: #C99A2E; }
.mood[data-mood="2"] { --m: var(--madeira); }
.mood[data-mood="1"] { --m: #7E6A5A; }
.mood .ico { color: var(--m); }
.mood[aria-pressed="true"] { border-color: var(--m); background: color-mix(in srgb, var(--m) 12%, var(--surface)); color: var(--text); }
.mood:focus-visible { outline: 3px solid var(--sol); outline-offset: 2px; }
.mood-card .mood { background: var(--bg); }

.note-form textarea { min-height: 96px; }
.notes { list-style: none; margin: 0; padding: 0; display: grid; }
.note { display: grid; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.note:last-child { border-bottom: 0; }
.note-head { display: flex; align-items: center; gap: 10px; }
.note-head .icon-btn { margin-left: auto; width: 32px; height: 32px; }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.mood-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; font-weight: 600; padding: 3px 10px 3px 4px; border-radius: 999px; background: var(--surface-2); }
.mood-tag .ico { width: 18px; height: 18px; }
.mood-tag[data-mood="5"] .ico { color: var(--folha); }
.mood-tag[data-mood="4"] .ico { color: var(--salvia); }
.mood-tag[data-mood="3"] .ico { color: #C99A2E; }
.mood-tag[data-mood="2"] .ico { color: var(--madeira); }
.mood-tag[data-mood="1"] .ico { color: #7E6A5A; }

@media (max-width: 380px) { .mood span { font-size: 0.6rem; } }

/* aviso gentil: uma coisa de cada vez */
.gentle {
  display: grid; gap: 8px; padding: 14px 16px; border-radius: 18px;
  background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--sol) 60%, transparent);
}
.gentle .eyebrow { color: var(--warn); }

/* hábito firme */
.firm { color: var(--accent); font-weight: 600; margin-top: 2px; }

/* mini comemoração a cada registro */
.mini-burst { position: fixed; z-index: 30; width: 0; height: 0; pointer-events: none; }
.mini-burst i {
  position: absolute; left: -4px; top: -6px; width: 8px; height: 12px; border-radius: 50% 0;
  animation: burst 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
.mini-burst b {
  position: absolute; left: 0; top: -40px; white-space: nowrap;
  background: var(--folha); color: #FFFFFF; font-size: 0.85rem; font-weight: 600;
  padding: 4px 12px; border-radius: 999px; box-shadow: 0 6px 16px rgb(0 0 0 / 0.18);
  animation: word-up 0.95s ease-out forwards;
}
@keyframes burst { to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.6); opacity: 0; } }
@keyframes word-up {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  75% { opacity: 1; transform: translate(-50%, -4px); }
  100% { opacity: 0; transform: translate(-50%, -14px); }
}
@media (prefers-reduced-motion: reduce) {
  .mini-burst i { display: none; }
  .mini-burst b { animation: none; transform: translate(-50%, 0); }
}

/* No celular: botão principal em cima, o secundário embaixo, centralizados
   e logo depois do conteúdo (sem colar no fim da tela). */
@media (max-width: 759px) {
  .builder { min-height: 0; grid-template-rows: auto auto auto; }
  .builder-body { padding-top: 2vh; }
  .builder-foot {
    flex-direction: column-reverse; align-items: center; justify-content: flex-start; gap: 6px;
    margin-bottom: 0; padding-top: 18px;
  }
  .builder-foot .btn.big { width: 100%; flex: none; }
  .builder-foot .btn:not(.big) { min-height: 44px; border-color: transparent; font-size: 0.95rem; }
}

/* seletor de horário do app */
.time-pick { display: grid; gap: 10px; }
.time-row { display: flex; align-items: center; gap: 14px; }
.time-btn {
  appearance: none; width: 52px; height: 52px; border-radius: 50%; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-size: 1.6rem; line-height: 1; display: grid; place-items: center;
}
.time-btn:hover { border-color: var(--salvia); }
.time-btn:focus-visible { outline: 3px solid var(--sol); outline-offset: 2px; }
.time-value { font-size: 2.2rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; min-width: 4.2ch; text-align: center; }
.time-presets .chip-btn { font-variant-numeric: tabular-nums; }
.time-presets .chip-btn[aria-pressed="true"]::before { content: ""; }

/* fim do foco: o sino balança e as ondas pulsam */
.cel-art .bell { transform-box: fill-box; transform-origin: 50% 0; animation: bell-swing 1.1s ease-in-out 0.2s 3; }
.cel-art .ring { animation: ring-pulse 1.1s ease-in-out 0.2s 3; }
@keyframes bell-swing { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(14deg); } 45% { transform: rotate(-11deg); } 70% { transform: rotate(6deg); } }
@keyframes ring-pulse { 0%, 100% { opacity: 0.15; } 30% { opacity: 0.7; } }
.focus-hint { display: flex; align-items: center; gap: 6px; }
.focus-hint .ico { width: 16px; height: 16px; }
@media (prefers-reduced-motion: reduce) { .cel-art .bell, .cel-art .ring { animation: none; } }

/* frequência do hábito */
.goal-pick { display: grid; gap: 8px; }
.goal-pick .chip-btn { min-width: 46px; text-align: center; }
.goal-pick .chip-btn[aria-pressed="true"]::before { content: ""; }

/* abas do Caderno */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface-2); }
.seg-btn { appearance: none; border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--muted); padding: 10px 8px; border-radius: 999px; cursor: pointer; }
.seg-btn[aria-selected="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.seg-btn:focus-visible { outline: 3px solid var(--sol); outline-offset: 2px; }

/* link da agenda Candeia */
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row input { flex: 1; min-width: 0; font-size: 0.8rem; }

/* foco flexível */
.focus { gap: 12px; }
.focus-pick { display: flex; align-items: center; gap: 14px; }
.focus-pick .time-value { min-width: 6ch; }
.focus .chip-row .chip-btn[aria-pressed="true"]::before { content: ""; }
.focus.paused .timer { opacity: 0.55; }
.focus-actions .btn { flex: 1 1 auto; }

.welcome-links { display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.82rem; }
.welcome-links a { color: var(--muted); }

/* cartão pra ligar os avisos */
.setup { border-color: color-mix(in srgb, var(--salvia) 60%, transparent); }
.setup-steps { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }
.setup-steps .ico { width: 18px; height: 18px; vertical-align: -3px; }

/* lembrete do que facilita e o cartão de ajuda */
.lead-pick { display: grid; gap: 8px; }
.lead-pick .chip-btn[aria-pressed="true"]::before { content: ""; }
.helper-line { display: inline-flex; align-items: center; gap: 6px; }
.helper-line .ico { width: 14px; height: 14px; }
.struggle { background: var(--warn-soft); border-color: color-mix(in srgb, var(--sol) 55%, transparent); }
.struggle .eyebrow { color: var(--warn); }
.struggle .link { appearance: none; border: 0; background: none; font: inherit; justify-self: start; cursor: pointer; padding: 4px 0; }

/* botão com cara de link (ações pequenas, sem pesar na tela) */
.link-btn { appearance: none; border: 0; background: none; font: inherit; font-size: 0.92rem; font-weight: 600; color: var(--accent); cursor: pointer; padding: 6px 0; text-align: left; }
.link-btn:hover { text-decoration: underline; }

/* Agora: marcar outro hábito da rotina, fora da ordem */
.now .actions { flex-wrap: wrap; }
.others { flex-basis: 100%; margin-top: 4px; }
.now .others .link-btn { color: inherit; opacity: 0.9; text-decoration: underline; text-underline-offset: 3px; }
.others-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.others-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 14px; background: color-mix(in srgb, currentColor 10%, transparent); }

/* Rotinas: a linha inteira marca; horário próprio do hábito */
.steps .step-body[data-action] { cursor: pointer; }
.step-time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--accent); margin-right: 2px; }

/* Editor: descer, mudar de período, escolher a parte do dia na montagem */
.icon-btn.down svg { transform: rotate(180deg); }
.move-kind, .kind-pick { display: grid; gap: 6px; }
.kind-pick { margin-bottom: 8px; }

/* metas */
.rate { display: grid; gap: 6px; margin-top: 14px; }
.rate-q { margin: 0; font-weight: 600; }
.goal-head { display: flex; align-items: center; gap: 12px; }
.goal-head h2 { margin: 0; }
.goal-art { width: 72px; flex: none; }
.goal-art svg { width: 100%; height: auto; display: block; }
.parts { list-style: none; margin: 4px 0 12px; padding: 0; display: grid; gap: 8px; }
.part { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px; }
.part div { display: grid; }
.part.guardada strong, .part.fila strong { font-weight: 500; }
.part-mark { text-align: center; }
.goal-tag { color: var(--accent); }
.link-btn.danger { color: var(--danger, #B3261E); font-weight: 500; font-size: 0.85rem; margin-top: 4px; }
.card.soft { background: transparent; border-style: dashed; }

/* Ajustes: engrenagem no canto de cima (a barra de baixo fica com 4 abas) */
.gear { position: absolute; z-index: 20; top: calc(env(safe-area-inset-top, 0px) + 12px); right: 16px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); background: color-mix(in srgb, var(--bg) 85%, transparent); text-decoration: none; }
.gear .ico { width: 24px; height: 24px; }
.gear[aria-current] { color: var(--accent); }
body.building .gear, body.celebrating .gear { display: none; }
.page-head, .hello { padding-right: 52px; }
.goal .hint { padding: 12px 14px; border-radius: 16px; margin: 12px 0; display: grid; gap: 10px; justify-items: start; }
.goal .hint p { margin: 0; }

/* Agora com o dia dentro: foco fechado, "e depois", voltar */
.focus-closed { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.focus-closed > span { display: grid; gap: 2px; }
.focus-closed .eyebrow { margin: 0; }
.focus-closed .ico { width: 20px; height: 20px; color: var(--muted); }
.next .then { margin: 4px 0 0; }
.next .link-btn { margin-top: 6px; }
.back-now { justify-self: start; }
