/* ═══════════════════════════════════════════════════════════════════════
   Habitual: acompanhar hábitos por dia e por semana. Visual calmo e claro, com tema escuro; nada de gamificação.
   Tema: claro por padrão, escuro quando o sistema pede (prefers-color-scheme) e as duas escolhas manuais (html[data-theme]).
   Os tokens de cada tema ficam nos três blocos marcados com `@theme`: test/habitual.test.js confere o contraste de cada par
   (texto sobre fundo, botão, ícone de marcado) e que os três blocos declaram as mesmas variáveis.
   As cores dos gráficos e dos hábitos são os tons categóricos e a rampa sequencial do dataviz (docs/apps/habitual.md), já
   escolhidos para cada tema. Não depende de tokens.css nem de Bootstrap. Movimento: juice.js põe data-motion="reduced" no <html>.
   ═══════════════════════════════════════════════════════════════════════ */

/* @theme light */
:root {
	color-scheme: light;
	--bg: #f9f9f7;
	--surface: #fcfcfb;
	--surface-2: #f1f0ec;
	--ink: #0b0b0b;
	--ink-2: #52514e;
	--ink-3: #6b6a64;
	--line: #e1e0d9;
	--line-2: #c3c2b7;
	--btn: #256abf;
	--btn-hover: #1c5cab;
	--btn-ink: #ffffff;
	--accent-text: #1c5cab;
	--danger: #b3261e;
	--danger-ink: #ffffff;
	--series: #2a78d6;
	--series-open: #9ec5f4;
	--logo-1: #2a78d6;
	--logo-2: #6250d6;
	--h0: #2a78d6; --h1: #eb6834; --h2: #1baf7a; --h3: #eda100; --h4: #e87ba4; --h5: #008300; --h6: #6250d6; --h7: #e34948;
	--hi0: #ffffff; --hi1: #0b0b0b; --hi2: #0b0b0b; --hi3: #0b0b0b; --hi4: #0b0b0b; --hi5: #ffffff; --hi6: #ffffff; --hi7: #0b0b0b;
	--heat-0: #e6e5df; --heat-1: #b7d3f6; --heat-2: #6da7ec; --heat-3: #2a78d6; --heat-4: #104281;
	--shadow: 0 1px 2px rgb(11 11 11 / .05), 0 8px 24px -12px rgb(11 11 11 / .12);
}
@media (prefers-color-scheme: dark) {
	/* @theme dark */
	:root:where(:not([data-theme="light"])) {
		color-scheme: dark;
		--bg: #0d0d0d;
		--surface: #1a1a19;
		--surface-2: #242423;
		--ink: #f0efec;
		--ink-2: #c3c2b7;
		--ink-3: #a3a29a;
		--line: #2c2c2a;
		--line-2: #383835;
		--btn: #256abf;
		--btn-hover: #2d74cb;
		--btn-ink: #ffffff;
		--accent-text: #6da7ec;
		--danger: #e66767;
		--danger-ink: #0b0b0b;
		--series: #3987e5;
		--series-open: #1c5cab;
		--logo-1: #3987e5;
		--logo-2: #9085e9;
		--h0: #3987e5; --h1: #d95926; --h2: #199e70; --h3: #c98500; --h4: #d55181; --h5: #008300; --h6: #9085e9; --h7: #e66767;
		--hi0: #0b0b0b; --hi1: #0b0b0b; --hi2: #0b0b0b; --hi3: #0b0b0b; --hi4: #0b0b0b; --hi5: #ffffff; --hi6: #0b0b0b; --hi7: #0b0b0b;
		--heat-0: #2c2c2a; --heat-1: #104281; --heat-2: #1c5cab; --heat-3: #3987e5; --heat-4: #9ec5f4;
		--shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px -12px rgb(0 0 0 / .6);
	}
}
/* @theme dark */
:root[data-theme="dark"] {
	color-scheme: dark;
	--bg: #0d0d0d;
	--surface: #1a1a19;
	--surface-2: #242423;
	--ink: #f0efec;
	--ink-2: #c3c2b7;
	--ink-3: #a3a29a;
	--line: #2c2c2a;
	--line-2: #383835;
	--btn: #256abf;
	--btn-hover: #2d74cb;
	--btn-ink: #ffffff;
	--accent-text: #6da7ec;
	--danger: #e66767;
	--danger-ink: #0b0b0b;
	--series: #3987e5;
	--series-open: #1c5cab;
	--logo-1: #3987e5;
	--logo-2: #9085e9;
	--h0: #3987e5; --h1: #d95926; --h2: #199e70; --h3: #c98500; --h4: #d55181; --h5: #008300; --h6: #9085e9; --h7: #e66767;
	--hi0: #0b0b0b; --hi1: #0b0b0b; --hi2: #0b0b0b; --hi3: #0b0b0b; --hi4: #0b0b0b; --hi5: #ffffff; --hi6: #0b0b0b; --hi7: #0b0b0b;
	--heat-0: #2c2c2a; --heat-1: #104281; --heat-2: #1c5cab; --heat-3: #3987e5; --heat-4: #9ec5f4;
	--shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px -12px rgb(0 0 0 / .6);
}

