/* ==========================================================================
   Family Reminder design system
   Warm, trustworthy palette · Inter (self-hosted, SIL OFL) · 4px spacing grid
   Colour pairs used for text meet WCAG AA (checked at 4.5:1 or above).
   The CSP only allows same-origin styles and images: no data: URIs, no inline styles.
   ========================================================================== */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@view-transition {
  navigation: auto;
}

:root {
  /* Colour */
  --ink: #2b1d16;            /* 15.4:1 on cream */
  --ink-soft: #4a382d;
  --muted: #6b5a4e;          /* 6.2:1 on cream */
  --cream: #fff8f1;
  --surface: #ffffff;
  --sand: #f6eadf;
  --sand-2: #efe0d2;
  --line: #eadccf;
  --line-strong: #9c8574;    /* 3.4:1 on white, for control borders */
  --brand: #b4432a;          /* 5.6:1 with white */
  --brand-strong: #9e3a23;
  --brand-500: #d9654a;
  --brand-100: #fbdccf;
  --brand-50: #fdeee6;
  --honey: #f2b544;
  --honey-50: #fef4dc;
  --honey-ink: #8a5a00;
  --sage: #2f6b55;
  --sage-500: #5c9b82;
  --sage-50: #e7f3ec;
  --rose: #c2456b;
  --rose-50: #fce8ee;
  --danger: #a3122f;
  --danger-50: #fdecee;
  --focus: #b4432a;
  --footer-bg: #2b1d16;
  --footer-ink: #f6eadf;
  --footer-muted: #c8b6a6;

  /* Legacy names kept for any older markup */
  --paper: var(--cream);
  --card: var(--surface);
  --green: var(--brand);
  --green-soft: var(--brand-50);
  --ok-bg: var(--sage-50);
  --error-bg: var(--danger-50);

  /* Type */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-base: 1.0625rem;
  --text-lg: 1.1875rem;
  --text-xl: 1.375rem;
  --text-2xl: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem);
  --text-hero: clamp(2.3rem, 1.6rem + 3vw, 3.75rem);

  /* Space (4px grid) */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.25rem;
  --s-6: 1.5rem;
  --s-8: 2rem;
  --s-10: 2.5rem;
  --s-12: 3rem;
  --s-16: 4rem;
  --s-20: 5rem;

  /* Shape and depth */
  --r-sm: 0.5rem;
  --r-md: 0.75rem;
  --r-lg: 1.125rem;
  --r-xl: 1.5rem;
  --r-pill: 999px;
  --shadow-xs: 0 1px 2px rgba(74, 42, 24, 0.06);
  --shadow-sm: 0 1px 2px rgba(74, 42, 24, 0.05), 0 2px 8px rgba(74, 42, 24, 0.06);
  --shadow-md: 0 2px 4px rgba(74, 42, 24, 0.05), 0 10px 24px -6px rgba(74, 42, 24, 0.14);
  --shadow-lg: 0 4px 8px rgba(74, 42, 24, 0.05), 0 24px 48px -12px rgba(74, 42, 24, 0.22);
  --ring: 0 0 0 4px rgba(180, 67, 42, 0.22);

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 140ms;
  --dur: 240ms;
  --dur-slow: 600ms;

  --header-h: 4rem;
  --tabbar-h: 4.25rem;
  color-scheme: light;
}

/* ---------- Base ---------- */

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

[hidden] {
  display: none !important;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--s-4));
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--cream);
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.6;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img,
svg {
  max-width: 100%;
}

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--dur-fast) ease, text-decoration-color var(--dur-fast) ease;
}

a:hover {
  color: var(--brand-strong);
  text-decoration-thickness: 2px;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--brand-100);
  color: var(--ink);
}

h1,
h2,
h3 {
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 700;
  text-wrap: balance;
}

h1 {
  font-size: var(--text-2xl);
  margin: 0 0 var(--s-3);
  letter-spacing: -0.03em;
}

h2 {
  font-size: var(--text-xl);
  margin: 0 0 var(--s-2);
}

h3 {
  font-size: var(--text-lg);
  margin: 0 0 var(--s-2);
}

p {
  margin: 0 0 var(--s-4);
  text-wrap: pretty;
}

strong {
  font-weight: 650;
}

code {
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
  font-size: 0.92em;
  background: var(--sand);
  padding: 0.1em 0.35em;
  border-radius: 0.3em;
}

.lede {
  font-size: var(--text-lg);
  color: var(--ink-soft);
}

.icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 auto;
  display: inline-block;
  vertical-align: middle;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: var(--s-3);
  top: -5rem;
  z-index: 100;
  padding: var(--s-3) var(--s-4);
  background: var(--ink);
  color: #fff;
  border-radius: var(--r-sm);
  font-weight: 600;
  text-decoration: none;
  transition: top var(--dur) var(--ease-out);
}

.skip:focus {
  top: var(--s-3);
  color: #fff;
}

/* ---------- Layout ---------- */

.wrap {
  width: min(48rem, calc(100% - 2.5rem));
  margin-inline: auto;
}

.wrap-wide {
  width: min(76rem, calc(100% - 2.5rem));
}

main {
  flex: 1 0 auto;
  min-width: 0;
  padding-top: var(--s-8);
  padding-bottom: var(--s-16);
}

.full-bleed {
  width: 100vw;
  margin-inline: calc(50% - 50vw);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 248, 241, 0.86);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) ease, box-shadow var(--dur) ease, background-color var(--dur) ease;
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 6px 20px -12px rgba(74, 42, 24, 0.25);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--ink);
  font-weight: 750;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  min-height: 44px;
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  display: block;
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  transition: transform var(--dur) var(--ease-spring);
}

.crumbs {
  margin: 0 0 var(--s-5);
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.15rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

.crumbs li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.crumbs li:not(:last-child)::after {
  content: "/";
  color: var(--line-strong);
}

.crumbs a {
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.brand:hover .brand-mark {
  transform: rotate(-8deg) scale(1.06);
}

.nav,
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.nav a,
.header-actions a:not(.button) {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  color: var(--ink-soft);
  font-weight: 550;
  font-size: var(--text-sm);
  text-decoration: none;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}

.nav a:hover,
.header-actions a:not(.button):hover {
  background: var(--sand);
  color: var(--ink);
}

.nav a[aria-current="page"],
.header-actions a[aria-current="page"] {
  background: var(--brand-50);
  color: var(--brand-strong);
}

.nav a .icon {
  width: 1.125rem;
  height: 1.125rem;
}

.nav form,
.header-actions form,
.inline-form {
  margin: 0;
}

.header-actions form {
  display: inline-flex;
  align-items: center;
}

.header-actions .button,
.header-actions button {
  margin-top: 0;
}

.button-logout {
  gap: var(--s-2);
}

/* Same outer height as .nav a (44px). The general
   `form > button[type="submit"]:last-child` margin would drop this
   capsule below the nav pills. */
.header-actions form > button.button-logout[type="submit"] {
  box-sizing: border-box;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0 var(--s-3);
}

/* Mobile: the app navigation becomes a bottom tab bar (no JavaScript needed). */
@media (max-width: 47.99rem) {
  .nav-app.nav-app-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-app.nav-app-5 a,
  .nav-app.nav-app-6 a {
    font-size: 0.6875rem;
    line-height: 1.15;
    padding-inline: 0.1rem;
  }

  .nav-app.nav-app-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .nav-app.nav-app-6 a {
    font-size: 0.625rem;
  }

  .has-tabbar {
    padding-bottom: calc(var(--tabbar-h) + var(--s-4) + env(safe-area-inset-bottom, 0px));
  }

  /* The fixed tab bar is taller than the old main padding, so the last line
     (for example a date on People) sat underneath it. */
  body.has-tabbar main {
    padding-bottom: calc(var(--tabbar-h) + var(--s-8) + env(safe-area-inset-bottom, 0px));
  }

  html:has(body.has-tabbar) {
    scroll-padding-bottom: calc(var(--tabbar-h) + var(--s-8) + env(safe-area-inset-bottom, 0px));
  }

  .nav-app {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    padding: var(--s-1) var(--s-2) calc(var(--s-1) + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: saturate(1.6) blur(16px);
    backdrop-filter: saturate(1.6) blur(16px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px -16px rgba(74, 42, 24, 0.3);
  }

  .nav-app a {
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-height: 3.5rem;
    padding: var(--s-1);
    border-radius: var(--r-md);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    text-align: center;
    line-height: 1.2;
  }

  .nav-app a .icon {
    width: 1.5rem;
    height: 1.5rem;
    transition: transform var(--dur) var(--ease-spring);
  }

  .nav-app a[aria-current="page"] {
    background: transparent;
    color: var(--brand);
  }

  .nav-app a[aria-current="page"] .icon {
    transform: translateY(-1px) scale(1.08);
  }

  .nav-app a:active .icon {
    transform: scale(0.9);
  }

  .button-logout .label-long {
    display: none;
  }

  .header-actions .button,
  .header-actions button {
    padding-inline: var(--s-3);
  }

  .header-actions .login-link {
    padding-inline: var(--s-2);
  }
}

@media (min-width: 48rem) {
  .nav-app {
    margin-left: auto;
  }

  .header-actions {
    margin-left: var(--s-2);
  }
}

@media (max-width: 22rem) {
  .brand-name {
    font-size: 1rem;
  }

  .header-actions .button {
    font-size: var(--text-xs);
  }
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: auto;
  background: var(--footer-bg);
  color: var(--footer-ink);
  padding: var(--s-12) 0 var(--s-8);
  position: relative;
  overflow: hidden;
}

.site-footer::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand-500), var(--honey), var(--sage-500), var(--rose));
}

.footer-grid {
  display: grid;
  gap: var(--s-6);
}

@media (min-width: 48rem) {
  .footer-grid {
    grid-template-columns: 1.4fr 1fr;
    align-items: start;
  }
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  color: #fff;
  font-weight: 750;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  margin-bottom: var(--s-2);
}

.footer-brand:hover {
  color: #fff;
}

.footer-tagline {
  color: var(--footer-muted);
  font-size: var(--text-sm);
  max-width: 28rem;
  margin: 0;
}

.footer-row nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-2);
}

