/*
 * Watermelon — sharp, fast, monochrome. One stylesheet, no build step.
 *
 * Everything visual is a token in :root below. Colour is greys only; the one
 * exception is meaning (success/danger). Dark mode follows the system.
 */

/* ── Fonts ──────────────────────────────────────────────────────────────── */

/* Geist and Geist Mono by Vercel, self-hosted (SIL Open Font License, next to
   the files in app/assets/fonts/geist). Variable: every weight in one file. */
@font-face {
  font-family: "Geist";
  src: url("/assets/geist/Geist-Variable-68b1bdfa.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("/assets/geist/GeistMono-Variable-774df0a9.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ── Tokens ─────────────────────────────────────────────────────────────── */

:root {
  color-scheme: light dark;

  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --text-xs: 0.75rem;     /* 12 */
  --text-sm: 0.8125rem;   /* 13 */
  --text-base: 0.875rem;  /* 14 */
  --text-lg: 1rem;        /* 16 */
  --text-xl: 1.25rem;     /* 20 */
  --text-2xl: 1.5rem;     /* 24 */

  --bg: #ffffff;
  --bg-sidebar: #f8f8f9;
  --bg-elevated: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: rgb(0 0 0 / 0.04);
  --bg-active: rgb(0 0 0 / 0.07);
  --border: #dbdbe0;
  --border-strong: #c6c6ce;
  --text: #0b0b0c;
  --text-secondary: #45454d;
  --text-tertiary: #6b6b75;
  --primary-bg: #0b0b0c;
  --primary-bg-hover: #2e2e33;
  --primary-text: #ffffff;
  --focus: #0b0b0c;
  --success: #1a7f37;
  --danger: #cf222e;
  --danger-bg: #fdf1f1;
  /* Sections, by their heading icons (Today's and a person's page). */
  --trips: #0284c7;
  --birthdays: #db2777;
  --anniversaries: #64748b;
  /* The memorial on the page of someone who's passed away: a grey stone,
     speckled and mottled, with words and a wreath raised off it. */
  --memorial-stone: #f6f5f3;
  --memorial-stone-low: #efeeeb;
  --memorial-grain: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.22 0 0 0 -0.08'/></filter><rect width='100%25' height='100%25' filter='url(%23g)'/></svg>");
  --memorial-mottle: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='800' height='300'><filter id='m'><feTurbulence type='fractalNoise' baseFrequency='0.006 0.016' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0 0 0 -0.03'/></filter><rect width='100%25' height='100%25' filter='url(%23m)'/></svg>");
  --memorial-ink: #75716b;
  --memorial-ink-strong: #5c5853;
  --memorial-relief: #a5a19a;
  --memorial-light: rgb(255 255 255 / 0.9);
  --memorial-shade: rgb(0 0 0 / 0.16);
  --memorial-ground: #b0a797;
  --tasks: #d97706;
  --check-ins: #7c3aed;
  --about: #059669;
  --mentions: #4f46e5;
  --emails: #0d9488;
  --relationships: #ea580c;
  /* Journal entry kinds: the icon in this colour, on a pale circle of it. */
  --journal-check-in: #7c3aed;
  --journal-note: #ea580c;
  --journal-mention: #16a34a;
  --backdrop: rgb(10 10 12 / 0.28);
  --shadow-popover: 0 0 0 1px rgb(0 0 0 / 0.07), 0 4px 12px rgb(0 0 0 / 0.07), 0 16px 40px rgb(0 0 0 / 0.08);

  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 12px;

  --sidebar-width: 15rem;
  --column: 50rem;          /* the centered content column, 800px */
  --side-pane: 22rem;       /* a person's page: the details pane on the right */
  --header-height: 3.25rem;
  --row-height: 2.25rem;    /* dense on desktop … */
  --control-height: 2rem;
  --control-height-sm: 1.75rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101012;
    --bg-sidebar: #0b0b0d;
    --bg-elevated: #19191c;
    --bg-input: #151517;
    --bg-hover: rgb(255 255 255 / 0.05);
    --bg-active: rgb(255 255 255 / 0.09);
    --border: #313137;
    --border-strong: #46464e;
    --text: #fafafb;
    --text-secondary: #c4c4cc;
    --text-tertiary: #8e8e98;
    --primary-bg: #fafafb;
    --primary-bg-hover: #ffffff;
    --primary-text: #101012;
    --focus: #fafafb;
    --success: #3fb950;
    --danger: #f85149;
    --danger-bg: rgb(248 81 73 / 0.12);
    --trips: #38bdf8;
    --birthdays: #f472b6;
    --anniversaries: #94a3b8;
    --memorial-stone: #29292b;
    --memorial-stone-low: #222224;
    --memorial-grain: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0.2 0 0 0 -0.08'/></filter><rect width='100%25' height='100%25' filter='url(%23g)'/></svg>");
    --memorial-mottle: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='800' height='300'><filter id='m'><feTurbulence type='fractalNoise' baseFrequency='0.006 0.016' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0.12 0 0 0 -0.04'/></filter><rect width='100%25' height='100%25' filter='url(%23m)'/></svg>");
    --memorial-ink: #a29e97;
    --memorial-ink-strong: #c3beb6;
    --memorial-relief: #6b6863;
    --memorial-light: rgb(255 255 255 / 0.09);
    --memorial-shade: rgb(0 0 0 / 0.7);
    --memorial-ground: #4a443c;
    --tasks: #fbbf24;
    --check-ins: #a78bfa;
    --about: #34d399;
    --mentions: #818cf8;
    --emails: #2dd4bf;
    --relationships: #fb923c;
    --journal-check-in: #a78bfa;
    --journal-note: #fb923c;
    --journal-mention: #4ade80;
    --backdrop: rgb(0 0 0 / 0.6);
    --shadow-popover: 0 0 0 1px rgb(255 255 255 / 0.07), 0 8px 24px rgb(0 0 0 / 0.45), 0 24px 56px rgb(0 0 0 / 0.35);
  }
}

@media (max-width: 48rem) {
  :root {
    --row-height: 2.75rem;  /* … comfortable for thumbs on a phone */
    --control-height: 2.5rem;
    --control-height-sm: 2.25rem;
  }
}

/* ── Base ───────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-height) + 1rem);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, p, dl, dd { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: var(--bg-active); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.icon { width: 1rem; height: 1rem; flex: none; }
/* The day of the month inside Today's calendar icon. */
.icon__day { font: 700 10px/1 var(--font-sans); font-variant-numeric: tabular-nums; letter-spacing: -0.04em; }

/* Read by screen readers, not shown. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.wordmark {
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: -0.015em;
}
.wordmark--large { font-size: var(--text-lg); }

/* ── App layout: sidebar + content ──────────────────────────────────────── */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}
.app--signed-out { display: block; }

/* Fixed-position things (drawer backdrop, toasts) leave the grid; the modal
   frame takes no space of its own (its dialog lives in the top layer). */
#modal { display: contents; }

.sidebar {
  grid-row: 1;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100dvh;
  padding: 0.75rem 0.5rem;
  border-right: 1px solid var(--border);
  background: var(--bg-sidebar);
}

.sidebar__header { display: flex; align-items: center; height: 2rem; padding: 0 0.5rem; }

.sidebar__nav { display: grid; gap: 1px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 1.875rem;
  padding: 0 0.5rem;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
}
button.nav-item { width: 100%; border: 0; background: none; text-align: left; cursor: pointer; }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item[aria-current] { background: var(--bg-active); color: var(--text); }
.nav-item__label { flex: 1; }