:root {
	--radius: 16px;
	--ease: cubic-bezier(.2, .8, .2, 1);
	--font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	min-height: 100vh;
	min-height: 100dvh;
	margin: 0;
	display: flex;
	flex-direction: column;
	overflow-x: hidden;
	background: var(--bg);
	color: var(--ink);
	font: 400 1rem/1.5 var(--font);
	-webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, p, dl, dd { margin: 0; }
.i { width: 1.2em; height: 1.2em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.flip { transform: scaleX(-1); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--series) 75%, var(--bg)); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
kbd { display: inline-block; min-width: 1.6em; padding: .05em .45em; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); font: 600 .78em/1.5 var(--font); text-align: center; }

/* Cada hábito herda a própria cor pelas classes hc-0 a hc-7 (--hc e a cor do ícone de marcado --hc-ink) */
.hc-0 { --hc: var(--h0); --hc-ink: var(--hi0); } .hc-1 { --hc: var(--h1); --hc-ink: var(--hi1); }
.hc-2 { --hc: var(--h2); --hc-ink: var(--hi2); } .hc-3 { --hc: var(--h3); --hc-ink: var(--hi3); }
.hc-4 { --hc: var(--h4); --hc-ink: var(--hi4); } .hc-5 { --hc: var(--h5); --hc-ink: var(--hi5); }
.hc-6 { --hc: var(--h6); --hc-ink: var(--hi6); } .hc-7 { --hc: var(--h7); --hc-ink: var(--hi7); }

/* ───────── Esqueleto de carregamento ───────── */
.sk { display: block; border-radius: 8px; background: linear-gradient(100deg, var(--surface-2) 30%, var(--line) 50%, var(--surface-2) 70%) 0 0 / 220% 100%; animation: shimmer 1.4s linear infinite; }
.sk--box { width: 28px; height: 28px; border-radius: 9px; flex: none; }
.sk--line { height: 14px; width: 56%; }
.sk--short { width: 38%; }
@keyframes shimmer { to { background-position: -220% 0; } }

/* ───────── Topo ───────── */
.top { display: flex; align-items: center; justify-content: space-between; gap: .8rem; width: min(100%, 760px); margin: 0 auto; padding: max(.8rem, env(safe-area-inset-top)) 16px .6rem; }
.pill { display: inline-flex; align-items: center; gap: .5rem; min-height: 40px; padding: .35rem .95rem .35rem .75rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: .88rem; font-weight: 600; text-decoration: none; transition: border-color .2s, color .2s; }
.pill:hover { border-color: var(--line-2); color: var(--ink); }
.brand { display: flex; align-items: center; gap: .5rem; font: 800 1.25rem/1 var(--font); letter-spacing: -.02em; }
.brand__logo { width: 1.8rem; height: 1.8rem; stroke: none; }
.top__tools { display: flex; gap: .3rem; }
.tool { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--ink-2); transition: background .2s, color .2s; }
.tool:hover { background: var(--surface-2); color: var(--ink); }
.tool[aria-pressed="false"] { color: var(--ink-3); opacity: .65; }