@media (min-width: 48rem) {
  .footer-row nav {
    justify-content: flex-end;
  }
}

.footer-row nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  color: var(--footer-ink);
  font-weight: 550;
  font-size: var(--text-sm);
  text-decoration: none;
  transition: background-color var(--dur-fast) ease;
}

.footer-row nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.site-footer :focus-visible {
  outline-color: var(--honey);
}

.company {
  margin: var(--s-8) 0 0;
  padding-top: var(--s-6);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--footer-muted);
  font-size: var(--text-xs);
  line-height: 1.7;
}

/* ---------- Buttons ---------- */

input,
select,
textarea,
button,
.button {
  font: inherit;
}

button,
.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  box-sizing: border-box;
  min-height: 48px;
  margin-top: var(--s-4);
  padding: 0.65rem 1.35rem;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: #fff;
  font-weight: 620;
  font-size: var(--text-sm);
  letter-spacing: -0.005em;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  text-box: trim-both cap alphabetic;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: 0 1px 2px rgba(74, 42, 24, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur) var(--ease-out), background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, color var(--dur-fast) ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:hover,
.button:hover {
  background: var(--brand-strong);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -6px rgba(180, 67, 42, 0.55);
}

button:active,
.button:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 1px 2px rgba(74, 42, 24, 0.12);
}

button:focus-visible,
.button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: var(--r-pill);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.button .icon,
button .icon {
  width: 1.15rem;
  height: 1.15rem;
}

.button .icon-trail {
  transition: transform var(--dur) var(--ease-out);
}

.button:hover .icon-trail {
  transform: translateX(3px);
}

.button-quiet,
button.button-quiet,
a.button-quiet {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-xs);
}

.button-quiet:hover,
button.button-quiet:hover,
a.button-quiet:hover {
  background: var(--sand);
  color: var(--ink);
  border-color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
}

.button-danger,
a.button-danger,
button.button-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.button-danger:hover,
a.button-danger:hover,
button.button-danger:hover {
  background: #860d25;
  border-color: #860d25;
  color: #fff;
  box-shadow: 0 6px 16px -6px rgba(163, 18, 47, 0.55);
}

.button-lg {
  min-height: 56px;
  padding: 0.85rem 1.75rem;
  font-size: var(--text-base);
}

.button-sm,
.people-table .save-row button {
  min-height: 40px;
  padding: 0.4rem 0.95rem;
}

.nav .button,
.nav button,
.inline-actions .button,
.inline-actions a,
.inline-actions button,
.title-row .button,
.page-head .button {
  margin-top: 0;
}

.inline-actions,
.title-row,
.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
}

.inline-actions {
  align-items: stretch;
}

.inline-actions > button,
.inline-actions > a.button,
.inline-actions > .button,
form.inline-actions > button[type="submit"]:last-child {
  flex: 0 1 auto;
  align-self: stretch;
  max-width: 100%;
  margin-top: 0;
  white-space: normal;
  text-align: center;
}

/* A pair shares one row, including at 320px. One control keeps its own width. */
@media (max-width: 35.99rem) {
  .page-head .inline-actions,
  .empty-state .inline-actions,
  .flow-card .inline-actions,
  .panel .inline-actions,
  form.inline-actions {
    width: 100%;
    flex-basis: 100%;
  }

  .inline-actions:has(> :is(button, a.button, .button) ~ :is(button, a.button, .button)) > :is(button, a.button, .button) {
    flex: 1 1 0;
    min-width: 0;
    min-height: 48px;
  }
}

.inline-actions {
  margin-top: var(--s-5);
}

.detail-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: var(--s-5);
}

.detail-actions-start,
.detail-actions-end,
.form-actions-start,
.form-actions-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
}

.form-actions-end {
  margin: 0;
}

.detail-actions .button,
.detail-actions a.button,
.form-actions button,
.form-actions .button,
.form-actions-end button {
  margin-top: 0;
}

.inline-actions > form {
  margin: 0;
}

.title-row {
  justify-content: space-between;
}

.title-row h1 {
  margin: 0;
}

/* ---------- Page heads ---------- */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}

.page-head > * {
  min-width: 0;
  max-width: 100%;
}

.page-head h1 {
  margin: 0;
  overflow-wrap: break-word;
}

.page-head > .button {
  white-space: normal;
  text-align: center;
}

.page-head p {
  margin: var(--s-1) 0 0;
  color: var(--muted);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin: 0 0 var(--s-2);
  color: var(--brand);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow .icon {
  width: 1rem;
  height: 1rem;
}

.heading-icon {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.heading-icon .icon-tile {
  margin: 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  margin-bottom: var(--s-2);
  font-weight: 600;
  font-size: var(--text-sm);
  text-decoration: none;
}

.back-link .icon {
  width: 1.1rem;
  height: 1.1rem;
  transition: transform var(--dur) var(--ease-out);
}

.back-link:hover .icon {
  transform: translateX(-3px);
}

/* ---------- Forms ---------- */

label,
legend {
  font-weight: 600;
  color: var(--ink);
}

label {
  display: block;
  margin-top: var(--s-5);
  font-size: var(--text-sm);
}

input,
select,
textarea {
  display: block;
  width: 100%;
  margin-top: var(--s-2);
  padding: 0.7rem 0.9rem;
  min-height: 48px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.4;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur) var(--ease-out), background-color var(--dur-fast) ease;
}

/* A hidden token must not become a text field. Inside a button row it was a
   flex item, so Merge and Replace wrapped onto different heights. */
input[type="hidden"] {
  display: none !important;
  width: 0;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  appearance: none;
}

input::placeholder,
textarea::placeholder {
  color: #8c7b6f;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--ink-soft);
}

input:focus,
select:focus,
textarea:focus,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
}

input[readonly] {
  background: var(--sand);
  color: var(--ink-soft);
}

input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.75rem;
  background-image: url("../img/chevron-down.svg");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 1.15rem;
  cursor: pointer;
}

select:disabled,
option:disabled {
  color: #8c7b6f;
}

input[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--danger);
  background-color: #fffafa;
  animation: field-nudge 420ms var(--ease-out) 1;
}

input[aria-invalid="true"]:focus,
select[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 4px rgba(163, 18, 47, 0.18);
}

@keyframes field-nudge {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--brand);
}

fieldset {
  margin: var(--s-6) 0 0;
  padding: var(--s-4) var(--s-5) var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  min-inline-size: 0;
  max-inline-size: 100%;
}

legend {
  padding: 0 var(--s-2);
  margin-left: calc(var(--s-2) * -1);
  font-size: var(--text-base);
}

fieldset > .hint:first-of-type {
  margin-top: var(--s-1);
}

.choice {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  margin-top: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  font-weight: 450;
  font-size: var(--text-base);
  cursor: pointer;
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease, box-shadow var(--dur) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.choice:hover {
  border-color: var(--line-strong);
  background: #fffcf9;
}

.choice:active {
  transform: scale(0.995);
}

.choice:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-50);
  box-shadow: 0 0 0 1px var(--brand) inset;
}

.choice:has(input:focus-visible) {
  box-shadow: var(--ring);
}

.choice:has(input:disabled) {
  opacity: 0.6;
  cursor: not-allowed;
}

.choice input {
  width: 1.25rem;
  height: 1.25rem;
  min-height: 1.25rem;
  margin: 0.15rem 0 0;
  flex: 0 0 auto;
  cursor: inherit;
}

.choice input:focus,
.choice input:focus-visible {
  box-shadow: none;
}

.choice > span {
  min-width: 0;
}

.choice-title {
  display: block;
  font-weight: 620;
}

.choice .hint {
  display: block;
  margin-top: 2px;
}

.hint,
.meta,
.optional {
  color: var(--muted);
}

.hint,
.meta {
  font-size: var(--text-sm);
}

.hint {
  margin: var(--s-2) 0 0;
  line-height: 1.55;
}

.on-this-day {
  margin: 0 0 var(--s-4);
}

.on-this-day .hint {
  margin: 0;
}

.on-this-day ul {
  margin: 0.15rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.optional {
  font-weight: 450;
  font-size: var(--text-xs);
  margin-left: var(--s-1);
  padding: 1px var(--s-2);
  border-radius: var(--r-pill);
  background: var(--sand);
}

.field-error {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  margin: var(--s-2) 0 0;
  color: var(--danger);
  font-size: var(--text-sm);
  font-weight: 550;
}

.field-error::before {
  content: "";
  flex: 0 0 auto;
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.15rem;
  background: currentColor;
  -webkit-mask: url("../img/i-alert.svg") center / contain no-repeat;
  mask: url("../img/i-alert.svg") center / contain no-repeat;
}

form > button[type="submit"]:last-child,
form > .inline-actions:last-child {
  margin-top: var(--s-6);
}

.split {
  display: grid;
  gap: 0 var(--s-4);
}

@media (min-width: 36rem) {
  .split {
    grid-template-columns: 1fr 1fr;
  }
}

details.more-options {
  margin-top: var(--s-6);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}

details.more-options summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  min-height: 56px;
  padding: var(--s-3) var(--s-5);
  cursor: pointer;
  font-weight: 650;
  list-style: none;
  transition: background-color var(--dur-fast) ease;
}