.sidebar__footer {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: auto;
  padding: 0 0 0 0.5rem;
}
.sidebar__footer form { display: contents; }
.sidebar__account {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-backdrop { display: none; }

.content { grid-column: 2; grid-row: 1; min-width: 0; container-type: inline-size; }

/* Phone: the sidebar becomes a drawer behind a menu button. */
@media (max-width: 48rem) {
  .app { display: block; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(18rem, 85vw);
    padding-top: max(0.75rem, env(safe-area-inset-top));
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    transform: translateX(-100%);
    transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
    visibility: hidden;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 29;
    background: var(--backdrop);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
  }

  .sidebar--open .sidebar { transform: none; visibility: visible; }
  .sidebar--open .sidebar-backdrop { opacity: 1; pointer-events: auto; }

  .nav-item { height: 2.5rem; font-size: var(--text-base); }
}

/* ── Page header and body ───────────────────────────────────────────────── */

.page-header {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
}

.page-header__inner {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  max-width: calc(var(--column) + 3rem);
  height: var(--header-height);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.page-header__heading { display: flex; align-items: baseline; gap: 0.625rem; min-width: 0; }
.page-header__title { font-size: var(--text-base); font-weight: 600; letter-spacing: -0.01em; }
.page-header__meta { min-width: 0; overflow: hidden; color: var(--text-tertiary); font-size: var(--text-sm); font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
/* "Friday, November 20", or "Fri, Nov 20" on phones (today_in_words). */
.date-short { display: none; }
.page-header__actions { display: flex; gap: 0.5rem; margin-left: auto; }
.page-header .page-header__menu,
.page-header .page-header__search { display: none; } /* beats .icon-button below */

/* "People / Ada Lovelace": the way back, then where you are. */
.breadcrumb { display: flex; align-items: center; gap: 0.5rem; min-width: 0; font-size: var(--text-base); }
.breadcrumb__parent { flex: none; color: var(--text-tertiary); font-weight: 500; }
.breadcrumb__parent:hover { color: var(--text); }
.breadcrumb__separator { flex: none; color: var(--border-strong); }
.breadcrumb__current { overflow: hidden; font-weight: 600; letter-spacing: -0.01em; text-overflow: ellipsis; white-space: nowrap; }

.page-body {
  max-width: calc(var(--column) + 3rem);
  margin: 0 auto;
  padding: 1rem 1.5rem calc(4rem + env(safe-area-inset-bottom));
}
/* A person's page. One column on phones and narrow windows, like any page:
   the person, their details and About, tasks, the journal, "Mentioned in",
   then Relationships. */
.person-page {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: calc(var(--column) + 3rem);
  margin: 0 auto;
  padding: 1rem 1.5rem calc(4rem + env(safe-area-inset-bottom));
}
.person-page__main, .person-page__side { display: contents; }
.person-page .profile { padding-bottom: 0; }
.person-page :is(.person-emails, .person-birthday, .person-passed-away, .person-location) { order: 1; }
.person-page .about { order: 1; }
.person-page .tasks { order: 2; }
.person-page .journal { order: 3; }
.person-page .mentioned-in { order: 4; }
.person-page .person-relationships { order: 5; }

/* Once there's room, two panes under a top bar that spans both: the person,
   tasks and journal on the left (centred in it), and a details pane on the
   right, full height, behind a divider. */
@container (min-width: 56rem) {
  .page-header--wide .page-header__inner { max-width: none; }
  .person-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--side-pane);
    gap: 0;
    max-width: none;
    min-height: calc(100dvh - var(--header-height));
    padding: 0;
  }
  .person-page__main {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    width: 100%;
    max-width: calc(var(--column) + 3rem);
    margin: 0 auto;
    padding: 1rem 1.5rem calc(4rem + env(safe-area-inset-bottom));
  }
  .person-page__side {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 1.75rem 1.5rem calc(4rem + env(safe-area-inset-bottom));
    border-left: 1px solid var(--border);
  }
}

@media (max-width: 48rem) {
  .page-header { padding-top: env(safe-area-inset-top); }
  .page-header__inner, .page-body, .person-page { padding-left: 1rem; padding-right: 1rem; }
  .page-header__inner { gap: 0.375rem; }
  .page-header .page-header__menu { display: inline-grid; margin-left: -0.625rem; }
  .page-header .page-header__search { display: inline-grid; }
}

/* ── Controls ───────────────────────────────────────────────────────────── */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: var(--control-height);
  padding: 0 0.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 100ms ease, border-color 100ms ease;
}

.button--primary { background: var(--primary-bg); color: var(--primary-text); }
.button--primary:hover { background: var(--primary-bg-hover); }

.button--secondary { background: transparent; border-color: var(--border-strong); color: var(--text); }
.button--secondary:hover { background: var(--bg-hover); }

.button--small { height: var(--control-height-sm); padding: 0 0.625rem; }
.button--ghost { background: transparent; color: var(--text-secondary); }
.button--ghost:hover { background: var(--bg-hover); color: var(--text); }
.button--block { width: 100%; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}
.icon-button:hover { background: var(--bg-hover); color: var(--text); }

@media (max-width: 48rem) {
  .icon-button { width: 2.5rem; height: 2.5rem; }
}

/* Key caps */

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 0.25rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font: 500 0.6875rem/1 var(--font-mono);
}

.hotkey-hint { display: inline-flex; gap: 0.125rem; margin-left: 0.125rem; }
.hotkey-hint:empty { display: none; }
.hotkey-then { color: var(--text-tertiary); font-size: var(--text-xs); }
.button--primary kbd {
  border-color: color-mix(in srgb, var(--primary-text) 28%, transparent);
  color: color-mix(in srgb, var(--primary-text) 72%, transparent);
}

/* Shortcuts mean nothing without a keyboard: hide hints on touch-only devices. */
@media (hover: none) {
  .hotkey-hint { display: none; }
}

/* ── Forms ──────────────────────────────────────────────────────────────── */

.form { display: grid; gap: 1rem; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 0.75rem; } /* a hint under one field doesn't stretch the other */

.field { display: grid; gap: 0.375rem; }
.field label, .field__label { color: var(--text-secondary); font-size: var(--text-xs); font-weight: 500; }
.field input, .field select {
  width: 100%;
  height: var(--control-height);
  padding: 0 0.625rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: var(--text-base);
  transition: border-color 100ms ease, box-shadow 100ms ease;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--bg-active);
}
.field_with_errors { display: contents; }
.field__hint { margin: 0; color: var(--text-tertiary); font-size: var(--text-xs); }

/* Emails in the Edit dialog: a row each (handle, address, label, ×), in
   order, then "Add email". A row being dragged fades. */
.emails-field { display: grid; gap: 0.375rem; }
.emails-field:not(:has(.email-row:not([hidden]))) { display: none; }
.email-row { display: flex; align-items: center; gap: 0.375rem; }
.email-row.is-dragging { opacity: 0.4; }
.email-row__handle { display: grid; flex: none; place-items: center; width: 1rem; color: var(--text-tertiary); cursor: grab; touch-action: none; }
.email-row__handle .icon { width: 0.875rem; height: 0.875rem; }
.email-row__address { flex: 1; min-width: 0; }
.email-row__label { flex: none; width: 7rem; }
.email-row__remove { flex: none; }
.emails-field__add { justify-self: start; margin-left: -0.625rem; }

/* A plain select, drawn like the text fields, with our own chevron. */
.select { position: relative; }
.select select { appearance: none; padding-right: 2rem; cursor: pointer; }
.select .icon { position: absolute; top: 50%; right: 0.625rem; translate: 0 -50%; color: var(--text-tertiary); pointer-events: none; }

/* Reversed so the primary button can come first in the HTML (see people/_form). */
.form__actions {
  display: flex;
  flex-direction: row-reverse;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.5rem;
}

/* Validation errors stay inline, next to the form they belong to. */
.form-errors {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: var(--text-sm);
  font-weight: 500;
}
.form-errors p + p { margin-top: 0.125rem; }

@media (max-width: 48rem) {
  .form__row { grid-template-columns: 1fr; row-gap: 1.25rem; } /* same rhythm as the rest of the form */
  .field input, .field select { font-size: var(--text-lg); } /* 16px stops iOS zooming in on focus */
  .form__actions .button { flex: 1; }
}

/* ── People ─────────────────────────────────────────────────────────────── */