/* ───────── Página ───────── */
.app { flex: 1; width: min(100%, 760px); margin: 0 auto; padding: .4rem 16px 2rem; }
.nojs { padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.banner { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin: 0 0 1rem; padding: .8rem 1rem; border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--line)); border-radius: 12px; background: color-mix(in srgb, var(--danger) 8%, var(--surface)); font-size: .92rem; }

/* ───────── Abas ───────── */
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 0 0 1.1rem; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.tab { min-height: 44px; padding: .45rem .3rem; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); font-weight: 600; font-size: .95rem; transition: background .2s, color .2s; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { background: var(--btn); color: var(--btn-ink); }
.view[hidden] { display: none; }

/* ───────── Navegação de dia e semana ───────── */
.daynav { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin: 0 0 .6rem; }
.daynav__title { flex: 1; text-align: center; min-width: 0; }
.daynav__title h2 { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.daynav__title p { color: var(--ink-2); font-size: .9rem; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); transition: background .2s, border-color .2s; }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--line-2); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn--sm { width: 36px; height: 36px; border-radius: 10px; }
.back-today { display: flex; margin: 0 auto .8rem; }

/* ───────── Faixa dos sete dias ───────── */
.strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 0 0 .9rem; }
.strip__day { display: grid; justify-items: center; gap: 2px; min-height: 64px; padding: .4rem 0 .45rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink-2); transition: background .2s, border-color .2s; }
.strip__day:hover:not(:disabled) { border-color: var(--line-2); }
.strip__day:disabled { opacity: .45; cursor: default; }
.strip__wd { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.strip__n { font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.strip__bar { width: 70%; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.strip__bar i { display: block; height: 100%; border-radius: 2px; background: var(--series); transition: width .35s var(--ease); }
.strip__day.is-today .strip__n { color: var(--accent-text); }
.strip__day.is-selected { border-color: var(--btn); background: color-mix(in srgb, var(--btn) 9%, var(--surface)); box-shadow: inset 0 0 0 1px var(--btn); }

/* ───────── Cartões, botões e campos ───────── */
.card { margin: 0 0 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .5rem 1.1rem; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--ink); font-weight: 600; font-size: .95rem; transition: background .2s, border-color .2s, transform .15s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn--primary { background: var(--btn); color: var(--btn-ink); }
.btn--primary:hover:not(:disabled) { background: var(--btn-hover); }
.btn--ghost { border-color: var(--line-2); background: var(--surface); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn--danger { border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); color: var(--danger); background: var(--surface); }
.btn--danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.btn--sm { min-height: 36px; padding: .3rem .8rem; font-size: .86rem; border-radius: 10px; }
.btn--block { width: 100%; margin-bottom: 1rem; }
.field { width: 100%; min-height: 46px; padding: .55rem .8rem; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg); color: var(--ink); }
.field:focus-visible { outline-offset: 0; }
.field--date { max-width: 14rem; }
.field-label { margin: 1.1rem 0 .4rem; font-size: .86rem; font-weight: 700; color: var(--ink-2); }
.field-label:first-child { margin-top: 0; }
.field__err { margin: .5rem 0 0; color: var(--danger); font-size: .9rem; font-weight: 600; }
.fine { color: var(--ink-2); font-size: .86rem; line-height: 1.45; margin: .6rem 0; }
.sub { margin: 1.4rem 0 .4rem; font-size: 1rem; font-weight: 700; }

/* Segmentado e chips */
.seg { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); max-width: 100%; }
.seg--wrap { display: flex; flex-wrap: wrap; }
.seg--wrap .seg__btn { white-space: normal; line-height: 1.2; }
.seg--3 { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
.seg--3 .seg__btn { padding-inline: .3rem; }
.seg__btn { flex: 1; min-height: 40px; padding: .35rem .8rem; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font-weight: 600; font-size: .9rem; white-space: nowrap; }
.seg__btn:hover { color: var(--ink); }
.seg__btn[aria-pressed="true"], .seg__btn[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line-2), 0 1px 2px rgb(0 0 0 / .08); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; padding: .35rem .9rem; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--ink); font-weight: 600; font-size: .9rem; }
.chip:hover { background: var(--surface-2); }
.chip .i { width: 1em; height: 1em; }
.chips--days { margin-top: .7rem; }
.chip--day { min-width: 3.1rem; justify-content: center; padding-inline: .6rem; }
.chip--day[aria-pressed="true"] { background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
.stepper { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .7rem; }
.stepper output { min-width: 2ch; text-align: center; font-size: 1.4rem; font-weight: 800; }
.stepper__unit { color: var(--ink-2); font-size: .9rem; }
.select select { min-height: 44px; max-width: 100%; padding: .4rem 2rem .4rem .8rem; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); color: var(--ink); font-weight: 600; font-size: .9rem; }