details.more-options summary::-webkit-details-marker {
  display: none;
}

details.more-options summary::after {
  content: "";
  width: 1.15rem;
  height: 1.15rem;
  background: currentColor;
  -webkit-mask: url("../img/chevron-mask.svg") center / contain no-repeat;
  mask: url("../img/chevron-mask.svg") center / contain no-repeat;
  transition: transform var(--dur) var(--ease-out);
}

details.more-options[open] summary::after {
  transform: rotate(180deg);
}

details.more-options summary:hover {
  background: var(--sand);
}

details.more-options > fieldset {
  margin: 0 var(--s-4) var(--s-4);
  border-color: var(--line);
}

details.more-options > .field-error {
  margin: 0 var(--s-5) var(--s-4);
}

details.more-options[open] > *:not(summary) {
  animation: rise-in var(--dur) var(--ease-out);
}

/* Autosave status, driven by app.js (data-state). */
.save-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  min-height: 2rem;
  margin-top: var(--s-3);
}

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 1.5rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
}

.save-status:empty {
  display: none;
}

.save-status::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: currentColor;
}

.save-status[data-state="saving"]::before {
  animation: pulse-dot 900ms ease-in-out infinite;
}

.save-status[data-state="saved"] {
  color: var(--sage);
  padding: 2px var(--s-3) 2px var(--s-2);
  border-radius: var(--r-pill);
  background: var(--sage-50);
  animation: pop-in 360ms var(--ease-spring);
}

.save-status[data-state="saved"]::before {
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 0;
  -webkit-mask: url("../img/i-check.svg") center / contain no-repeat;
  mask: url("../img/i-check.svg") center / contain no-repeat;
}

.save-status.is-error {
  color: var(--danger);
  padding: 2px var(--s-3) 2px var(--s-2);
  border-radius: var(--r-pill);
  background: var(--danger-50);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.35; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}

@keyframes pop-in {
  0% { opacity: 0; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1); }
}

/* ---------- Alerts / banners ---------- */

.banner {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  margin: 0 0 var(--s-6);
  border-radius: var(--r-lg);
  border: 1px solid var(--honey);
  background: var(--honey-50);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: var(--shadow-xs);
  animation: rise-in 420ms var(--ease-out) both;
}

.banner::before {
  content: "";
  flex: 0 0 auto;
  width: 1.3rem;
  height: 1.3rem;
  margin-top: 0.05rem;
  background: var(--honey-ink);
  -webkit-mask: url("../img/i-info.svg") center / contain no-repeat;
  mask: url("../img/i-info.svg") center / contain no-repeat;
}

.banner a {
  color: inherit;
  font-weight: 650;
}

.banner-ok {
  border-color: #bcdccb;
  background: var(--sage-50);
}

.banner-ok::before {
  background: var(--sage);
  -webkit-mask-image: url("../img/i-check-circle.svg");
  mask-image: url("../img/i-check-circle.svg");
}

.banner-error {
  border-color: #f2b8c2;
  background: var(--danger-50);
}

.banner-error::before {
  background: var(--danger);
  -webkit-mask-image: url("../img/i-alert.svg");
  mask-image: url("../img/i-alert.svg");
}

/* ---------- Cards and panels ---------- */

.stack {
  display: grid;
  gap: var(--s-3);
}

.card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.card {
  padding: var(--s-5);
}

.card p {
  margin: var(--s-1) 0;
}

.card h2,
.card h3 {
  margin: var(--s-1) 0;
}

.panel {
  margin: 0 0 var(--s-5);
  padding: var(--s-6);
}

@media (max-width: 35.99rem) {
  .panel {
    padding: var(--s-5) var(--s-4);
    border-radius: var(--r-md);
  }
}

.panel > h2:first-child,
.panel-head {
  margin-bottom: var(--s-4);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.panel-head h2 {
  margin: 0;
}

.panel-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

.panel-danger {
  border-color: #f2c4cc;
  background: linear-gradient(180deg, #fffafa, var(--surface) 40%);
}

.icon-tile {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--r-md);
  background: var(--brand-50);
  color: var(--brand);
}

.icon-tile .icon {
  width: 1.4rem;
  height: 1.4rem;
}

.icon-tile.tone-coral { background: var(--brand-50); color: var(--brand); }
.icon-tile.tone-rose { background: var(--rose-50); color: #a3355a; }
.icon-tile.tone-sage { background: var(--sage-50); color: var(--sage); }
.icon-tile.tone-honey { background: var(--honey-50); color: var(--honey-ink); }
.icon-tile.tone-sand { background: var(--sand); color: var(--ink-soft); }
.icon-tile.tone-danger { background: var(--danger-50); color: var(--danger); }

.when {
  margin: 0;
  color: var(--brand);
  font-weight: 650;
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 0.15rem 0.6rem;
  border-radius: var(--r-pill);
  background: var(--brand-50);
  color: var(--brand-strong);
  font-size: var(--text-xs);
  font-weight: 650;
  line-height: 1.5;
  white-space: nowrap;
}

.badge {
  margin-left: var(--s-2);
}

.pill .icon {
  width: 0.95rem;
  height: 0.95rem;
}

.pill-sage { background: var(--sage-50); color: var(--sage); }
.pill-honey { background: var(--honey-50); color: var(--honey-ink); }
.pill-sand { background: var(--sand); color: var(--ink-soft); }
.pill-danger { background: var(--danger-50); color: var(--danger); }

/* Date cards (Coming Up and My Dates) */

.date-card {
  --date-tile-w: 3.75rem;
  --date-face-pad-x: var(--s-5);
  --date-face-pad-y: var(--s-4);
  --date-face-gap: var(--s-4);
  --date-copy-end: 2.75rem;
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s-4);
  align-items: start;
  padding: var(--s-4) var(--s-5);
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), border-color var(--dur) ease;
}

.date-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--sand-2);
}

.date-card.is-soon {
  border-color: #f3c7b6;
  background: linear-gradient(100deg, #fff6f1, var(--surface) 55%);
}

.date-tile {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  width: var(--date-tile-w, 3.75rem);
  height: 4rem;
  border-radius: var(--r-md);
  background: var(--sand);
  color: var(--ink);
  text-align: center;
  line-height: 1;
  overflow: visible;
}

.date-tile::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 0.9rem;
  border-radius: var(--r-md) var(--r-md) 0 0;
  background: var(--brand);
}

.date-tile-month {
  position: relative;
  margin-top: 0.2rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
}

