:root {
  /* Elos "Herbário" — a warm, diary-like skin. Colours that rest the eyes:
     low saturation, warm paper, espresso ink, dusty rose for affection and
     sage for growth. X/TikTok marks are black — flipped light in candlelight
     mode below, or they vanish. */
  --brand-x: #000000;
  --brand-tiktok: #111111;
  --bg: #f3ede2;          /* oat-linen paper */
  --card: #fcf8f0;        /* warm ivory — never pure white */
  --primary: #946a1e;     /* deep honey/amber — afeto sem gênero (AA on ivory & as button) */
  --primary-dark: #7c5917;
  --sage: #6f8663;        /* muted sage — crescimento, orgânico; drives the thread */
  --honey: #c68f35;       /* bright honey glow — third voice, the fio's warm midpoint */
  --danger: #c0392b;      /* clean red — kept clearly apart from the amber affection */
  --text: #3b2f26;        /* warm espresso — never cold black */
  --muted: #7c6a58;       /* warm taupe */
  --border: #e6d9c6;      /* soft sand hairline */
  --accent-bg: #f2e7d2;   /* faint honey-cream */
  --accent: #efe6d6;      /* warm neutral */
  --input-bg: #fffcf6;    /* warm near-white */
  --toast-bg: #3b2f26;
  --toast-text: #fcf8f0;
  --mix: #fcf8f0;
  /* Warm-tinted shadows — afternoon light, not camera flash. */
  --shadow: 22px 20px 50px -30px rgba(74, 48, 30, 0.42);
  --shadow-soft: 8px 10px 26px -18px rgba(74, 48, 30, 0.32);
  /* Barely-there paper grain — one grayscale noise reads on both grounds
     (dark specks on paper, light specks on candlelight). CSP allows data: imgs. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23g)' opacity='0.05'/%3E%3C/svg%3E");
  --radius: 18px;
  /* Self-hosted (see fonts.css). Fraunces = display + reading; Figtree = UI.
     Non-Latin scripts fall through to the system stack. */
  --font-display: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --font-sans: 'Figtree', ui-rounded, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-read: 'Fraunces', 'Iowan Old Style', Palatino, Georgia, 'Times New Roman', serif;
}

[data-theme="dark"] {
  /* Candlelight — warm dark, never cold black. */
  --brand-x: #efe4d4;
  --brand-tiktok: #efe4d4;
  --bg: #1d1714;
  --card: #29211b;
  --primary: #e3b25c;     /* glowing honey/amber (dark CTA text overridden below) */
  --primary-dark: #ce9a45;
  --sage: #aec299;
  --honey: #dba95e;
  --danger: #e8836f;
  --text: #f0e5d5;        /* warm parchment */
  --muted: #ac9a85;
  --border: #3c3128;
  --accent-bg: #37301f;
  --accent: #2e2620;
  --input-bg: #181310;
  --toast-bg: #f0e5d5;
  --toast-text: #29211b;
  --mix: #29211b;
  --shadow: 22px 20px 50px -30px rgba(0, 0, 0, 0.6);
  --shadow-soft: 8px 10px 26px -18px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg);
  background-image: var(--grain);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-optical-sizing: auto;
}

/* A gentle settle on load — the page arrives softly, like opening a notebook. */
@keyframes riseIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.container { animation: riseIn 0.45s ease both; }

/* Visible keyboard focus everywhere it wasn't already handled. */
a:focus-visible, .btn:focus-visible, button:focus-visible, summary:focus-visible,
[role="menuitem"]:focus-visible, .chip:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .container { animation: none; }
  .support-fab svg, .plan .f-icon.heart { animation: none; }
  * { scroll-behavior: auto !important; }
}

.ico-sun, .ico-moon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
html[data-theme="dark"] .ico-moon { display: none; }
html:not([data-theme="dark"]) .ico-sun { display: none; }

a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: 1.55rem; line-height: 1.15; margin: 0.4rem 0 0.8rem; }
h2 { font-size: 1.12rem; line-height: 1.2; margin: 0 0 0.6rem; }
/* The intimate surface: what you write about people, set like a book. */
.notes, .tl-body p, .diary-scroll .notes { font-family: var(--font-read); font-size: 0.98rem; line-height: 1.65; }
code.wrap { word-break: break-all; font-size: 0.8rem; }

/* Layout */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.7rem 1rem;
  padding-top: calc(0.7rem + env(safe-area-inset-top));
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.brand { font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; letter-spacing: 0; color: var(--primary); }
.topbar { align-items: center; min-height: 3.2rem; }
.topbar > *, .top-actions > *, .top-links > * {
  display: inline-flex; align-items: center; line-height: 1; margin: 0;
}
.top-actions { display: flex; align-items: center; gap: 0.9rem; }
.top-links { display: flex; align-items: center; gap: 0.7rem; }
.topbar svg { display: block; }
.topbar details {
  display: inline-flex; align-items: center; height: 2rem;
}
.topbar details > summary {
  display: inline-flex; align-items: center; justify-content: center;
  height: 100%; padding: 0 0.5rem; box-sizing: border-box; margin: 0;
}
.topbar details > summary::marker,
.topbar details > summary::-webkit-details-marker { display: none; content: ""; }
.lang-toggle { font-weight: 700; font-size: 0.8rem; color: var(--muted); }

.container { max-width: 640px; margin: 0 auto; padding: 1rem; }
.container.has-nav { padding-bottom: calc(5rem + env(safe-area-inset-bottom)); }

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-around;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 0.35rem 0 calc(0.35rem + env(safe-area-inset-bottom));
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: 0.66rem; padding: 0.2rem 0.6rem; min-width: 56px;
}
.bottomnav a.active { color: var(--primary); }
.bottomnav svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Cards & lists */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; margin-bottom: 1rem; box-shadow: var(--shadow-soft); }
.card-head, .page-head { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; }
.page-head h1 { margin: 0; }
.person-head { display: flex; align-items: center; gap: 0.7rem; }