/* Rows keep 0.5rem of padding for their highlight, and pull out by the same
   amount so names line up with the page title. One list per first letter,
   separated by a little space instead of a heading. */
.people-list { margin: 0 -0.5rem; padding: 0; list-style: none; }
.people-list + .people-list { margin-top: 1rem; }

.person-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: var(--row-height);
  padding: 0 0.5rem;
  border-radius: var(--radius);
}
.person-row:hover { background: var(--bg-hover); }
[data-keyboard] .person-row:hover:not(:focus-visible) { background: transparent; }
/* The keyboard selection (j/k) is just focus, drawn as a filled row. */
.person-row:focus-visible { outline: none; background: var(--bg-active); }
.person-row__name { flex: 0 1 auto; min-width: 0; overflow-wrap: anywhere; }
.person-row__first { font-weight: 500; }
/* The cross after the name of someone who's passed away (passed_away_mark). */
.passed-mark { margin-left: 0.3em; color: var(--text-tertiary); font-weight: 400; }
/* "You" after your name where people are picked (menus, mentions). */
:is(.command-menu__label, .person-field__option, .people-picker__option, .mention-option__name) .tag { margin-left: 0.5em; font-weight: 500; }
.person-row__nickname {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--text-tertiary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* "You", by your own name. */
.tag {
  display: inline-flex;
  flex: none;
  align-items: center;
  height: 1.25rem;
  padding: 0 0.375rem;
  border-radius: var(--radius-sm);
  background: var(--bg-active);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0;
  vertical-align: middle;
}

.person-row__status { flex: none; margin-left: auto; padding-left: 1rem; color: var(--text-tertiary); font-size: var(--text-sm); }

.person-row--new, .person-row:target { animation: row-highlight 2.4s ease-out; }
@keyframes row-highlight {
  0%, 35% { background: var(--bg-active); }
  100% { background: transparent; }
}

.avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  background: var(--bg-active);
  color: var(--text-secondary);
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.avatar--large { width: 3.5rem; height: 3.5rem; font-size: var(--text-lg); letter-spacing: 0.01em; }
@media (max-width: 48rem) {
  .avatar:not(.avatar--large) { width: 1.75rem; height: 1.75rem; font-size: 0.625rem; }
}

/* A person's page: who they are, at the top. More sections stack below. */
.profile { display: flex; align-items: center; gap: 1rem; padding: 1.5rem 0 2rem; }
.profile__names { min-width: 0; }

/* The memorial, above the name of someone who's passed away (_memorial):
   a grey stone, speckled like granite, with their years in a laurel wreath.
   Everything on it is the stone's own greys, raised a little: lit from
   above, with a shadow under. */
.memorial {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  position: relative;
  margin-top: 1.5rem;
  padding: 1.25rem 1rem 1.75rem;
  border-radius: 1.75rem 1.75rem 0 0; /* rounded shoulders, square at the foot: a headstone */
  background: var(--memorial-grain), var(--memorial-mottle), linear-gradient(180deg, var(--memorial-stone), var(--memorial-stone-low));
  background-size: auto, cover, auto;
  background-repeat: repeat, no-repeat, no-repeat;
  box-shadow: inset 0 1px 0 var(--memorial-light), inset 0 -1px 0 var(--memorial-shade);
  color: var(--memorial-ink);
}
.memorial + .profile { padding-top: 0; }
/* The ground it stands in: a strip of grass across its foot, a little wider
   than the stone, fading out at the ends. */
.memorial::after {
  content: "";
  position: absolute;
  inset: auto -1rem 0;
  height: 1.75rem;
  background: var(--memorial-ground);
  --memorial-grass: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='28'><path d='M0 28Q-0.3 16.2 -1.3 6.6Q1.1 16.2 2.2 28ZM2.5 28Q2.3 20.5 1.5 14.3Q3.8 20.5 4.9 28ZM4.3 28Q4.8 17.7 5.7 9.3Q6.2 17.7 6.6 28ZM6.5 28Q7.2 17.6 8.4 9.1Q8.6 17.6 8.8 28ZM8.6 28Q10.2 18.5 13.6 10.8Q11.6 18.5 11 28ZM18 28Q17.6 24.3 16.2 21.2Q19 24.3 20.4 28ZM20.2 28Q20.4 23 20.4 19Q22 23 22.9 28ZM23 28Q23.9 23.8 25.6 20.4Q25.5 23.8 25.6 28ZM23 28Q24.2 23.1 26.6 19.2Q25.7 23.1 25.5 28ZM34.9 28Q34.6 24 33.6 20.8Q36.4 24 37.8 28ZM37.1 28Q37.6 22.8 38.2 18.6Q39.4 22.8 40.1 28ZM39.4 28Q40.7 22.8 43.3 18.6Q42.4 22.8 42.2 28ZM52.9 28Q52.2 20.5 50 14.4Q53.9 20.5 55.8 28ZM55 28Q55.1 17.7 54.9 9.2Q56.8 17.7 57.9 28ZM56.8 28Q57 19.6 57.1 12.7Q58.7 19.6 59.6 28ZM59.9 28Q60.5 17.5 61.5 9Q62.1 17.5 62.5 28ZM60.9 28Q62.2 21.4 64.8 15.9Q63.7 21.4 63.4 28ZM64.4 28Q66.2 18.7 69.6 11.1Q68.1 18.7 67.6 28ZM68.6 28Q68.1 22.1 66.7 17.2Q69.7 22.1 71.3 28ZM70.6 28Q70.9 22.1 71.1 17.3Q72.4 22.1 73.2 28ZM72.8 28Q73.8 21.8 75.6 16.7Q75.5 21.8 75.6 28ZM75.7 28Q77 21.4 79.6 16Q78.9 21.4 78.8 28ZM81.4 28Q80.4 24.3 77.7 21.2Q81.9 24.3 83.8 28ZM83 28Q82.5 24.4 80.8 21.5Q83.9 24.4 85.4 28ZM86.4 28Q86.6 24.3 86.7 21.3Q88.3 24.3 89.2 28ZM87.3 28Q88.1 22.4 89.6 17.9Q89.5 22.4 89.6 28ZM89.7 28Q90.8 24.4 92.8 21.5Q92.2 24.4 92 28ZM93.5 28Q95.8 24.6 100.6 21.9Q97.2 24.6 95.9 28ZM97.6 28Q97.5 21.3 96.8 15.8Q99.2 21.3 100.4 28ZM100.1 28Q100.6 20.6 101.4 14.6Q102.1 20.6 102.6 28ZM102 28Q103.1 17.7 105 9.3Q104.7 17.7 104.9 28ZM110 28Q109.3 20.1 107.3 13.5Q111 20.1 112.7 28ZM111.9 28Q111.3 18.4 109.5 10.5Q112.7 18.4 114.3 28ZM115.1 28Q115.3 17 115.3 8.1Q117.2 17 118.3 28ZM115.5 28Q116.5 20.8 118.4 14.9Q117.9 20.8 117.9 28ZM119.8 28Q121 18.6 123.5 10.8Q122.6 18.6 122.4 28ZM121.3 28Q123.5 17.9 128.1 9.6Q125.3 17.9 124.4 28ZM126.4 28Q125.5 23.3 122.9 19.5Q127.3 23.3 129.3 28ZM128.2 28Q128.2 24.5 127.8 21.7Q130.1 24.5 131.4 28ZM130.9 28Q131.8 23 133.2 18.8Q133.4 23 133.7 28ZM131.7 28Q133 24.5 135.7 21.7Q134.7 24.5 134.4 28ZM133.2 28Q135.1 24.2 138.9 21.1Q136.8 24.2 136.2 28ZM146.9 28Q146.9 21.9 146.5 17Q148.4 21.9 149.4 28ZM148.6 28Q149.3 22.7 150.4 18.4Q151.2 22.7 151.8 28ZM151.9 28Q153 20.8 155.1 15Q154.6 20.8 154.5 28Z'/><rect y='24' width='160' height='4'/></svg>");
  -webkit-mask: var(--memorial-grass) repeat-x bottom / 10rem 1.75rem, linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  -webkit-mask-composite: source-in;
  mask: var(--memorial-grass) repeat-x bottom / 10rem 1.75rem, linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  mask-composite: intersect;
  pointer-events: none;
}
.memorial__words { min-width: 0; text-align: center; text-shadow: 0 -1px 0 var(--memorial-light), 0 1px 1px var(--memorial-shade); }
.memorial__words p { margin: 0; }
.memorial__words p + p { margin-top: 0.25rem; }
.memorial__kicker { font-size: var(--text-xs); font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; }
.memorial__years { color: var(--memorial-ink-strong); font-size: 1.625rem; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; }
.memorial__laurel {
  flex: none;
  width: 3.25rem;
  height: 6.5rem;
  overflow: visible;
  filter: drop-shadow(0 -1px 0 var(--memorial-light)) drop-shadow(0 1px 1px var(--memorial-shade));
}
.memorial__stem { fill: none; stroke: var(--memorial-relief); stroke-width: 1.4; stroke-linecap: round; }
.memorial__leaf { fill: var(--memorial-relief); }
@media (max-width: 48rem) {
  .memorial { gap: 0.5rem; padding-inline: 0.75rem; }
  .memorial__laurel { width: 2.75rem; height: 5.5rem; }
  .memorial__years { font-size: 1.375rem; }
}
.profile__name { font-size: var(--text-2xl); font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; overflow-wrap: anywhere; }
.profile__nickname { margin-top: 0.125rem; color: var(--text-tertiary); font-size: var(--text-base); overflow-wrap: anywhere; }

/* "↻ Every 3 months · Last check-in Sep 12 · Due in 3 weeks" */
.check-in-status { display: flex; flex-wrap: wrap; gap: 0.125rem 0.5rem; margin-top: 0.5rem; color: var(--text-tertiary); font-size: var(--text-sm); }
.check-in-status:not(:has(span)) { display: none; }
.check-in-status > span { display: inline-flex; align-items: center; gap: 0.3125rem; }
.check-in-status > span + span::before { content: "·"; margin-right: 0.1875rem; color: var(--text-tertiary); }
.check-in-status .icon { width: 0.875rem; height: 0.875rem; }
.check-in-status__overdue { color: var(--text); font-weight: 500; }

/* About: a few lines, edited in place. It looks like text until you hover
   or type in it, and grows with what you write. */
.about { margin: 0 -0.5rem; }

/* A small heading over a section ("About", "Journal"…), with its icon in the
   section's colour; the rest stays grey. The same kind of thing has the same
   colour everywhere: places (trips, a location) blue, check-ins and the
   journal violet, tasks amber, birthdays pink. */
.section-label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.375rem;
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-weight: 500;
}
.section-label .icon { flex: none; width: 0.875rem; height: 0.875rem; }
.section-label--trips .icon, .section-label--location .icon { color: var(--trips); }
.section-label--birthdays .icon { color: var(--birthdays); }
.section-label--anniversaries .icon { color: var(--anniversaries); }
.section-label--tasks .icon { color: var(--tasks); }
.section-label--check-ins .icon, .section-label--journal .icon { color: var(--check-ins); }
.section-label--about .icon { color: var(--about); }
.section-label--mentions .icon { color: var(--mentions); }
.section-label--emails .icon { color: var(--emails); }
.section-label--relationships .icon { color: var(--relationships); }
/* About pulls out by 0.5rem for its hover background; its label steps back in. */
.about .section-label { margin-bottom: 0.125rem; padding: 0 0.5rem; }
.editor--about { border: 0; border-radius: var(--radius); background: transparent; }
.editor--about .lexxy-editor__content { min-height: 2.25rem; padding: 0.375rem 0.5rem; }
.editor--about:hover, .editor--about:focus-within { background: var(--bg-hover); }
.about__error { padding: 0.25rem 0.5rem 0; color: var(--danger); font-size: var(--text-sm); }