.date-tile-day {
  margin-top: 0.4rem;
  font-size: 1.5rem;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.date-tile .kind-dot {
  position: absolute;
  right: -0.55rem;
  bottom: -0.55rem;
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: var(--brand-50);
  color: var(--brand);
}

.date-tile .kind-dot .icon {
  width: 1rem;
  height: 1rem;
}

.date-tile .kind-dot.tone-rose { background: var(--rose-50); color: #a3355a; }
.date-tile .kind-dot.tone-sage { background: var(--sage-50); color: var(--sage); }
.date-tile .kind-dot.tone-honey { background: var(--honey-50); color: var(--honey-ink); }
.date-tile .kind-dot.tone-sand { background: var(--sand-2); color: var(--ink-soft); }

.date-card-body {
  min-width: 0;
  container: date-copy / inline-size;
}

.date-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}

.date-card .when {
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
}

.date-card.is-soon .when {
  color: var(--brand-strong);
}

.date-card h2,
.date-card h3 {
  margin: 2px 0 var(--s-1);
  font-size: var(--text-lg);
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.date-card h2 a,
.date-card h3 a {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size var(--dur) var(--ease-out), color var(--dur-fast) ease;
}

.date-card h2 a:hover,
.date-card h3 a:hover {
  color: var(--brand-strong);
  background-size: 100% 2px;
}

.date-card .summary {
  color: var(--ink-soft);
  font-size: var(--text-sm);
  line-height: 1.35;
  letter-spacing: -0.012em;
}

/* Shrink the kind, relationship, and date as the text column narrows so a
   usual line stays on one row. A longer line can wrap instead of being clipped. */
@container date-copy (inline-size < 20rem) {
  .date-card .summary {
    font-size: 0.8125rem;
    letter-spacing: -0.02em;
  }
}

@container date-copy (inline-size < 16.5rem) {
  .date-card .summary {
    font-size: 0.75rem;
    letter-spacing: -0.028em;
  }
}

.date-card .meta {
  font-size: var(--text-xs);
  line-height: 1.4;
}

@media (max-width: 30rem) {
  .date-card {
    --date-tile-w: 3.15rem;
    --date-face-pad-x: var(--s-3);
    --date-face-pad-y: var(--s-3);
    --date-face-gap: var(--s-3);
    gap: var(--s-3);
    padding: var(--s-3);
  }

  .date-tile {
    height: 3.45rem;
  }

  .date-tile-day {
    font-size: 1.3rem;
  }
}

.date-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

.date-card-actions .button {
  margin: 0;
}

/* Swipe-to-reveal actions. The face slides left; the buttons stay put.
   A More control opens the same actions without a gesture. */

.date-card.swipe-card {
  display: block;
  padding: 0;
  overflow: hidden;
}

.date-card.swipe-card.is-soon {
  background: var(--surface);
}

.swipe-reveal {
  position: relative;
}

.swipe-face {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--date-face-gap, var(--s-4));
  align-items: start;
  padding-block: var(--date-face-pad-y, var(--s-4));
  padding-inline: var(--date-face-pad-x, var(--s-5));
  background: var(--surface);
  touch-action: pan-y;
  transition: transform var(--dur) var(--ease-out);
}

.date-card.is-soon .swipe-face {
  background: linear-gradient(100deg, #fff6f1, var(--surface) 55%);
}

.swipe-card {
  --swipe-open: 3.5rem;
}

.swipe-card:has(.swipe-action-edit),
.swipe-card:has(.swipe-action-label) {
  --swipe-open: 10.5rem;
}

.swipe-card:has(.swipe-action-remind):not(:has(.swipe-action-edit)):not(:has(.swipe-action-label)) {
  --swipe-open: 7.5rem;
}

/* Resting open: the actions cover the right of the card and the name stays
   put. A finger-drag still slides the face aside; on release it eases home. */
.swipe-card.is-open .swipe-actions,
.swipe-card:has(.card-more[open]) .swipe-actions {
  z-index: 3;
}

.swipe-card.is-open .card-more,
.swipe-card:has(.card-more[open]) .card-more {
  right: calc(var(--swipe-open) + 0.35rem);
}

.swipe-card.is-open .card-more-button,
.swipe-card:has(.card-more[open]) .card-more-button {
  opacity: 0;
  pointer-events: none;
}

.swipe-card.is-open .date-card-body,
.swipe-card:has(.card-more[open]) .date-card-body {
  padding-right: calc(var(--swipe-open) + 0.75rem);
}

/* Three labelled actions leave too little room for the name on a narrow phone.
   The open strip moves under the card instead of covering it. */
@media (max-width: 23.5rem) {
  .swipe-card.is-open .swipe-actions,
  .swipe-card:has(.card-more[open]) .swipe-actions {
    position: static;
    height: 3.5rem;
    width: 100%;
  }

  .swipe-card.is-open .swipe-actions > form,
  .swipe-card.is-open .swipe-actions > a.swipe-action,
  .swipe-card:has(.card-more[open]) .swipe-actions > form,
  .swipe-card:has(.card-more[open]) .swipe-actions > a.swipe-action {
    flex: 1 1 0;
    width: auto;
  }

  .swipe-card.is-open .date-card-body,
  .swipe-card:has(.card-more[open]) .date-card-body {
    padding-right: 2.75rem;
  }
}

.swipe-card.is-dragging .swipe-face {
  transition: none;
}

.swipe-card.is-open:hover,
.swipe-card.is-dragging:hover {
  transform: none;
}

.swipe-face .date-card-body h2 a::after,
.swipe-face .date-card-body h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.card-more {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 2;
}

.card-more-button {
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  cursor: pointer;
  list-style: none;
}

.card-more-button::-webkit-details-marker {
  display: none;
}

.card-more-button::marker {
  content: "";
}

.card-more-button:hover,
.card-more[open] .card-more-button {
  background: var(--sand);
  color: var(--ink);
}

.card-more-button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.swipe-face .date-card-body {
  padding-right: var(--date-copy-end, 2.75rem);
}

.swipe-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  display: flex;
  visibility: hidden;
}

.swipe-card.is-open .swipe-actions,
.swipe-card:has(.card-more[open]) .swipe-actions {
  visibility: visible;
}

.swipe-actions > form,
.swipe-actions > a.swipe-action {
  flex: 0 0 3.5rem;
  width: 3.5rem;
  height: 100%;
  margin: 0;
}

.swipe-actions form > button[type="submit"] {
  margin-top: 0;
}

button.swipe-action,
a.swipe-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  width: 100%;
  height: 100%;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0.35rem 0.2rem;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: 0.75rem;
  font-weight: 680;
  line-height: 1.1;
  letter-spacing: 0;
  text-decoration: none;
}

button.swipe-action:hover,
button.swipe-action:active,
a.swipe-action:hover,
a.swipe-action:active {
  transform: none;
  box-shadow: none;
}

.swipe-action .icon {
  width: 1.15rem;
  height: 1.15rem;
}

button.swipe-action-remind,
a.swipe-action-remind {
  background: var(--honey-50);
  color: var(--honey-ink);
}

button.swipe-action-remind:hover,
button.swipe-action-remind:active {
  background: var(--honey);
  color: var(--honey-ink);
}

.shared-from {
  color: var(--ink-soft);
}

.shared-circles {
  list-style: none;
  margin: var(--s-4) 0 0;
  padding: 0;
  display: grid;
  gap: var(--s-3);
}

.shared-circles li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
}

.shared-circles form {
  margin: 0;
}

.shared-circles .button {
  min-height: 44px;
}

button.swipe-action-ignore,
a.swipe-action-ignore {
  background: var(--ink-soft);
  color: #fff;
}

button.swipe-action-ignore:hover,
button.swipe-action-ignore:active {
  background: var(--ink);
  color: #fff;
}

button.swipe-action-edit,
a.swipe-action-edit,
button.swipe-action-label,
a.swipe-action-label {
  background: var(--brand-50);
  color: var(--brand-strong);
}

button.swipe-action-edit:hover,
a.swipe-action-edit:hover,
button.swipe-action-edit:active,
a.swipe-action-edit:active,
button.swipe-action-label:hover,
a.swipe-action-label:hover,
button.swipe-action-label:active,
a.swipe-action-label:active {
  background: var(--brand-100);
  color: var(--brand-strong);
}

.suggested-mark {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 450;
  margin-left: 0.35rem;
}

.my-label,
.my-reminders {
  margin: var(--s-5) 0;
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
  max-width: 28rem;
}

.my-reminders {
  max-width: 36rem;
}

.my-label h2,
.my-reminders h2 {
  margin: 0 0 var(--s-3);
  font-size: var(--text-lg);
}

button.swipe-action-delete,
a.swipe-action-delete {
  background: var(--danger);
  color: #fff;
}

button.swipe-action-delete:hover,
button.swipe-action-delete:active {
  background: #860d25;
  color: #fff;
}

.detail-actions .detail-ignore,
.detail-actions-ignore,
.ignored-stop {
  margin: 0;
}

.detail-actions form > button[type="submit"],
.ignored-dates form > button[type="submit"] {
  margin-top: 0;
}

.ignored-dates {
  list-style: none;
  margin: var(--s-4) 0 0;
  padding: 0;
  display: grid;
  gap: var(--s-3);
}

.ignored-dates li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
}

.ignored-dates .meta {
  margin: 0.15rem 0 0;
}

@media (max-width: 30rem) {
  .swipe-face {
    gap: var(--date-face-gap, var(--s-3));
    padding: var(--date-face-pad-y, var(--s-3));
  }
}

@media (max-width: 35.99rem) {
  .detail-actions-end .detail-ignore {
    grid-column: 1 / -1;
  }

  .detail-actions-ignore,
  .detail-actions-ignore .button {
    width: 100%;
  }
}

/* Month groups (Coming Up) */

.month-group {
  margin: 0 0 var(--s-8);
}

.month-head {
  position: sticky;
  top: calc(var(--header-h) - 1px);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: 0 calc(var(--s-2) * -1) var(--s-3);
  padding: var(--s-2);
  background: linear-gradient(var(--cream) 75%, rgba(255, 248, 241, 0));
}

.month-head h2,
.month-group h2 {
  margin: 0;
  font-size: var(--text-lg);
}

.month-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.month-count {
  order: 2;
}

.month-empty {
  margin: 0;
  padding: var(--s-3) var(--s-4);
  border: 1.5px dashed var(--line);
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: var(--text-sm);
}

/* Empty states */

.empty-state {
  position: relative;
  display: grid;
  justify-items: center;
  gap: var(--s-2);
  padding: var(--s-10) var(--s-6);
  border: 1.5px dashed var(--sand-2);
  border-radius: var(--r-xl);
  background: radial-gradient(120% 90% at 50% 0%, var(--surface), rgba(255, 255, 255, 0.4));
  text-align: center;
}

.empty-state h2 {
  margin: var(--s-3) 0 0;
}

.empty-state p {
  max-width: 32rem;
  margin: 0;
  color: var(--ink-soft);
}

.empty-state .inline-actions {
  justify-content: center;
}

.empty-art {
  width: 8.5rem;
  height: 7rem;
}

/* Facts list (date detail) */

.facts {
  margin: var(--s-6) 0;
  padding: var(--s-2) var(--s-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.facts div {
  display: grid;
  grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr);
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--line);
}

.facts div:last-child {
  border-bottom: 0;
}

.facts dt {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 550;
}

.facts dd {
  margin: 0;
  min-width: 0;
  font-weight: 550;
  overflow-wrap: anywhere;
}