.list { list-style: none; margin: 0; padding: 0; }
.list .row { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.list .row:last-child { border-bottom: none; }
.row-body { flex: 1; min-width: 0; }
.row-body a { font-weight: 600; color: var(--text); }
.row-icon { font-size: 1.2rem; }

.avatar {
  flex-shrink: 0;
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-bg); color: var(--primary); font-weight: 700;
}
.avatar.big { width: 52px; height: 52px; font-size: 1.3rem; }
/* A contact photo that came in from the phone via sync. object-fit keeps
   portrait and landscape crops circular instead of squashed. */
.avatar-photo { object-fit: cover; padding: 0; }
/* A form that has to sit inline among the toolbar buttons without
   breaking the row it lives in. */
.inline-form { display: inline; }

.dot { flex-shrink: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--chip, var(--primary)); }
.dot.big { width: 22px; height: 22px; }

.date-badge {
  flex-shrink: 0; width: 44px; text-align: center;
  background: var(--accent-bg); border-radius: 10px; padding: 0.3rem 0;
  color: var(--primary);
}
.date-badge strong { display: block; font-size: 1.05rem; line-height: 1; }
.date-badge span { font-size: 0.68rem; }

.badge {
  flex-shrink: 0; font-size: 0.7rem; font-weight: 600;
  background: var(--accent-bg); color: var(--primary);
  border-radius: 999px; padding: 0.25rem 0.6rem;
}
.badge-hot { background: var(--primary); color: #fff; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.chip {
  display: inline-block; font-size: 0.75rem; font-weight: 600;
  padding: 0.3rem 0.7rem; border-radius: 999px;
  background: color-mix(in srgb, var(--chip, var(--primary)) 14%, var(--mix));
  color: color-mix(in srgb, var(--chip, var(--primary)) 75%, var(--text));
  border: 1px solid color-mix(in srgb, var(--chip, var(--primary)) 35%, var(--mix));
}
.chip-grid { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chip-check input { position: absolute; opacity: 0; }
.chip-check input:checked + .chip { outline: 2px solid var(--chip, var(--primary)); }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 0.85rem; }
label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; font-weight: 600; }
/* Same look as a label, but NOT a <label> — so clickable dropdown options inside
   it aren't hijacked by the label and redirected to the input. */
.field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; font-weight: 600; }
input, textarea, select {
  font: inherit; font-weight: 400;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--input-bg); color: var(--text);
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
/* Writing about someone should feel like a diary page, not a form field. */
textarea.note-edit, textarea[name="notes"] { font-family: var(--font-read); font-size: 1rem; line-height: 1.6; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--primary); border-color: transparent; }
input[type="color"] { padding: 0.15rem; height: 42px; width: 64px; }
/* Keyboard-friendly date field (app.js [data-date]): a text input the user can
   type into (dd-mm-yyyy / mm-dd-yyyy per their setting) with a 📅 button that
   opens the native picker. The hidden ISO field is what actually submits. */