/* Journal: a heading with "New entry", then entries, newest first. */


.section-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.375rem; }
.section-header .section-label { margin-bottom: 0; }

.journal__empty, .section-empty { color: var(--text-tertiary); font-size: var(--text-sm); }
.journal__empty kbd, .section-empty kbd { vertical-align: 1px; }

/* The entry and task dialogs: the editor drawn like our text fields. */
.editor--journal, .editor--task {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-input);
  transition: border-color 100ms ease, box-shadow 100ms ease;
}
lexxy-editor.editor, lexxy-editor.editor:focus-visible, .editor .lexxy-editor__content:focus-visible { outline: none; }
.editor--journal:focus-within, .editor--task:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px var(--bg-active); }
.editor--journal .lexxy-editor__content { min-height: 8.5rem; max-height: 50vh; overflow-y: auto; padding: 0.5rem 0.625rem; }
.editor--task .lexxy-editor__content { min-height: 0; padding: 0.4375rem 0.625rem; }

/* The Location field: a text box to find a place, and the list of places. */
.location-picker { position: relative; }
.location-picker input { padding-right: 2rem; }
.location-picker__clear {
  position: absolute;
  top: 50%;
  right: 0.375rem;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  translate: 0 -50%;
}
.location-picker__clear:hover { background: var(--bg-hover); color: var(--text); }
.location-picker__clear .icon { width: 0.875rem; height: 0.875rem; }
.location-picker__list {
  position: fixed;
  inset: auto;
  max-height: 16rem;
  margin: 0;
  padding: 0.25rem;
  overflow-y: auto;
  border: 0;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-popover);
  color: var(--text);
  list-style: none;
}
.location-picker__option { padding: 0.375rem 0.5rem; border-radius: var(--radius-sm); font-size: var(--text-sm); cursor: pointer; }
.location-picker__option[aria-selected="true"] { background: var(--bg-active); }
.location-picker__empty { padding: 0.375rem 0.5rem; color: var(--text-tertiary); font-size: var(--text-sm); }

/* Their birthday and where they live: a heading like About's, then the
   date or place, set like About's text. */
:is(.person-birthday, .person-passed-away, .person-location) p { margin: 0; line-height: 1.6; }
.person-passed-away__unknown { color: var(--text-tertiary); }

/* Their emails: each a link to write to them, with its label after it. */
.person-emails__list { display: grid; gap: 0.125rem; margin: 0; padding: 0; list-style: none; line-height: 1.6; }
.person-emails__address { color: var(--text); overflow-wrap: anywhere; }
.person-emails__address:hover { text-decoration: underline; text-underline-offset: 2px; }
.person-emails__label { color: var(--text-tertiary); font-size: var(--text-sm); }

/* Who they're related to: each name a link to them, then how ("Wife"), then
   a pencil to change it (there when you point at the row, or always on touch). */
.icon-button--small { width: 1.5rem; height: 1.5rem; color: var(--text-tertiary); }
.icon-button--small .icon { width: 0.875rem; height: 0.875rem; }
.section-header .icon-button > .tooltip { left: auto; right: 0; transform: translateY(2px); }
.section-header .icon-button:is(:hover, :focus-visible) > .tooltip { transform: none; }
.relationships { display: grid; margin: 0 -0.375rem 0 0; padding: 0; list-style: none; line-height: 1.6; }
.relationship { display: flex; align-items: baseline; gap: 0.5rem; min-height: 1.75rem; }
.relationship__name { min-width: 0; color: var(--text); overflow-wrap: anywhere; }
.relationship__name:hover { text-decoration: underline; text-underline-offset: 2px; }
.relationship__role { flex: none; color: var(--text-tertiary); font-size: var(--text-sm); }
/* In groups under small headings (Relationship::Tree); someone who comes
   through another stands under them, behind a line. */