@media (max-width: 30rem) {
  .facts div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

.detail-hero {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  margin-bottom: var(--s-2);
  min-width: 0;
}

.detail-hero > div {
  min-width: 0;
}

.detail-hero h1 {
  overflow-wrap: anywhere;
}

.detail-hero .date-tile {
  width: 4.75rem;
  height: 5rem;
}

.detail-hero .date-tile-day {
  font-size: 2rem;
}

.detail-hero h1 {
  margin: var(--s-1) 0 0;
}

/* People lists */

.people {
  list-style: none;
  padding: 0;
  margin: var(--s-4) 0 0;
}

.people li {
  padding: var(--s-4) 0;
  border-top: 1px solid var(--line);
}

.people .meta {
  display: block;
}

.child-card {
  display: grid;
  gap: var(--s-3);
}

@media (min-width: 48rem) {
  .child-card {
    grid-template-columns: minmax(12rem, 1fr) 2fr;
    align-items: start;
  }
}

.child-card-tools {
  display: grid;
  gap: var(--s-3);
}

.child-card-tools form {
  margin: 0;
  padding: var(--s-3) var(--s-4) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fffcf9;
}

.child-card-tools form label:first-of-type {
  margin-top: var(--s-1);
}

.hint-list {
  padding-left: 1.1rem;
}

/* ---------- Tables ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--s-4) 0;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: var(--s-3) var(--s-3);
  border-bottom: 1px solid var(--line);
}

.table-scroll {
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  margin: var(--s-4) 0 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.people-table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.people-table th,
.people-table td {
  text-align: start;
  vertical-align: middle;
  padding: var(--s-3) var(--s-3);
  border-bottom: 1px solid var(--line);
}

.people-table tbody tr:last-child td {
  border-bottom: 0;
}

.people-table th {
  white-space: nowrap;
  background: var(--sand);
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.people-table th:first-child { border-top-left-radius: calc(var(--r-lg) - 1px); }
.people-table th:last-child { border-top-right-radius: calc(var(--r-lg) - 1px); }

.people-table th a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 32px;
  color: inherit;
  text-decoration: none;
}

.people-table th a:hover {
  color: var(--brand-strong);
  text-decoration: underline;
}

.people-table th[aria-sort] a {
  color: var(--brand-strong);
}

.people-table th[aria-sort="ascending"] a::after {
  content: "\2191";
}

.people-table th[aria-sort="descending"] a::after {
  content: "\2193";
}

.people-table tbody tr {
  transition: background-color var(--dur-fast) ease;
}

.people-table tbody tr:hover {
  background: #fffaf5;
}

.people-table td strong {
  display: block;
  font-weight: 650;
}

.people-table select,
.people-table input {
  min-height: 42px;
  margin-top: 0;
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
  font-size: var(--text-sm);
}

.people-table select {
  min-width: 11rem;
}

.people-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  max-width: 100%;
  min-width: 0;
}

.people-network {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  min-width: 0;
  margin: 0;
}

.people-network select {
  width: 12rem;
  max-width: 100%;
  min-width: 0;
}

.roster-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  min-width: 0;
  margin-top: 0.35rem;
}

.roster-link input {
  flex: 1 1 8rem;
  min-width: 0;
  max-width: 100%;
}

.roster-section,
.roster-others {
  margin-top: var(--s-5);
  min-width: 0;
  max-width: 100%;
}

.roster-section > h2,
.roster-others > summary {
  margin: 0;
  font-size: var(--text-lg);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.roster-others > summary {
  cursor: pointer;
  font-weight: 650;
}

.roster-section .filters,
.roster-others .filters,
.roster-section .table-scroll,
.roster-others .table-scroll {
  margin-top: var(--s-3);
}

.people-table form {
  margin: 0;
}

.people-table .save-status {
  margin-top: var(--s-1);
}

.action-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}

.action-line button {
  margin: 0;
  min-height: 40px;
  padding: 0.4rem 0.95rem;
}

td.table-actions {
  display: table-cell;
  vertical-align: middle;
  white-space: nowrap;
}

.table-actions form {
  margin: 0;
}

.table-actions p {
  margin: 0 0 var(--s-2);
  white-space: normal;
}

.table-actions form button {
  margin: 0 var(--s-2) 0 0;
}

.icon-row {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: var(--s-1);
  vertical-align: middle;
}

.icon-row form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

/* The ignore control is the only action that is a submit button, so
   `form > button[type="submit"]:last-child` was adding 1.5rem of
   margin-top and sitting it below Edit and Remove. */
.icon-row form > button.icon-button[type="submit"] {
  margin: 0;
}

a.icon-button,
button.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink-soft);
  line-height: 1;
  text-decoration: none;
  box-shadow: none;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}

a.icon-button:hover,
button.icon-button:hover,
a.icon-button:focus-visible,
button.icon-button:focus-visible {
  background: var(--brand-50);
  color: var(--brand-strong);
  transform: none;
  box-shadow: none;
}

a.icon-button:active,
button.icon-button:active {
  transform: scale(0.9);
}

button.icon-button.icon-danger,
a.icon-button.icon-danger {
  color: var(--danger);
  background: transparent;
}

a.icon-button.icon-danger:hover,
button.icon-button.icon-danger:hover,
a.icon-button.icon-danger:focus-visible,
button.icon-button.icon-danger:focus-visible {
  background: var(--danger-50);
  color: var(--danger);
}

.icon-button svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

.people-table th.verified-col,
.people-table td.verified-cell {
  width: 1%;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.people-table td.verified-cell .verified-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  vertical-align: middle;
}

.verified-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--sage-50);
  color: var(--sage);
}

.verified-mark.is-open {
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.verified-mark svg {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}

.self-label {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.65rem;
  border-radius: var(--r-pill);
  background: var(--honey-50);
  color: var(--honey-ink);
  font-weight: 650;
  font-size: var(--text-xs);
}

.people-empty td {
  text-align: center;
  color: var(--muted);
  padding: var(--s-8) var(--s-4);
}

.table-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: var(--s-3);
}

.table-foot .meta {
  margin: 0;
}

.pager {
  display: flex;
  gap: var(--s-2);
  margin-top: 0;
}

.pager a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--s-4);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: var(--text-sm);
  text-decoration: none;
  margin-top: 0;
  transition: background-color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}

.pager a:hover {
  background: var(--sand);
  color: var(--ink);
}

.pager a:active {
  transform: scale(0.97);
}

@media (max-width: 46rem) {
  .table-scroll {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .people-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
  }

  .people-table,
  .people-table tbody,
  .people-table tr,
  .people-table td {
    display: block;
    width: auto;
  }

  .people-table tr {
    margin: 0 0 var(--s-3);
    padding: var(--s-2) var(--s-4) var(--s-3);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
  }

  .people-table tbody tr:hover {
    background: var(--surface);
  }

  .people-table tbody tr:last-child td,
  .people-table td,
  .people-table td.table-actions {
    display: block;
    border: 0;
    padding: var(--s-2) 0;
    text-align: start;
    white-space: normal;
  }

  .people-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: var(--s-1);
    font-size: 0.75rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    color: var(--muted);
  }

  .people-table td[data-label="Name"]::before {
    display: none;
  }

  .people-table td[data-label="Name"] strong {
    font-size: var(--text-base);
  }

  .people-table td.verified-cell,
  .people-table td.verified-cell::before {
    text-align: start;
  }

  .people-table select {
    min-width: 0;
    width: 100%;
  }

  .people-table select,
  .people-table input {
    min-height: 48px;
  }

  .people-table button,
  .people-table .button {
    max-width: 100%;
    height: auto;
    white-space: normal;
  }

  .people-table .choice {
    max-width: 100%;
  }

  .people-table .member-actions,
  .people-actions,
  .people-network,
  .roster-link {
    flex-wrap: wrap;
    max-width: 100%;
  }

  .people-network,
  .people-network select,
  .roster-link input {
    width: 100%;
    max-width: 100%;
  }

  .people-table .member-actions button,
  .people-table .member-actions .button {
    min-height: 2rem;
    width: auto;
    max-width: 100%;
    white-space: nowrap;
  }

  .people-table .member-actions input[type="checkbox"] {
    min-height: 1rem;
    width: 1rem;
    height: 1rem;
  }

  .people-empty td {
    text-align: center;
  }
}

.people-table .save-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}

.people-table .save-row button {
  margin-top: var(--s-1);
}

/* ---------- Filters ---------- */

.filters {
  display: grid;
  gap: var(--s-3);
  margin: 0;
  min-width: 0;
  max-width: 100%;
  padding: var(--s-4);
  border-radius: var(--r-lg);
  background: var(--sand);
}

@media (min-width: 40rem) {
  .filters {
    grid-template-columns: 2fr 1fr 1fr auto;
    align-items: end;
  }
}

.filters label {
  margin-top: 0;
  font-size: var(--text-xs);
}

.filters input,
.filters select {
  margin-top: var(--s-1);
}

.filters button,
.table-actions button,
.pager a {
  margin-top: 0;
}

.search-field {
  position: relative;
}

.search-field .icon {
  position: absolute;
  left: 0.85rem;
  bottom: 0.85rem;
  width: 1.15rem;
  height: 1.15rem;
  color: var(--muted);
  pointer-events: none;
}

.search-field input {
  padding-left: 2.6rem;
}

/* ---------- Sub navigation ---------- */

.subnav,
.chip-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--s-2);
  margin: 0 0 var(--s-6);
  min-width: 0;
  max-width: 100%;
  padding-bottom: var(--s-1);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.subnav::-webkit-scrollbar,
.chip-nav::-webkit-scrollbar {
  display: none;
}

.subnav a,
.chip-nav a {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 var(--s-4);
  border: 1.5px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}

.subnav a:hover,
.chip-nav a:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.subnav a:active,
.chip-nav a:active {
  transform: scale(0.97);
}

.subnav a[aria-current="page"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

/* The two sharing views are long labels. On a phone they wrap onto another
   line instead of sliding sideways off the card. */
@media (max-width: 40rem) {
  #sharing .subnav {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

.chip-nav a .icon {
  width: 1rem;
  height: 1rem;
}

/* ---------- Onboarding progress ---------- */

.step-count {
  margin: 0 0 var(--s-2);
  color: var(--brand);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.progress {
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-2);
  list-style: none;
  margin: 0 0 var(--s-8);
  padding: 0;
}

.progress li {
  counter-increment: step;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding-top: var(--s-3);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
}

.progress li::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--sand-2);
}