/* ───────── Progresso do dia e lista de hábitos ───────── */
.progress { margin: 0 0 .5rem; }
.progress__text { margin: 0 0 .5rem; font-weight: 700; }
.meter { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--series); transition: width .4s var(--ease); }
.rows { display: grid; }
.group { margin: .9rem 0 .2rem; color: var(--ink-3); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.row + .row { border-top: 1px solid var(--line); }
.row--sk { display: flex; align-items: center; gap: .9rem; min-height: 60px; }
.row__btn { display: flex; align-items: center; gap: .9rem; width: 100%; min-height: 60px; padding: .55rem .2rem; border: 0; background: transparent; text-align: left; border-radius: 12px; }
.row__btn:disabled { cursor: default; opacity: .55; }
.row__text { display: grid; min-width: 0; }
.row__name { font-weight: 600; font-size: 1.02rem; overflow-wrap: anywhere; }
.row__hint { color: var(--ink-2); font-size: .85rem; }
.box { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; border: 2px solid var(--hc, var(--series)); border-radius: 10px; background: transparent; color: transparent; transition: background .2s, color .2s; }
.box .i { width: 18px; height: 18px; stroke-width: 3; }
.row__btn:hover:not(:disabled) .box { background: color-mix(in srgb, var(--hc) 14%, transparent); }
.row.is-done .box, .row__btn[aria-pressed="true"] .box { background: var(--hc); color: var(--hc-ink); }
.row.is-done .row__name { color: var(--ink-2); }
.rows--quiet .row__name { font-weight: 500; }
.others { margin-top: .6rem; border-top: 1px solid var(--line); padding-top: .4rem; }
.others summary, .more summary, .how summary, .archived summary { min-height: 40px; display: flex; align-items: center; gap: .6rem; cursor: pointer; color: var(--ink-2); font-weight: 600; font-size: .92rem; list-style: none; }
.others summary::-webkit-details-marker, .more summary::-webkit-details-marker, .how summary::-webkit-details-marker, .archived summary::-webkit-details-marker { display: none; }
.others summary::before, .more summary::before, .how summary::before, .archived summary::before { content: ''; flex: none; width: .5em; height: .5em; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .2s; }
details[open] > summary::before { transform: rotate(45deg); }
.others summary:hover, .more summary:hover, .how summary:hover, .archived summary:hover { color: var(--ink); }

/* ───────── Estado vazio ───────── */
.empty { display: grid; justify-items: center; gap: .5rem; padding: 1.4rem .5rem; text-align: center; }
.empty--card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 1rem; }
.empty__art { width: 72px; height: 72px; fill: none; stroke: var(--series); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.empty__title { font-weight: 800; font-size: 1.1rem; }
.empty__text { max-width: 34rem; color: var(--ink-2); font-size: .95rem; }
.empty .chips { justify-content: center; margin-top: .6rem; }

/* ───────── Grade da semana ───────── */
.gridwrap { overflow-x: auto; margin: 0 -.2rem; }
.grid { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.grid th, .grid td { padding: 0; }
.grid thead th { padding: 0 0 .4rem; font-weight: 600; font-size: .72rem; color: var(--ink-2); text-align: center; }
.grid__corner { width: 30%; }
.grid__wd { display: block; text-transform: uppercase; letter-spacing: .04em; }
.grid__n { display: block; font-size: .95rem; font-weight: 700; color: var(--ink); }
.grid__day.is-today .grid__n { color: var(--accent-text); }
.grid__goalhead { width: 2.8rem; }
.grid tbody tr + tr > * { border-top: 1px solid var(--line); }
.grid__name { padding: .35rem .5rem .35rem 0 !important; text-align: left; font-weight: 600; font-size: .92rem; }
.grid__name > * { vertical-align: middle; }
.grid__name .dot { display: inline-block; margin-right: .5rem; }
.grid__label { display: inline-block; max-width: calc(100% - 1.2rem); overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--hc, var(--series)); }
.grid__cell { text-align: center; }
.cell { display: inline-grid; place-items: center; width: calc(100% - 2px); max-width: 34px; aspect-ratio: 1; margin: 3px 0; padding: 0; border: 2px solid var(--line-2); border-radius: 9px; background: transparent; color: transparent; transition: background .15s, border-color .15s; }
.cell .i { width: 16px; height: 16px; stroke-width: 3; }
.cell.is-open:hover { border-color: var(--hc); background: color-mix(in srgb, var(--hc) 14%, transparent); }
.cell.is-due { border-color: var(--hc); }
.cell.is-done { border-color: var(--hc); background: var(--hc); color: var(--hc-ink); }
.cell.is-off { border-style: dashed; border-color: var(--line); opacity: .7; cursor: default; }
.cell.is-future { border-color: var(--line); opacity: .5; cursor: default; }
.cell.is-today { box-shadow: 0 0 0 3px color-mix(in srgb, var(--series) 28%, transparent); }
.grid__goal { text-align: center; font-weight: 700; font-size: .85rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.grid__goal.is-met { color: var(--accent-text); }

/* ───────── Gráficos ───────── */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 0 0 1rem; }
.filters .seg { overflow-x: auto; }
.filters .select { margin-left: auto; min-width: 0; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin: 0 0 .6rem; }
.tile { display: flex; flex-direction: column-reverse; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.tile dd { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.tile dt { color: var(--ink-2); font-size: .82rem; line-height: 1.25; }
.how { margin: 0 0 1rem; }
.how p { padding: .2rem 0 .6rem; color: var(--ink-2); font-size: .9rem; line-height: 1.5; }
.chart-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; margin: 0 0 .9rem; }
.chart-card h2 { font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; }
.chart-card__sub { color: var(--ink-2); font-size: .86rem; line-height: 1.4; margin-top: .15rem; }
.chart-host, .heat { position: relative; }
.chart-host { width: 100%; min-height: 190px; outline-offset: 4px; }
.chart-svg { display: block; max-width: none; overflow: visible; }
.c-grid { stroke: var(--line); stroke-width: 1; }
.c-axis { stroke: var(--line-2); stroke-width: 1; }
.c-tick { fill: var(--ink-3); font: 500 11px/1 var(--font); }
.c-val { fill: var(--ink); font: 700 12px/1 var(--font); }
.c-col { fill: var(--series); }
.c-col.is-open { fill: var(--series-open); }
.c-col.is-hover { filter: brightness(1.15); }
.is-anim .c-col { transform-box: fill-box; transform-origin: 50% 100%; animation: grow .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 14ms); }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.tip { position: absolute; z-index: 5; display: grid; gap: 2px; max-width: 16rem; padding: .5rem .7rem; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); font-size: .82rem; line-height: 1.35; pointer-events: none; color: var(--ink-2); }
.tip strong { color: var(--ink); font-size: .86rem; }