.relationship-groups { display: grid; gap: 1rem; margin-top: 0.75rem; }
.relationship-group__title { margin: 0 0 0.375rem; color: var(--text-tertiary); font-size: var(--text-xs); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.relationships--under { margin: 0 0 0.25rem 0.375rem; padding-left: 0.875rem; border-left: 1px solid var(--border); }
.relationship__edit { flex: none; align-self: center; margin-left: auto; opacity: 0; }
.relationship:hover .relationship__edit, .relationship__edit:focus-visible { opacity: 1; }
@media (hover: none) { .relationship__edit { opacity: 1; } }

/* The relationship dialog: who (picked like a place, see .location-picker),
   then how they're related. */
.person-field__option { display: flex; align-items: center; gap: 0.5rem; }
.person-field__option .avatar { width: 1.375rem; height: 1.375rem; font-size: 0.5625rem; }
.person-field__meta { margin-left: auto; color: var(--text-tertiary); font-size: var(--text-xs); }
.person-field__new { color: var(--text-secondary); }
.person-field__new .icon { width: 1.375rem; height: 0.875rem; color: var(--text-tertiary); }
.relationship-form__who { margin: 0; font-weight: 500; }
/* "☑ Also Lana's son", under how they're related. */
.co-parents { display: grid; gap: 0.375rem; margin-top: -0.25rem; }
.co-parent { display: flex; align-items: center; gap: 0.5rem; color: var(--text-secondary); font-size: var(--text-sm); cursor: pointer; }
.co-parent input { flex: none; width: 1rem; height: 1rem; margin: 0; accent-color: var(--primary-bg); cursor: pointer; }

/* Who else an entry is with: chips, then "Add person". */
.with { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; font-size: var(--text-sm); }
.with__label { color: var(--text-tertiary); font-weight: 500; }
.with__people { display: contents; margin: 0; padding: 0; list-style: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  height: 1.625rem;
  padding: 0 0.125rem 0 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-active);
  color: var(--text);
  font-weight: 500;
}
.chip__remove {
  display: grid;
  place-items: center;
  width: 1.375rem;
  height: 1.375rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
}
.chip__remove:hover { background: var(--bg-hover); color: var(--text); }
.chip__remove .icon { width: 0.75rem; height: 0.75rem; }
.with__add {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 1.625rem;
  padding: 0 0.5rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-secondary);
  font: inherit;
  cursor: pointer;
}
.with__add:hover, .with__add[aria-expanded="true"] { background: var(--bg-hover); color: var(--text); }
.with__add .icon { width: 0.875rem; height: 0.875rem; }

.people-picker {
  position: fixed;
  inset: auto;
  width: 16rem;
  margin: 0;
  padding: 0.375rem;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-popover);
  color: var(--text);
}
.people-picker:popover-open { animation: modal-in 120ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.people-picker__query {
  width: 100%;
  height: var(--control-height);
  padding: 0 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}
.people-picker__query:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.people-picker__results { max-height: 14rem; margin: 0.375rem 0 0; padding: 0; overflow-y: auto; list-style: none; }
.people-picker__option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 2rem;
  padding: 0 0.375rem;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  cursor: pointer;
}
.people-picker__option[aria-selected="true"] { background: var(--bg-active); }
.people-picker__option .avatar { width: 1.375rem; height: 1.375rem; font-size: 0.5625rem; }
.people-picker__meta { margin-left: auto; color: var(--text-tertiary); font-size: var(--text-xs); }
.people-picker__empty { padding: 0.5rem 0.375rem; color: var(--text-tertiary); font-size: var(--text-sm); }

.dialog-form__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }

/* Two or three choices side by side, one picked (a task's Date / Place). */
.segmented { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--radius); background: var(--bg-hover); }
.segmented__choice {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  height: calc(var(--control-height-sm) - 4px);
  padding: 0 0.5rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}
.segmented__choice:hover { color: var(--text); }
.segmented__choice[aria-checked="true"] { background: var(--bg); color: var(--text); font-weight: 500; box-shadow: 0 0 0 1px var(--border); }
.segmented__choice .icon { width: 0.875rem; height: 0.875rem; }
.dialog-form__submit { margin-left: auto; }
.dialog-form__delete { margin-left: auto; color: var(--danger); }

/* Deleting someone: a red button, off until their name is typed. */
.button--danger { border-color: transparent; background: var(--danger); color: #ffffff; }
.button--danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 88%, #000000); }
.button:disabled { opacity: 0.45; cursor: not-allowed; }
.passing__unmark { color: var(--text-secondary); }
.deletion__text { margin: 0; color: var(--text-secondary); font-size: var(--text-sm); line-height: 1.55; }
/* ••• by Edit on a person's page: just the icon, and a menu under it. */
.icon-button:has(+ .menu:popover-open) { background: var(--bg-active); color: var(--text); }
.menu a.menu__item { display: block; color: inherit; text-decoration: none; }
.menu a.menu__item--danger { color: var(--danger); }
.mention--deleted { cursor: default; }
.dialog-form__delete + .dialog-form__submit { margin-left: 0; }


/* Date picker: a button showing the date, and a panel with a box to type a
   date into and a month calendar. The panel is a popover, so it sits above
   dialogs; date_picker_controller.js positions it under the button. */
.date-picker__button {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: var(--control-height-sm);
  padding: 0 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
}
.date-picker__button .icon { width: 0.875rem; height: 0.875rem; }
.date-picker__button:hover, .date-picker__button[aria-expanded="true"] { background: var(--bg-hover); color: var(--text); }

.date-picker__panel {
  position: fixed;
  inset: auto;
  width: 16.5rem;
  margin: 0;
  padding: 0.5rem;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-popover);
}
.date-picker__panel:popover-open { animation: modal-in 120ms cubic-bezier(0.2, 0.8, 0.2, 1); }

.date-picker__query {
  width: 100%;
  height: var(--control-height);
  padding: 0 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}
.date-picker__query::placeholder { color: var(--text-tertiary); }
.date-picker__query:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.date-picker__query[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }

.date-picker__month { display: flex; align-items: center; justify-content: space-between; margin: 0.5rem 0 0.25rem; }
.date-picker__month-name { font-size: var(--text-sm); font-weight: 600; }

.date-picker__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.date-picker__weekday { padding: 0.25rem 0; color: var(--text-tertiary); font-size: 0.6875rem; font-weight: 500; text-align: center; }

.date-picker__day {
  position: relative;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.date-picker__day:hover { background: var(--bg-hover); }
.date-picker__day--outside { color: var(--text-tertiary); }
.date-picker__day--today { font-weight: 700; }
.date-picker__day--today::after {
  content: "";
  position: absolute;
  bottom: 0.25rem;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  translate: -50% 0;
}
.date-picker__day--highlighted { background: var(--bg-active); }
.date-picker__clear {
  width: 100%;
  margin-top: 0.375rem;
  padding: 0.375rem;
  border: 0;
  border-top: 1px solid var(--border);
  background: none;
  color: var(--text-secondary);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}
.date-picker__clear:hover { color: var(--text); }
.date-picker__day[aria-pressed="true"] { background: var(--primary-bg); color: var(--primary-text); }

/* Two-way switch built from radio buttons, so Tab reaches it and ←/→ flip it. */
.segmented { display: inline-flex; margin: 0; padding: 2px; border: 0; border-radius: var(--radius); background: var(--bg-active); }
.segmented__input { position: absolute; opacity: 0; pointer-events: none; }
.segmented__option {
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
}
.segmented__option:hover { color: var(--text); }
.segmented__input:checked + .segmented__option {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--border), 0 1px 2px rgb(0 0 0 / 0.06);
}
.segmented__input:focus-visible + .segmented__option { outline: 2px solid var(--focus); outline-offset: 1px; }

.journal__entries { display: grid; margin-top: 0.5rem; }