.progress li:has(~ li[aria-current="step"])::before {
  background: var(--sage-500);
}

.progress li[aria-current="step"] {
  color: var(--ink);
  font-weight: 700;
}

.progress li[aria-current="step"]::before {
  background: linear-gradient(90deg, var(--brand), var(--brand-500));
  animation: grow-x 700ms var(--ease-out) both;
  transform-origin: left center;
}

@keyframes grow-x {
  from { transform: scaleX(0.15); }
  to { transform: scaleX(1); }
}

.flow-card {
  padding: var(--s-8);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

@media (max-width: 35.99rem) {
  .flow-card {
    padding: var(--s-6) var(--s-4);
    border-radius: var(--r-lg);
  }

  .detail-actions,
  .form-actions:has(.form-actions-end) {
    flex-direction: column;
    align-items: stretch;
  }

  .detail-actions-start,
  .detail-actions-end,
  .form-actions-start {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .detail-actions .button,
  .form-actions-start .button,
  .form-actions-start button,
  .form-actions-end,
  .form-actions-end button {
    width: 100%;
  }
}

@media (max-width: 22rem) {
  .detail-actions-start,
  .detail-actions-end,
  .form-actions-start {
    grid-template-columns: 1fr;
  }
}

.flow-card > h1 {
  margin-top: 0;
}

/* ---------- Auth pages ---------- */

.auth-shell {
  display: grid;
  place-items: center;
  padding: var(--s-4) 0 var(--s-8);
}

.auth-card {
  position: relative;
  width: min(30rem, 100%);
  padding: var(--s-8);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.auth-card.auth-card-wide {
  width: min(38rem, 100%);
}

@media (max-width: 35.99rem) {
  .auth-card {
    padding: var(--s-6) var(--s-5);
    border-radius: var(--r-lg);
  }
}

.auth-card > .icon-tile {
  margin-bottom: var(--s-4);
  width: 3.25rem;
  height: 3.25rem;
  border-radius: var(--r-lg);
}

.auth-card > .icon-tile .icon {
  width: 1.6rem;
  height: 1.6rem;
}

.auth-card h1 {
  margin-bottom: var(--s-2);
}

.auth-card form button[type="submit"] {
  width: 100%;
  margin-top: var(--s-6);
}

.auth-card .cf-turnstile {
  width: min(100%, 18.75rem);
  min-height: 4.0625rem;
  margin-top: var(--s-6);
}

.auth-card .auth-sub {
  color: var(--muted);
  margin-bottom: var(--s-2);
}

.auth-links {
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-6);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
}

.auth-links p,
.auth-links .hint {
  margin: 0;
}

/* ---------- Invite tools / group panels ---------- */

.settings-grid {
  display: grid;
  gap: var(--s-5);
}

@media (min-width: 60rem) {
  .settings-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.settings-grid > div {
  min-width: 0;
  padding: var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: #fffcf9;
}

.settings-compact h3 {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--text-base);
  margin: 0 0 var(--s-1);
}

.settings-compact h3 .icon {
  color: var(--brand);
}

.group-note,
.group-panel {
  display: none;
}

.group-panel {
  margin-top: var(--s-6);
  padding-top: var(--s-5);
  border-top: 1px dashed var(--line-strong);
}

.group-panel h2,
.group-panel h3 {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--text-base);
}

.copy-row {
  display: flex;
  gap: var(--s-2);
  align-items: stretch;
}

button[data-copy-target].is-copied {
  background: var(--sage);
  border-color: var(--sage);
  animation: pop-in 320ms var(--ease-spring);
}

/* ---------- Country picker ---------- */

.ip2c-flag {
  display: inline-block;
  width: 24px;
  height: 18px;
  object-fit: cover;
  vertical-align: -0.15em;
  flex: 0 0 auto;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(43, 29, 22, 0.12);
}

.country-field .country-flag-static {
  margin-top: var(--s-2);
}

.country-field.is-enhanced .country-flag-static {
  display: none !important;
}

.country-picker {
  position: relative;
  z-index: 2;
  margin-top: var(--s-2);
}

/* The open list hangs out of its card. Lift that card above the next one.
   The people search on Circle is a text filter, not a list, so it is left alone. */
main > *:has(.country-picker:focus-within) {
  position: relative;
  z-index: 30;
}

.country-picker .country-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.country-picker-control {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 48px;
  padding: 0.35rem 0.9rem;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur) var(--ease-out);
}

.country-picker-control:hover {
  border-color: var(--ink-soft);
}

.country-picker-control:focus-within {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
}

.country-picker-control .country-picker-input {
  display: block;
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0.15rem 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.country-picker-control .country-picker-input:focus,
.country-picker-control .country-picker-input:focus-visible {
  outline: none;
  box-shadow: none;
}

.country-picker-list {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 0.4rem);
  max-height: 16rem;
  margin: 0;
  padding: var(--s-1);
  overflow: auto;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  animation: drop-in 180ms var(--ease-out);
}

@keyframes drop-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.country-picker-list li {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 44px;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  cursor: pointer;
}

.country-picker-list li[aria-selected="true"] {
  font-weight: 700;
}

.country-picker-list li.is-active,
.country-picker-list li:hover {
  background: var(--brand-50);
}

.country-picker-empty {
  color: var(--muted);
  cursor: default;
}

/* ---------- Home page ---------- */

.hero {
  position: relative;
  padding: var(--s-8) 0 var(--s-16);
  margin-top: calc(var(--s-8) * -1);
  isolation: isolate;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0 calc(50% - 50vw);
  z-index: -1;
  background:
    radial-gradient(40rem 26rem at 85% 20%, rgba(242, 181, 68, 0.22), transparent 70%),
    radial-gradient(36rem 28rem at 10% 0%, rgba(217, 101, 74, 0.16), transparent 70%),
    radial-gradient(30rem 22rem at 60% 100%, rgba(92, 155, 130, 0.14), transparent 70%);
}

.hero-grid {
  display: grid;
  gap: var(--s-10);
  align-items: center;
  padding-top: var(--s-10);
}

@media (min-width: 60rem) {
  .hero-grid {
    grid-template-columns: 1.05fr 1fr;
    gap: var(--s-12);
    padding-top: var(--s-12);
  }
}

.hero h1 {
  font-size: var(--text-hero);
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin: 0 0 var(--s-5);
}

.hero h1 .accent {
  color: var(--brand);
  background: linear-gradient(90deg, var(--brand), #c9622c);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero .lede {
  font-size: clamp(1.1rem, 1rem + 0.4vw, 1.3rem);
  max-width: 34rem;
  margin-bottom: var(--s-8);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin: 0;
}

.hero-actions .button {
  margin: 0;
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  margin: var(--s-6) 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: 550;
}

.hero-points li {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}

.hero-points .icon {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--sage);
}

.hero-art {
  position: relative;
  width: min(100%, 32rem);
  margin-inline: auto;
}

.hero-art svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.section {
  padding: var(--s-16) 0;
}

.section-tint {
  background: var(--surface);
  border-block: 1px solid var(--line);
}

.section-head {
  max-width: 40rem;
  margin: 0 auto var(--s-10);
  text-align: center;
}

.section-head h2 {
  font-size: var(--text-2xl);
  letter-spacing: -0.03em;
  margin-bottom: var(--s-3);
}

.section-head p {
  color: var(--ink-soft);
  font-size: var(--text-lg);
  margin: 0;
}

.steps {
  counter-reset: how;
  display: grid;
  gap: var(--s-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 52rem) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
  }
}

.steps li {
  counter-increment: how;
  position: relative;
  margin: 0;
  padding: var(--s-6);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--cream);
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}

.steps li:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.steps li::after {
  content: counter(how);
  position: absolute;
  top: var(--s-5);
  right: var(--s-6);
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--sand-2);
}

.steps li + li,
.stack + .stack {
  margin-top: 0;
}

.step-title {
  display: block;
  margin: var(--s-4) 0 var(--s-2);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.015em;
}

.steps p {
  margin: 0;
  color: var(--ink-soft);
}

.feature-grid {
  display: grid;
  gap: var(--s-4);
}

@media (min-width: 40rem) {
  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 64rem) {
  .feature-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.feature {
  padding: var(--s-6);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), border-color var(--dur) ease;
}

.feature:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--sand-2);
}

.feature .icon-tile {
  transition: transform var(--dur) var(--ease-spring);
}

.feature:hover .icon-tile {
  transform: rotate(-6deg) scale(1.08);
}

.feature h3 {
  margin: var(--s-4) 0 var(--s-2);
}

.feature p {
  margin: 0;
  color: var(--ink-soft);
  font-size: var(--text-sm);
}

.cta-band {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: var(--s-6);
  align-items: center;
  padding: var(--s-10) var(--s-8);
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, #3a2419, #2b1d16 60%);
  color: var(--footer-ink);
  box-shadow: var(--shadow-lg);
}

@media (min-width: 48rem) {
  .cta-band {
    grid-template-columns: 1fr auto;
    padding: var(--s-12);
  }
}

@media (max-width: 35.99rem) {
  .cta-band {
    padding: var(--s-8) var(--s-5);
  }
}

.cta-band::after {
  content: "";
  position: absolute;
  right: -6rem;
  top: -6rem;
  width: 18rem;
  height: 18rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 181, 68, 0.28), transparent 70%);
  animation: float-soft 9s ease-in-out infinite;
}

.cta-band h2 {
  color: #fff;
  font-size: var(--text-2xl);
  margin-bottom: var(--s-2);
}