/* Barras por hábito (HTML): a cor é a da série; o ponto ao lado do nome carrega a identidade do hábito */
.bars { display: grid; gap: .9rem; }
.bar-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'name value' 'track track' 'count count'; gap: .3rem .8rem; align-items: center; }
.bar-row.is-dim { opacity: .45; }
.bar-row__name { grid-area: name; display: flex; align-items: center; gap: .5rem; min-width: 0; font-weight: 600; font-size: .94rem; overflow-wrap: anywhere; }
.bar-row__track { grid-area: track; height: 10px; border-radius: 0 5px 5px 0; background: var(--line); overflow: hidden; }
.bar-row__fill { display: block; height: 100%; border-radius: 0 5px 5px 0; background: var(--series); transition: width .5s var(--ease); }
.bar-row__value { grid-area: value; font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.bar-row__count { grid-area: count; color: var(--ink-2); font-size: .8rem; }

/* Calendário */
.heat__scroll { overflow-x: auto; padding-bottom: .3rem; }
.c-cell { fill: var(--heat-0); }
.c-cell.h0 { fill: var(--heat-0); } .c-cell.h1 { fill: var(--heat-1); } .c-cell.h2 { fill: var(--heat-2); } .c-cell.h3 { fill: var(--heat-3); } .c-cell.h4 { fill: var(--heat-4); }
.c-cell.h-none { fill: none; stroke: var(--line); stroke-width: 1; }
.c-cell.h-future { fill: none; stroke: var(--line); stroke-width: 1; opacity: .5; }
.c-cell.is-today { stroke: var(--ink); stroke-width: 1.5; }
.c-cell.is-hover { stroke: var(--ink); stroke-width: 1.5; }
.legend { display: flex; align-items: center; gap: 4px; margin-top: .6rem; color: var(--ink-3); font-size: .78rem; }
.legend i { display: block; width: 12px; height: 12px; border-radius: 3px; background: var(--heat-0); }
.legend .h1 { background: var(--heat-1); } .legend .h2 { background: var(--heat-2); } .legend .h3 { background: var(--heat-3); } .legend .h4 { background: var(--heat-4); }
.legend span:first-child { margin-right: 4px; } .legend span:last-child { margin-left: 4px; }

/* Versão em tabela de cada gráfico */
.table-wrap { display: none; overflow-x: auto; }
.show-table .table-wrap { display: block; }
.show-table :is(.bars, .chart-host, .heat, .legend) { display: none; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: right; }
.table th:first-child, .table td:first-child { text-align: left; }
.table thead th { color: var(--ink-2); font-size: .78rem; font-weight: 700; }
.table tbody th { font-weight: 600; }

/* ───────── Hábitos (gerenciar) ───────── */
.manage__row { display: flex; align-items: center; gap: .4rem; min-height: 60px; }
.manage__row + .manage__row { border-top: 1px solid var(--line); }
.manage__main { display: flex; align-items: center; gap: .8rem; flex: 1; min-width: 0; min-height: 56px; padding: .4rem .2rem; border: 0; border-radius: 12px; background: transparent; text-align: left; }
.manage__main:hover .manage__name { text-decoration: underline; }
.manage__text { display: grid; min-width: 0; }
.manage__name { font-weight: 600; overflow-wrap: anywhere; }
.manage__hint { color: var(--ink-2); font-size: .85rem; }
.archived { padding: .5rem 1rem; }

/* ───────── Rodapé ───────── */
.usage-wrap { margin-top: 1.6rem; color: var(--ink); }
.foot { width: min(100%, 760px); margin: 0 auto; padding: 1rem 16px max(1.6rem, env(safe-area-inset-bottom)); color: var(--ink-2); font-size: .85rem; text-align: center; }
.foot p + p { margin-top: .4rem; }
.foot a { color: var(--ink-2); }
.foot__keys { color: var(--ink-3); }

/* ───────── Avisos ───────── */
.toasts { position: fixed; z-index: 50; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: .5rem; width: min(92vw, 28rem); pointer-events: none; }
.toast { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .7rem 1rem; border-radius: 12px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow); font-size: .92rem; font-weight: 500; pointer-events: auto; animation: toast-in .25s var(--ease) both; }
.toast--bad { background: var(--danger); color: var(--danger-ink); }
.toast.is-out { animation: toast-out .2s ease both; }
.toast__btn { flex: none; min-height: 32px; padding: .2rem .7rem; border: 1px solid currentColor; border-radius: 8px; background: transparent; font-weight: 700; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ───────── Diálogos ───────── */
.dlg { width: min(94vw, 34rem); max-height: 92dvh; padding: 0; border: 1px solid var(--line-2); border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgb(0 0 0 / .5); }
.dlg--small { width: min(94vw, 26rem); }
.dlg::backdrop { background: rgb(0 0 0 / .45); }
.dlg[open] { animation: dlg-in .22s var(--ease) both; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.dlg__box { display: flex; flex-direction: column; max-height: 92dvh; margin: 0; }
.dlg__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem .4rem; }
.dlg__head h2 { font-size: 1.2rem; font-weight: 800; letter-spacing: -.01em; }
.dlg__body { flex: 1; overflow-y: auto; padding: .6rem 1.2rem 1rem; }
.dlg__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; padding: .8rem 1.2rem 1.1rem; border-top: 1px solid var(--line); }
.dlg__foot--stack { flex-direction: column; align-items: stretch; }
.dlg__side { display: flex; flex-wrap: wrap; gap: .5rem; margin-right: auto; }
.more { margin-top: 1.1rem; }
.btnrow { display: grid; gap: .5rem; margin-top: .4rem; }
.btnrow .btn { justify-content: flex-start; }
.swatches { display: flex; flex-wrap: wrap; gap: .5rem; }
.swatch { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 3px solid transparent; border-radius: 50%; background: var(--hc); color: transparent; box-shadow: 0 0 0 1px var(--line-2); }
.swatch .i { width: 18px; height: 18px; stroke-width: 3; }
.swatch[aria-checked="true"] { color: var(--hc-ink); border-color: var(--surface); box-shadow: 0 0 0 2px var(--ink); }

