/* Relatórios (reports.js): alternador, setas, números e gráficos em SVG.
   Cores só dos tokens de base.css. */
/* três cores bem diferentes: noite azul (touca), soneca lilás (corpo), acordado amarelo (sol) */
.rp-night { --c: var(--blue); }
.rp-nap { --c: var(--sleep); }
.rp-awake { --c: color-mix(in srgb, var(--awake) 85%, var(--surface)); }
.rp-feed { --c: var(--milk); }
.rp-empty { --c: var(--surface-2); }

.rp-nav { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 8px; }
.rp-label { margin: 0; text-align: center; font: 700 19px/1.2 var(--font-display); }
.rp-body { display: flex; flex-direction: column; gap: 14px; }
.rp-card { display: grid; gap: 12px; }
.rp-h { margin: 0; font: 700 18px/1.2 var(--font-display); }
.rp-sub { margin: 2px 0 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.rp-note { margin: 0; display: grid; justify-items: center; gap: 12px; padding: 32px 16px; text-align: center; font-weight: 700; color: var(--muted); }
.rp-note p { margin: 0; }

/* Números: texto de verdade, dois por linha */
.rp-nums { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rp-nums div { padding: 10px 12px 11px; border-radius: 14px; background: var(--surface-2); }
.rp-nums dt { font-size: 12.5px; font-weight: 800; line-height: 1.25; color: var(--muted); }
.rp-nums dd { margin: 4px 0 0; font-size: 22px; font-weight: 900; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.rp-nums small { display: block; margin-top: 3px; font-size: 13px; font-weight: 800; letter-spacing: 0; color: var(--muted); }

/* Gráficos */
.rp-svg { display: block; width: 100%; overflow: visible; }
.rp-svg text { font: 800 11px var(--font); fill: var(--muted); }
.rp-svg .rp-wd { fill: var(--text); }
.rp-night, .rp-nap, .rp-awake, .rp-empty { fill: var(--c); }
.rp-feed { fill: var(--c); stroke: var(--milk-ink); stroke-width: 1.5; }
.rp-grid { stroke: var(--surface); stroke-opacity: .6; }
.rp-hline { stroke: var(--line); }
.rp-base { stroke: var(--muted); stroke-opacity: .5; }
.rp-now { stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
.rp-avg { stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 5 4; }
.rp-partial { opacity: .5; }
.rp-nodata { fill: var(--muted); opacity: .6; }

.rp-legend { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.rp-legend li { display: inline-flex; align-items: center; gap: 6px; }
.rp-key { width: 12px; height: 12px; border-radius: 4px; background: var(--c); }
.rp-key.rp-feed { border-radius: 50%; border: 1.5px solid var(--milk-ink); }
.rp-key.rp-avg { width: 16px; height: 0; border-radius: 0; border-top: 2px dashed var(--text); }

/* Diário de sono: data | faixa de 24 h | total */
.rp-drow { display: grid; grid-template-columns: 5em minmax(0, 1fr) 3.2em; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; }
.rp-diary { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.rp-date { color: var(--muted); white-space: nowrap; }
.rp-today .rp-date { color: var(--text); }
.rp-tot { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rp-svg.rp-dbar { height: 14px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }

/* Destaque: o número principal, a comparação e a divisão noite x sonecas */
.rp-hero { background: linear-gradient(160deg, color-mix(in srgb, var(--sleep) 22%, var(--surface)), var(--surface)); }
.rp-big { margin: 0; font: 700 46px/1 var(--font-display); }
.rp-chip { margin: 0; justify-self: start; padding: 6px 12px; border-radius: 16px; background: var(--surface-2); font-size: 13px; font-weight: 800; color: var(--muted); }
.rp-chip.rp-up { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.rp { --ok: #8FF0BD; }
:root[data-theme="light"] .rp { --ok: #1C7A4C; }
.rp-split { display: flex; gap: 2px; height: 14px; border-radius: 99px; overflow: hidden; background: var(--surface-2); }
.rp-split i { background: var(--c); }
.rp-strong { font-size: 13.5px; font-weight: 800; color: var(--text); }
.rp-strong small { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.rp-sub b { color: var(--text); font-weight: 900; }

/* Três números curtos do dia */
.rp-trio { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rp-trio div { display: grid; align-content: start; gap: 3px; padding: 12px 10px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.rp-trio div > span { font-size: 20px; }
.rp-trio .rp-fic { width: 1.2em; height: 1.2em; margin: 0; vertical-align: -.24em; }

/* Peito e mamadeira: figurinha de ui.js no lugar do emoji. No meio do texto vai pequena e sem os enfeites (.d).
   O emoji continua no HTML com letra de tamanho zero: não aparece, mas vai no texto do Compartilhar. */
.rp-fic { width: 1.4em; height: 1.4em; margin-right: .25em; vertical-align: -.36em; } /* cabe na altura da linha, sem empurrar */
.rp-fic .d { display: none; }
.rp-emo { font-size: 0; }
.rp-fig { white-space: nowrap; }
.rp-trio dd { margin: 0; font-size: 21px; font-weight: 900; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.rp-trio dt { font-size: 12px; font-weight: 800; line-height: 1.25; color: var(--muted); }

/* Hora a hora: horário | cor | o que foi | duração ou mL */
.rp-log { margin: 0; padding: 0; list-style: none; }
.rp-log li { display: grid; grid-template-columns: 3.2em 12px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; font-weight: 800; }
.rp-log li:first-child { border-top: 0; padding-top: 0; }
.rp-log li:last-child { padding-bottom: 0; }
.rp-log time { color: var(--muted); font-variant-numeric: tabular-nums; }
.rp-log small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
.rp-log em { display: block; font-size: 12px; font-style: normal; font-weight: 700; color: var(--text); opacity: .85; }
.rp-log strong { font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rp-top strong { color: var(--awake); }
:root[data-theme="light"] .rp-top strong { color: var(--pink); }

/* Rotina da semana / do mês */
.rp-habits { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.rp-habits li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; }
.rp-habits b { font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; }

/* Cabeçalho, voltar e filtros */
.rp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rp-head .chip { background: var(--surface); border: 1px solid var(--line); }
.rp-back { justify-self: start; align-self: flex-start; min-height: 36px; padding: 0 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 900; }
.rp-filters { display: flex; gap: 8px; }

/* Quatro números numa linha */
.rp-four { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); text-align: center; }
.rp-four div + div { border-left: 1px solid var(--line); }
.rp-four dd { margin: 0; font-size: 20px; font-weight: 900; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.rp-four dt { margin-top: 3px; padding: 0 2px; font-size: 11px; font-weight: 800; line-height: 1.2; color: var(--muted); }
.rp-four + .rp-chip { justify-self: center; }

/* Faixa da noite ou do dia: pedaços posicionados em % da janela; mamadas em cima */
.rp-strip { position: relative; height: 34px; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.rp-strip i { position: absolute; top: 0; bottom: 0; background: var(--c); }
.rp-dots { position: relative; height: 12px; }
.rp-dots i { position: absolute; top: 1px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--milk); border: 1.5px solid var(--milk-ink); }
.rp-ruler { display: flex; justify-content: space-between; font-size: 11px; font-weight: 800; color: var(--muted); }
.rp-rows { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.rp-rows li { display: grid; grid-template-columns: 4.2em minmax(0, 1fr) 2.2em; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; }
.rp-rows .rp-strip { height: 16px; border-radius: 5px; }
.rp-rows b { text-align: right; font-variant-numeric: tabular-nums; }
.rp-rows-ruler { padding: 0 calc(2.2em + 8px) 0 calc(4.2em + 8px); }
.rp-daybtn { min-height: 28px; text-align: left; font-size: 12.5px; font-weight: 800; color: var(--muted); white-space: nowrap; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }

/* Passo a passo: eventos com bolinha e trechos com barrinha, numa linha vertical */
.rp-story { position: relative; margin: 0; padding: 0; list-style: none; }
.rp-story::before { content: ""; position: absolute; left: calc(3em + 20px); top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.rp-story li { position: relative; display: grid; grid-template-columns: 3em 14px minmax(0, 1fr); gap: 14px; align-items: start; padding: 7px 0; font-size: 14px; font-weight: 800; }
.rp-story time { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.rp-story i { z-index: 1; width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; background: var(--c); }
.rp-story small { display: block; margin-top: 2px; font-size: 12px; font-weight: 700; color: var(--muted); }
.rp-story .rp-gap { padding: 2px 0; font-size: 12.5px; color: var(--muted); }
.rp-story .rp-gap i { width: 4px; height: 26px; margin: 0 5px; border-radius: 2px; opacity: .6; }
.rp-story .rp-gap.rp-top { color: var(--text); }

/* Calendário do mês: a cor é o nível (1 a 3) e muda com o modo */
.rp-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.rp-cal b { text-align: center; font-size: 11px; font-weight: 800; color: var(--muted); }
.rp-cal button, .rp-nocell { aspect-ratio: 1; display: grid; place-content: center; justify-items: center; border-radius: 10px; font-size: 14px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rp-cal button { background: var(--c); color: var(--ink, var(--text)); }
.rp-cal button:active { transform: scale(.94); }
.rp-cal small { font-size: 10px; font-weight: 800; opacity: .85; }
.rp-nocell { border: 1px dashed var(--line); color: var(--muted); font-weight: 800; }
.rp-lv1 { --c: var(--blue); --ink: #fff; }
.rp-lv2 { --c: color-mix(in srgb, var(--blue) 45%, var(--surface-2)); }
.rp-lv3 { --c: color-mix(in srgb, var(--awake) 85%, var(--surface)); --ink: var(--awake-ink); }
.rp-mode-dia .rp-lv1 { --c: color-mix(in srgb, var(--sleep) 30%, var(--surface-2)); --ink: var(--text); }
.rp-mode-dia .rp-lv2 { --c: color-mix(in srgb, var(--sleep) 60%, var(--surface-2)); --ink: var(--text); }
.rp-mode-dia .rp-lv3 { --c: var(--sleep); --ink: var(--sleep-ink); }

/* Tabela de números */
.rp-table { width: 100%; border-collapse: collapse; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.rp-table th, .rp-table td { padding: 9px 0; text-align: right; white-space: nowrap; }
.rp-table thead th { padding: 0 0 8px; font-size: 11px; color: var(--muted); }
.rp-table th:first-child { text-align: left; color: var(--muted); font-weight: 800; }
.rp-table tbody tr, .rp-table tfoot tr { border-top: 1px solid var(--line); }
.rp-table tfoot tr { border-top-width: 2px; }
.rp-table tfoot th, .rp-table tfoot td { color: var(--text); font-weight: 900; }
.rp-hi td { color: var(--awake); }
:root[data-theme="light"] .rp-hi td { color: var(--pink); }

.rp-lines { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; font-size: 14px; font-weight: 800; }
.rp-lines li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 6px; }