.cta-band p {
  margin: 0;
  color: var(--footer-muted);
}

.cta-band .button {
  margin: 0;
  position: relative;
  z-index: 1;
}

.cta-band :focus-visible {
  outline-color: var(--honey);
}

/* ---------- Prose (legal) ---------- */

.prose {
  max-width: 44rem;
}

.prose h1 {
  font-size: var(--text-2xl);
}

.prose h2 {
  margin-top: var(--s-10);
  padding-top: var(--s-6);
  border-top: 1px solid var(--line);
}

.prose ul,
.prose ol {
  padding-left: 1.25rem;
  margin: 0 0 var(--s-4);
}

.prose li {
  margin: var(--s-2) 0;
}

.prose li::marker {
  color: var(--brand);
}

.prose table {
  font-size: var(--text-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}

.prose th {
  background: var(--sand);
}

.prose-meta {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-pill);
  background: var(--sand);
  color: var(--ink-soft);
  font-size: var(--text-xs);
  font-weight: 600;
}

/* ---------- Status pages ---------- */

.status-page {
  display: grid;
  justify-items: center;
  gap: var(--s-3);
  padding: var(--s-12) var(--s-4);
  text-align: center;
}

.status-page h1 {
  margin: var(--s-3) 0 0;
}

.status-page p {
  max-width: 32rem;
  margin: 0;
  color: var(--ink-soft);
}

.status-page .icon-tile {
  width: 4rem;
  height: 4rem;
  border-radius: var(--r-xl);
}

.status-page .icon-tile .icon {
  width: 2rem;
  height: 2rem;
}

/* ---------- Gift / ad slots ---------- */

.gift-slot[hidden] {
  display: none !important;
}

/* ---------- Animation ---------- */

@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes float-soft {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -10px, 0); }
}

@keyframes float-tilt {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  50% { transform: translate3d(0, -8px, 0) rotate(-3deg); }
}

@keyframes bell-ring {
  0%, 70%, 100% { transform: rotate(0deg); }
  75% { transform: rotate(12deg); }
  80% { transform: rotate(-10deg); }
  85% { transform: rotate(7deg); }
  90% { transform: rotate(-4deg); }
}

/* Page entrance: first blocks in main fade up, staggered.
   Fill mode is backwards so a finished translateY(0) does not leave a
   stacking context on every block. That context was painting the next
   card over the country typeahead. */
main > * {
  animation: rise-in 520ms var(--ease-out) backwards;
}

main > *:nth-child(2) { animation-delay: 60ms; }
main > *:nth-child(3) { animation-delay: 120ms; }
main > *:nth-child(4) { animation-delay: 180ms; }
main > *:nth-child(5) { animation-delay: 240ms; }
main > *:nth-child(n + 6) { animation-delay: 300ms; }

/* Floating illustration pieces. transform-box keeps SVG groups rotating on their own centre. */
.float,
.float-slow,
.float-tilt {
  transform-box: fill-box;
  transform-origin: center;
  will-change: transform;
}

.float { animation: float-soft 6s ease-in-out infinite; }
.float-slow { animation: float-soft 8.5s ease-in-out infinite; }
.float-tilt { animation: float-tilt 7s ease-in-out infinite; }
.delay-1 { animation-delay: -1.5s; }
.delay-2 { animation-delay: -3s; }
.delay-3 { animation-delay: -4.5s; }

.ring-bell {
  transform-box: fill-box;
  transform-origin: 50% 10%;
  animation: bell-ring 5s ease-in-out infinite;
}

/* Scroll reveal: app.js adds .reveal only to blocks that start below the fold. */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 220ms;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .nav-app,
  .hero-art {
    display: none !important;
  }

  body {
    background: #fff;
  }
}

/* ---------- Admin ---------- */

search {
  display: block;
}

.admin-shell {
  display: block;
}

.admin-main > :first-child {
  margin-top: 0;
}

.admin-nav {
  margin-bottom: var(--s-5);
}

@media (min-width: 64rem) {
  .admin-shell {
    display: grid;
    grid-template-columns: 14.5rem minmax(0, 1fr);
    gap: var(--s-6);
    align-items: start;
  }

  .admin-shell .admin-nav {
    position: sticky;
    top: calc(var(--header-h) + var(--s-4));
    flex-direction: column;
    align-items: stretch;
    margin: 0;
    padding: var(--s-2);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    overflow: visible;
  }

  .admin-shell .admin-nav a {
    justify-content: flex-start;
  }
}

.stat-grid {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: 1fr;
}

@media (min-width: 40rem) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters.filters-wide {
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  }
}

@media (min-width: 72rem) {
  .stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.stat-card h2 {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 650;
}

.stat-value {
  margin: var(--s-2) 0;
  color: var(--ink);
  font-size: var(--text-2xl);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.spark {
  display: block;
  width: 100%;
  max-width: 10rem;
  height: 2.25rem;
  margin-top: var(--s-3);
  color: var(--brand);
}

.spark rect {
  fill: currentColor;
}

.detail-list {
  display: grid;
  gap: var(--s-3);
  margin: 0;
}

@media (min-width: 40rem) {
  .detail-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.detail-list div {
  margin: 0;
}

.detail-list dt {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 650;
}

.detail-list dd {
  margin: var(--s-1) 0 0;
}

.people-table code {
  overflow-wrap: anywhere;
  font-size: var(--text-xs);
}

/* People-first home. Cards stack in a narrow container and sit side by side when the group is wide enough. */
.person-board,
.person-links {
  display: grid;
  gap: var(--s-4);
  min-width: 0;
}

.person-group {
  container-type: inline-size;
  container-name: people;
  min-width: 0;
}

.person-group.is-linked {
  padding: var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--sand);
}

.person-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-3);
}

.person-card-link {
  display: block;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  border-radius: var(--r-lg);
}

.person-card-link:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.person-card-link:hover .person-card {
  border-color: var(--brand);
}

.person-card {
  min-width: 0;
  height: 100%;
  padding: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.person-card h2,
.person-card p,
.person-relation,
.person-dates,
.person-unassigned {
  overflow-wrap: break-word;
}

.person-card h2 {
  margin: 0 0 var(--s-1);
}

.person-card h2 a {
  color: inherit;
  text-decoration: none;
}

.person-card p,
.person-relation {
  margin: 0;
}

.person-card .person-next {
  margin-top: var(--s-2);
  color: var(--muted);
}

.person-card-link:hover .person-card {
  border-color: var(--brand);
}

.person-unassigned {
  margin-top: var(--s-5);
  min-width: 0;
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.person-unassigned-list,
.person-dates {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--s-4);
}

.person-dates {
  gap: 0;
}

.person-dates li {
  min-width: 0;
  padding-block: var(--s-3);
  border-top: 1px solid var(--line);
}

.person-unassigned form,
.person-links form {
  min-width: 0;
}

.person-unassigned form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--s-2);
}

.person-unassigned select {
  flex: 1 1 10rem;
  min-width: 0;
  max-width: 100%;
}

@container people (min-width: 36rem) {
  .person-group.is-linked .person-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .person-group.is-linked .person-card-link.is-child {
    grid-column: 1 / -1;
  }
}