/* A task: a square checkbox, then the text (a link to edit it) and its due date. */
.tasks__list { display: grid; gap: 1px; margin-top: 0.25rem; }
.task { position: relative; display: flex; align-items: baseline; gap: 0.625rem; margin: 0 -0.5rem; padding: 0.4375rem 0.5rem; border-radius: var(--radius); }
.task:hover, .task:focus-within { background: var(--bg-hover); }
.task__checkbox { position: relative; z-index: 1; align-self: center; }
.task__done { display: contents; }
.task__checkbox {
  display: grid;
  flex: none;
  place-items: center;
  width: 1rem;
  height: 1rem;
  padding: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 2px;
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
}
.task__checkbox .icon { width: 0.75rem; height: 0.75rem; opacity: 0; }
.task__checkbox:hover { border-color: var(--text-secondary); }
.task__checkbox:hover .icon { opacity: 1; }
.task__checkbox:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* The link to edit it lies over the whole row; links in the text sit above it. */
.task__link { position: absolute; inset: 0; border-radius: inherit; }
.task__link:focus-visible { outline: none; }
.task__body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.task__body a { position: relative; z-index: 1; }
.task__due { flex: none; color: var(--text-tertiary); font-size: var(--text-sm); }
.task__due--overdue { color: var(--text); font-weight: 500; }
.task--new { animation: entry-in 2.4s ease-out; }
/* On Today, who the task is for comes first: "Pero · Return the olive shaker". */
.task__person { position: relative; z-index: 1; flex: none; max-width: 40%; overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.task__person:hover { text-decoration: underline; text-underline-offset: 2px; }
.task__separator { flex: none; margin: 0 -0.25rem; color: var(--text-tertiary); }

/* ── Today ──────────────────────────────────────────────────────────────── */
/* Tasks due this week, then people due a check-in. */
.today { display: flex; flex-direction: column; gap: 2.75rem; padding-top: 1.75rem; }
.today .section-label { margin-bottom: 0.75rem; }

/* While moving by keyboard (j/k), only the selected row looks selected. */
.today[data-keyboard] :is(.birthday, .task, .check-in):hover:not(:focus-within) { background: transparent; }
.today .task:has(.task__link:focus-visible), .check-in:has(.check-in__link:focus-visible),
.birthday:has(.birthday__link:focus-visible) { background: var(--bg-active); }

/* Birthdays this week: who, how old they turn, and when (today's stands out).
   Just a reminder: the whole row is a link to their page. */
.birthdays { display: grid; gap: 1px; }
.birthday { position: relative; display: flex; align-items: center; gap: 0.625rem; min-height: var(--row-height); margin: 0 -0.5rem; padding: 0.25rem 0.5rem; border-radius: var(--radius); }
.birthday:hover { background: var(--bg-hover); }
.birthday__name { min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.birthday__age { flex: none; color: var(--text-tertiary); font-size: var(--text-sm); }
.birthday__when { flex: none; margin-left: auto; color: var(--text-tertiary); font-size: var(--text-sm); }
.birthday__link { position: absolute; inset: 0; border-radius: inherit; }
.birthday__link:focus-visible { outline: none; }

/* On someone's birthday, a celebration: the row in a faint pink glow,
   confetti falling in between how old they turn and when, and a cake by
   "Today". */
.birthday--today { background: linear-gradient(90deg, color-mix(in srgb, var(--birthdays) 7%, transparent), color-mix(in srgb, var(--birthdays) 1.5%, transparent)); }
.birthday--today:hover { background: linear-gradient(90deg, color-mix(in srgb, var(--birthdays) 11%, transparent), color-mix(in srgb, var(--birthdays) 3%, transparent)); }
.today[data-keyboard] .birthday--today:hover:not(:focus-within) { background: linear-gradient(90deg, color-mix(in srgb, var(--birthdays) 7%, transparent), color-mix(in srgb, var(--birthdays) 1.5%, transparent)); }
.birthday--today .birthday__when { color: var(--birthdays); font-weight: 500; }
.birthday__when .icon { width: 0.875rem; height: 0.875rem; margin-right: 0.3125rem; vertical-align: -0.125rem; }
/* Confetti fills the room between how old they turn and when, never over words. */
.birthday__confetti { position: relative; flex: 1; align-self: stretch; min-width: 0; overflow: hidden; pointer-events: none; mask-image: linear-gradient(90deg, transparent, black 18%, black 82%, transparent); }
.birthday__bit { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%) rotate(var(--turn)); opacity: 0.9; animation: confetti-in 0.9s var(--delay) cubic-bezier(0.2, 0.7, 0.3, 1) backwards; }
.birthday__bit--strip { width: 0.4375rem; height: 0.15625rem; border-radius: 1px; }
.birthday__bit--dot { width: 0.25rem; height: 0.25rem; border-radius: 50%; }
.birthday__bit--1 { background: var(--birthdays); }
.birthday__bit--2 { background: #f59e0b; }
.birthday__bit--3 { background: #8b5cf6; }
.birthday__bit--4 { background: var(--trips); }
@keyframes confetti-in {
  from { opacity: 0; transform: translate(-50%, calc(-50% - 0.75rem)) rotate(calc(var(--turn) - 120deg)); }
}

/* Someone due a check-in: who, how often, how late, and what to do about it. The
   row is a link to their page (laid over it); the button sits above it. */
.check-ins { display: grid; gap: 1px; }
.check-in { position: relative; display: flex; align-items: center; gap: 0.625rem; min-height: var(--row-height); margin: 0 -0.5rem; padding: 0.25rem 0.5rem; border-radius: var(--radius); }
.check-in:hover, .check-in:focus-within { background: var(--bg-hover); }
.check-in__name { min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.check-in__cadence { flex: none; color: var(--text-tertiary); font-size: var(--text-sm); }
.check-in__due { flex: none; margin-left: auto; color: var(--text-tertiary); font-size: var(--text-sm); }
.check-in__due--overdue { color: var(--text); font-weight: 500; }
.check-in__link { position: absolute; inset: 0; border-radius: inherit; }
.check-in__link:focus-visible { outline: none; }

/* Trips on Today, under one heading. Each is a line like a row ("Split ·
   Nov 20–23", and "in 5 weeks" at the end) until planning starts; then its
   people follow, like "Check-ins". */
.today__trips:not(:has(*)) { display: none; } /* no trips: only whitespace in it */
.trips { display: grid; gap: 1rem; }
.trip__heading { display: flex; align-items: center; gap: 0.5rem; min-height: var(--row-height); margin: 0; font-size: var(--text-base); font-weight: 400; }
.trip__edit { min-width: 0; color: var(--text); overflow-wrap: anywhere; }
.trip__heading .flag { flex: none; font-size: var(--text-base); line-height: 1; }
.trip__edit:hover { text-decoration: underline; text-underline-offset: 2px; }
.trip__place { font-weight: 500; }
.trip__when { flex: none; margin-left: auto; color: var(--text-tertiary); font-size: var(--text-sm); }
.trip__waiting { color: var(--text-secondary); }
/* In planning, the trip's people are tucked in under it, behind a line. */
.trip--planning :is(.check-ins, .trip__nearby) { margin-left: 0.4375rem; padding-left: 1.25rem; border-left: 1px solid var(--border); }
.trip__nearby { padding-top: 0.5rem; color: var(--text-secondary); font-size: var(--text-sm); }
.trip__nearby summary { width: fit-content; cursor: pointer; }
.trip__nearby summary:hover { color: var(--text); }
.trip__people { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin: 0.5rem 0 0; padding: 0; list-style: none; }
.trip__person { color: var(--text); }
.trip__person:hover { text-decoration: underline; text-underline-offset: 2px; }
.trip-form__to { color: var(--text-tertiary); }

/* Done, Log check-in, Snooze: above the row's link. Each one's key is in a
   tooltip (see .tooltip), so nothing shifts as the mouse moves around. */
.check-in__actions { position: relative; z-index: 1; display: flex; flex: none; gap: 0.375rem; }
.check-in__form { display: contents; }

/* A tooltip: a small dark label above its button while you point at it (or
   it has keyboard focus), after a moment. Says what it does and its key. */
.tooltip {
  position: absolute;
  bottom: calc(100% + 0.375rem);
  left: 50%;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.4375rem;
  border-radius: var(--radius-sm);
  background: var(--primary-bg);
  color: var(--primary-text);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transform: translate(-50%, 2px);
  transition: opacity 100ms, transform 100ms, visibility 100ms;
}
.tooltip kbd {
  border-color: color-mix(in srgb, var(--primary-text) 28%, transparent);
  color: color-mix(in srgb, var(--primary-text) 72%, transparent);
}
.button:has(> .tooltip), .nav-item:has(> .tooltip), .icon-button:has(> .tooltip) { position: relative; }
:is(.button, .nav-item, .icon-button):is(:hover, :focus-visible) > .tooltip {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, 0);
  transition-delay: 400ms;
}
/* In the top bar there's no room above: below instead, lined up with the
   button's right edge so it stays inside the window. */
.page-header .tooltip { top: calc(100% + 0.375rem); bottom: auto; left: auto; right: 0; transform: translateY(-2px); }
.page-header :is(:hover, :focus-visible) > .tooltip { transform: none; }
/* In the sidebar: to the right, beside the item. */
.nav-item > .tooltip { top: 50%; bottom: auto; left: calc(100% + 0.5rem); transform: translate(-2px, -50%); }
.nav-item:is(:hover, :focus-visible) > .tooltip { transform: translate(0, -50%); }
/* Shortcuts mean nothing without a mouse and keyboard. */
@media (hover: none) {
  .tooltip { display: none; }
}

/* A small menu of choices (Snooze for 1 day…), opened from a button. */
.menu {
  position: fixed;
  inset: auto;
  min-width: 10rem;
  margin: 0;
  padding: 0.25rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-popover);
}
.menu:popover-open { display: grid; animation: modal-in 120ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.menu__label { margin: 0; padding: 0.375rem 0.5rem 0.25rem; color: var(--text-tertiary); font-size: var(--text-xs); font-weight: 500; }
.menu__item {
  padding: 0.375rem 1.25rem 0.375rem 0.5rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: inherit;
  font: inherit;
  font-size: var(--text-sm);
  text-align: left;
  cursor: pointer;
}
.menu__item:hover, .menu__item:focus-visible { outline: none; background: var(--bg-active); }

/* Phones: the buttons go on a line of their own under the name, sharing
   it evenly. A task for someone puts what to do first, and who it's for and
   when under it ("Ćaća · Overdue 4 days"), so the text gets the whole width. */
@media (max-width: 48rem) {
  .date-long { display: none; }
  .date-short { display: inline; }

  .check-in { flex-wrap: wrap; row-gap: 0.5rem; padding-block: 0.625rem; }
  .check-in__cadence { display: none; }
  .check-in__actions { flex-basis: 100%; padding-left: calc(1.75rem + 0.625rem); }
  .check-in__actions .button { flex: 1; justify-content: center; }

  .task:has(.task__person) {
    display: grid;
    grid-template-columns: auto auto auto 1fr;
    grid-template-areas: "check body body body" "check person separator due";
    align-items: baseline;
    column-gap: 0.375rem;
    row-gap: 0.125rem;
    padding-block: 0.5rem;
  }
  .task:has(.task__person) .task__checkbox { grid-area: check; align-self: start; margin: 0.1875rem 0.25rem 0 0; }
  .task:has(.task__person) .task__body { grid-area: body; }
  .task:has(.task__person) .task__person { grid-area: person; max-width: none; font-size: var(--text-sm); }
  .task:has(.task__person) .task__separator { grid-area: separator; margin: 0; }
  .task:has(.task__person) .task__due { grid-area: due; justify-self: start; }
}

/* Each entry is a link to edit it; it pulls out by 0.5rem for its hover background. */
/* Clicking an entry opens it: the link lies over the whole entry, and links
   in the text sit above it. */
/* A journal entry: what kind it is in a pale circle on the left, the icon in
   its colour (check-ins violet, notes orange, mentions green), a heading with the date, and the text
   under the heading. A thin line joins the circles: one history. The whole
   entry is a link (see .journal-entry__open). */
.journal-entry {
  position: relative;
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr);
  column-gap: 0.75rem;
  margin: 0 -0.5rem;
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius);
}
.journal-entry:hover { background: var(--bg-hover); }
.journal-entry:has(.journal-entry__open:focus-visible) { background: var(--bg-active); }
.journal-entry__open { position: absolute; inset: 0; border-radius: inherit; }
.journal-entry__open:focus-visible { outline: none; }
.journal-entry__body a { position: relative; z-index: 1; }

.journal-entry__icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--kind) 14%, var(--bg));
  color: var(--kind);
  pointer-events: none;
}
.journal-entry__icon .icon { width: 0.875rem; height: 0.875rem; }
.journal-entry--note { --kind: var(--journal-note); }
.journal-entry--check-in { --kind: var(--journal-check-in); }
.journal-entry--mention { --kind: var(--journal-mention); }