/* ───────── Telas pequenas e movimento reduzido ───────── */
@media (max-width: 480px) {
	.pill span { display: none; }
	.pill { padding: .35rem .75rem; }
	.tiles { gap: .4rem; }
	.tile { padding: .7rem .7rem; }
	.tile dd { font-size: 1.5rem; }
	.card { padding: .85rem; }
	.filters .select { margin-left: 0; width: 100%; }
	.filters .select select { width: 100%; }
	.filters .seg { width: 100%; }
	.seg__btn { padding-inline: .5rem; }
	.grid__corner { width: 23%; }
	.grid__goalhead { width: 2.4rem; }
	.grid__name { font-size: .84rem; }
	.grid__name .dot { margin-right: .35rem; }
}
html[data-motion="reduced"] .is-anim .c-col, html[data-motion="reduced"] .toast, html[data-motion="reduced"] .dlg[open] { animation: none; }
html[data-motion="reduced"] .meter i, html[data-motion="reduced"] .bar-row__fill, html[data-motion="reduced"] .strip__bar i { transition: none; }
@media (prefers-reduced-motion: reduce) { .is-anim .c-col, .toast, .dlg[open], .sk { animation: none; } .meter i, .bar-row__fill, .strip__bar i { transition: none; } }
@media (forced-colors: active) {
	.box, .cell, .swatch { border-color: ButtonText; }
	.row.is-done .box, .cell.is-done { background: Highlight; color: HighlightText; }
}