@media (min-width: 48rem) {
  .person-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

.person-new {
  display: none;
  margin-top: var(--s-3);
}

.person-new {
  display: none;
}

form.date-form:has(#add_person:checked) .person-new {
  display: block;
}

form.person-form:not(:has(select[name="relationship"] option[value="other"]:checked)) .relationship-other {
  display: none;
}

/* ==========================================================================
   Behaviour rules. These show and hide fields without JavaScript.
   Keep the selectors in step with the templates.
   ========================================================================== */

.fixed-note,
.relationship-other,
.custom-field,
.remind-me,
.parent-day-opt-in {
  margin-top: var(--s-3);
}

form.date-form.is-moving .needs-calendar,
form.date-form.is-moving .custom-field,
form.date-form.is-moving .remind-me {
  display: none;
}

.invite-on-add {
  margin-top: var(--s-5);
}

.invite-on-add .invite-email {
  display: none;
  margin-top: var(--s-3);
}

.invite-on-add:has(#invite_to_circle:checked) .invite-email {
  display: block;
}

.invite-tools:has(#invite_group option[value="immediate"]:checked) .group-note-immediate,
.invite-tools:has(#invite_group option[value="immediate"]:checked) .group-panel-immediate,
.invite-tools:has(#invite_group option[value="extended"]:checked) .group-note-extended,
.invite-tools:has(#invite_group option[value="extended"]:checked) .group-panel-extended,
.invite-tools:has(#invite_group option[value="like_family"]:checked) .group-note-like_family,
.invite-tools:has(#invite_group option[value="like_family"]:checked) .group-panel-like_family {
  display: block;
}

form.date-form .year-hint-birthday {
  display: none;
}

form.date-form:has(#kind option[value="birthday"]:checked) .year-hint-other {
  display: none;
}

form.date-form:has(#kind option[value="birthday"]:checked) .year-hint-birthday {
  display: block;
}

form.date-form:not(:has(#kind option[value="other"]:checked)):not(:has(#kind option[value="special"]:checked)) .custom-field,
form.date-form:not(:has(#kind option[value="wedding"]:checked)) .remind-once,
form.date-form:not(:has(#relationship option[value="other"]:checked)) .relationship-other {
  display: none;
}

/* Submit feedback added by app.js; purely visual, the button still submits normally. */
.button.is-busy,
button.is-busy {
  position: relative;
  cursor: progress;
  opacity: 0.85;
}

.button.is-busy::after,
button.is-busy::after {
  content: "";
  width: 1em;
  height: 1em;
  margin-left: 0.5em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  vertical-align: -0.15em;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Redesign helpers ---------- */
.feature-grid {
  margin: 0;
  padding: 0;
  list-style: none;
}

.feature-grid > li + li {
  margin-top: 0;
}

.section-features {
  padding-top: 0;
}

.confirm-card form {
  display: grid;
  gap: var(--s-3);
}

.confirm-card form .button,
.confirm-card form button {
  width: 100%;
  margin: 0;
}

.confirm-card form button[type="submit"] {
  margin-top: var(--s-4);
}

.panel > h2.heading-icon {
  font-size: var(--text-lg);
}

.empty-state > p + p {
  margin-top: 0;
}

.brand-name,
.header-actions a,
.header-actions button {
  white-space: nowrap;
}

@media (max-width: 30rem) {
  .header-row {
    gap: var(--s-2);
  }

  .brand {
    font-size: 1rem;
  }

  .brand-mark {
    width: 2rem;
    height: 2rem;
  }

  .header-actions {
    gap: var(--s-1);
  }

  .header-actions .button {
    min-height: 44px;
    padding: 0 0.9rem;
    font-size: var(--text-sm);
  }
}

@media (max-width: 47.99rem) {
  /* backdrop-filter would make the header the containing block of the fixed tab bar. */
  .has-tabbar .site-header {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--cream);
  }
}

@media (max-width: 30rem) {
  /* Logged-out header: keep Log In and Get Started visible; the mark carries the brand. */
  .site-header:has(.login-link) .brand-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* ---------- Public holidays ---------- */

.date-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin: 0 0 var(--s-4);
}

.date-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  color: var(--ink-soft);
  text-decoration: none;
  background: var(--sand);
}

.date-nav a[aria-current="page"] {
  color: var(--brand-strong);
  background: var(--brand-50);
  font-weight: 650;
}

.holiday-countries,
.holiday-country {
  margin-bottom: var(--s-5);
  overflow: visible;
}

.holiday-countries-head,
.holiday-days-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.holiday-picks,
.holiday-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.holiday-picks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}

.holiday-picks li,
.holiday-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
}

.holiday-picks li {
  flex: 0 1 auto;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.country-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-sizing: border-box;
  min-height: 44px;
  max-width: 100%;
  margin: 0;
  padding: 0.25rem 0.85rem 0.25rem 0.65rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 620;
  line-height: 1.2;
  cursor: pointer;
}

.country-pill:hover {
  border-color: var(--ink-soft);
  background: #fffcf9;
}

.country-pill:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-50);
  color: var(--brand-strong);
  box-shadow: 0 0 0 1px var(--brand) inset;
}

.country-pill .ip2c-flag {
  width: 20px;
  height: 15px;
}

.country-pill-name {
  min-width: 0;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.holiday-list li {
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--line);
}

.holiday-list li:last-child {
  border-bottom: 0;
}

.holiday-list label[for^="pick-"] {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  flex: 1 1 16rem;
}

.holiday-name {
  font-weight: 650;
}

.holiday-when,
.holiday-list .hint {
  color: var(--muted);
}

.holiday-lead {
  align-self: center;
  color: var(--muted);
  font-size: var(--text-sm);
}

.holiday-country {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  padding: var(--s-4);
}

.holiday-country legend {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0 var(--s-2);
  font-weight: 650;
}

.holiday-list input,
.holiday-picks input {
  accent-color: var(--brand);
  width: 1.15rem;
  height: 1.15rem;
}

.holiday-list select {
  flex: 1 1 12rem;
  max-width: 16rem;
  min-height: 44px;
}

/* Checkboxes were inheriting text-field padding, a 48px min-height, and the
   4px focus halo, so the tick sat in a tall box and the ring was much larger
   than the control. Size them as the tick, and draw the keyboard ring on the
   box itself. Choice rows keep their selected inset and do not add that halo. */
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--brand);
  box-sizing: border-box;
  display: inline-block;
  width: 1.15rem;
  height: 1.15rem;
  min-width: 1.15rem;
  min-height: 1.15rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0.25rem;
  background: transparent;
  box-shadow: none;
  vertical-align: middle;
  flex: 0 0 auto;
}

.table-wrap {
  container: share-grid / inline-size;
  position: relative;
  max-width: 100%;
  min-width: 0;
  overflow-x: clip;
}

.share-matrix {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.share-matrix thead th:first-child {
  width: 34%;
}

.share-matrix th,
.share-matrix td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid var(--line, #e6dfd4);
  overflow-wrap: anywhere;
}

.share-matrix thead th a {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  color: inherit;
  text-decoration: none;
}

.share-matrix thead th a:hover {
  color: var(--brand-strong);
  text-decoration: underline;
}

.share-sort-caption,
.share-cell-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.share-cell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  cursor: pointer;
}

.share-cell-value {
  font-weight: 600;
}

/* Under 40rem the wide columns become one card per person. The same inputs
   stay in the row, with the category name beside each tick. Sort links wrap
   above the cards and the pager stays under the list. */
@container share-grid (inline-size < 40rem) {
  .share-matrix {
    display: block;
    table-layout: auto;
    margin: 0;
  }

  .share-sort-caption {
    position: static;
    width: auto;
    height: auto;
    margin: 0 0 var(--s-2);
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: normal;
    font-size: var(--text-xs);
    font-weight: 650;
    letter-spacing: 0.02em;
    color: var(--muted);
    text-align: start;
  }

  .share-matrix thead,
  .share-matrix tbody {
    display: block;
  }

  .share-matrix thead tr {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    margin: 0 0 var(--s-3);
  }

  .share-matrix thead th,
  .share-matrix tbody th,
  .share-matrix td {
    display: block;
    width: auto;
  }

  .share-matrix thead th {
    border: 0;
    padding: 0;
    background: transparent;
  }

  .share-matrix thead th:first-child {
    width: auto;
  }

  .share-matrix thead th a {
    min-height: 44px;
    padding: 0 0.85rem;
    border: 1.5px solid var(--line);
    border-radius: var(--r-pill);
    background: var(--surface);
    white-space: nowrap;
    text-decoration: none;
  }

  .share-matrix tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.5rem;
    margin: 0 0 var(--s-3);
    padding: var(--s-3) var(--s-4) var(--s-4);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
  }

  .share-matrix tbody th {
    grid-column: 1 / -1;
    border: 0;
    padding: 0 0 0.15rem;
    font-size: var(--text-base);
  }

  .share-matrix tbody td {
    border: 0;
    padding: 0;
    min-width: 0;
  }

  .share-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: #fffcf9;
  }

  .share-cell-label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: normal;
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: var(--text-xs);
    font-weight: 650;
    line-height: 1.3;
    color: var(--muted);
  }
}

.share-matrix th .meta,
.share-summary .meta {
  display: block;
  font-weight: 400;
}

.share-summary {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.share-summary li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line, #e6dfd4);
}

.share-summary li span,
.share-summary li strong {
  min-width: 0;
}

.advanced-sharing {
  margin-top: 1rem;
  min-width: 0;
}

.advanced-sharing summary {
  cursor: pointer;
  font-weight: 600;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.network-card {
  margin-top: 1.25rem;
}

.hub-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
  margin: 0 0 1.5rem;
}

.hub-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line, #e6dfd4);
  border-radius: 1rem;
  background: #fff;
  color: inherit;
  text-decoration: none;
}

.hub-card h2 {
  margin: 0;
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}

.hub-card p {
  margin: 0;
}

.network-ticks {
  min-width: 0;
  max-width: 100%;
}

.network-ticks .choice > span {
  overflow-wrap: anywhere;
}

/* Member actions stay on one short line. On a narrow phone they wrap onto a
   second line inside the cell, and the page itself does not scroll sideways. */
.member-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin: 0;
  max-width: 100%;
  min-width: 0;
}

form.member-actions > button[type="submit"],
form.member-actions > button[type="submit"]:last-child,
.member-actions > a.button,
.member-actions > a.button:last-child {
  margin: 0;
  min-height: 2rem;
  height: auto;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  line-height: 1.2;
  white-space: nowrap;
  max-width: 100%;
  flex: 0 1 auto;
}

.member-actions .choice {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.15rem 0.5rem;
  min-height: 2rem;
  max-width: 100%;
  font-size: 0.75rem;
  font-weight: 550;
}

.member-actions .choice input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  min-width: 1rem;
  min-height: 1rem;
  margin: 0;
}

.danger-panel {
  margin-top: var(--s-6);
  max-width: 100%;
  border: 1px solid var(--danger);
  border-radius: var(--r-lg);
  background: var(--danger-50, #fff5f6);
  padding: 0.75rem 1rem 1rem;
}

.danger-panel summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--danger);
}

.danger-panel form {
  margin-top: var(--s-3);
  max-width: 36rem;
}

.network-members {
  list-style: none;
  padding: 0;
}

.choice input[type="checkbox"],
.choice input[type="radio"] {
  width: 1.25rem;
  height: 1.25rem;
  min-width: 1.25rem;
  min-height: 1.25rem;
  margin: 0.15rem 0 0;
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
  border: 0;
  box-shadow: none;
}

input[type="checkbox"]:focus {
  outline: none;
}

input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  box-shadow: none;
}

.choice:has(input[type="checkbox"]:focus-visible) {
  box-shadow: none;
}

.choice:has(input[type="checkbox"]:checked) {
  border-color: var(--brand);
  background: var(--brand-50);
  box-shadow: 0 0 0 1px var(--brand) inset;
}