/* Plain text with spaces between its parts, so it reads (and copies) as one line. */
.journal-entry__heading {
  min-height: 1.75rem;
  padding-top: 0.25rem;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}
.journal-entry__title { color: var(--text); font-weight: 500; }
.journal-entry__body { margin-top: 0.125rem; line-height: 1.6; overflow-wrap: anywhere; }

.journal-entry { padding-bottom: 1rem; }
.journal-entry:not(:last-child)::before {
  content: "";
  position: absolute;
  top: calc(0.375rem + 1.75rem);
  bottom: -0.375rem;
  left: calc(0.5rem + 0.875rem - 0.5px);
  width: 1px;
  background: var(--border);
}

/* Where else someone's mentioned: other people's About and tasks. */

.mentioned-in__list { display: grid; gap: 1px; margin: 0 -0.5rem; padding: 0; list-style: none; }
.mentioned-in__item { display: grid; gap: 0.125rem; padding: 0.375rem 0.5rem; border-radius: var(--radius); }
.mentioned-in__item:hover { background: var(--bg-hover); }
.mentioned-in__where { color: var(--text-tertiary); font-size: var(--text-xs); font-weight: 500; }
.mentioned-in__text { overflow-wrap: anywhere; }

/* ── Rich text ──────────────────────────────────────────────────────────── */

/* Lexxy (the editor) in our colours and type. These follow light and dark
   mode with the tokens they point at. */
:root {
  --lexxy-font-base: var(--font-sans);
  --lexxy-font-mono: var(--font-mono);
  --lexxy-color-ink: var(--text);
  --lexxy-color-ink-medium: var(--text-secondary);
  --lexxy-color-ink-light: var(--text-tertiary);
  --lexxy-color-ink-lighter: var(--border);
  --lexxy-color-ink-lightest: var(--bg-hover);
  --lexxy-color-ink-inverted: var(--bg-elevated);
  --lexxy-color-canvas: var(--bg-elevated);
  --lexxy-color-text: var(--text);
  --lexxy-color-text-subtle: var(--text-secondary);
  --lexxy-color-link: var(--text);
  --lexxy-color-accent-dark: var(--focus);
  --lexxy-color-accent-light: var(--bg-active);
  --lexxy-color-accent-lightest: var(--bg-active);
  --lexxy-color-selected: var(--bg-active);
  --lexxy-color-selected-hover: var(--bg-active);
  --lexxy-focus-ring-color: var(--focus);
  --lexxy-shadow: var(--shadow-popover);
  --lexxy-radius: var(--radius);
  --lexxy-content-margin: 0; /* lines sit together, as they did as plain text */
}

.lexxy-content { line-height: 1.6; }
.lexxy-content :is(ul, ol):not(.lexxy-prompt-menu) { padding-left: 1.25rem; } /* lists in the text, not the @ menu */
.lexxy-content a { color: inherit; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 2px; }
.lexxy-content a:hover { text-decoration-color: currentColor; }
.lexxy-editor__content { color: var(--text); }
.lexxy-editor--empty .lexxy-editor__content::before { color: var(--text-tertiary); opacity: 1; }
.task__body .lexxy-content p { display: inline; }

/* An @mention: a quiet chip with the person's name. In the editor it's
   selected (not followed) when clicked. */