.date-field { position: relative; display: block; width: 100%; }
.date-field .date-text { padding-inline-end: 2.6rem; }
.date-cal {
  position: absolute; inset-inline-end: 0.35rem; top: 50%; transform: translateY(-50%);
  width: 2rem; height: 2rem; padding: 0; border: none; background: none; cursor: pointer;
  font-size: 1.15rem; line-height: 1; opacity: 0.7; border-radius: 8px;
}
.date-cal:hover { opacity: 1; }
.date-cal:focus-visible { outline: 2px solid var(--primary); opacity: 1; }
/* Present for showPicker() but out of the layout/tab-flow. */
.date-native {
  position: absolute; inset-inline-end: 0.5rem; bottom: 0;
  width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none;
}
/* Password reveal toggle (injected by app.js around every password input). */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap input { padding-right: 2.7rem; }
.pw-toggle {
  position: absolute; top: 0; right: 0; height: 100%; width: 2.7rem;
  display: flex; align-items: center; justify-content: center;
  padding: 0; border: 0; border-radius: 0 10px 10px 0;
  background: none; color: var(--muted); cursor: pointer;
}
.pw-toggle:hover { color: var(--text); }
.pw-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* Password strength meter (injected by app.js under new-password fields). */
.pw-strength { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem; }
.pw-bars { display: flex; gap: 3px; flex: 1; }
.pw-bars i { height: 4px; flex: 1; border-radius: 2px; background: var(--border); transition: background 0.15s; }
.pw-level { font-size: 0.72rem; font-weight: 700; color: var(--muted); min-width: 4.5em; text-align: end; }
.pw-strength[data-level="1"] .pw-bars i.on { background: #e11d48; }
.pw-strength[data-level="1"] .pw-level { color: #e11d48; }
.pw-strength[data-level="2"] .pw-bars i.on { background: #f59e0b; }
.pw-strength[data-level="2"] .pw-level { color: #f59e0b; }
.pw-strength[data-level="3"] .pw-bars i.on { background: #84cc16; }
.pw-strength[data-level="3"] .pw-level { color: #65a30d; }
.pw-strength[data-level="4"] .pw-bars i.on { background: #16a34a; }
.pw-strength[data-level="4"] .pw-level { color: #16a34a; }
fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 0.7rem; }
legend { font-size: 0.85rem; font-weight: 600; padding: 0 0.3rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem;
  font: inherit; font-weight: 600; font-size: 0.9rem;
  padding: 0.62rem 1.05rem; border-radius: 12px;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  cursor: pointer; text-align: center;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--primary) 70%, transparent); }
.btn.primary:active { background: var(--primary-dark); }
/* In candlelight the amber is light, so white text on it is weak — use deep ink. */
[data-theme="dark"] .btn.primary { color: #241a08; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, white); }
.btn.small-btn { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
.btn-row { display: flex; gap: 0.6rem; }
.icon-btn {
  border: none; background: none; color: var(--muted);
  font-size: 1.2rem; cursor: pointer; padding: 0.2rem 0.5rem;
}
.linklike { border: none; background: none; color: var(--muted); font: inherit; font-size: 0.8rem; font-weight: 700; cursor: pointer; padding: 0; }

.searchbar { margin-bottom: 1rem; }
.group-filter { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.group-filter .chip {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  padding: 0.3rem 0.75rem; border-radius: 999px; font-size: 0.82rem; cursor: pointer;
  line-height: 1.4;
}
.group-filter .chip:hover { border-color: var(--primary); }
.group-filter .chip.active {
  background: var(--chip, var(--primary)); color: #fff; border-color: transparent;
}
.list .row[hidden] { display: none; }
.combobox { position: relative; }
.combobox-input { width: 100%; }
.combobox-list {
  position: absolute; z-index: 20; inset-inline: 0; top: 100%;
  margin: 3px 0 0; padding: 0; list-style: none;
  max-height: 240px; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.14);
}
.combobox-opt { padding: 0.5rem 0.7rem; cursor: pointer; }
.combobox-opt:hover, .combobox-opt.active { background: var(--accent); }
.combobox-opt[hidden] { display: none; }
.check-inline { display: flex; align-items: center; gap: 0.45rem; margin: -0.3rem 0 0.2rem; }
.check-inline input { width: auto; }
input.linked { opacity: 0.6; }
/* Phone line with an inline "same number for WhatsApp + Telegram" toggle. */
.phone-row { display: flex; align-items: center; gap: 0.55rem; }
.phone-input { flex: 1 1 auto; min-width: 0; }
/* flex-direction beats the global `label { flex-direction: column }` above —
   without it the checkbox + icons stack vertically. */
.phone-link { flex: none; display: inline-flex; flex-direction: row; align-items: center; gap: 0.4rem; cursor: pointer; font-weight: 400; }
.phone-link input { width: auto; margin: 0; cursor: pointer; }
.phone-ic { display: inline-flex; }
.phone-ic svg { width: 22px; height: 22px; display: block; }
.phone-ic.wa { color: #25d366; }
.phone-ic.tg { color: #2aabee; }
.phone-link input:not(:checked) ~ .phone-ic { color: var(--muted); opacity: 0.4; }
.tag-input { border: 1px solid var(--border); border-radius: 10px; padding: 0.4rem; background: var(--card); }
.tag-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag-chips:not(:empty) { margin-bottom: 0.35rem; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.82rem;
  background: var(--accent); color: var(--text); padding: 0.2rem 0.2rem 0.2rem 0.55rem;
  border-radius: 999px;
}
.tag-x { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 1rem; line-height: 1; padding: 0 0.25rem; }
.tag-x:hover { color: var(--warn, #dc2626); }
.tag-entry { width: 100%; border: none; background: transparent; padding: 0.25rem; }
.tag-entry:focus { outline: none; }
.pf-extra { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.pf-extra:not(:empty) { margin-bottom: 1rem; }
.pf-extra .group-filter { margin-bottom: 0; }
.pf-city { max-width: 240px; }
.chip-plain { background: var(--accent); color: var(--muted); border-color: var(--border); }
.row-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; }
/* Bulk selection (People page): a checkbox per row + a floating action bar.
   Everything is hidden until the "select" toggle adds .bulk-on to the root. */
.bulk-box { display: none; }
.bulk-on .bulk-box { display: flex; align-items: center; flex: 0 0 auto; }
.bulk-box input { width: 21px; height: 21px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.bulk-bar {
  position: fixed; inset-inline: 0.8rem; z-index: 30;
  bottom: calc(4.1rem + env(safe-area-inset-bottom));
  max-width: 600px; margin: 0 auto; padding: 0.55rem 0.7rem;
  display: none; flex-direction: column; gap: 0.4rem;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}
.bulk-on .bulk-bar { display: flex; } /* shown only in selection mode */
.bulk-head, .bulk-row { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.bulk-head #bulk-delete { margin-inline-start: auto; }
/* One row per dimension: the field stretches, the +/− stay a fixed square. */
.bulk-row > select, .bulk-combo { flex: 1 1 140px; min-width: 0; }
.bulk-bar select { width: auto; padding: 0.4rem 0.5rem; font-size: 0.83rem; }
.bulk-combo .combobox-input { padding: 0.4rem 0.5rem; font-size: 0.83rem; }
/* The bar is pinned to the bottom of the screen, so its list opens upward. */
.bulk-combo .combobox-list { top: auto; bottom: 100%; margin: 0 0 3px; max-height: 190px; }
.bulk-op { flex: 0 0 auto; min-width: 2.1rem; font-weight: 700; line-height: 1; }
.bulk-count { font-weight: 700; font-size: 0.85rem; }
.bulk-on .pf-list { margin-bottom: 16rem; } /* keep the last rows reachable under the bar */
.ic-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
}
.ic-btn svg { width: 17px; height: 17px; }
.social-ic { background: var(--chip, var(--primary)); color: #fff; }
/* Light badge in dark mode needs a dark glyph. */
[data-theme="dark"] .social-ic.s-x,
[data-theme="dark"] .social-ic.s-tiktok { color: #10131a; }
.edit-ic { background: var(--accent); color: var(--muted); }
.edit-ic:hover { color: var(--primary); }
details > summary { list-style: none; width: fit-content; margin-bottom: 0.6rem; }
details > summary::-webkit-details-marker { display: none; }

/* Key-value lists */
.kv { list-style: none; margin: 0; padding: 0; }
.kv li { display: flex; gap: 0.8rem; padding: 0.45rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; align-items: baseline; }
.kv li:last-child { border-bottom: none; }
.kv li > span:first-child { flex-shrink: 0; width: 100px; color: var(--muted); font-size: 0.8rem; }
.notes { white-space: pre-wrap; margin: 0.7rem 0 0; font-size: 0.92rem; }

/* Timeline — "o fio": a single warming thread the beads sit on. Its colour is
   set per person by data-warmth (see person_detail): rose when contact is
   recent, cooling through honey to sage as the bond falls asleep. */
.timeline { list-style: none; margin: 0.6rem 0 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 4.5px; top: 7px; bottom: 7px; width: 2.5px;
  border-radius: 3px; opacity: 0.6;
  background: linear-gradient(var(--primary), var(--sage));
}
.timeline[data-warmth="warm"]::before { opacity: 0.8; background: linear-gradient(var(--primary), var(--honey)); }
.timeline[data-warmth="mild"]::before { opacity: 0.7; background: linear-gradient(var(--honey), var(--sage)); }
.timeline[data-warmth="cool"]::before { opacity: 0.5; background: linear-gradient(var(--sage), var(--border)); }
.timeline li { display: flex; gap: 0.7rem; }
.tl-dot {
  flex-shrink: 0; width: 12px; height: 12px; margin-top: 5px; border-radius: 50%;
  background: var(--card); border: 2.5px solid var(--primary);
  box-shadow: 0 0 0 3px var(--bg); position: relative; z-index: 1;
}
/* The newest bead is filled — the warmth of the last time you met. */
.timeline li:first-child .tl-dot { background: var(--primary); }
.timeline[data-warmth="cool"] li:first-child .tl-dot { background: var(--sage); border-color: var(--sage); }
.timeline[data-warmth="cool"] .tl-dot { border-color: var(--sage); }
.tl-body { flex: 1; padding-bottom: 1rem; position: relative; }
.tl-body p { margin: 0.2rem 0 0; font-size: 0.92rem; white-space: pre-wrap; }
.tl-body > form { position: absolute; top: 0; inset-inline-end: 0; }

/* Inline "edit" disclosure on list & timeline rows (dates, links, interactions). */
.row-edit { margin-top: 0.35rem; }
.row-edit > summary {
  display: inline-flex; align-items: center; gap: 0.3rem;
  cursor: pointer; color: var(--muted); font-size: 0.82rem; list-style: none; width: max-content;
}
.row-edit > summary::-webkit-details-marker { display: none; }
.row-edit > summary::before { content: "\270E"; }
.row-edit > summary:hover, .row-edit[open] > summary { color: var(--primary); }
.row-edit > form { margin-top: 0.6rem; }

/* Feedback */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(5.2rem + env(safe-area-inset-bottom));
  background: var(--toast-bg); color: var(--toast-text);
  padding: 0.55rem 1.1rem; border-radius: 999px; font-size: 0.85rem;
  z-index: 20; transition: opacity 0.4s;
}
/* Person page, desktop: who the person is on the left, what happened with them
   on the right. Below the breakpoint it is one column in source order — info
   first, story last — which is the order the page always had. */
.person-grid { display: grid; gap: 0 1rem; }
@media (min-width: 1000px) {
  .person-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; }
  /* Deliberately not sticky. Pinning the info column needs a height cap to keep
     its own bottom reachable, and that cap turns it into a scroll container —
     which clips the "important people" dropdown that lives inside it. The page
     scrolls as one, which is the behaviour nobody has to learn. */
}

/* Dashboard contact finder (the 🔎 in "Cooling off"). Hidden until asked for,
   so the block still reads as the cold list at a glance. */
.find-box { margin: 0 0 0.6rem; }
.find-box .combobox-input { width: 100%; padding: 0.45rem 0.6rem; font-size: 0.88rem; }
.find-results { margin-top: 0.3rem; }
.find-results:empty { display: none; }
.find-results .row { padding: 0.45rem 0; }
#find-toggle.active { background: var(--accent-bg); border-radius: 50%; }

/* Contact log: the card that opens when a network icon is tapped. It dims the
   page behind it and sits in the middle — the whole point is that the tap gets
   one moment of attention before the user goes back to what they were doing. */
.log-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: rgba(28, 20, 14, 0.55);
  animation: logFade 0.18s ease both;
}
.log-overlay[hidden] { display: none; }
@keyframes logFade { from { opacity: 0; } to { opacity: 1; } }
.log-card {
  width: 100%; max-width: 26rem; max-height: 90vh; overflow-y: auto;
  padding: 1.1rem; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 16px 44px rgba(0, 0, 0, 0.35);
}
@media (prefers-reduced-motion: reduce) { .log-overlay { animation: none; } }
.log-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.log-title { font-family: var(--font-display); font-size: 1rem; }
.log-actions { display: flex; gap: 0.4rem; align-items: center; }
.log-card textarea { min-height: 3.4rem; }

.alert {
  background: color-mix(in srgb, var(--danger) 12%, var(--mix));
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--mix));
  border-radius: 10px;
  padding: 0.6rem 0.9rem; font-size: 0.88rem; margin-bottom: 1rem;
}

/* Auth pages */
.auth-wrap { max-width: 420px; margin: 0 auto; padding-top: 1.5rem; }
.auth-hero { text-align: center; margin-bottom: 1.4rem; }
.auth-hero .logo { width: 64px; height: 64px; }
.auth-hero h1 { margin: 0.5rem 0 0.2rem; }
.divider { display: flex; align-items: center; gap: 0.8rem; color: var(--muted); font-size: 0.8rem; margin: 1rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.muted { color: var(--muted); }
.small { font-size: 0.78rem; }
.center { text-align: center; }
.right { text-align: end; margin: -0.3rem 0 0; }
.center-row { justify-content: center; }

/* Language menu */
.lang-menu { position: relative; }
.lang-menu > summary {
  list-style: none; cursor: pointer;
  font-weight: 700; font-size: 0.8rem; color: var(--muted);
  padding: 0.25rem 0.4rem;
}
.lang-menu > summary::-webkit-details-marker { display: none; }
.lang-list {
  position: absolute; inset-inline-end: 0; top: 1.9rem; z-index: 30;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  min-width: 10rem; padding: 0.3rem; display: flex; flex-direction: column;
}
.lang-list a { padding: 0.45rem 0.7rem; border-radius: 8px; color: var(--text); font-size: 0.88rem; }
.lang-list a.active { color: var(--primary); font-weight: 700; background: var(--accent-bg); }
.lang-list a:hover { background: var(--accent-bg); }

#theme-toggle { color: var(--muted); display: inline-flex; align-items: center; padding: 0.35rem; }

/* Topbar links + share menu */
.top-links a { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
@media (max-width: 560px) { .top-links { display: none; } }
.share-menu > summary svg {
  width: 19px; height: 19px; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; vertical-align: middle;
}
.share-menu .lang-list button {
  font: inherit; font-size: 0.88rem; text-align: start; color: var(--text);
  background: none; border: none; cursor: pointer;
  padding: 0.45rem 0.7rem; border-radius: 8px;
}
.share-menu .lang-list button:hover { background: var(--accent-bg); }
.share-title { padding: 0.3rem 0.7rem; }
.share-row { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; align-items: center; margin-top: 0.7rem; }

/* Diary */
/* V58 — compact diary filters: two datefields on one line, no search button
   (the dates search as soon as they change; app.js). The kind chips are
   icon + count and filter the loaded list in place. */
.diary-filter { display: flex; align-items: center; gap: 0.3rem; margin-bottom: 0.6rem; }
.diary-filter .diary-range { flex: 1 1 0; min-width: 0; }
.diary-filter .date-text { width: 100%; padding: 0.35rem 0.4rem; padding-inline-end: 2.2rem; font-size: 0.85rem; }
.diary-filter .date-cal { font-size: 1rem; width: 1.7rem; inset-inline-end: 0.15rem; }
.diary-totals { margin-bottom: 0.6rem; }
button.diary-kind { cursor: pointer; font-family: inherit; }
.diary-scroll { max-height: 340px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 0 0.7rem; }

/* Stats picker */
.stats-picker { position: relative; }
.stats-form { text-align: start; margin-top: 0.5rem; background: var(--accent-bg); border-radius: 10px; padding: 0.7rem; }
.section-gap { margin-top: 1.2rem; }

/* Social handles grid (person form) */
.social-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
@media (max-width: 480px) { .social-grid { grid-template-columns: 1fr; } }

/* V62 — editor dos outros dados do contato (campos CardDAV não modelados) */
.extra-editor { margin-top: 0.5rem; }
.extra-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem;
  text-align: start; background: var(--accent-bg); border-radius: 10px;
  padding: 0.7rem; margin-top: 0.5rem; }
.extra-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; }
.extra-form input, .extra-form select { width: 100%; }
.extra-form button { grid-column: 1 / -1; justify-self: start; }
@media (max-width: 480px) { .extra-form { grid-template-columns: 1fr; } }

/* Landing */
.landing { text-align: center; }
.landing .hero { text-align: center; padding: 2.2rem 0 1.6rem; }
.landing .hero .logo { width: 72px; height: 72px; }
.landing .hero h1 { font-size: clamp(2rem, 6vw, 2.7rem); line-height: 1.12; margin: 0.9rem 0 0.6rem; }
.landing .hero-sub { color: var(--muted); max-width: 34rem; margin: 0 auto 1.2rem; }
.landing .small-hero { padding: 1rem 0 2rem; }

/* V71 — o fio dos elos: hero sem mídia. O traço de mel se desenha ligando
   retratos; SVG inline + CSS puro, zero bytes de rede. No candlelight os
   mesmos tokens fazem o fio brilhar sobre o café. */
.fio-hero { position: relative; overflow: hidden; min-height: 480px;
  display: flex; align-items: center; justify-content: center;
  /* full-bleed para fora do .container (640px): o fio precisa de palco;
     96vw (e não 100vw) para não criar barra de rolagem horizontal.
     margin-inline nos DOIS lados: com margem só à esquerda o RTL resolve a
     sobre-restrição recalculando-a e empurra o hero para fora da tela. */
  width: min(96vw, 1100px); margin-inline: calc(50% - min(48vw, 550px)); }
.fio-hero svg.fio { position: absolute; inset: 0; width: 100%; height: 100%; }
.fio .thread { fill: none; stroke: var(--honey); stroke-width: 2.2;
  stroke-linecap: round; stroke-dasharray: 3000;
  animation: fio-draw 3.4s ease-out forwards; }
@keyframes fio-draw { from { stroke-dashoffset: 3000; } to { stroke-dashoffset: 0; } }
.fio .node { animation: node-float 8s ease-in-out infinite alternate; }
.fio .pop { transform-box: fill-box; transform-origin: center;
  animation: node-in 0.7s ease-out backwards; }
@keyframes node-in { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: scale(1); } }
@keyframes node-float { to { translate: 0 -8px; } }
.fio .face { fill: var(--accent-bg); stroke: var(--honey); stroke-width: 1.6; }
.fio .node text { fill: var(--primary); font-family: var(--font-sans);
  font-size: 17px; font-weight: 600; text-anchor: middle; }
.fio .tag rect { fill: var(--input-bg); stroke: var(--border); }
.fio .tag text { fill: var(--muted); font-family: var(--font-sans); font-size: 12.5px; }
.fio .leaf { fill: var(--sage); opacity: 0.5; }
.fio .dot { fill: var(--honey); opacity: 0.6; }
.fio-inner { position: relative; max-width: 640px; padding: 1rem 1.25rem; }
.hero-proof { margin-top: 0.9rem; font-size: 0.82rem; color: var(--muted); }
.landing .pain { padding: 1.6rem 1.25rem 0.4rem; }
.landing .pain h2 { font-size: clamp(1.35rem, 4vw, 1.8rem); margin-bottom: 0.5rem; }
.landing .pain p { max-width: 36rem; margin: 0 auto 1rem; }
@media (max-width: 640px) {
  .fio-hero { min-height: 420px; }
  /* no celular o corte lateral do slice engoliria meia etiqueta */
  .fio .tag { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .fio .thread, .fio .node, .fio .pop { animation: none; }
}
.landing-title { text-align: center; margin: 1rem 0; font-size: 1.15rem; }
.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin-bottom: 1rem; }
@media (max-width: 520px) { .feature-grid { grid-template-columns: 1fr; } }
.feature { margin-bottom: 0; }
.feature .f-icon { font-size: 1.5rem; }
.feature h3 { margin: 0.4rem 0 0.3rem; font-size: 0.95rem; }
.feature p { margin: 0; font-size: 0.85rem; }
.landing-privacy { padding: 1.4rem; }
.landing-privacy .btn { margin-top: 0.6rem; }

/* Support banner + FAB */
.support-banner {
  position: sticky; top: 0; z-index: 15;
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 0.5rem 0.7rem;
  padding: 0.55rem 2.6rem;
  background: color-mix(in srgb, var(--primary) 12%, var(--card));
  border-bottom: 1px solid color-mix(in srgb, var(--primary) 30%, var(--card));
  font-size: 0.82rem;
}
.support-banner span { text-align: center; }
.support-banner .icon-btn {
  position: absolute; inset-inline-end: 0.6rem; top: 50%; transform: translateY(-50%);
}
/* The flex display above would otherwise override the hidden attribute. */
.support-banner[hidden], .support-fab[hidden], .quick-menu[hidden] { display: none; }

/* Bottom-right floating action stack: quick-add (+) always, support (♥) above
   it for free users. Sits just above the bottom nav. */
.fab-stack {
  position: fixed; z-index: 15;
  inset-inline-end: 1rem;
  bottom: calc(4.6rem + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.7rem;
}
.support-fab {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.support-fab svg {
  width: 26px; height: 26px; fill: #e11d48; stroke: none;
  animation: heartbeat 1.3s ease-in-out infinite;
  transform-origin: center;
}
@keyframes heartbeat {
  0%, 40%, 100% { transform: scale(1); }
  10% { transform: scale(1.22); }
  20% { transform: scale(1); }
  30% { transform: scale(1.15); }
}

/* Quick-add (+) button + its pop-up menu */
.quick-fab-wrap { position: relative; }
.quick-fab {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary); border: none; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
.quick-fab svg {
  width: 27px; height: 27px; fill: none; stroke: #fff; stroke-width: 2.4;
  stroke-linecap: round; transition: transform 0.2s ease;
}
.quick-fab[aria-expanded="true"] svg { transform: rotate(45deg); }
.quick-menu {
  position: absolute; inset-inline-end: 0; bottom: calc(100% + 0.6rem);
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.45rem;
}
.quick-menu-item {
  display: inline-flex; align-items: center; gap: 0.55rem; white-space: nowrap;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 0.55rem 0.95rem; font-size: 0.9rem; font-weight: 500;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  animation: quickPop 0.16s ease both;
}
.quick-menu-item svg {
  width: 19px; height: 19px; fill: none; stroke: var(--primary);
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.quick-menu-item:hover { border-color: var(--primary); color: var(--primary); }
.quick-menu-item:hover svg { stroke: var(--primary); }
@keyframes quickPop {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Icon picker for the "first interaction" kind on the quick new-contact form */
.kind-picker { border: 1px solid var(--border); border-radius: 12px; padding: 0.9rem 1rem; margin: 0; }
.kind-picker legend { padding: 0 0.4rem; font-size: 0.9rem; font-weight: 600; }
.kind-opts { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.6rem; }
.kind-opt {
  display: inline-flex; flex-direction: column; align-items: center; gap: 0.25rem;
  min-width: 4.2rem; cursor: pointer; padding: 0.5rem 0.6rem;
  border: 1px solid var(--border); border-radius: 10px; color: var(--muted);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.kind-radio { position: absolute; opacity: 0; width: 0; height: 0; }
.kind-opt:has(.kind-radio:checked) {
  border-color: var(--primary); color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, var(--card));
}
.kind-radio:focus-visible + .kind-ic { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.kind-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.kind-lbl { font-size: 0.78rem; }

/* Relationship temperature */
.temp { flex-shrink: 0; font-size: 1rem; cursor: default; }
.tools-row { display: flex; gap: 0.6rem; align-items: flex-start; margin-bottom: 1rem; flex-wrap: wrap; }
.import-box form { margin-top: 0.5rem; }

/* ------------------------------------------------------------------ People
   V53 — the page is the LIST. Filters live in a side column (wide screens)
   or a bottom sheet (phone); the toolbar collapses into one primary action
   plus a "Tools" menu; sync state shrinks to an icon. */
.container.wide { max-width: 1200px; }

.head-tools { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }
/* Keep "People · 148" on one line however narrow the head gets. */
.page-head h1 { display: flex; align-items: baseline; gap: 0.45rem; white-space: nowrap; }
body.pf-sheet-open .fab-stack { display: none; }
.sync-ic { position: relative; font-size: 1.05rem; }
.sync-ic.sync-err::after {
  content: ""; position: absolute; top: 0.1rem; inset-inline-end: 0.15rem;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 1.5px solid var(--card);
}
/* The tools menu borrows the lang-menu dropdown skeleton; items become a
   simple vertical list of links, buttons and one inline import form. */
.tools-menu > summary { padding: 0; }
.tools-list { min-width: 14rem; padding: 0.4rem; }
.tools-list > a, .tools-list > button, .tools-list > details > summary {
  display: block; width: 100%; text-align: start; font: inherit; font-size: 0.88rem;
  color: var(--text); background: none; border: none; cursor: pointer;
  padding: 0.45rem 0.7rem; border-radius: 8px;
}
.tools-list > a:hover, .tools-list > button:hover,
.tools-list > details > summary:hover { background: var(--accent-bg); }
.tools-list > details { width: 100%; }
.tools-list > details > summary { margin-bottom: 0; }
.tools-list .import-box form { padding: 0.3rem 0.7rem 0.5rem; }

/* Filter column + list area */
.pf-layout { display: block; }
.pf-h {
  margin: 0 0 0.45rem; font-family: var(--font-sans);
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.pf-sec { margin-bottom: 1rem; }
.pf-side .searchbar { margin-bottom: 1rem; }
.pf-side .group-filter { margin-bottom: 0; }
.pf-side-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.7rem;
}
.pf-clear { width: 100%; margin-top: 0.3rem; }

.pf-bar { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.7rem; flex-wrap: wrap; }
.pf-badge { margin-inline-start: 0.35rem; padding: 0.1rem 0.45rem; }
.pf-count { flex: 1; }
.pf-sortwrap { display: flex; flex-direction: row; align-items: center; gap: 0.4rem; font-weight: 400; }
.pf-sortwrap select { width: auto; padding: 0.35rem 0.5rem; font-size: 0.83rem; }
.pf-active { margin-bottom: 0.7rem; }
.pf-active:empty { display: none; }
.pf-active .chip { cursor: pointer; }
.pf-active .chip:hover { border-color: var(--danger); color: var(--danger); }

/* Phone: the column becomes a bottom sheet, opened by the Filters button. */
.pf-side { display: none; }
.pf-drawer .pf-side {
  display: block; position: fixed; z-index: 60;
  inset-inline: 0; bottom: 0; max-height: 82dvh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border); border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1rem 1.1rem calc(1.2rem + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
}
.pf-backdrop { display: none; }
.pf-drawer .pf-backdrop {
  display: block; position: fixed; inset: 0; z-index: 55;
  background: rgba(0, 0, 0, 0.4);
}
.pf-drawer .pf-backdrop[hidden] { display: none; }

/* Wide screens: a real sidebar; the Filters button and sheet chrome vanish. */
@media (min-width: 900px) {
  .pf-layout {
    display: grid; grid-template-columns: 250px minmax(0, 1fr);
    gap: 1.3rem; align-items: start;
  }
  .pf-side, .pf-drawer .pf-side {
    display: block; position: sticky; top: 4.3rem; z-index: 1;
    max-height: calc(100dvh - 5.5rem); overflow-y: auto;
    inset-inline: auto; bottom: auto; border: none; border-radius: 0;
    background: none; box-shadow: none; padding: 0 0.2rem 0 0;
  }
  .pf-open, .pf-close, .pf-side-head .icon-btn { display: none; }
  .pf-drawer .pf-backdrop { display: none; }
}

/* ------------------------------------------------------------------- Home
   V54 — the dashboard mosaic. The window is the frame: on wide screens the
   grid divides the whole viewport between the blocks and each block scrolls
   by itself; the page does not. Below 700px nothing changes: the blocks
   stack exactly as they always did. */
a.stat { color: inherit; }
a.stat:hover, a.stat:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.dash-sub { margin-top: 1rem; }
.heat-coldest { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
/* V56.1 — the lists are no longer capped in SQL (cooling and recent bring
   everyone), so below the mosaic breakpoint each block gets a bounded,
   scrollable body; ≥1100px the grid overrides this with max-height: none. */
.dash-scroll { max-height: 340px; overflow-y: auto; }

/* V63 — long lists lay out lazily: rows outside the scrollport skip layout and
   paint entirely, so a 1500-row block costs what its visible slice costs. The
   intrinsic-size estimate keeps the scrollbar honest. */
.dash-scroll .row, .pf-list .row {
  content-visibility: auto;
  contain-intrinsic-size: auto 56px;
}

/* Phone: the quick-action cluster drops to its own right-aligned line, so
   "11 anos de casamento · Elisa" never has to squeeze past four icons. */
@media (max-width: 699.9px) {
  .dash-grid .row { flex-wrap: wrap; }
  .dash-grid .row .row-quick {
    order: 10; flex-basis: 100%; justify-content: flex-end; margin-top: 0.15rem;
  }
}

@media (min-width: 700px) {
  .dash-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem; align-items: start;
  }
  .dash-grid > .dash-block { margin-bottom: 0; }
  .b-stats { grid-column: 1 / -1; }
}

@media (min-width: 1100px) {
  /* Lock the page to the viewport; hand the scrollbar to each block. */
  .container.dash {
    max-width: 1500px;
    height: calc(100dvh - 8.6rem); /* topbar + bottom nav */
    display: flex; flex-direction: column;
    overflow: hidden;
    padding-bottom: 0.2rem;
  }
  .container.dash.has-nav { padding-bottom: 0.2rem; }
  .dash-hello { flex: 0 0 auto; }
  .dash-grid {
    flex: 1; min-height: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
  }
  .dash-grid > .dash-block {
    min-height: 0; overflow: hidden;
    display: flex; flex-direction: column;
  }
  /* "What's coming" is the tall first column, like a day planner. */
  .b-dates { grid-row: span 2; }
  /* Stats fit one row (1×N, whatever the user picked) — more room below. */
  .b-stats .stats-grid {
    grid-template-columns: none;
    grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  }
  .dash-block .dash-scroll {
    flex: 1 1 auto; min-height: 0; overflow-y: auto;
    max-height: none; border: none; padding: 0;
  }
}

/* ----------------------------------------------------------------- Import
   V55 — one door for "bring my contacts": a three-source hub, a review with
   honest pre-selection and A–Z headers, and a done page that can undo. */
.steps {
  display: flex; gap: 0.6rem; align-items: center;
  list-style: none; margin: 0 0 1.2rem; padding: 0;
  font-size: 0.8rem; font-weight: 600; color: var(--muted);
}
.steps li { display: flex; align-items: center; gap: 0.6rem; }
.steps li + li::before { content: "·"; color: var(--border); font-weight: 800; }
.steps li.on { color: var(--primary); }
.steps li.done { color: var(--sage); }
.steps li.done::after { content: " ✓"; }

.src-grid { display: grid; grid-template-columns: 1fr; gap: 0.8rem; }
@media (min-width: 820px) { .src-grid { grid-template-columns: repeat(3, 1fr); } }
.src-card { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 0; }
.src-card .f-icon { font-size: 1.6rem; }
.src-card h2 { margin: 0; font-size: 1.05rem; }
.src-card .src-cta { margin-top: auto; display: flex; flex-direction: column; gap: 0.6rem; align-items: flex-start; }
.src-card .src-cta form { width: 100%; }

.ir-letter {
  padding: 0.55rem 0 0.15rem; font-weight: 700; font-size: 0.78rem;
  letter-spacing: 0.08em; color: var(--muted);
}
/* The review's checkboxes reuse the bulk-box markup, but here they are the
   whole point — always visible, no selection mode to enter first. (They were
   invisible before V55: the bulk rule hid them outside .bulk-on.) */
[data-import-review] .bulk-box { display: flex; align-items: center; flex: 0 0 auto; }
/* The confirm button rides above the bottom nav, always in reach. */
.ir-bar {
  position: sticky; z-index: 5;
  bottom: calc(4.3rem + env(safe-area-inset-bottom));
  display: flex; justify-content: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-soft);
  padding: 0.6rem 0.8rem;
}

/* Quick actions: edit + the person's networks, right-aligned on every row.
   Dimmed until the row is hovered/focused; always on where hover
   doesn't exist. */
.row-quick { display: flex; align-items: center; gap: 0.35rem; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }
.row-quick .ic-btn { opacity: 0.5; transition: opacity 0.12s ease; }
.list .row:hover .row-quick .ic-btn,
.list .row:focus-within .row-quick .ic-btn { opacity: 1; }
@media (hover: none) { .row-quick .ic-btn { opacity: 1; } }

/* Testimonial */
.landing-quote-box {
  text-align: center;
  border-inline-start: 4px solid var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, var(--card));
  padding: 1.4rem 1.2rem;
}
.landing-quote-box .quote {
  margin: 0.6rem auto 0; max-width: 36rem;
  font-family: var(--font-read);
  font-style: italic; font-size: 1.15rem; line-height: 1.65;
}
.landing-quote-box .quote footer { margin-top: 0.7rem; font-style: normal; font-size: 0.85rem; font-weight: 600; }
.cause { font-size: 0.9rem; color: var(--primary); font-weight: 600; }
.cause-hero { max-width: 36rem; margin: 0.8rem auto 0; }

/* Pricing page */
.pricing-page .pricing-hero { padding: 1.2rem 0 0.6rem; }
.pricing-page .pricing-hero .logo { width: 56px; height: 56px; }
.pricing-page .plans { text-align: center; margin-top: 1.2rem; }
.plan .f-icon { font-size: 1.7rem; }
/* Supporter card: red, beating heart (reuses the @keyframes heartbeat above). */
.plan .f-icon.heart {
  color: #e11d48;
  display: inline-block;
  transform-origin: center;
  animation: heartbeat 1.3s ease-in-out infinite;
}
.plan-features { font-size: 0.85rem; }
.plan-cta { margin-top: auto; }

/* Tutorial */
.tut-title { font-weight: 700; cursor: pointer; }
.tut-body { white-space: pre-line; font-size: 0.92rem; line-height: 1.6; }

/* Roadmap */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem; margin-top: 0.6rem; }
@media (max-width: 480px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--accent-bg); border-radius: 12px; padding: 0.8rem 0.4rem; display: flex; flex-direction: column; gap: 0.15rem; }
.stat strong { font-size: 1.3rem; color: var(--primary); }
.stat span { font-size: 0.72rem; color: var(--muted); }
.roadmap-list { margin: 0; padding-inline-start: 1.2rem; line-height: 1.9; font-size: 0.92rem; }
.newsletter-row { display: flex; gap: 0.5rem; max-width: 26rem; margin: 0.4rem auto 0; }
.footer-links { padding: 1rem 0 2rem; }
.check-row { flex-direction: row; align-items: center; gap: 0.5rem; font-weight: 400; }
.check-row input { width: auto; }

/* Pricing */
.region-picker { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin: 0.8rem 0 0.2rem; }
.chip-active { outline: 2px solid var(--chip, var(--primary)); }
.btn-col { display: flex; flex-direction: column; gap: 0.5rem; }
.donate-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.donate-custom { display: flex; gap: 0.5rem; align-items: center; flex: 1; min-width: 220px; }
.donate-custom input { max-width: 160px; }
@media (max-width: 520px) {
  .donate-row { justify-content: center; }
  /* On phones, drop the custom amount + submit onto their own centered line. */
  .donate-custom { flex-basis: 100%; min-width: 0; justify-content: center; }
}
.crypto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
@media (max-width: 520px) { .crypto-grid { grid-template-columns: 1fr; } }
.crypto-box { text-align: center; display: flex; flex-direction: column; gap: 0.4rem; align-items: center; }
.crypto-box .qr { background: #fff; padding: 6px; border-radius: 10px; }
.crypto-box .qr svg { display: block; width: 140px; height: 140px; }

/* Pricing plans */
/* Inverted-T layout: Free + Supporter side by side, Donate spanning below. */
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin-top: 1rem; align-items: stretch; }
.plan-donate { grid-column: 1 / -1; }
@media (max-width: 560px) { .plans { grid-template-columns: 1fr; } .plan-donate { grid-column: auto; } }
.plan { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0; }
.plan h2 { margin: 0; }
.plan .price { font-size: 1.6rem; font-weight: 800; }
.plan-featured { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.plan .badge { align-self: flex-start; }

/* ---- Group temperature (Início + Grupos) --------------------------------
   The bar reuses the fio's palette: honey for a live relationship, sage for
   one that is merely quiet, sand for one that has gone cold. Three widths
   that always add up to 100%, so the eye reads proportion, not counts. */
.heat-bar {
  display: flex; height: 8px; border-radius: 999px; overflow: hidden;
  background: var(--border); margin: 0.35rem 0 0.25rem;
}
.heat-bar.small { height: 5px; }
.heat-bar > span { display: block; }
.heat-hot { background: var(--primary); }
.heat-warm { background: var(--sage); }
.heat-cold { background: var(--border); }
.heat-row .row-body { width: 100%; }
.heat-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.heat-list .row { align-items: stretch; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
