/* ---------- Temas (Alvorada) ---------- */
:root, html[data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--noite);
  --surface: var(--noite-card);
  --surface-hover: #22303A;
  --text: var(--papel);
  --muted: var(--bruma-clara);
  --line: rgba(248, 246, 241, .1);
  --line-strong: rgba(248, 246, 241, .24);
  --btn-bg: var(--salvia);
  --btn-fg: var(--noite);
  --fill: var(--salvia);
  --track: rgba(248, 246, 241, .12);
  --soft: rgba(168, 195, 174, .14);
  --soft-ink: var(--salvia);
  --accent: var(--aurora);
  --accent-soft: rgba(245, 180, 138, .16);
  --accent-ink: var(--aurora);
  --hero: linear-gradient(150deg, #22333B 0%, #1B262E 60%, #16212A 100%);
  --hero-text: var(--papel);
  --hero-muted: #A9B6BC;
  --watermark: .07;
  --focus: var(--salvia);
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: var(--papel);
  --surface: var(--linho);
  --surface-hover: #E5DFD0;
  --text: var(--tinta);
  --muted: var(--bruma);
  --line: rgba(30, 42, 50, .12);
  --line-strong: rgba(30, 42, 50, .3);
  --btn-bg: var(--pinho);
  --btn-fg: var(--papel);
  --fill: var(--pinho);
  --track: rgba(30, 42, 50, .12);
  --soft: rgba(168, 195, 174, .38);
  --soft-ink: var(--pinho);
  --accent: var(--aurora);
  --accent-soft: rgba(245, 180, 138, .34);
  --accent-ink: var(--tinta);
  --hero: var(--grad-alvorada);
  --hero-text: var(--tinta);
  --hero-muted: #46555C;
  --watermark: .09;
  --focus: var(--pinho);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
html[data-size="small"] { font-size: 15px; }
html[data-size="large"] { font-size: 18px; }
body {
  margin: 0; min-width: 320px; font-family: var(--font); background: var(--bg); color: var(--text);
  line-height: 1.55; font-synthesis: none; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Estrutura ---------- */
.app { min-height: 100vh; }
.rail { display: none; }
.content { width: 100%; max-width: 880px; margin: 0 auto; padding: 1.25rem 1.125rem 7rem; }
.tabbar {
  position: fixed; inset: auto 0 0; z-index: 10; display: grid; grid-template-columns: repeat(6, 1fr);
  padding: .5rem .25rem calc(.5rem + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line);
}
.tab { display: grid; justify-items: center; gap: .25rem; padding: .25rem 0; background: none; border: 0; color: var(--muted); font-size: .6875rem; font-weight: 600; text-decoration: none; }
.tab .tab-ico { display: grid; place-items: center; width: 2.9rem; height: 2rem; border-radius: 999px; transition: background .2s var(--ease); }
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"] .tab-ico { background: var(--btn-bg); color: var(--btn-fg); }

@media (min-width: 900px) {
  .rail {
    position: fixed; inset: 0 auto 0 0; width: 264px; display: flex; flex-direction: column; gap: 2rem;
    padding: 1.75rem 1.25rem; border-right: 1px solid var(--line); background: var(--bg);
  }
  .rail-logo { display: block; width: 11.5rem; padding-left: .5rem; }
  .rail-logo img { width: 100%; height: auto; display: block; }
  .rail nav { display: grid; gap: .25rem; }
  .rail .tab {
    grid-auto-flow: column; justify-content: start; align-items: center; gap: .75rem; padding: .7rem .85rem;
    border-radius: 14px; font-size: .9375rem; font-weight: 600;
  }
  .rail .tab .tab-ico { width: auto; height: auto; background: none; }
  .rail .tab:hover { background: var(--surface-hover); color: var(--text); }
  .rail .tab[aria-current="page"] { background: var(--btn-bg); color: var(--btn-fg); }
  .rail .tab[aria-current="page"] .tab-ico { background: none; color: inherit; }
  .rail-foot { margin-top: auto; padding: 1rem .5rem 0; border-top: 1px solid var(--line); font-size: .8125rem; color: var(--muted); }
  .rail-foot strong { display: block; color: var(--text); font-size: 1.125rem; margin-bottom: .5rem; }
  .tabbar { display: none; }
  .content { margin-left: 264px; width: calc(100% - 264px); max-width: none; padding: 3rem clamp(2rem, 5vw, 4.5rem) 4rem; }
  .content > * { max-width: 880px; }
}

/* ---------- Tipografia e blocos ---------- */
.eyebrow { font-size: .6875rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head h1 { font-size: clamp(1.75rem, 4.6vw, 2.5rem); line-height: 1.1; letter-spacing: -.035em; font-weight: 700; margin-top: .4rem; }
.page-head p.sub { color: var(--muted); margin-top: .5rem; max-width: 34rem; }
.mobile-brand { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.mobile-brand img { height: 2.25rem; width: auto; }
@media (min-width: 900px) { .mobile-brand { display: none; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 1.375rem; }
.card + .card, .stack > * + * { margin-top: 1rem; }
.card h2 { font-size: 1.0625rem; font-weight: 700; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.wrap { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---------- Botões e chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.875rem; padding: .6rem 1.1rem;
  border: 1px solid transparent; border-radius: var(--radius-btn); font-size: .9375rem; font-weight: 700; text-decoration: none;
  transition: transform .15s var(--ease), background .2s var(--ease), border-color .2s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-quiet { background: none; color: var(--muted); padding-inline: .6rem; }
.btn-quiet:hover { color: var(--text); }
.btn-done { background: var(--soft); color: var(--soft-ink); border-color: transparent; }
.btn-icon { width: 2.875rem; padding: 0; }
.btn-sm { min-height: 2.25rem; padding: .35rem .8rem; font-size: .8125rem; border-radius: 12px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 2.25rem; padding: .25rem .9rem; border-radius: 999px; border: 1px solid var(--line-strong);
  background: transparent; font-size: .8125rem; font-weight: 700; color: var(--text);
}
.chip[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-fg); border-color: transparent; }
.tag { display: inline-flex; align-items: center; padding: .25rem .7rem; border-radius: 999px; background: rgba(128, 128, 118, .16); font-size: .75rem; font-weight: 700; }

.field { display: grid; gap: .5rem; font-size: .8125rem; font-weight: 700; }
.input, textarea.input, select.input {
  width: 100%; padding: .8rem 1rem; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--bg); font-weight: 500; font-size: .9375rem;
}
textarea.input { min-height: 7.5rem; resize: vertical; line-height: 1.6; }
.input::placeholder { color: var(--muted); }
.search { position: relative; }
.search .ico { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 2.75rem; }

.bar { height: .5rem; border-radius: 999px; background: var(--track); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--fill); transition: width .4s var(--ease); }

/* ---------- Hoje ---------- */
.today-card { position: relative; overflow: hidden; border-radius: 28px; padding: 1.5rem; background: var(--hero); color: var(--hero-text); border: 1px solid var(--line); }
.today-card .watermark { position: absolute; right: -2.5rem; bottom: -2rem; width: 13rem; opacity: var(--watermark); pointer-events: none; }
.today-card .top { display: flex; justify-content: space-between; align-items: center; gap: .75rem; position: relative; }
.today-card .tags { display: flex; gap: .5rem; flex-wrap: wrap; }
.today-card .tag { background: rgba(248, 246, 241, .1); color: var(--hero-text); }
[data-theme="light"] .today-card .tag { background: rgba(248, 246, 241, .6); }
.daynav { display: flex; gap: .25rem; }
.daynav .btn { color: var(--hero-text); width: 2.25rem; min-height: 2.25rem; padding: 0; border-radius: 12px; }
.daynav .btn:hover { background: rgba(128, 128, 118, .2); }
.refs { position: relative; margin: 1.5rem 0 1rem; display: grid; gap: .1rem; }
.refs strong { font-size: clamp(2rem, 7.5vw, 3.25rem); line-height: 1.08; letter-spacing: -.045em; font-weight: 700; }
.today-meta { position: relative; display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; color: var(--hero-muted); font-size: .9375rem; font-weight: 600; }
.today-meta span { display: inline-flex; align-items: center; gap: .45rem; }
.today-actions { position: relative; display: flex; flex-wrap: wrap; gap: .625rem; margin-top: 1.5rem; }
.today-actions .btn-ghost { border-color: rgba(128, 128, 118, .5); color: var(--hero-text); }
.today-actions .btn-ghost:hover { background: rgba(128, 128, 118, .16); }
.hint { position: relative; margin-top: 1.1rem; display: flex; align-items: center; gap: .5rem; color: var(--hero-muted); font-size: .8125rem; }

.resume { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-style: dashed; border-color: var(--line-strong); background: transparent; }
.resume p { color: var(--muted); font-size: .9375rem; margin-top: .25rem; }
.next-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem .25rem 0; }
.next-row h2 { font-size: 1.125rem; margin-top: .2rem; }

/* ---------- Plano ---------- */
.plan-summary { display: grid; gap: 1.5rem; grid-template-columns: auto 1fr; align-items: center; }
.ring { --p: 0; position: relative; width: 8.5rem; height: 8.5rem; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--fill) calc(var(--p) * 1%), var(--track) 0); }
.ring::before { content: ""; position: absolute; inset: .7rem; border-radius: 50%; background: var(--surface); }
.ring span { position: relative; text-align: center; font-size: 1.75rem; font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.ring small { display: block; margin-top: .3rem; font-size: .6875rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stat-list { display: grid; gap: .85rem; }
.stat-list div { display: flex; justify-content: space-between; gap: 1rem; font-size: .9375rem; border-bottom: 1px solid var(--line); padding-bottom: .65rem; }
.stat-list div:last-child { border: 0; padding: 0; }
.stat-list b { font-weight: 700; }
.sections { display: grid; gap: 1rem; margin-top: 1.1rem; }
.sections .row { margin-bottom: .45rem; font-size: .875rem; font-weight: 600; }

.cal-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 1rem; }
.cal-head h2::first-letter { text-transform: uppercase; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .3rem; }
.cal-week { margin-bottom: .35rem; text-align: center; font-size: .6875rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.cal-day, .cal-empty { min-height: 3.6rem; border-radius: 12px; padding: .35rem .4rem; border: 1px solid var(--line); }
.cal-empty { border-color: transparent; color: var(--muted); opacity: .45; font-size: .75rem; }
.cal-day { background: transparent; text-align: left; display: grid; align-content: space-between; gap: .1rem; }
.cal-day b { font-size: .8125rem; }
.cal-day small { font-size: .625rem; line-height: 1.15; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cal-day.done { background: var(--soft); border-color: transparent; }
.cal-day.done small { color: var(--soft-ink); opacity: .8; }
.cal-day.sel { outline: 2px solid var(--focus); outline-offset: 1px; }
.cal-day.now b::after { content: ""; display: inline-block; width: .4rem; height: .4rem; margin-left: .3rem; border-radius: 50%; background: var(--fill); }
.legend { display: flex; gap: 1.25rem; margin-top: 1rem; font-size: .75rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend i { width: .75rem; height: .75rem; border-radius: 4px; background: var(--soft); border: 1px solid var(--line-strong); }

.list { display: grid; }
.list-item {
  display: flex; align-items: center; gap: 1rem; width: 100%; padding: .9rem .25rem; background: none; border: 0; border-bottom: 1px solid var(--line);
  text-align: left; color: inherit;
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-hover); }
.list-item .num { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--track); font-weight: 700; font-size: .8125rem; flex: none; }
.list-item.done .num { background: var(--btn-bg); color: var(--btn-fg); }
.list-item .grow { flex: 1; min-width: 0; display: grid; }
.list-item small { color: var(--muted); font-size: .8125rem; }
.list-item strong { font-weight: 700; }

/* ---------- Biblioteca ---------- */
.group-title { display: flex; align-items: baseline; justify-content: space-between; margin: 1.75rem 0 .5rem; font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.book-grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.book { color: inherit; text-decoration: none; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 1rem; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); text-align: left; }
.book:hover { background: var(--surface-hover); }
.book strong { display: block; font-weight: 700; }
.book small { color: var(--muted); font-size: .8125rem; }
.book[hidden], .group[hidden] { display: none; }
.day-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }
.day-chip { min-width: 2.75rem; min-height: 2.5rem; padding: 0 .6rem; border-radius: 12px; border: 1px solid var(--line-strong); background: transparent; font-size: .8125rem; font-weight: 700; }
.day-chip.done { background: var(--btn-bg); color: var(--btn-fg); border-color: transparent; }
.placeholder { border: 1px dashed var(--line-strong); border-radius: 18px; padding: 1.1rem 1.25rem; color: var(--muted); font-size: .9375rem; }

/* ---------- Caderno ---------- */
.entry { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: 0; padding-bottom: 0; }
.entry[hidden] { display: none; }
.entry h3 { font-size: .9375rem; font-weight: 700; }
.entry p { margin-top: .35rem; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.entry small { color: var(--muted); font-size: .75rem; }
.empty { border: 1px dashed var(--line-strong); border-radius: 16px; padding: 1.1rem; color: var(--muted); font-size: .9375rem; }

/* ---------- Ajustes ---------- */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.setting h2 { font-size: 1rem; }
.setting p { color: var(--muted); font-size: .875rem; margin-top: .25rem; max-width: 30rem; }
.setting .controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.setting .input { min-width: 14rem; width: auto; }
.pill { display: inline-flex; padding: .3rem .75rem; border-radius: 999px; background: var(--soft); color: var(--soft-ink); font-size: .75rem; font-weight: 700; }
.danger { color: #ff8a7a; }
[data-theme="light"] .danger { color: #9b2c1c; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(5.75rem + env(safe-area-inset-bottom)); transform: translate(-50%, 1rem); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: .65rem 1.1rem; border-radius: 999px; font-size: .875rem; font-weight: 700; transition: .25s var(--ease); z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { .toast { bottom: 2rem; } }

@media (max-width: 520px) {
  .plan-summary { grid-template-columns: 1fr; justify-items: center; }
  .stat-list { width: 100%; }
  .setting { align-items: flex-start; flex-direction: column; gap: 1rem; }
  .setting .input { width: 100%; min-width: 0; }
  .cal-day, .cal-empty { min-height: 3.1rem; padding: .25rem; }
  .cal-day small { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media print { .tabbar, .rail { display: none; } .content { margin: 0; width: 100%; } }

/* ---------- Ajustes finos ---------- */
.content:focus { outline: none; }
[data-theme="light"] .today-card .btn-done { background: rgba(248, 246, 241, .65); color: var(--tinta); }
[data-theme="dark"] .today-card .btn-done { background: rgba(168, 195, 174, .18); color: var(--salvia); }
.today-card .btn-primary { min-width: 11rem; }

.today-actions .btn-primary { flex: 1 1 11rem; }
@media (max-width: 520px) { .today-actions .label { display: none; } .today-actions .btn-ghost { width: 2.875rem; padding: 0; } .today-actions .btn-primary { flex: 1; } }
@media (min-width: 521px) { .today-actions .btn-primary { flex: 0 0 auto; } }

/* ---------- Layout "Hoje" em duas colunas (modelo do Lume, na identidade do O Livro em Nós) ---------- */
.today-grid { display: grid; gap: 1.25rem; align-items: start; }
.today-main { display: grid; gap: 1rem; }
.today-main > .card + .card, .today-main .stack > * + * { margin-top: 0; }
.today-side { display: grid; gap: 1rem; }
@media (min-width: 1100px) {
  .content > .today-grid { max-width: 1120px; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
  .content > .page-head { max-width: 1120px; }
  .content > .cal-head, .content > .month-pills, .content > .cal-grid, .content > .legend { max-width: 1120px; }
  .content > .nb-sec, .content > .group, .content > .search, .content > .wrap { max-width: 1120px; }
}
.today-date { position: relative; margin-top: 1.4rem; color: var(--hero-muted); font-weight: 600; font-size: .9375rem; }
.today-date::first-letter { text-transform: uppercase; }
.today-card .refs { margin-top: .4rem; }
.banner { display: flex; align-items: center; gap: .9rem; padding: .9rem 1.1rem; border-radius: 18px; border: 1px solid var(--line); background: var(--soft); color: var(--text); text-decoration: none; }
.banner.soft { background: var(--surface); }
.banner .grow, .next-card .grow, .side-link .grow { flex: 1; min-width: 0; display: grid; }
.banner small, .next-card small { color: var(--muted); font-size: .8125rem; font-weight: 600; }
.banner strong { font-size: 1rem; }
.day-nav { display: flex; align-items: center; justify-content: space-between; padding: 0 .25rem; }
.day-nav-mid { display: inline-flex; align-items: center; gap: .4rem; color: var(--text); text-decoration: none; font-weight: 700; font-size: .875rem; }
.stat-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: 1.1rem 0; }
.stat-tiles > div { border: 1px solid var(--line); border-radius: 16px; padding: .85rem 1rem; display: grid; gap: .1rem; background: var(--bg); }
.stat-tiles b { font-size: 1.75rem; line-height: 1.1; letter-spacing: -.04em; }
.stat-tiles b.sm { font-size: 1.05rem; padding: .35rem 0; }
.stat-tiles small { color: var(--muted); font-size: .75rem; font-weight: 600; }
.stat-tiles.four { margin: 0; }
.period-box { display: grid; gap: .5rem; padding: 1rem 0 1.1rem; border-top: 1px solid var(--line); }
.period-box h3 { font-size: 1.125rem; letter-spacing: -.02em; }
.period-box .pct { font-size: 1.25rem; letter-spacing: -.03em; }
.btn-block { width: 100%; }
.side-label { padding: .25rem .25rem 0; }
.next-card { display: flex; align-items: center; gap: 1rem; width: 100%; text-align: left; padding: .9rem 1.1rem; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.next-card:hover { background: var(--surface-hover); }
.next-card strong { font-size: 1.0625rem; }
.side-link { display: flex; align-items: center; gap: .6rem; padding: .75rem .25rem; border-top: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: .875rem; }
.side-link b { color: var(--text); }

/* ---------- Plano ---------- */
.seg { display: inline-flex; padding: .25rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); }
.seg button { border: 0; background: none; padding: .45rem 1rem; border-radius: 999px; font-size: .8125rem; font-weight: 700; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-fg); }
.month-pills { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .5rem; margin-bottom: 1rem; scrollbar-width: thin; }
.month-pills .chip { flex: none; }
.cal-head { margin-bottom: .9rem; }
.cal-head h2 { font-size: 1.375rem; letter-spacing: -.03em; }
.cal-day { position: relative; padding-bottom: .55rem; min-height: 4.75rem; background: var(--surface); }
.cal-day::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: .3rem; border-radius: 0 0 11px 11px; background: var(--line-strong); }
.cal-day.p1::after { background: var(--fill); }
.cal-day em { font-style: normal; font-size: .5625rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text); }
.cal-day.done { background: var(--soft); }
.cal-day small { -webkit-line-clamp: 1; }
.sw { display: inline-block; width: .75rem; height: .75rem; border-radius: 4px; background: var(--line-strong) !important; border: 0 !important; }
.sw.p1 { background: var(--fill) !important; }
.legend { flex-wrap: wrap; row-gap: .4rem; }

/* ---------- Progresso ---------- */
.prog-grid > div { display: grid; gap: 1rem; align-content: start; min-width: 0; }
.prog-grid .card, .today-main > *, .today-side > * { min-width: 0; }
.prog-grid .card + .card { margin-top: 0; }
.prog-summary { display: grid; gap: 1.25rem; grid-template-columns: auto 1fr; align-items: center; }
.eyebrow.sm, .card > .eyebrow { margin-bottom: .9rem; display: block; }
.heat-wrap { overflow-x: auto; padding-bottom: .5rem; }
.heat { display: grid; grid-template-rows: repeat(7, .8rem); grid-auto-flow: column; grid-auto-columns: .8rem; gap: .22rem; width: max-content; }
.hm { width: .8rem; height: .8rem; border-radius: 3px; display: inline-block; }
.hm.none { background: none; }
.hm.todo { background: var(--track); }
.hm.open { background: var(--soft); outline: 1px solid var(--line-strong); outline-offset: -1px; }
.hm.done { background: var(--fill); }
.legend .hm { width: .75rem; height: .75rem; border: 0; }
.months { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem 1.5rem; }
.months .row { font-size: .8125rem; margin-bottom: .35rem; }
.marks { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); gap: .6rem; }
.mark { display: grid; justify-items: center; gap: .4rem; text-align: center; padding: .8rem .5rem; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.mark span { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 1.5px dashed var(--line-strong); font-weight: 800; font-size: .875rem; }
.mark small { font-size: .6875rem; font-weight: 700; line-height: 1.25; }
.mark.got { color: var(--text); background: var(--soft); border-color: transparent; }
.mark.got span { border: 0; background: var(--btn-bg); color: var(--btn-fg); }

/* ---------- Biblioteca ---------- */
.book { display: grid; gap: .5rem; align-content: start; padding: 1rem; }
.book .bar { height: .3rem; }
.group-title { text-transform: none; letter-spacing: 0; font-size: .8125rem; align-items: center; }
.group-title .g-name { display: inline-flex; align-items: center; gap: .5rem; font-size: 1.25rem; font-weight: 700; color: var(--text); letter-spacing: -.02em; }

/* ---------- Caderno ---------- */
.nb-sec { margin-top: 1.6rem; display: grid; gap: .5rem; justify-items: start; }
.nb-sec > * { width: 100%; }
.nb-sec .btn { width: auto; }
.nb-sec h2 { display: flex; align-items: center; gap: .6rem; font-size: 1.25rem; letter-spacing: -.02em; }
.empty-line { color: var(--muted); text-align: center; padding: 1rem 0 .5rem; font-size: .9375rem; }
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 1rem; background: rgba(18, 26, 32, .55); }
.modal-card { width: min(32rem, 100%); max-height: 92vh; overflow: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 24px; padding: 1.4rem; }
.rail-link { display: block; margin-top: 1rem; color: var(--muted); font-size: .75rem; }

@media (max-width: 899px) { .rail-link { display: none; } }
@media (max-width: 520px) {
  .prog-summary { grid-template-columns: 1fr; justify-items: center; }
  .prog-summary .stat-tiles { width: 100%; }
  .months { grid-template-columns: 1fr; }
  .cal-day { min-height: 3.6rem; }
  .cal-day em { display: none; }
  .tab { font-size: .625rem; }
  .page-head { flex-wrap: wrap; }
}

/* ---------- Funcionalidades do app antigo, adaptadas ---------- */
.recado { margin-top: .6rem; display: inline-block; padding: .3rem .8rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: .8125rem; font-weight: 700; }
.until { position: relative; margin-top: .9rem; color: var(--hero-muted); text-align: left; white-space: normal; height: auto; }
.until:hover { color: var(--hero-text); }
.week-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: .4rem; margin-top: .9rem; }
.wk { display: grid; justify-items: center; gap: .3rem; padding: .45rem 0; border-radius: 14px; border: 1px solid var(--line); background: transparent; color: var(--muted); }
.wk small { font-size: .6875rem; font-weight: 800; text-transform: uppercase; }
.wk i { display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 1.5px solid var(--line-strong); font-style: normal; font-size: .75rem; }
.wk i .ico { width: .85rem; height: .85rem; stroke-width: 2.5; }
.wk.done i { background: var(--btn-bg); color: var(--btn-fg); border-color: transparent; }
.wk.now { border-color: var(--text); color: var(--text); }
.wk.late i { border-style: dashed; }
.wk.skip { opacity: .6; }
.cal-day.skip { opacity: .55; border-style: dashed; }
.list-item.skip { opacity: .6; }
.list-item[hidden] { display: none; }
.hm.skip { background: none; outline: 1px dashed var(--line-strong); outline-offset: -1px; }
.ref-result { display: grid; gap: .75rem; margin-top: 1rem; }
.ref-result:empty { display: none; }
.ref-card h2 { margin-top: .3rem; font-size: 1.375rem; letter-spacing: -.03em; }
.ref-result .list-item { width: 100%; }
.opt { display: grid; gap: .25rem; text-align: left; padding: .9rem 1rem; border-radius: 16px; border: 1.5px solid var(--line-strong); background: transparent; color: var(--text); }
.opt small { color: var(--muted); font-size: .8125rem; }
.opt[aria-pressed="true"] { border-color: var(--text); background: var(--soft); }

/* ---------- Esqueleto de carregamento (some quando o app renderiza) ---------- */
.sk { display: flex; min-height: 100vh; }
.sk-rail { display: none; }
.sk-main { flex: 1; max-width: 880px; margin: 0 auto; padding: 1.25rem 1.125rem; }
.sk-b { display: block; border-radius: 10px; background: var(--track); position: relative; overflow: hidden; }
.sk-b::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, var(--line), transparent); animation: sk-shine 1.4s infinite; }
.sk-card { margin-top: 1.4rem; padding: 1.5rem; border-radius: 28px; border: 1px solid var(--line); background: var(--surface); }
.sk-short { padding: 1.1rem 1.5rem 1.4rem; }
@keyframes sk-shine { to { transform: translateX(100%); } }
@media (min-width: 900px) {
  .sk-rail { display: grid; align-content: start; gap: 1rem; width: 264px; flex: none; padding: 1.75rem 1.25rem; border-right: 1px solid var(--line); }
  .sk-main { margin: 0 auto; padding: 2.5rem 2rem; max-width: 1120px; }
}
@media (prefers-reduced-motion: reduce) { .sk-b::after { animation: none; } }

/* ---------- Desempenho ---------- */
.list-item { content-visibility: auto; contain-intrinsic-size: auto 4.2rem; }
.banner small, .next-card small { color: var(--hero-muted); }

.setting p a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
#gsi-btn { margin-top: .75rem; min-height: 0; }