.lexxy-content a.mention, .mention {
  padding: 0 0.25rem;
  border-radius: var(--radius-sm);
  background: var(--bg-active);
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.lexxy-content a.mention:hover { background: var(--border); }
lexxy-editor .mention { pointer-events: none; }
action-text-attachment[content-type="application/vnd.actiontext.mention"] { display: inline; }

/* The list that opens when you type @. */
.lexxy-prompt-menu { min-inline-size: 14rem; max-inline-size: 18rem; padding: 0.25rem; border-radius: var(--radius-lg); font-size: var(--text-sm); }
.lexxy-prompt-menu__item { padding: 0.25rem 0.375rem; border-radius: var(--radius); }
.mention-option { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.mention-option .avatar { width: 1.375rem; height: 1.375rem; font-size: 0.5625rem; }
.mention-option__meta { color: var(--text-tertiary); font-size: var(--text-xs); }
.journal-entry--new { animation: entry-in 2.4s ease-out; }
@keyframes entry-in {
  0% { opacity: 0; transform: translateY(-2px); }
  10% { opacity: 1; transform: none; }
}

@media (max-width: 48rem) {
  .editor--journal, .editor--task, .editor--about, .people-picker__query { font-size: var(--text-lg); } /* 16px stops iOS zooming in on focus */
  :is(.person-birthday, .person-passed-away, .person-location) p, .person-emails__list, .relationship__name { font-size: var(--text-lg); } /* the same size as the About under it */
  .dialog-form__submit { flex: 1 0 100%; }
}

.empty-state { padding: 4rem 1rem; text-align: center; }
.empty-state__title { font-weight: 500; }
.empty-state__text { margin-top: 0.25rem; color: var(--text-tertiary); font-size: var(--text-sm); }
.empty-state kbd { vertical-align: 1px; }

/* ── Modal dialogs ──────────────────────────────────────────────────────── */

.modal {
  width: min(38rem, calc(100vw - 2rem));
  margin: 12vh auto auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-popover);
}
.modal--small { width: min(24rem, calc(100vw - 2rem)); }
.modal[open] { animation: modal-in 140ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.modal[open]::backdrop { background: var(--backdrop); animation: fade-in 140ms ease; }

@keyframes modal-in { from { opacity: 0; transform: translateY(-4px) scale(0.985); } }
@keyframes fade-in { from { opacity: 0; } }

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0 1.5rem;
}
.modal__title { font-size: var(--text-base); font-weight: 600; }
.modal__subtitle { color: var(--text-tertiary); font-weight: 500; }
.modal .form { gap: 1.25rem; padding: 1.25rem 1.5rem 1.5rem; }

@media (max-width: 48rem) {
  .modal { margin-top: max(1rem, env(safe-area-inset-top)); }
}

.shortcut-list { padding: 0.5rem 1.5rem 1.25rem; }
.shortcut-list__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 2.25rem;
  font-size: var(--text-sm);
}
.shortcut-list__row + .shortcut-list__row { border-top: 1px solid var(--border); }
.shortcut-list dd { display: flex; gap: 0.25rem; }

/* ── Command menu (⌘K) ───────────────────────────────────────────────── */

.command-menu {
  width: min(40rem, calc(100vw - 2rem));
  margin: 12vh auto auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-popover);
}
.command-menu[open] { display: flex; flex-direction: column; animation: modal-in 140ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.command-menu[open]::backdrop { background: var(--backdrop); animation: fade-in 140ms ease; }

.command-menu__search {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-tertiary);
}
.command-menu__input {
  flex: 1;
  min-width: 0;
  height: 3.25rem;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--text-lg); /* 16px, which also stops iOS zooming in on focus */
}
.command-menu__input::placeholder { color: var(--text-tertiary); }

.command-menu__results { max-height: min(24rem, 55vh); padding: 0.375rem; overflow-y: auto; overscroll-behavior: contain; }

.command-menu__group {
  padding: 0.5rem 0.625rem 0.25rem;
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-weight: 500;
}
.command-menu__group:not(:first-child) { margin-top: 0.25rem; }

.command-menu__item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: var(--row-height);
  padding: 0 0.625rem;
  border-radius: var(--radius);
  cursor: pointer;
}
.command-menu__item[aria-selected="true"] { background: var(--bg-active); }
.command-menu__icon { display: inline-grid; place-items: center; width: 1.375rem; color: var(--text-secondary); }
.command-menu__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.command-menu__first { font-weight: 500; }
.command-menu__meta { min-width: 0; overflow: hidden; color: var(--text-tertiary); text-overflow: ellipsis; white-space: nowrap; }
.command-menu__item .hotkey-hint { margin-left: auto; }

.command-menu__empty { padding: 1.5rem 0.625rem; color: var(--text-tertiary); font-size: var(--text-sm); text-align: center; }

@media (max-width: 48rem) {
  .command-menu { margin-top: max(1rem, env(safe-area-inset-top)); }
}

/* ── Toasts ─────────────────────────────────────────────────────────────── */

/* A popover (top layer), so undo the browser's popover styles. */
.toasts {
  position: fixed;
  inset: auto max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  width: min(22rem, calc(100vw - 2rem));
  height: auto;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  color: inherit;
  pointer-events: none; /* the empty stack shouldn't block clicks */
}
.toasts:not(:popover-open) { display: none; }

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  width: 100%;
  padding: 0.625rem 0.5rem 0.625rem 0.75rem;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-popover);
  font-size: var(--text-sm);
  font-weight: 500;
  pointer-events: auto;
  animation: toast-in 200ms cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(0.5rem) scale(0.98); } }

.toast__icon { flex: none; width: 1rem; height: 1rem; margin-top: 0.0625rem; }
.toast--notice .toast__icon { color: var(--success); }
.toast--alert .toast__icon { color: var(--danger); }
.toast__message { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.toast form { display: contents; }
.toast__undo {
  flex: none;
  height: 1.5rem;
  margin: -0.125rem 0;
  padding: 0 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
}
.toast__undo:hover { background: var(--bg-hover); }

.toast__close {
  display: grid;
  flex: none;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  margin: -0.0625rem 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
}
.toast__close:hover { background: var(--bg-hover); color: var(--text); }
.toast__close .icon { width: 0.875rem; height: 0.875rem; }

@media (max-width: 40rem) {
  .toasts { inset-inline: 1rem; width: auto; align-items: stretch; }
}

/* ── Sign in ────────────────────────────────────────────────────────────── */

.app--signed-out .content {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 1.5rem 1rem;
}
.sign-in { width: min(20rem, 100%); }
.sign-in__title { margin: 2rem 0 1.25rem; font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.02em; }
.sign-in .button { margin-top: 0.25rem; }

/* ── Motion preferences ─────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::backdrop { animation: none !important; transition: none !important; }
}

/* ── Styleguide (development only) ──────────────────────────────────────── */

.styleguide section { padding: 1.5rem 0; border-bottom: 1px solid var(--border); }
.styleguide section:last-child { border-bottom: 0; }
.styleguide__heading { margin-bottom: 0.25rem; font-size: var(--text-sm); font-weight: 600; }
.styleguide__note { margin-bottom: 1rem; color: var(--text-tertiary); font-size: var(--text-sm); }
.styleguide code { color: var(--text-tertiary); font: 500 var(--text-xs) var(--font-mono); }
.styleguide__swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 0.75rem; }
.styleguide__swatch { display: flex; align-items: center; gap: 0.5rem; }
.styleguide__chip { width: 1.75rem; height: 1.75rem; flex: none; border: 1px solid var(--border-strong); border-radius: var(--radius); }
.styleguide__type-row { display: grid; grid-template-columns: 8rem 1fr; align-items: baseline; gap: 1rem; padding: 0.375rem 0; }
.styleguide__row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.styleguide__form { max-width: 30rem; }
.styleguide__toasts { display: grid; gap: 0.5rem; max-width: 22rem; }
.styleguide__toasts .toast { animation: none; }
.styleguide__modal { position: static; display: block; margin: 0; }
.styleguide__modal .form { gap: 1.25rem; padding: 1.25rem 1.5rem 1.5rem; }

