/* ── Theme tokens ─────────────────────────────────────────────── */
:root,
[data-theme="sage"] {
  color-scheme: light;
  --native-ad-banner-height: 64px;
  --bg: #f4f6f5;
  --bg-elevated: #ffffff;
  --bg-soft: #e8eeeb;
  --bg-muted: #f0f4f2;
  --ink: #1a2420;
  --ink-secondary: #5c6b64;
  --ink-tertiary: #8a9890;
  --ink-muted: var(--ink-tertiary);
  --border: rgba(26, 36, 32, 0.08);
  --border-strong: rgba(26, 36, 32, 0.14);
  --accent: #3f7f5b;
  --accent-hover: #336f4e;
  --accent-strong: var(--accent-hover);
  --accent-soft: rgba(63, 127, 91, 0.12);
  --accent-text: #ffffff;
  --danger: #e05252;
  --danger-soft: rgba(224, 82, 82, 0.1);
  --warning: #d4920a;
  --success: #3d9b5a;
  --plus-bg: #fff8df;
  --plus-bg-strong: #ffefad;
  --plus-border: rgba(207, 150, 23, 0.46);
  --plus-ink: #735008;
  --plus-shadow: 0 10px 26px rgba(173, 124, 16, 0.12);
  --shadow-sm: 0 1px 2px rgba(26, 36, 32, 0.05);
  --shadow-md: 0 8px 26px rgba(26, 36, 32, 0.08);
  --shadow-lg: 0 20px 56px rgba(26, 36, 32, 0.14);
  --nav-bg: rgba(255, 255, 255, 0.88);
  --sidebar-bg: #ffffff;
  --surface-tint: rgba(255, 255, 255, 0.72);
  --calendar-paper: #fffaf0;
  --coral: #fb6655;
  --sky: #6aa7c7;
  --amber: #d99a17;
  --berry: #9953a5;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-full: 999px;
}

[data-theme="ocean"] {
  --bg: #f0f5fa;
  --bg-elevated: #ffffff;
  --bg-soft: #e3edf7;
  --bg-muted: #eef4fa;
  --ink: #142033;
  --ink-secondary: #4d6278;
  --ink-tertiary: #7d92a8;
  --border: rgba(20, 32, 51, 0.08);
  --border-strong: rgba(20, 32, 51, 0.14);
  --accent: #2b6cb0;
  --accent-hover: #245d9a;
  --accent-soft: rgba(43, 108, 176, 0.12);
  --nav-bg: rgba(255, 255, 255, 0.9);
  --sidebar-bg: #ffffff;
}

[data-theme="sunset"] {
  --bg: #faf5f2;
  --bg-elevated: #ffffff;
  --bg-soft: #f5ebe4;
  --bg-muted: #faf0ea;
  --ink: #2a1f1a;
  --ink-secondary: #6b5548;
  --ink-tertiary: #9a8274;
  --border: rgba(42, 31, 26, 0.08);
  --border-strong: rgba(42, 31, 26, 0.14);
  --accent: #d4623a;
  --accent-hover: #c05532;
  --accent-soft: rgba(212, 98, 58, 0.12);
  --nav-bg: rgba(255, 255, 255, 0.9);
  --sidebar-bg: #ffffff;
}

[data-theme="lavender"] {
  --bg: #f6f4fa;
  --bg-elevated: #ffffff;
  --bg-soft: #ece8f4;
  --bg-muted: #f2eff8;
  --ink: #221a2e;
  --ink-secondary: #5e4f72;
  --ink-tertiary: #8c7da0;
  --border: rgba(34, 26, 46, 0.08);
  --border-strong: rgba(34, 26, 46, 0.14);
  --accent: #7c4dbd;
  --accent-hover: #6b42a8;
  --accent-soft: rgba(124, 77, 189, 0.12);
  --nav-bg: rgba(255, 255, 255, 0.9);
  --sidebar-bg: #ffffff;
}

[data-theme="midnight"] {
  color-scheme: dark;
  --bg: #12151a;
  --bg-elevated: #1c2128;
  --bg-soft: #252b34;
  --bg-muted: #1a1f26;
  --ink: #eef1f5;
  --ink-secondary: #9aa5b4;
  --ink-tertiary: #6b7788;
  --border: rgba(238, 241, 245, 0.08);
  --border-strong: rgba(238, 241, 245, 0.14);
  --accent: #5b9fd4;
  --accent-hover: #4d8fc4;
  --accent-soft: rgba(91, 159, 212, 0.16);
  --danger: #f07070;
  --danger-soft: rgba(240, 112, 112, 0.14);
  --plus-bg: rgba(161, 119, 25, 0.22);
  --plus-bg-strong: rgba(235, 180, 56, 0.22);
  --plus-border: rgba(244, 198, 82, 0.44);
  --plus-ink: #f8dc8a;
  --plus-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.35);
  --nav-bg: rgba(28, 33, 40, 0.92);
  --sidebar-bg: #1c2128;
  --surface-tint: rgba(28, 33, 40, 0.72);
  --calendar-paper: #22201b;
}

/* ── Reset & base ───────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  width: 100%;
  overflow-x: hidden;
  touch-action: manipulation;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 5%, var(--bg)) 0%, var(--bg) 36rem),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: calc(28px + env(safe-area-inset-top)) 24px calc(28px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 250, 240, 0.84), transparent 34rem),
    linear-gradient(180deg, #eef5f1 0%, var(--bg) 55%, #f8f7f1 100%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.loading-overlay[hidden] {
  display: none;
}

.loading-stage {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(360px, 100%);
  text-align: center;
  color: var(--ink);
}

.loading-stage .brand-mark {
  margin-bottom: 14px;
}

.loading-tagline {
  color: var(--ink-secondary);
  font-size: 1rem;
  font-weight: 700;
}

.loading-rail {
  position: relative;
  width: min(132px, 44vw);
  height: 6px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--accent) 12%, white);
}

.loading-rail span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 62%, var(--sky)));
  animation: sharedays-load 1.45s ease-in-out infinite;
}

.loading-message {
  margin-top: 6px;
  color: var(--ink-tertiary);
  font-size: 0.82rem;
  font-weight: 800;
}

@keyframes sharedays-load {
  0% {
    transform: translateX(-30%);
  }

  50% {
    transform: translateX(138%);
  }

  100% {
    transform: translateX(-30%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-rail span {
    animation: none;
    width: 58%;
  }
}

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

button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: inherit;
}

/* ── Icons ──────────────────────────────────────────────────── */
.icon {
  display: inline-flex;
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-lg {
  width: 1.5rem;
  height: 1.5rem;
}

.icon-sm {
  width: 1rem;
  height: 1rem;
}

/* ── Layout shell ───────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100vh;
  height: 100dvh;
  padding: 22px 18px;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--sidebar-bg) 92%, var(--bg-soft));
}

.brand,
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  margin-bottom: 8px;
  border-radius: var(--radius-md);
  color: inherit;
  text-decoration: none;
  transition: background 150ms ease;
}

.brand:hover {
  background: var(--bg-soft);
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0)),
    url("icons/icon-calendar-cutout-192.png") center / cover no-repeat;
  box-shadow: 0 8px 20px rgba(26, 36, 32, 0.12);
}

.brand-mark-xl {
  width: 118px;
  height: 118px;
  border-radius: 30px;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0)),
    url("icons/icon-calendar-cutout-512.png");
  box-shadow: 0 24px 54px rgba(26, 36, 32, 0.14);
}

.brand-mark-mini {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  box-shadow: 0 6px 14px rgba(26, 36, 32, 0.1);
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  color: var(--ink);
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1;
}

.wordmark span + span {
  color: var(--accent);
}

.wordmark-stacked {
  justify-content: center;
  font-size: clamp(2rem, 12vw, 3.35rem);
}

.brand .wordmark {
  font-size: 1.05rem;
}

.brand strong,
.brand small,
.timeline strong,
.timeline small {
  display: block;
}

.brand strong {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand small {
  font-size: 0.72rem;
  color: var(--ink-tertiary);
}

.family-switcher {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-tint);
}

.family-switcher label {
  gap: 5px;
  color: var(--ink-secondary);
  font-size: 0.72rem;
}

.family-switcher select {
  min-height: 40px;
  padding: 0 10px;
  background: var(--bg-elevated);
}

.family-switcher .ghost-button {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.78rem;
}

.nav-list {
  display: grid;
  gap: 4px;
}

.nav-list a,
.nav-action {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 13px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--ink-secondary);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.nav-list a:hover,
.nav-action:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

.nav-list a.active {
  background:
    linear-gradient(90deg, var(--accent-soft), rgba(255, 255, 255, 0.44));
  color: var(--accent);
}

.nav-list a.active .icon {
  stroke: var(--accent);
}

.nav-action {
  width: 100%;
  margin-top: 8px;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: auto;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: white;
  font-size: 0.68rem;
  font-weight: 800;
}

.nav-badge.is-hidden {
  display: none;
}

.plan-card {
  margin-top: auto;
  padding: 16px;
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(255, 250, 240, 0.86), var(--surface-tint));
  border: 1px solid var(--border);
  line-height: 1.5;
  font-size: 0.82rem;
  color: var(--ink-secondary);
}

/* ── Main content ───────────────────────────────────────────── */
.main-content {
  display: grid;
  align-content: start;
  gap: 16px;
  width: 100%;
  min-width: 0;
  padding: 22px 24px 32px;
  max-width: 1220px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 8px;
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.topbar-brand .wordmark {
  font-size: 1rem;
}

.topbar-info {
  flex: 1;
  min-width: 0;
  display: grid;
  justify-items: end;
}

.topbar h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.eyebrow {
  margin: 0 0 2px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-tertiary);
}

.helper-text,
.muted,
.timeline small,
.brand small {
  color: var(--ink-secondary);
}

.empty-state {
  margin: 0;
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
}

#auth-status {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  line-height: 1.4;
}

#auth-status[data-tone="error"] {
  border-color: rgba(185, 66, 50, 0.45);
  background: rgba(185, 66, 50, 0.08);
  color: #9f3024;
}

#auth-status[data-tone="success"] {
  border-color: rgba(45, 138, 110, 0.4);
  background: rgba(45, 138, 110, 0.08);
  color: var(--accent-hover);
}

.action-status {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  line-height: 1.4;
}

.action-status[data-tone="error"] {
  border-color: rgba(185, 66, 50, 0.45);
  background: rgba(185, 66, 50, 0.08);
  color: #9f3024;
}

.action-status[data-tone="success"] {
  border-color: rgba(45, 138, 110, 0.4);
  background: rgba(45, 138, 110, 0.08);
  color: var(--accent-hover);
}

.action-status[data-tone="warning"] {
  border-color: rgba(200, 135, 23, 0.45);
  background: rgba(200, 135, 23, 0.12);
  color: #7a4b00;
}

.auth-buttons {
  display: grid;
  grid-template-columns: 1fr;
}

.invite-code-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.invite-code-card h3 {
  margin: 0 0 4px;
}

.invite-code-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.invite-code-box code {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

/* ── Buttons ────────────────────────────────────────────────── */
.primary-button,
.ghost-button,
.danger-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 120ms ease, background 150ms ease, box-shadow 150ms ease;
}

.primary-button:active,
.ghost-button:active,
.danger-button:active,
.icon-button:active {
  transform: scale(0.97);
}

.primary-button {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, white), var(--accent));
  color: var(--accent-text);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 18%, transparent);
}

.primary-button:hover {
  background: var(--accent-hover);
}

.ghost-button {
  background: var(--surface-tint);
  color: var(--ink);
  border: 1px solid var(--border-strong);
}

.ghost-button:hover {
  background: var(--bg-soft);
}

.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid transparent;
}

.danger-button:hover {
  background: var(--danger);
  color: white;
}

.text-button {
  justify-self: center;
  min-height: 36px;
  padding: 0 8px;
  color: var(--accent);
  font-weight: 700;
}

.text-button:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.icon-button {
  width: 44px;
  min-width: 44px;
  padding: 0;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  color: var(--ink-secondary);
}

.icon-button:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

.menu-button {
  display: none;
}

.fab-button {
  position: fixed;
  right: 20px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 25;
  display: none;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, white), var(--accent));
  color: var(--accent-text);
  box-shadow: var(--shadow-lg);
  transition: transform 120ms ease;
}

.fab-button:active {
  transform: scale(0.94);
}

/* ── Onboarding ─────────────────────────────────────────────── */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: calc(20px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 250, 240, 0.86), transparent 30rem),
    linear-gradient(135deg, rgba(244, 246, 245, 0.96), rgba(238, 246, 242, 0.95)),
    var(--bg);
}

.onboarding-overlay[hidden] {
  display: none;
}

.onboarding-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  grid-template-areas:
    "visual content"
    "visual progress"
    "visual actions";
  gap: 22px 28px;
  width: min(860px, 100%);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg-elevated) 92%, var(--calendar-paper));
  box-shadow: var(--shadow-lg);
}

.onboarding-visual {
  grid-area: visual;
  position: relative;
  display: grid;
  place-items: center;
  min-height: 330px;
  overflow: hidden;
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(63, 127, 91, 0.14), rgba(255, 250, 240, 0.82)),
    var(--bg-soft);
}

.onboarding-preview-image {
  width: min(92%, 310px);
  max-height: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
}

.onboarding-content {
  grid-area: content;
  align-self: end;
  display: grid;
  gap: 12px;
}

.onboarding-content h1 {
  margin: 0;
  color: var(--ink);
  font-size: 2.8rem;
  line-height: 1;
  letter-spacing: 0;
}

.onboarding-content p {
  margin: 0;
  max-width: 52ch;
  color: var(--ink-secondary);
  font-size: 1rem;
}

.onboarding-feature-list {
  display: grid;
  gap: 8px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.onboarding-feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--ink-secondary);
  font-weight: 700;
}

.onboarding-feature-list li::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 8px;
  border-radius: var(--radius-full);
  background: var(--accent);
}

.onboarding-progress {
  grid-area: progress;
  display: flex;
  align-items: center;
  gap: 8px;
}

.onboarding-progress button {
  width: 34px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.onboarding-progress button.active {
  width: 48px;
  background: var(--accent);
  border-color: var(--accent);
}

.onboarding-actions,
.onboarding-plan-actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.onboarding-actions[hidden],
.onboarding-plan-actions[hidden] {
  display: none;
}

/* ── Cards & panels ─────────────────────────────────────────── */
.auth-panel,
.setup-panel,
.feature-card,
.calendar-panel,
.day-cell,
dialog {
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--bg-elevated) 94%, var(--calendar-paper));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.auth-panel,
.setup-panel {
  display: grid;
  gap: 20px;
  width: min(560px, 100%);
  padding: 28px;
  justify-self: center;
}

.auth-panel.is-hidden,
.setup-panel.is-hidden,
.app-panels.is-hidden,
.view-panel {
  display: none;
}

.auth-panel h2,
.setup-panel h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.auth-hero {
  text-align: center;
  padding: 10px 0 6px;
}

.auth-hero .brand-mark {
  display: block;
  width: 86px;
  height: 86px;
  margin: 0 auto 18px;
  border-radius: 22px;
}

.auth-hero h2 {
  margin-bottom: 8px;
  font-size: 2.1rem;
}

.auth-hero p {
  margin: 0;
  color: var(--ink-secondary);
  font-size: 0.92rem;
}

.social-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.social-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border-radius: var(--radius-sm);
  background: var(--surface-tint);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.social-button:hover {
  background: var(--bg-soft);
  border-color: var(--border-strong);
}

.social-button:disabled,
.auth-mode-tab:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.social-button:active {
  transform: scale(0.98);
}

.social-button .icon {
  flex: 0 0 auto;
}

.auth-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}

.auth-mode-tab {
  min-height: 40px;
  border: 0;
  border-radius: calc(var(--radius-sm) - 4px);
  background: transparent;
  color: var(--ink-secondary);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.auth-mode-tab.active {
  background: var(--bg-elevated);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.auth-form[hidden] {
  display: none;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-tertiary);
  font-size: 0.78rem;
  font-weight: 600;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-strong);
}

.app-panels {
  display: grid;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
}

.view-panel.active {
  display: grid;
  gap: 18px;
  min-width: 0;
  max-width: 100%;
}

#today {
  width: min(100%, 720px);
  justify-self: center;
}

#today .section-heading {
  align-items: flex-end;
  padding: 6px 0 0;
}

#today .section-heading h2 {
  font-size: clamp(2.2rem, 7vw, 3.2rem);
  line-height: 0.98;
  letter-spacing: 0;
}

#today .section-heading .primary-button {
  border-radius: var(--radius-full);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 20%, transparent);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0 0;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-heading.compact h2 {
  font-size: 1.1rem;
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid.two,
.two-column,
.dashboard-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.dashboard-grid > .calendar-panel {
  grid-column: auto;
}

.settings-grid {
  grid-template-columns: minmax(0, 760px);
  align-items: start;
}

#meals .two-column {
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.15fr);
}

#meals .meal-more-panel {
  grid-column: 1 / -1;
}

.settings-tabs,
.event-tabs,
.today-filter-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  max-width: 100%;
  margin: -4px 0 4px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.settings-tabs::-webkit-scrollbar,
.event-tabs::-webkit-scrollbar,
.today-filter-row::-webkit-scrollbar {
  display: none;
}

.settings-tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  color: var(--ink-secondary);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.settings-tab.active {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.settings-grid [hidden] {
  display: none !important;
}

.family-panel-grid {
  grid-template-columns: minmax(0, 760px) !important;
}

.family-panel-grid [hidden] {
  display: none !important;
}

.today-filter-row {
  margin-top: -2px;
}

.today-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border));
  border-radius: var(--radius-md);
  background:
    linear-gradient(135deg, var(--accent-soft), rgba(255, 250, 240, 0.74)),
    var(--bg-elevated);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

#today .today-summary {
  min-height: 96px;
  padding: 20px 22px;
  border-radius: 22px;
}

#today .today-summary strong {
  font-size: 1.12rem;
}

#today .today-summary span {
  font-size: 0.92rem;
  font-weight: 700;
}

.today-summary div:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.today-summary strong,
.today-summary span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-summary strong {
  font-size: 1rem;
}

.today-summary span {
  color: var(--ink-secondary);
  font-size: 0.78rem;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  color: var(--ink);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

select {
  appearance: none;
  padding-right: 42px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%),
    linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position:
    calc(100% - 22px) 50%,
    calc(100% - 16px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  min-height: 96px;
  padding-top: 12px;
  resize: vertical;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.feature-card,
.calendar-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
}

#today .feature-card,
#today .calendar-panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#today .feature-card h3,
#today .calendar-panel h3 {
  padding: 0 2px;
  font-size: 1rem;
  font-weight: 850;
}

#today .card-icon {
  display: none;
}

#today .timeline,
#today .insight-list,
#today .task-list {
  border-radius: 20px;
  background: color-mix(in srgb, var(--bg-elevated) 90%, var(--calendar-paper));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

.plus-feature-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--plus-bg), var(--bg-elevated));
  border-color: var(--plus-border);
  box-shadow: var(--plus-shadow);
}

.plus-feature-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 4px solid var(--plus-border);
  pointer-events: none;
}

.plus-feature-card > * {
  position: relative;
}

.plus-feature-card .card-icon {
  background: var(--plus-bg-strong);
  color: var(--plus-ink);
}

.plan-settings-card {
  background: linear-gradient(180deg, var(--plus-bg), var(--bg-elevated));
  border-color: var(--plus-border);
  box-shadow: var(--plus-shadow);
}

.plan-settings-card .card-icon {
  background: var(--plus-bg-strong);
  color: var(--plus-ink);
}

.plan-settings-card .feature-list,
.plan-settings-card .helper-text {
  color: color-mix(in srgb, var(--plus-ink) 72%, var(--ink-secondary));
}

.account-settings-card {
  gap: 16px;
}

.link-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.link-list a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.danger-zone {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 42%, var(--border));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--danger) 8%, var(--bg-elevated));
}

.danger-zone h4 {
  margin: 0;
  font-size: 0.95rem;
}

.feature-card h3,
.calendar-panel h3 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px auto;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

#shopping-form {
  grid-template-columns: minmax(0, 1.2fr) 90px minmax(120px, 0.8fr) 150px auto;
}

#chore-form {
  grid-template-columns: minmax(0, 1fr) 150px 150px auto;
}

/* ── Dashboard widgets ──────────────────────────────────────── */
.status-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

#today .status-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

#today .status-strip::-webkit-scrollbar {
  display: none;
}

.member-chip {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  align-items: center;
  min-width: 0;
  padding: 13px 15px;
  border-radius: var(--radius-md);
  background: var(--surface-tint);
  border: 1px solid var(--border);
  transition: box-shadow 150ms ease;
}

#today .member-chip {
  flex: 0 0 auto;
  min-width: 132px;
  padding: 10px 12px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--bg-elevated) 82%, var(--bg-soft));
}

#today .member-avatar {
  width: 30px;
  height: 30px;
}

.member-chip:hover {
  box-shadow: var(--shadow-md);
}

.member-chip small {
  grid-column: 2;
  font-size: 0.78rem;
  color: var(--ink-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-chip strong {
  font-size: 0.92rem;
}

.member-avatar {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--member-color, var(--accent));
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--member-color, var(--accent)) 20%, transparent);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--member-color, var(--accent));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--member-color, var(--accent)) 20%, transparent);
}

.timeline,
.insight-list,
.task-list,
.member-list,
.invite-list {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-tint);
}

.timeline article,
.insight-item,
.task-row,
.member-row,
.invite-row {
  min-width: 0;
  padding: 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  border-bottom: 1px solid var(--border);
}

.timeline article:last-child,
.insight-item:last-child,
.task-row:last-child,
.member-row:last-child,
.invite-row:last-child {
  border-bottom: 0;
}

.timeline article {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: start;
}

#today .timeline article,
#today .task-row,
#today .insight-item {
  padding: 16px;
}

#today .timeline time {
  width: 42px;
  color: var(--ink-secondary);
  font-size: 0.82rem;
}

#today .timeline article {
  grid-template-columns: 46px minmax(0, 1fr) auto;
}

#today .timeline article strong,
#today .task-row strong {
  font-size: 0.98rem;
}

.timeline time {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 0 10px;
  border-radius: var(--radius-full);
  background: var(--bg-soft);
  color: var(--ink-secondary);
  font-size: 0.72rem;
  font-weight: 700;
}

.insight-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink-secondary);
  font-size: 0.88rem;
}

button.insight-item {
  width: 100%;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.insight-action {
  align-items: center;
}

.insight-action span {
  flex: 1;
  min-width: 0;
}

.insight-action .icon {
  flex-shrink: 0;
  color: var(--ink-tertiary);
}

button.insight-item:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.insight-item::before {
  content: "";
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: var(--radius-full);
  background: var(--warning);
}

/* ── Calendar ───────────────────────────────────────────────── */
.notification-list {
  display: grid;
  gap: 14px;
}

.notification-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: stretch;
  gap: 8px;
  width: min(100%, 420px);
}

.notification-actions .segmented-control,
.calendar-actions .segmented-control {
  width: 100%;
}

.notification-actions .segmented-control button,
.calendar-actions .segmented-control button {
  min-width: 0;
}

.notification-toolbar {
  display: flex;
  justify-content: flex-end;
}

#notification-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

#notification-summary .member-chip {
  min-height: 78px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border));
  border-left: 4px solid var(--accent);
  background:
    linear-gradient(135deg, var(--accent-soft), transparent 72%),
    var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

#notification-summary .member-chip .dot {
  width: 9px;
  height: 9px;
  background: var(--accent);
}

#notification-summary .member-chip strong {
  color: var(--ink);
  font-size: 1.2rem;
}

#notification-summary .member-chip small {
  color: var(--ink-secondary);
  font-weight: 800;
}

.notification-group {
  display: grid;
  gap: 8px;
}

.notification-group h3 {
  margin: 0;
  font-size: 0.92rem;
}

.notification-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--member-color, var(--accent));
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.notification-row.is-dismissed,
.notification-row.is-sent {
  opacity: 0.68;
}

.notification-row.is-failed {
  border-left-color: var(--danger);
}

.notification-row strong,
.notification-row small {
  display: block;
}

.notification-row small {
  color: var(--ink-secondary);
  font-size: 0.78rem;
}

.notification-row-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.notification-row time {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
}

.notification-row .ghost-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.78rem;
}

.event-card-readonly,
.imported-event-row {
  background: var(--bg-muted);
}

.event-card-readonly {
  cursor: default;
}

.notification-toggle {
  width: min(100%, 320px);
}

.calendar-actions {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  gap: 8px;
}

.month-density-control {
  display: none;
}

body.is-month-calendar .month-density-control {
  display: none;
}

.calendar-nav-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  margin-top: -4px;
}

.calendar-nav-row .helper-text {
  margin: 0;
  text-align: center;
  font-weight: 800;
}

.calendar-nav-row .icon-button {
  width: 44px;
  min-width: 44px;
}

.calendar-search-row,
.billing-actions {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
}

.calendar-search-row input,
.calendar-search-row select {
  min-height: 44px;
}

.calendar-search-row .toggle-row {
  margin: 0;
  min-height: 44px;
}

.billing-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 16px 0 8px;
}

.support-request-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.segmented-control {
  display: inline-grid;
  grid-auto-flow: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--surface-tint);
}

.segmented-control button {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-secondary);
  font-weight: 700;
}

.segmented-control button.active {
  background: var(--accent);
  color: var(--accent-text);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  gap: 10px;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.day-cell {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 110px;
  min-height: 200px;
  padding: 12px;
  box-shadow: none;
}

.day-cell[data-add-event-date],
.month-cell[data-add-event-date],
.add-event-empty {
  cursor: pointer;
}

.add-event-empty {
  width: 100%;
  color: var(--ink-secondary);
  text-align: left;
}

.day-calendar {
  grid-template-columns: minmax(0, 1fr);
}

.day-cell-large {
  min-height: 320px;
}

.day-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  color: var(--ink-tertiary);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.day-title span:last-child {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.68rem;
}

.date-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.weather-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
}

.weather-chip.compact {
  gap: 4px;
  min-height: 20px;
  padding: 2px 6px;
  font-size: 0.66rem;
}

.weather-chip.muted {
  background: var(--bg-soft);
  color: var(--ink-tertiary);
}

.weather-warning {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  background: var(--warning);
  color: #ffffff;
  font-size: 0.66rem;
  font-weight: 900;
}

.moon-phase {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  min-height: 24px;
  padding: 3px 8px 3px 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-soft);
  color: var(--ink-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
}

.moon-phase.compact {
  min-height: 20px;
  padding: 2px 5px;
  font-size: 0;
}

.moon-icon {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--ink-secondary) 35%, transparent);
  border-radius: var(--radius-full);
  background: #f2efd6;
  box-shadow: inset -2px -2px 4px rgba(61, 64, 68, 0.16);
}

.moon-icon::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-full);
}

.moon-phase-0 {
  background: #4b5560;
  box-shadow: inset 2px 2px 4px rgba(255, 255, 255, 0.16);
}

.moon-phase-1,
.moon-phase-7 {
  background: #4b5560;
}

.moon-phase-1::after {
  left: 8px;
  background: #f2efd6;
}

.moon-phase-2 {
  background: linear-gradient(90deg, #4b5560 0 50%, #f2efd6 50% 100%);
}

.moon-phase-3,
.moon-phase-5 {
  background: #f2efd6;
}

.moon-phase-3::after {
  right: 8px;
  background: #4b5560;
}

.moon-phase-4::after {
  display: none;
}

.moon-phase-5::after {
  left: 8px;
  background: #4b5560;
}

.moon-phase-6 {
  background: linear-gradient(90deg, #f2efd6 0 50%, #4b5560 50% 100%);
}

.moon-phase-7::after {
  right: 8px;
  background: #f2efd6;
}

.event-card {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--member-color, var(--accent));
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-elevated) 92%, var(--calendar-paper));
  text-align: left;
  transition: box-shadow 150ms ease;
}

.event-card:hover {
  box-shadow: var(--shadow-sm);
}

.event-card strong {
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.event-card small {
  font-size: 0.72rem;
  color: var(--ink-secondary);
}

.month-calendar {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  overflow-x: visible;
}

.month-weekday {
  grid-column: var(--month-cell-column);
  grid-row: var(--month-cell-row);
  color: var(--ink-tertiary);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.month-cell {
  grid-column: var(--month-cell-column);
  grid-row: var(--month-cell-row);
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  min-height: 98px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-elevated) 94%, var(--calendar-paper));
}

.month-cell.muted-month {
  background: var(--bg-muted);
  opacity: 0.62;
}

.month-cell-title {
  display: flex;
  justify-content: space-between;
  color: var(--ink-secondary);
  font-size: 0.78rem;
  font-weight: 800;
}

.month-event {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  width: 100%;
  min-height: 20px;
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--member-color, var(--accent));
  border-radius: 9px;
  background: var(--surface-tint);
  text-align: left;
}

.month-event span {
  color: var(--ink-tertiary);
  font-size: 0.6rem;
  font-weight: 800;
}

.month-event strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.66rem;
}

.more-events {
  color: var(--ink-secondary);
  font-size: 0.72rem;
  font-weight: 700;
}

.month-calendar.is-compact .month-cell {
  min-height: 82px;
}

.month-calendar.is-compact .month-event {
  grid-template-columns: minmax(0, 1fr);
  min-height: 18px;
  padding: 2px 5px;
}

.month-calendar.is-compact .month-event span {
  display: none;
}

.month-calendar.is-compact .month-event strong {
  font-size: 0.68rem;
}

/* ── Tasks & members ────────────────────────────────────────── */
.task-row,
.member-row,
.invite-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.task-row > span,
.member-row > span,
.invite-row > span {
  min-width: 0;
}

.task-row strong,
.task-row small,
.member-row strong,
.member-row small,
.invite-row strong,
.invite-row small {
  display: block;
}

.task-row small,
.member-row small,
.invite-row small {
  font-size: 0.78rem;
  color: var(--ink-secondary);
}

.task-row.done strong {
  color: var(--ink-tertiary);
  text-decoration: line-through;
}

.task-row .ghost-button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.78rem;
}

.task-row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.task-row .danger-button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.78rem;
}

.member-editor {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) 130px 86px auto;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
}

.member-editor label {
  gap: 4px;
  font-size: 0.72rem;
  color: var(--ink-secondary);
}

.member-editor input,
.member-editor select {
  min-height: 38px;
  padding: 0 10px;
}

.member-editor input[type="color"] {
  min-width: 56px;
  padding: 4px;
}

.member-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.member-editor-actions .ghost-button,
.member-editor-actions .danger-button {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.78rem;
}

.member-permission {
  grid-column: 2 / -1;
  color: var(--ink-secondary);
  font-size: 0.78rem;
}

.permission-list {
  display: grid;
  gap: 8px;
}

.permission-list div {
  display: grid;
  gap: 2px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

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

.permission-list strong {
  font-size: 0.88rem;
}

.permission-list span {
  color: var(--ink-secondary);
  font-size: 0.78rem;
  line-height: 1.35;
}

/* ── Settings & toggles ─────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-tint);
  border: 1px solid var(--border);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
}

.toggle-row.plus-feature-row {
  background: var(--plus-bg);
  border-color: var(--plus-border);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.plus-limit-card:has(input:disabled) {
  background: linear-gradient(180deg, var(--plus-bg), var(--bg-elevated));
  border-color: var(--plus-border);
}

.stacked-form,
.meal-more-panel {
  display: grid;
  gap: 14px;
}

.meal-more-panel summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

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

.meal-more-panel summary::after {
  content: "";
  width: 9px;
  height: 9px;
  margin-left: 4px;
  border-right: 2px solid var(--ink-tertiary);
  border-bottom: 2px solid var(--ink-tertiary);
  transform: rotate(45deg);
  transition: transform 150ms ease;
}

.meal-more-panel[open] summary::after {
  transform: rotate(225deg);
}

.toggle-row input[type="checkbox"] {
  appearance: none;
  width: 48px;
  min-height: 28px;
  height: 28px;
  padding: 0;
  border-radius: var(--radius-full);
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  position: relative;
  transition: background 200ms ease;
}

.toggle-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: white;
  box-shadow: var(--shadow-sm);
  transition: transform 200ms ease;
}

.toggle-row input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-row input[type="checkbox"]:checked::after {
  transform: translateX(20px);
}

.feature-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: var(--ink-secondary);
  font-size: 0.86rem;
}

.feature-list li::marker {
  color: var(--accent);
}

.plus-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-full);
  background: var(--plus-bg-strong);
  border: 1px solid var(--plus-border);
  color: var(--plus-ink);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.45) inset;
}

.feature-card h3 .plus-pill {
  margin-left: auto;
}

.toggle-row .plus-pill {
  margin-left: auto;
}

input:disabled,
select:disabled,
textarea:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

/* ── Theme picker ───────────────────────────────────────────── */
.theme-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}

.theme-option {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--bg-muted);
  cursor: pointer;
  text-align: center;
  transition: border-color 150ms ease, transform 120ms ease;
}

.theme-option:hover {
  border-color: var(--border-strong);
}

.theme-option.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.theme-option:active {
  transform: scale(0.97);
}

.theme-swatch {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.theme-swatch span {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  border: 2px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow-sm);
}

.theme-option strong {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
}

/* ── Ad banner ──────────────────────────────────────────────── */
.ad-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-height: 80px;
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-muted);
}

.ad-banner.is-hidden {
  display: none;
}

.ad-banner span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 28px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--bg-elevated);
  font-size: 0.68rem;
  font-weight: 800;
}

.ad-banner p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-secondary);
}

.ad-slot {
  display: grid;
  gap: 4px;
}

.ad-slot small {
  color: var(--ink-muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

/* ── Dialog ─────────────────────────────────────────────────── */
dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  overflow: hidden;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

#event-form {
  display: grid;
  gap: 14px;
  padding: 20px;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: calc(100dvh - 32px);
}

.event-tabs {
  margin: -2px 0 0;
}

.event-detail-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.event-detail-panel[hidden] {
  display: none !important;
}

.event-detail-panel:not(.event-checklist-section, .event-thread-section) {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-muted);
}

.event-detail-panel label {
  min-width: 0;
}

.repeat-builder {
  position: sticky;
  bottom: 76px;
  z-index: 3;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-lg);
}

.repeat-builder[hidden] {
  display: none !important;
}

.repeat-builder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.repeat-builder-header h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
}

.repeat-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.repeat-days[hidden] {
  display: none !important;
}

.repeat-days legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
  color: var(--ink-secondary);
  font-size: 0.78rem;
  font-weight: 800;
}

.repeat-days label {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  color: var(--ink-secondary);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.repeat-days input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.repeat-days label:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  background: var(--accent-soft);
  color: var(--accent-strong);
}

#event-form > .button-row {
  position: sticky;
  bottom: -20px;
  z-index: 2;
  margin: 2px -20px -20px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

#event-form > .button-row button {
  min-height: 48px;
}

#event-form-status:empty {
  display: none;
}

.event-weather-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--plus-border);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--plus-bg-strong), var(--plus-bg));
  color: var(--plus-ink);
  box-shadow: var(--plus-shadow);
}

.event-weather-panel[hidden] {
  display: none !important;
}

.event-weather-panel div {
  display: grid;
  gap: 4px;
}

.event-weather-panel strong,
.event-weather-panel span {
  display: block;
}

.event-weather-panel strong {
  font-size: 0.86rem;
}

.event-weather-panel span {
  font-size: 0.76rem;
  font-weight: 700;
}

.event-checklist-section,
.event-thread-section {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-muted);
}

.event-checklist-section .section-heading,
.event-thread-section .section-heading {
  margin: 0;
}

.event-checklist-section h3,
.event-thread-section h3 {
  margin: 0;
  font-size: 1rem;
}

.comment-thread {
  display: grid;
  gap: 8px;
}

.comment-row {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.comment-row p {
  margin: 0;
  color: var(--ink);
}

.comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-secondary);
  font-size: 0.78rem;
}

.compact-form {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.compact-list {
  gap: 8px;
}

/* ── Bottom navigation ──────────────────────────────────────── */
.bottom-nav {
  display: none;
}

.sidebar-overlay {
  display: none;
}

/* ── Responsive: tablet ───────────────────────────────────── */
@media (max-width: 1100px) {
  .calendar-search-row,
  .billing-actions {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-grid > .calendar-panel {
    grid-column: 1 / -1;
  }
}

/* ── Responsive: mobile ─────────────────────────────────────── */
@media (max-width: 860px) {
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  body.native-ad-banner-active {
    padding-top: var(--native-ad-banner-height);
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(82vw, 300px);
    max-width: 100%;
    overflow-y: auto;
    padding-top: calc(22px + env(safe-area-inset-top));
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
    transform: translateX(-105%);
    transition: transform 220ms cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: var(--shadow-lg);
    -webkit-overflow-scrolling: touch;
  }

  body.native-ad-banner-active .sidebar {
    padding-top: calc(var(--native-ad-banner-height) + 22px + env(safe-area-inset-top));
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
  }

  body.nav-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .menu-button {
    display: inline-flex;
  }

  .main-content {
    padding: calc(82px + env(safe-area-inset-top)) 16px calc(30px + env(safe-area-inset-bottom));
    gap: 14px;
  }

  body.native-ad-banner-active .main-content {
    padding-top: calc(var(--native-ad-banner-height) + 82px + env(safe-area-inset-top));
  }

  .topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 30;
    padding: calc(9px + env(safe-area-inset-top)) 16px 9px;
    background: color-mix(in srgb, var(--bg) 86%, white);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  body.native-ad-banner-active .topbar {
    top: var(--native-ad-banner-height);
  }

  .topbar-brand {
    display: inline-flex;
  }

  .topbar h1 {
    font-size: 1.3rem;
  }

  .topbar-info {
    display: grid;
    justify-items: end;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  input[type="date"],
  input[type="time"] {
    min-width: 0;
    max-width: 100%;
    -webkit-appearance: none;
  }

  .fab-button {
    display: inline-flex;
  }

  .status-strip,
  .dashboard-grid,
  .settings-grid,
  .two-column {
    grid-template-columns: 1fr;
  }

  .link-list {
    grid-template-columns: 1fr;
  }

  #meals .two-column {
    grid-template-columns: 1fr;
  }

  #notification-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #notification-summary .member-chip {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 3px;
    padding: 12px 6px;
    text-align: center;
  }

  #notification-summary .member-chip .dot {
    display: none;
  }

  .calendar-actions {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .notification-actions {
    width: 100%;
  }

  .onboarding-panel {
    grid-template-columns: 1fr;
    grid-template-areas:
      "visual"
      "content"
      "progress"
      "actions";
    gap: 18px;
    padding: 18px;
  }

  .onboarding-visual {
    min-height: 230px;
  }

  .onboarding-preview-image {
    width: min(76%, 230px);
    border-radius: 20px;
  }

  .onboarding-content h1 {
    font-size: 2rem;
  }

  .onboarding-content p {
    font-size: 0.95rem;
  }

  .onboarding-feature-list li {
    font-size: 0.92rem;
  }

  .onboarding-actions,
  .onboarding-plan-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .onboarding-actions button,
  .onboarding-plan-actions button {
    width: 100%;
  }

  .invite-code-card {
    align-items: stretch;
    flex-direction: column;
  }

  .invite-code-box {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .invite-code-box code,
  .invite-code-box button {
    width: 100%;
    justify-content: center;
  }

  .calendar-grid {
    grid-template-columns: 1fr;
    overflow-x: visible;
  }

  .month-calendar {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    overflow-x: visible;
  }

  .month-weekday,
  .month-cell {
    min-width: 0;
  }

  .month-cell {
    min-height: 78px;
    padding: 6px 4px;
  }

  .month-cell-title {
    font-size: 0.7rem;
  }

  .month-event {
    grid-template-columns: minmax(0, 1fr);
    min-height: 20px;
    padding: 2px 4px;
  }

  .month-event span {
    display: none;
  }

  .month-event strong,
  .more-events {
    font-size: 0.62rem;
  }

  .month-calendar.is-detail .month-cell {
    min-height: 94px;
  }

  .day-cell {
    min-width: 0;
    min-height: auto;
  }

  .bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 80;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    width: 100%;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--border);
    border-radius: 0;
    background: color-mix(in srgb, var(--nav-bg) 88%, white);
    box-shadow: 0 -8px 24px rgba(26, 36, 32, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .bottom-nav .secondary-tab {
    display: none;
  }

  .bottom-nav a {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 52px;
    padding: 4px 2px;
    border-radius: 16px;
    color: var(--ink-tertiary);
    font-size: 0.62rem;
    font-weight: 700;
    text-decoration: none;
    transition: color 150ms ease, background 150ms ease;
  }

  .bottom-nav a .icon {
    width: 1.35rem;
    height: 1.35rem;
  }

  .bottom-nav .nav-badge {
    position: absolute;
    top: 4px;
    right: 8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 0;
    font-size: 0.62rem;
  }

  .bottom-nav a.active {
    color: var(--accent);
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent),
      var(--accent-soft);
  }

  .bottom-nav a.active .icon {
    stroke: var(--accent);
  }

  dialog {
    width: calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right));
    max-width: calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right));
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    margin: auto;
    overflow: hidden;
  }

  #event-form {
    max-width: 100%;
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 16px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  #event-form > .button-row {
    bottom: -16px;
    margin: 2px -16px -16px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }

  #event-form > *,
  .event-checklist-section,
  .event-thread-section,
  .compact-form {
    min-width: 0;
    max-width: 100%;
  }

  #event-form .form-grid.two {
    grid-template-columns: 1fr;
  }

  .repeat-days {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .event-checklist-section,
  .event-thread-section,
  .compact-form {
    overflow-x: hidden;
  }
}

@media (max-width: 520px) {
  .main-content {
    padding: calc(78px + env(safe-area-inset-top)) 14px calc(28px + env(safe-area-inset-bottom));
  }

  .topbar {
    padding-right: 14px;
    padding-left: 14px;
  }

  .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-heading.compact {
    flex-direction: row;
    align-items: center;
  }

  .auth-panel,
  .setup-panel,
  .feature-card,
  .calendar-panel {
    padding: 16px;
  }

  .form-grid.two,
  .inline-form,
  #shopping-form,
  #chore-form {
    grid-template-columns: 1fr;
  }

  .button-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button-row button {
    width: 100%;
  }

  dialog {
    width: calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right));
    max-width: calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right));
    max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }

  #event-form {
    max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 14px;
  }

  #event-form > .button-row {
    bottom: -14px;
    margin: 2px -14px -14px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  }

  .timeline article {
    grid-template-columns: 48px 1fr;
  }

  .timeline article .ghost-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .social-buttons {
    grid-template-columns: 1fr;
  }

  .theme-picker {
    grid-template-columns: repeat(3, 1fr);
  }

  .member-editor {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .member-editor label,
  .member-editor-actions,
  .member-permission {
    grid-column: 1 / -1;
  }

  .member-editor-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* SharedDays visual rebuild ------------------------------------------------ */
:root,
[data-theme="sage"] {
  --bg: #edf2ea;
  --bg-elevated: #fffdf7;
  --bg-soft: #eef2e9;
  --bg-muted: #f8f6ee;
  --ink: #17241d;
  --ink-secondary: #526258;
  --ink-tertiary: #879289;
  --border: rgba(45, 54, 46, 0.12);
  --border-strong: rgba(45, 54, 46, 0.18);
  --accent: #5d8565;
  --accent-hover: #4d7357;
  --accent-strong: #335b40;
  --accent-soft: #e8f0e5;
  --accent-text: #fffdf7;
  --danger: #eb6b5c;
  --danger-soft: #ffe4dd;
  --warning: #e4a83c;
  --success: #5d8565;
  --calendar-paper: #fffaf0;
  --surface-tint: rgba(255, 253, 247, 0.84);
  --nav-bg: rgba(255, 253, 247, 0.92);
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.72), 0 1px 3px rgba(40, 50, 42, 0.07);
  --shadow-md: 0 10px 24px rgba(40, 50, 42, 0.10);
  --shadow-lg: 0 24px 60px rgba(40, 50, 42, 0.18);
  --radius-sm: 14px;
  --radius-md: 18px;
  --radius-lg: 28px;
}

html,
body {
  min-height: 100%;
  background:
    linear-gradient(180deg, #e8eee4 0%, #f5f3e8 56%, #e9efe7 100%);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
  color: var(--ink);
}

.wordmark,
.section-heading h2,
.auth-hero h2,
.onboarding-content h1,
.topbar h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: 0;
}

.wordmark span + span {
  color: #5d7f63;
}

.brand-mark {
  background: url("icons/icon-calendar-cutout-192.png") center / cover no-repeat;
  box-shadow: 0 10px 22px rgba(39, 48, 39, 0.15);
}

.brand-mark-xl {
  background: url("icons/icon-calendar-cutout-512.png") center / cover no-repeat;
}

.app-shell {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.96), rgba(255, 250, 240, 0.96)),
    var(--bg-elevated);
  box-shadow: 0 0 0 1px rgba(45, 54, 46, 0.07), var(--shadow-lg);
}

.sidebar,
.sidebar-overlay,
.menu-button,
.fab-button {
  display: none !important;
}

.main-content {
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  padding: calc(22px + env(safe-area-inset-top)) 16px calc(92px + env(safe-area-inset-bottom));
  gap: 14px;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.94), rgba(255, 250, 240, 0.98)),
    var(--bg-elevated);
}

.is-auth-screen .main-content,
.is-setup-screen .main-content {
  display: grid;
  align-content: center;
  padding: calc(28px + env(safe-area-inset-top)) 20px calc(28px + env(safe-area-inset-bottom));
}

.is-auth-screen .topbar,
.is-setup-screen .topbar {
  display: none;
}

.topbar {
  position: sticky !important;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 46px;
  padding: 0 0 8px !important;
  border: 0 !important;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.topbar-brand {
  gap: 7px;
}

.topbar-brand .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.topbar-brand .wordmark {
  font-size: 1.02rem;
}

.topbar-info {
  display: none;
}

.view-panel.active {
  gap: 14px;
}

#today,
.view-panel.active {
  width: 100%;
  justify-self: stretch;
}

.section-heading {
  flex-direction: row !important;
  align-items: center !important;
  padding: 0;
}

.section-heading .eyebrow {
  display: none;
}

.section-heading h2 {
  color: var(--ink);
  font-size: 1.72rem;
  line-height: 1.1;
}

#today .section-heading h2 {
  font-size: 2.05rem;
}

.section-heading .primary-button {
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-full);
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button,
.social-button {
  min-height: 42px;
  border-radius: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

.primary-button {
  background: linear-gradient(180deg, #6f9674, #5d8565);
  box-shadow: 0 8px 18px rgba(75, 111, 82, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.ghost-button,
.icon-button {
  border-color: var(--border);
  background: rgba(255, 253, 247, 0.78);
  color: var(--ink-secondary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.66);
}

.danger-button {
  color: #b64a3f;
  background: var(--danger-soft);
}

.settings-tabs,
.event-tabs,
.today-filter-row {
  gap: 8px;
  margin: 0;
  padding: 1px 0 7px;
}

.settings-tab,
.segmented-control button {
  min-height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
}

.settings-tab {
  border-color: var(--border);
  background: rgba(248, 246, 238, 0.86);
  color: var(--ink-secondary);
}

.settings-tab.active,
.segmented-control button.active {
  border-color: transparent;
  background: linear-gradient(180deg, #6f9674, #5d8565);
  color: #fffdf7;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 5px 12px rgba(75, 111, 82, 0.16);
}

.segmented-control {
  gap: 3px;
  padding: 4px;
  border-color: var(--border);
  background: #f4f1e8;
  overflow: visible;
}

.auth-panel,
.setup-panel,
.feature-card,
.calendar-panel,
.day-cell,
dialog {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 253, 247, 0.92);
  box-shadow: var(--shadow-sm);
}

.auth-panel {
  width: 100%;
  gap: 12px;
  padding: 10px 0 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
}

.auth-hero {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 0;
}

.auth-hero .brand-mark {
  width: 82px;
  height: 82px;
  margin: 0 0 4px;
  border-radius: 22px;
}

.auth-hero h2 {
  margin: 0;
  font-size: 2.55rem;
  line-height: 0.95;
}

.auth-hero p {
  color: var(--accent-strong);
  font-size: 1rem;
  font-weight: 500;
}

.auth-lede {
  max-width: 260px;
  margin: 14px auto 8px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.18rem;
  line-height: 1.28;
}

.auth-preview-card {
  display: grid;
  gap: 9px;
  width: min(284px, 100%);
  margin: 6px auto 10px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 253, 247, 0.9);
  box-shadow: var(--shadow-md);
  text-align: left;
}

.auth-preview-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  color: var(--ink-secondary);
  font-size: 0.58rem;
  text-align: center;
}

.auth-preview-week span {
  display: grid;
  gap: 2px;
}

.auth-preview-week span:first-child b {
  color: #fff;
  background: var(--accent);
}

.auth-preview-week b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0 auto;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
}

.auth-preview-card > p {
  margin: 2px 0 -2px;
  font-size: 0.72rem;
  font-weight: 700;
}

.auth-preview-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 37px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fffdf7;
}

.auth-preview-item span {
  width: 24px;
  height: 24px;
  border-radius: 8px;
}

.auth-preview-item strong {
  font-size: 0.78rem;
}

.auth-preview-item small {
  color: var(--ink-secondary);
  font-size: 0.68rem;
}

.auth-preview-item.is-school span {
  background: #dce9dc;
}

.auth-preview-item.is-swim span {
  background: #d7ebf6;
}

.auth-preview-item.is-meal span {
  background: #ffe1b8;
}

.social-buttons {
  grid-template-columns: 1fr;
  width: min(300px, 100%);
  margin: 0 auto;
}

.social-button {
  background: #fffdf7;
}

.social-button[data-auth-provider="apple"] {
  background: #111614;
  border-color: #111614;
  color: #fff;
}

.divider,
.auth-mode-tabs,
.auth-form,
#auth-status {
  width: min(300px, 100%);
  margin-right: auto;
  margin-left: auto;
}

.auth-mode-tabs {
  background: #f2efe6;
}

.setup-panel {
  width: 100%;
  gap: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.setup-panel .section-heading {
  display: grid;
  justify-items: center;
  gap: 11px;
  text-align: center;
}

.setup-panel .section-heading::before {
  content: "";
  width: 132px;
  height: 132px;
  border-radius: var(--radius-full);
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.54), rgba(255, 253, 247, 0.1)),
    url("assets/rebuild/house.png") center / 126px auto no-repeat,
    #edf0e4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.setup-panel h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  font-weight: 500;
}

.setup-copy {
  max-width: 260px;
  margin: 6px auto 0;
  color: var(--ink-secondary);
  font-size: 0.9rem;
  line-height: 1.35;
}

.setup-panel .two-column {
  grid-template-columns: 1fr;
}

.setup-panel .feature-card {
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 10px 14px;
  min-height: 104px;
  padding: 16px;
}

.setup-panel .feature-card h3 {
  grid-column: 2 / -1;
}

.setup-panel .feature-card label,
.setup-panel .feature-card button {
  grid-column: 1 / -1;
}

.setup-panel .feature-card .card-icon {
  grid-row: 1;
  grid-column: 1;
  width: 58px;
  height: 58px;
  border-radius: var(--radius-full);
  background: #e8f0e5;
}

.setup-panel #join-family-form .card-icon {
  background: #ffe0d4;
  color: #cc5f4c;
}

.onboarding-overlay {
  padding: calc(26px + env(safe-area-inset-top)) 20px calc(26px + env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(235, 241, 231, 0.96), rgba(250, 247, 236, 0.98));
}

.onboarding-panel {
  grid-template-columns: 1fr;
  grid-template-areas:
    "progress"
    "content"
    "visual"
    "actions";
  gap: 18px;
  width: min(390px, 100%);
  min-height: min(760px, calc(100dvh - 48px));
  padding: 30px 20px 24px;
  border-radius: 28px;
  background: rgba(255, 253, 247, 0.94);
}

.onboarding-content {
  align-self: start;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.onboarding-content .eyebrow {
  display: none;
}

.onboarding-content h1 {
  max-width: 300px;
  font-size: 1.55rem;
  line-height: 1.18;
}

.onboarding-content p {
  max-width: 280px;
  font-size: 0.9rem;
  line-height: 1.42;
}

.onboarding-visual {
  min-height: 230px;
  border: 0;
  background: transparent;
}

.onboarding-preview-image {
  width: min(82%, 280px);
  aspect-ratio: auto;
  object-fit: contain;
  border: 0;
  border-radius: 20px;
  background: transparent;
  box-shadow: none;
}

.onboarding-feature-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  margin-top: 12px;
}

.onboarding-feature-list li {
  display: grid;
  justify-items: center;
  min-height: 52px;
  gap: 5px;
  color: var(--ink);
  font-size: 0.72rem;
  line-height: 1.1;
  text-align: center;
}

.onboarding-feature-list li::before {
  width: 32px;
  height: 32px;
  margin: 0;
  border-radius: 10px;
  background: #e8f0e5;
}

.onboarding-progress {
  justify-content: center;
}

.onboarding-progress button {
  width: 24px;
  height: 6px;
  border: 0;
  background: #dddcd2;
}

.onboarding-progress button.active {
  width: 32px;
  background: var(--accent);
}

.onboarding-actions,
.onboarding-plan-actions {
  display: grid;
  grid-template-columns: 1fr;
}

.onboarding-actions .ghost-button,
.onboarding-plan-actions .ghost-button {
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--accent-strong);
}

.today-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  min-height: 102px;
  padding: 14px 0 !important;
  border-radius: 16px !important;
  background: rgba(255, 253, 247, 0.88);
}

.summary-stat {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 0;
  padding: 0 8px;
  text-align: center;
}

.summary-stat + .summary-stat {
  border-left: 1px solid var(--border);
}

.summary-stat strong {
  max-width: 100%;
  color: var(--ink);
  font-size: 0.86rem !important;
  font-family: inherit;
  font-weight: 800;
}

.summary-stat span:not(.row-icon) {
  color: var(--ink);
  font-size: 0.72rem !important;
  font-weight: 700;
  line-height: 1.08;
  white-space: normal;
}

.summary-stat .row-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
}

.date-signals {
  grid-column: 1 / -1;
  justify-content: center;
  margin-top: 2px;
}

.feature-card,
.calendar-panel {
  gap: 10px;
  padding: 14px;
}

#today .feature-card,
#today .calendar-panel {
  padding: 0;
}

.feature-card h3,
.calendar-panel h3 {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
}

.timeline,
.insight-list,
.task-list,
.member-list,
.invite-list {
  border-radius: 15px;
  background: rgba(255, 253, 247, 0.9);
}

.timeline article,
.task-row,
.member-row,
.invite-row,
.notification-row,
.comment-row {
  background: rgba(255, 253, 247, 0.88);
}

.timeline article {
  grid-template-columns: 48px minmax(0, 1fr) auto !important;
  align-items: center;
  padding: 12px 14px !important;
}

.timeline time {
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 700;
}

.timeline article > div {
  border-left: 2px solid var(--member-color, var(--accent));
  padding-left: 12px;
}

.timeline strong,
.task-row strong,
.notification-row strong {
  color: var(--ink);
  font-size: 0.86rem;
}

.timeline small,
.task-row small,
.notification-row small {
  color: var(--ink-secondary);
  font-size: 0.72rem;
}

.event-meta {
  display: none;
}

.pill {
  min-height: 22px;
  padding: 0 8px;
  background: #f1eee5;
  font-size: 0.68rem;
}

.row-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: #e8f0e5;
  color: var(--accent-strong);
}

.row-icon-shopping {
  background: #e5f1f4;
  color: #427a80;
}

.row-icon-chore,
.row-icon-list {
  background: #edf3e9;
  color: #52705c;
}

.row-icon-meal {
  background: #f8ead9;
  color: #a86d2f;
}

.row-icon-reminder {
  background: #ffe5d7;
  color: #d46b4e;
}

.row-icon-calendar,
.row-icon-event {
  background: #e5efe5;
  color: #466a50;
}

.meal-thumb {
  display: block;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(40, 50, 42, 0.12);
}

.task-row {
  justify-content: flex-start;
  min-height: 54px;
  padding: 11px 12px;
}

.task-row > span {
  flex: 1;
}

.task-row-actions {
  margin-left: auto;
}

.task-row-actions .ghost-button,
.task-row-actions .danger-button,
.timeline .ghost-button {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 0.72rem;
}

#meal-list .task-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

#meal-list .task-row-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  margin-left: 0;
}

#meal-list .task-row-actions .ghost-button,
#meal-list .task-row-actions .danger-button {
  width: 100%;
}

.insight-item {
  padding: 12px 14px;
}

.member-chip {
  border-radius: 15px;
  background: rgba(255, 253, 247, 0.82);
}

#today .status-strip {
  display: none;
}

.member-avatar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(0, 0, 0, 0.04)),
    var(--member-color, var(--accent));
  box-shadow: 0 0 0 3px rgba(255, 253, 247, 0.9), 0 3px 8px rgba(39, 48, 39, 0.12);
}

.calendar-actions,
.notification-actions {
  width: auto;
}

.calendar-actions {
  grid-template-columns: 1fr;
}

.calendar-search-row {
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0;
}

.calendar-search-row select,
.calendar-search-row .toggle-row {
  display: none;
}

.calendar-nav-row {
  grid-template-columns: 38px 1fr 38px;
  margin: -2px 0 0;
}

.calendar-nav-row .icon-button {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.calendar-grid.month-calendar {
  gap: 6px;
}

.month-weekday {
  color: var(--ink-secondary);
  font-size: 0.67rem;
  text-transform: none;
  letter-spacing: 0;
}

.month-cell {
  min-height: 48px !important;
  padding: 6px 3px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: center;
}

.month-cell-title {
  justify-content: center;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 500;
}

.month-cell-title span:last-child {
  display: none;
}

.month-cell:has(.month-event) .month-cell-title span:first-child {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  margin: 0 auto;
  border-radius: var(--radius-full);
  background: #e4eee2;
}

.month-event {
  display: inline-block;
  width: 6px;
  min-height: 6px;
  height: 6px;
  padding: 0;
  margin: 1px 1px 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--member-color, var(--accent));
  vertical-align: top;
}

.month-event span,
.month-event strong,
.more-events,
.month-cell .date-signals {
  display: none;
}

.event-card {
  border-radius: 13px;
}

.day-cell {
  min-height: 0;
  padding: 12px;
}

.notification-toolbar {
  display: none;
}

#notification-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#notification-summary .member-chip {
  min-height: 72px;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 2px;
  padding: 10px 6px;
  border-left: 0;
  text-align: center;
}

#notification-summary .member-chip .dot {
  display: none;
}

.notification-list {
  gap: 12px;
}

.notification-group {
  gap: 7px;
}

.notification-group h3 {
  padding-left: 2px;
}

.notification-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 13px;
}

.notification-row-actions {
  gap: 5px;
}

.inline-form,
#shopping-form,
#chore-form {
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 253, 247, 0.86);
}

#shopping-list,
#chore-list {
  order: 2;
}

#shopping-form,
#chore-form {
  order: 3;
}

#meal-form {
  order: 2;
}

#meals .two-column > article.feature-card {
  order: 1;
}

#meals .meal-more-panel {
  order: 3;
}

input,
select,
textarea {
  min-height: 44px;
  border-color: var(--border);
  border-radius: 12px;
  background: #fbf9f1;
}

label {
  color: var(--ink-secondary);
  font-size: 0.76rem;
}

.toggle-row {
  min-height: 48px;
  border-radius: 13px;
  background: rgba(255, 253, 247, 0.84);
}

.settings-grid,
.family-panel-grid,
#meals .two-column,
.two-column,
.dashboard-grid {
  grid-template-columns: 1fr !important;
}

.settings-grid {
  align-items: stretch;
}

.invite-code-card {
  align-items: stretch;
  flex-direction: column;
  border-radius: 16px;
  background: rgba(255, 253, 247, 0.9);
}

.invite-code-box {
  flex-direction: column;
  align-items: stretch;
}

.invite-code-box code {
  justify-content: center;
}

.link-list,
.billing-actions {
  grid-template-columns: 1fr;
}

dialog {
  width: min(390px, calc(100vw - 22px));
  max-height: calc(100dvh - 22px);
  border-radius: 24px;
  background: #fffdf7;
}

dialog::backdrop {
  background: rgba(30, 35, 30, 0.32);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#event-form {
  gap: 12px;
  padding: 16px;
}

.event-detail-panel:not(.event-checklist-section, .event-thread-section),
.event-checklist-section,
.event-thread-section {
  border-radius: 16px;
  background: #fbf9f1;
}

#event-form > .button-row {
  background: #fffdf7;
}

.bottom-nav {
  position: fixed;
  right: 50%;
  bottom: 0;
  left: auto;
  z-index: 80;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
  width: min(430px, 100vw);
  transform: translateX(50%);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  border: 0;
  border-top: 1px solid var(--border);
  background: rgba(255, 253, 247, 0.94);
  box-shadow: 0 -10px 26px rgba(40, 50, 42, 0.09);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.bottom-nav .secondary-tab {
  display: none;
}

.bottom-nav a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  border-radius: 14px;
  color: #19241e;
  font-size: 0.62rem;
  font-weight: 700;
  text-decoration: none;
}

.bottom-nav a .icon {
  width: 1.3rem;
  height: 1.3rem;
}

.bottom-nav a.active {
  color: var(--accent-strong);
  background: #f0eee6;
}

.bottom-nav a.active .icon {
  fill: var(--accent);
  stroke: var(--accent);
}

.bottom-nav .nav-badge {
  position: absolute;
  top: 4px;
  right: 11px;
}

.loading-overlay {
  background:
    linear-gradient(180deg, rgba(237, 242, 234, 0.98), rgba(250, 247, 236, 0.98));
}

.loading-stage {
  min-height: min(720px, 92dvh);
  align-content: center;
}

.loading-stage .wordmark {
  font-size: 2.45rem;
}

.loading-tagline {
  color: var(--accent-strong);
  font-weight: 500;
}

.loading-rail {
  width: 190px;
  height: 7px;
  margin-top: 36px;
  background: #d9ddd2;
}

.loading-rail span {
  background: #6b8c6c;
}

.loading-message {
  margin-top: 14px;
  color: var(--ink-secondary);
  font-weight: 500;
}

@media (min-width: 700px) {
  body {
    display: grid;
    place-items: center;
    min-height: 100dvh;
    padding: 26px;
  }

  .app-shell {
    min-height: min(860px, calc(100dvh - 52px));
    overflow: hidden;
    border-radius: 28px;
  }

  .main-content {
    min-height: min(860px, calc(100dvh - 52px));
    overflow-y: auto;
  }

  .bottom-nav {
    bottom: 26px;
    border-radius: 0 0 28px 28px;
  }
}

@media (max-width: 430px) {
  .app-shell {
    max-width: none;
    box-shadow: none;
  }

  .main-content {
    padding-right: 14px;
    padding-left: 14px;
  }

  .bottom-nav {
    width: 100vw;
  }
}

/* Feedback pass: closer mobile shell and reference-board details ------------ */
html[data-theme="ocean"] {
  --bg: #eaf2f7;
  --bg-elevated: #fbfdff;
  --bg-soft: #e5eff5;
  --bg-muted: #f3f8fb;
  --ink: #13212b;
  --ink-secondary: #4b6475;
  --border: rgba(31, 70, 95, 0.14);
  --border-strong: rgba(31, 70, 95, 0.2);
  --accent: #4e7f9f;
  --accent-hover: #3e6d8b;
  --accent-strong: #2f5f7d;
  --accent-soft: #e1eef5;
  --surface-tint: rgba(251, 253, 255, 0.86);
  --nav-bg: rgba(251, 253, 255, 0.94);
}

html[data-theme="sunset"] {
  --bg: #f4ebe3;
  --bg-elevated: #fffaf4;
  --bg-soft: #f5e6dc;
  --bg-muted: #fbf0e7;
  --ink: #2c1e18;
  --ink-secondary: #72564b;
  --border: rgba(111, 68, 49, 0.14);
  --border-strong: rgba(111, 68, 49, 0.22);
  --accent: #c96b4d;
  --accent-hover: #b45b40;
  --accent-strong: #8e4936;
  --accent-soft: #f7e3da;
  --surface-tint: rgba(255, 250, 244, 0.88);
  --nav-bg: rgba(255, 250, 244, 0.94);
}

html[data-theme="lavender"] {
  --bg: #f1edf6;
  --bg-elevated: #fffaff;
  --bg-soft: #ece5f4;
  --bg-muted: #f7f1fb;
  --ink: #241d2d;
  --ink-secondary: #63536f;
  --border: rgba(82, 55, 111, 0.14);
  --border-strong: rgba(82, 55, 111, 0.22);
  --accent: #7d67a7;
  --accent-hover: #6d5798;
  --accent-strong: #5a467f;
  --accent-soft: #ece4f5;
  --surface-tint: rgba(255, 250, 255, 0.88);
  --nav-bg: rgba(255, 250, 255, 0.94);
}

html[data-theme="midnight"] {
  --bg: #141b20;
  --bg-elevated: #1d252b;
  --bg-soft: #202d33;
  --bg-muted: #253139;
  --ink: #eef5ef;
  --ink-secondary: #c8d4cb;
  --ink-tertiary: #94a39b;
  --border: rgba(226, 238, 229, 0.14);
  --border-strong: rgba(226, 238, 229, 0.24);
  --accent: #83a989;
  --accent-hover: #74a07c;
  --accent-strong: #b8d7bb;
  --accent-soft: rgba(131, 169, 137, 0.18);
  --accent-text: #101712;
  --surface-tint: rgba(29, 37, 43, 0.9);
  --nav-bg: rgba(29, 37, 43, 0.94);
  --calendar-paper: #242f34;
}

html[data-theme] body {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 88%, #ffffff) 0%, var(--bg-elevated) 58%, var(--bg) 100%);
}

html[data-theme] .wordmark span + span,
html[data-theme] .loading-tagline {
  color: var(--accent-strong);
}

html[data-theme] .primary-button,
html[data-theme] .settings-tab.active,
html[data-theme] .segmented-control button.active {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #ffffff), var(--accent));
  color: var(--accent-text);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 28%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

html[data-theme] .bottom-nav a.active,
html[data-theme] .month-cell:has(.month-event) .month-cell-title span:first-child {
  background: var(--accent-soft);
}

html[data-theme] .bottom-nav a.active,
html[data-theme] .bottom-nav a.active .icon,
html[data-theme] .loading-rail span {
  color: var(--accent-strong);
  fill: var(--accent);
  stroke: var(--accent);
  background: var(--accent);
}

body.is-app-screen .menu-button {
  display: inline-grid !important;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body.is-app-screen .sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 88;
  display: block !important;
  pointer-events: none;
  opacity: 0;
  background: rgba(29, 34, 30, 0.28);
  transition: opacity 180ms ease;
}

body.is-app-screen.nav-open .sidebar-overlay {
  pointer-events: auto;
  opacity: 1;
}

body.is-app-screen .sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: max(0px, calc((100vw - 430px) / 2));
  z-index: 90;
  display: flex !important;
  width: min(330px, 88vw);
  max-width: 88vw;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));
  border-right: 1px solid var(--border);
  border-radius: 0 24px 24px 0;
  background: var(--surface-tint);
  box-shadow: 22px 0 44px rgba(40, 50, 42, 0.17);
  transform: translateX(calc(-100% - 20px));
  transition: transform 220ms ease;
}

body.is-app-screen.nav-open .sidebar {
  transform: translateX(0);
}

.topbar {
  align-items: center;
  gap: 8px;
}

.topbar-brand {
  min-width: 0;
  flex: 1 1 auto;
}

.topbar-family-stack {
  display: none;
  align-items: center;
  justify-content: flex-end;
  min-width: 96px;
  margin-left: auto;
  padding-right: 2px;
}

body.is-app-screen[data-view="today"] .topbar-family-stack {
  display: flex;
}

body.is-app-screen[data-view="today"] .topbar-brand {
  flex: 0 1 auto;
}

.topbar-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-left: -8px;
  border-radius: var(--radius-full);
  color: #fffdf7;
  font-size: 0.64rem;
  font-weight: 800;
}

.topbar-avatar:first-child {
  margin-left: 0;
}

.topbar-avatar-more {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

#today .section-heading [data-open-event] {
  display: none;
}

body.is-app-screen .fab-button {
  position: fixed;
  right: max(18px, calc((100vw - 430px) / 2 + 18px));
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 82;
  display: grid !important;
  place-items: center;
  width: 58px;
  height: 58px;
  min-height: 58px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
  border-radius: var(--radius-full);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, #ffffff), var(--accent));
  color: var(--accent-text);
  box-shadow: 0 16px 28px color-mix(in srgb, var(--accent) 26%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

body.is-app-screen .fab-button .icon {
  width: 1.8rem;
  height: 1.8rem;
}

body:not(.is-app-screen) .fab-button {
  display: none !important;
}

#calendar .section-heading > div:first-child {
  display: none;
}

#calendar .section-heading {
  align-items: stretch !important;
}

#calendar .calendar-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  gap: 8px;
}

#calendar .calendar-actions .segmented-control:first-child {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}

#calendar .month-density-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
}

#calendar .calendar-actions button {
  white-space: nowrap;
}

#calendar-today-button {
  min-width: 72px;
}

.calendar-grid {
  touch-action: pan-y;
}

.week-calendar .day-title span:first-child,
.day-calendar .day-title span:first-child {
  font-size: 0.86rem;
  line-height: 1.2;
}

.month-cell {
  min-height: 67px !important;
  padding: 5px 3px;
}

.month-event {
  display: block;
  width: 100%;
  height: auto;
  min-height: 17px;
  margin: 2px 0 0;
  padding: 2px 4px;
  border: 0;
  border-radius: 6px;
  background: color-mix(in srgb, var(--member-color, var(--accent)) 18%, var(--calendar-paper));
  color: var(--ink);
  text-align: left;
}

.month-event strong {
  display: block;
  overflow: hidden;
  font-size: 0.54rem;
  font-weight: 700;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-event span {
  display: none;
}

.more-events {
  display: block;
  margin-top: 1px;
  color: var(--ink-secondary);
  font-size: 0.52rem;
  line-height: 1;
}

.month-cell .date-signals {
  display: none;
}

#notifications .section-heading {
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 10px;
}

#notifications .notification-actions,
#notifications .notification-actions .segmented-control {
  width: 100%;
}

#notifications .notification-actions .segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#notifications .notification-actions .segmented-control button {
  min-width: 0;
  padding: 0 8px;
  overflow: hidden;
  font-size: 0.74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#notification-summary {
  gap: 8px;
}

#notification-summary .member-chip {
  min-height: 68px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), transparent),
    color-mix(in srgb, var(--accent-soft) 62%, var(--bg-elevated));
  box-shadow: var(--shadow-sm);
}

#notification-summary .member-chip strong {
  color: var(--accent-strong);
  font-size: 1.2rem;
}

#event-form {
  min-height: min(690px, calc(100dvh - 22px));
}

.event-detail-panel {
  min-height: 286px;
}

#event-form > .button-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  margin: 0;
  padding: 0;
  border-top: 0;
  background: transparent;
}

#event-form > .button-row button {
  width: 100%;
  min-height: 44px;
}

.more-hub {
  display: grid;
  gap: 8px;
}

.more-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 72px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 253, 247, 0.82);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.more-card strong,
.more-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.more-card strong {
  font-size: 0.92rem;
}

.more-card small {
  margin-top: 3px;
  color: var(--ink-secondary);
  font-size: 0.76rem;
  line-height: 1.25;
}

.more-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 15px;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.more-icon.is-shopping { color: #416f83; background: #dfeef3; }
.more-icon.is-chores { color: #55765c; background: #e5eee2; }
.more-icon.is-meals { color: #a96d35; background: #f6e5ce; }
.more-icon.is-alerts { color: #c76d34; background: #fae4d2; }
.more-icon.is-theme { color: #6d578d; background: #eee7f3; }
.more-icon.is-plus { color: #5b7f60; background: #dce9d8; }

.more-chevron {
  color: var(--ink-tertiary);
}

.more-plus-card {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent-soft) 70%, transparent), rgba(255, 253, 247, 0.86)),
    rgba(255, 253, 247, 0.86);
}

.more-hub + .settings-tabs {
  margin-top: 4px;
}

@media (max-width: 370px) {
  #calendar .calendar-actions {
    grid-template-columns: 1fr;
  }

  #calendar-today-button {
    width: 100%;
  }

  .topbar-family-stack {
    min-width: 78px;
  }

  .topbar-avatar {
    width: 28px;
    height: 28px;
    margin-left: -10px;
  }
}

html[data-theme] .bottom-nav a.active {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

html[data-theme] .bottom-nav a.active .icon {
  color: var(--accent);
  fill: var(--accent);
  stroke: var(--accent);
  background: transparent;
}

html[data-theme] .loading-rail span {
  background: var(--accent);
}

#event-form {
  height: min(690px, calc(100dvh - 22px));
  max-height: calc(100dvh - 22px);
  overflow-y: auto;
}

/* Feedback fixes: event scrolling, More root, drawer, calendar swipe -------- */
body.is-app-screen .sidebar {
  background: var(--bg-elevated) !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.is-app-screen .sidebar-overlay {
  background: rgba(29, 34, 30, 0.42);
}

#event-dialog {
  max-height: calc(100dvh - 16px);
  overflow: hidden;
}

#event-form {
  height: auto !important;
  min-height: min(620px, calc(100dvh - 16px));
  max-height: calc(100dvh - 16px);
  overflow-y: auto !important;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

#event-dialog .event-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  overflow: visible;
}

#event-dialog .event-tabs .settings-tab {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 0 4px;
  overflow: hidden;
  font-size: 0.64rem;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#event-form > .button-row {
  position: sticky;
  bottom: 0;
  z-index: 6;
  padding: 10px 0 0;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0), var(--bg-elevated) 18px),
    var(--bg-elevated);
}

#settings > .settings-tabs {
  display: none !important;
}

#settings:not(.settings-detail-open) .settings-grid {
  display: none;
}

#settings.settings-detail-open .settings-grid {
  display: grid;
}

.more-icon.is-weather { color: #527b80; background: #dfedf0; }
.more-icon.is-agenda { color: #9c7142; background: #f4e8d5; }
.more-icon.is-preferences { color: #607766; background: #e7eee3; }

.calendar-grid.calendar-slide-forward {
  animation: calendar-slide-forward 210ms ease-out;
}

.calendar-grid.calendar-slide-backward {
  animation: calendar-slide-backward 210ms ease-out;
}

@keyframes calendar-slide-forward {
  from {
    opacity: 0.55;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes calendar-slide-backward {
  from {
    opacity: 0.55;
    transform: translateX(-24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.event-panel-title {
  display: none;
  margin: 0;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.15;
}

#event-dialog.is-new-event .event-tabs {
  display: none !important;
}

#event-dialog.is-new-event #event-form {
  min-height: auto;
  gap: 10px;
}

#event-dialog.is-new-event .event-detail-panel {
  min-height: 0;
}

#event-dialog.is-new-event .event-detail-panel:not(.event-checklist-section, .event-thread-section) {
  padding: 13px;
}

#event-dialog.is-new-event .event-panel-title {
  display: block;
}

#event-dialog.is-new-event .form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#event-dialog.is-new-event .compact-toggle {
  grid-column: 1 / -1;
}

#event-dialog.is-new-event #event-form > .button-row {
  margin-top: 2px;
}

@media (max-width: 380px) {
  #event-dialog.is-new-event .form-grid.two {
    grid-template-columns: 1fr;
  }
}

/* Reference pass: Lists, More, and stacked event editing ------------------- */
#shopping .section-heading,
#chores .section-heading,
#meals .section-heading,
#settings .section-heading {
  margin-bottom: 4px;
}

#shopping .section-heading .eyebrow,
#chores .section-heading .eyebrow,
#meals .section-heading .eyebrow,
#settings .section-heading .eyebrow {
  display: none;
}

#shopping .section-heading h2,
#chores .section-heading h2,
#meals .section-heading h2,
#settings .section-heading h2 {
  color: var(--ink);
  font-size: 1.72rem;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0;
}

#shopping .task-list.large,
#chores .task-list.large {
  display: grid;
  gap: 14px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

#meal-list.task-list.large {
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.sd-list-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 253, 247, 0.9);
  box-shadow: 0 12px 30px rgba(44, 55, 45, 0.08);
}

.sd-list-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 13px;
  background: linear-gradient(90deg, #dce8d5, rgba(250, 247, 238, 0.96));
  color: var(--ink);
  font-size: 0.83rem;
  font-weight: 800;
}

.sd-list-card-header span {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border-radius: 13px;
  background: rgba(255, 253, 247, 0.78);
  color: var(--ink-secondary);
  font-size: 0.76rem;
}

.sd-list-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto 32px;
  gap: 10px;
  align-items: center;
  min-height: 45px;
  padding: 8px 11px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 253, 247, 0.72);
}

.sd-list-row:last-child {
  border-bottom: 0;
}

.sd-list-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.sd-list-copy strong,
.sd-list-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sd-list-copy strong {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 850;
}

.sd-list-copy small {
  color: var(--ink-secondary);
  font-size: 0.72rem;
}

.sd-check-button,
.sd-row-icon-button {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 1.5px solid color-mix(in srgb, var(--ink-tertiary) 58%, transparent);
  border-radius: 7px;
  background: transparent;
  color: var(--accent-strong);
}

.sd-check-button.is-round {
  border-radius: 50%;
}

.sd-list-row.is-done .sd-check-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.sd-list-row.is-done .sd-list-copy strong {
  color: var(--ink-secondary);
  text-decoration: line-through;
}

.sd-row-icon-button {
  border: 0;
  color: var(--ink-secondary);
}

.sd-row-icon-button:disabled {
  opacity: 0.36;
}

.sd-owner-pill {
  max-width: 76px;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--member-color, var(--accent)) 18%, #fffdf7);
  color: color-mix(in srgb, var(--member-color, var(--accent)) 72%, var(--ink));
  font-size: 0.68rem;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sd-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 0 13px;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: rgba(255, 253, 247, 0.62);
  color: var(--accent-strong);
  font-weight: 800;
  text-align: left;
}

#chores > .sd-add-row,
#chore-list > .sd-add-row {
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #ffffff), var(--accent-strong));
  color: #ffffff;
  box-shadow: 0 12px 22px color-mix(in srgb, var(--accent) 22%, transparent);
}

.sd-list-group {
  display: grid;
  gap: 7px;
}

.sd-list-group > h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 850;
}

.sd-list-group .sd-list-card-header {
  display: none;
}

.sd-meal-card .sd-list-card-header {
  background: rgba(255, 253, 247, 0.76);
}

.sd-meal-row {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 58px 30px 30px;
  gap: 10px;
  align-items: center;
  min-height: 74px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 253, 247, 0.72);
}

.sd-meal-row:last-child {
  border-bottom: 0;
}

.sd-meal-row time {
  display: grid;
  place-items: center;
  align-self: stretch;
  border-right: 1px solid var(--border);
  color: var(--ink);
  font-size: 0.75rem;
}

.sd-meal-row time strong {
  font-size: 1rem;
}

.sd-meal-row .meal-thumb,
.sd-meal-row .row-icon {
  width: 56px;
  height: 50px;
  border-radius: 11px;
  object-fit: cover;
}

#shopping-form,
#chore-form {
  margin-top: 4px;
  border-radius: 16px;
  background: rgba(255, 253, 247, 0.78);
  box-shadow: none;
}

#shopping-form:not(.is-open),
#chore-form:not(.is-open) {
  display: none;
}

#settings .more-reference-panel {
  display: grid;
  gap: 8px;
}

.more-reference-panel h3,
.more-section-label {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 0.93rem;
  font-weight: 850;
}

.more-member-list,
#settings .more-hub {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 253, 247, 0.9);
  box-shadow: 0 12px 30px rgba(44, 55, 45, 0.08);
}

.more-member-row,
#settings .more-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 54px;
  padding: 9px 11px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: rgba(255, 253, 247, 0.68);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.more-member-row:last-child,
#settings .more-card:last-child {
  border-bottom: 0;
}

.more-member-row .member-avatar {
  width: 34px;
  height: 34px;
}

.more-member-row strong,
.more-member-row small,
#settings .more-card strong,
#settings .more-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.more-member-row strong,
#settings .more-card strong {
  color: var(--ink);
  font-size: 0.86rem;
}

.more-member-row small,
#settings .more-card small {
  margin-top: 2px;
  color: var(--ink-secondary);
  font-size: 0.72rem;
  line-height: 1.22;
}

.more-inline-icon,
#settings .more-hub .more-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: transparent;
  color: var(--accent-strong);
}

#settings .more-plus-card {
  min-height: 72px;
  background:
    linear-gradient(90deg, color-mix(in srgb, #e6d2b3 42%, rgba(255, 253, 247, 0.92)), rgba(255, 253, 247, 0.9)),
    rgba(255, 253, 247, 0.9);
}

#event-dialog.is-edit-event .event-tabs {
  display: none !important;
}

#event-dialog.is-edit-event #event-form {
  min-height: auto;
  gap: 10px;
}

#event-dialog.is-edit-event .event-detail-panel {
  min-height: 0;
}

#event-dialog.is-edit-event .event-detail-panel:not(.event-checklist-section, .event-thread-section),
#event-dialog.is-edit-event .event-checklist-section,
#event-dialog.is-edit-event .event-thread-section {
  padding: 13px;
}

#event-dialog.is-edit-event .event-panel-title {
  display: block;
}

#event-dialog.is-edit-event .form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#event-dialog.is-edit-event .compact-toggle {
  grid-column: 1 / -1;
}

#event-dialog.is-new-event #event-form > .button-row,
#event-dialog.is-edit-event #event-form > .button-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

#event-dialog.is-new-event #event-form > .button-row button,
#event-dialog.is-edit-event #event-form > .button-row button {
  width: 100%;
  min-width: 0;
  padding-inline: 8px;
}

@media (max-width: 380px) {
  #event-dialog.is-edit-event .form-grid.two {
    grid-template-columns: 1fr;
  }

  .sd-list-row {
    grid-template-columns: 28px minmax(0, 1fr) auto 28px;
    gap: 8px;
  }

  .sd-meal-row {
    grid-template-columns: 44px minmax(0, 1fr) 48px 28px 28px;
    gap: 7px;
  }

  .sd-meal-row .meal-thumb,
  .sd-meal-row .row-icon {
    width: 48px;
    height: 44px;
  }
}

@media (max-width: 720px) {
  html,
  body,
  .main-content {
    scrollbar-width: none;
  }

  html::-webkit-scrollbar,
  body::-webkit-scrollbar,
  .main-content::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  body.is-app-screen .main-content {
    padding-bottom: calc(118px + env(safe-area-inset-bottom)) !important;
  }

  #shopping-form,
  #chore-form,
  #meal-form {
    scroll-margin-bottom: calc(128px + env(safe-area-inset-bottom));
  }
}

/* Full-style completion pass --------------------------------------------- */
.view-panel.active {
  animation: sd-view-enter 180ms ease-out both;
}

@keyframes sd-view-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lists-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  min-height: 42px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: rgba(255, 253, 247, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.lists-switcher button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 34px;
  padding: 0 8px;
  border-radius: 13px;
  color: var(--ink-secondary);
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
  transition: background 160ms ease, color 160ms ease, transform 120ms ease;
}

.lists-switcher button.active {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, #ffffff), var(--accent-strong));
  color: #ffffff;
  box-shadow: 0 7px 16px color-mix(in srgb, var(--accent) 18%, transparent);
}

.lists-switcher button:active {
  transform: scale(0.98);
}

#shopping-form:not(.is-open),
#chore-form:not(.is-open) {
  display: none !important;
}

#shopping-form.is-open,
#chore-form.is-open {
  display: grid !important;
  animation: sd-form-open 180ms ease-out both;
}

@keyframes sd-form-open {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#shopping-form.is-open,
#chore-form.is-open,
#meal-form,
#prep-template-form,
.support-request-form,
#calendar-subscription-form {
  border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--border));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent),
    rgba(255, 253, 247, 0.9);
  box-shadow: 0 12px 28px rgba(44, 55, 45, 0.08);
}

.empty-state-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 92px;
  padding: 18px;
  border: 1px dashed color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 16px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 52%, transparent), rgba(255, 253, 247, 0.72)),
    rgba(255, 253, 247, 0.78);
  color: var(--ink-secondary);
  text-align: center;
}

.empty-state-card p {
  margin: 0;
  max-width: 34ch;
  font-size: 0.82rem;
  font-weight: 750;
}

.empty-state-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.add-event-empty {
  display: grid;
  place-items: center;
  min-height: 56px;
  border: 1px dashed color-mix(in srgb, var(--accent) 25%, var(--border));
  border-radius: 13px;
  background: rgba(255, 253, 247, 0.68);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 850;
}

.action-status:not(:empty),
#auth-status:not(:empty),
#event-comment-status:not(:empty),
#event-checklist-status:not(:empty) {
  display: block;
  min-height: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 253, 247, 0.72);
  color: var(--ink-secondary);
  font-size: 0.78rem;
  font-weight: 750;
}

.action-status[data-tone="success"],
#auth-status[data-tone="success"] {
  border-color: color-mix(in srgb, var(--success) 28%, var(--border));
  background: color-mix(in srgb, var(--success) 10%, rgba(255, 253, 247, 0.86));
  color: color-mix(in srgb, var(--success) 68%, var(--ink));
}

.action-status[data-tone="error"],
#auth-status[data-tone="error"] {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
  background: color-mix(in srgb, var(--danger) 9%, rgba(255, 253, 247, 0.88));
  color: color-mix(in srgb, var(--danger) 72%, var(--ink));
}

.action-status[data-tone="warning"] {
  border-color: color-mix(in srgb, var(--warning) 30%, var(--border));
  background: color-mix(in srgb, var(--warning) 12%, rgba(255, 253, 247, 0.88));
  color: color-mix(in srgb, var(--warning) 70%, var(--ink));
}

#event-form-status:empty,
#event-comment-status:empty,
#event-checklist-status:empty,
#meal-status:empty,
#family-status:empty,
#setup-status:empty {
  display: none;
}

.settings-detail-header {
  display: none;
  align-items: center;
  gap: 12px;
  min-height: 54px;
}

.settings-detail-header h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.28rem;
  font-weight: 900;
  line-height: 1.05;
}

.settings-detail-header .eyebrow {
  display: block !important;
  margin: 0 0 2px;
}

#settings.settings-detail-open .section-heading,
#settings.settings-detail-open .more-reference-panel,
#settings.settings-detail-open .more-section-label,
#settings.settings-detail-open .more-hub {
  display: none !important;
}

#settings.settings-detail-open .settings-detail-header {
  display: flex;
}

#settings.settings-detail-open .settings-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

#settings.settings-detail-open .settings-grid > .feature-card,
#settings.settings-detail-open .settings-grid > form.feature-card,
#settings.settings-detail-open .settings-grid > .ad-banner {
  border-radius: 18px;
  background: rgba(255, 253, 247, 0.9);
  box-shadow: 0 12px 30px rgba(44, 55, 45, 0.08);
}

#settings.settings-detail-open .feature-card h3 {
  font-size: 0.98rem;
  font-weight: 850;
}

.theme-picker {
  gap: 9px;
}

.theme-option {
  border-radius: 15px;
  background: rgba(255, 253, 247, 0.74);
}

.theme-option.active {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  background: color-mix(in srgb, var(--accent-soft) 52%, rgba(255, 253, 247, 0.84));
}

.link-list a,
.permission-list > div,
.billing-actions button {
  border-radius: 13px;
}

dialog {
  border: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(33, 38, 34, 0.36);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#event-form {
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), transparent 160px),
    var(--bg-elevated);
  box-shadow: 0 24px 60px rgba(30, 38, 32, 0.18);
}

#event-dialog .section-heading.compact {
  align-items: center;
  padding: 0;
}

.event-detail-panel {
  border: 1px solid var(--border);
  border-radius: 17px;
  background: rgba(255, 253, 247, 0.76);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.repeat-builder {
  border-radius: 16px;
  background: rgba(255, 253, 247, 0.94);
  box-shadow: 0 14px 34px rgba(44, 55, 45, 0.12);
}

.compact-form {
  border-radius: 14px;
  background: rgba(255, 253, 247, 0.84);
}

.auth-panel,
.setup-panel {
  overflow: hidden;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent),
    rgba(255, 253, 247, 0.86);
  box-shadow: 0 20px 54px rgba(44, 55, 45, 0.12);
}

.auth-preview-card {
  border-radius: 20px;
}

.setup-panel .feature-card {
  border-radius: 18px;
  background: rgba(255, 253, 247, 0.84);
}

.onboarding-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent),
    rgba(255, 253, 247, 0.92);
}

.onboarding-preview-image {
  object-fit: contain;
  background: rgba(255, 253, 247, 0.72);
}

.more-icon.is-weather { color: #527b80; background: #dfedf0; }
.more-icon.is-agenda { color: #9c7142; background: #f4e8d5; }

@media (max-width: 720px) {
  .lists-switcher {
    position: sticky;
    top: calc(66px + env(safe-area-inset-top));
    z-index: 18;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  #settings.settings-detail-open {
    gap: 12px;
  }

  #settings.settings-detail-open .settings-grid > .feature-card,
  #settings.settings-detail-open .settings-grid > form.feature-card,
  #settings.settings-detail-open .settings-grid > .ad-banner {
    padding: 15px;
  }

  #event-form {
    border-radius: 22px 22px 0 0;
  }

  .onboarding-panel {
    grid-template-columns: 1fr;
    grid-template-areas:
      "visual"
      "content"
      "progress"
      "actions";
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    padding: 18px;
    border-radius: 24px;
  }

  .onboarding-visual {
    min-height: 220px;
  }

  .onboarding-preview-image {
    width: min(74%, 230px);
    aspect-ratio: 1 / 1;
  }

  .onboarding-content h1 {
    font-size: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .view-panel.active,
  #shopping-form.is-open,
  #chore-form.is-open {
    animation: none;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ── Public website ─────────────────────────────────────────── */
.marketing-site {
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--bg)) 0%, var(--bg) 34rem),
    var(--bg);
}

.marketing-site[hidden] {
  display: none;
}

body.is-site-screen {
  padding-bottom: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  padding: 14px clamp(18px, 5vw, 64px);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, white);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.site-brand {
  min-width: 0;
  margin: 0;
  padding: 0;
}

.site-brand:hover {
  background: transparent;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-nav a,
.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 13px;
  color: var(--ink-secondary);
  font-size: 0.9rem;
  font-weight: 750;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a.active,
.site-footer a:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.site-nav-login {
  border: 1px solid var(--border-strong);
  background: var(--surface-tint);
  color: var(--ink) !important;
}

.site-menu-button {
  display: none;
}

.site-main {
  display: grid;
}

.site-page {
  display: grid;
  gap: clamp(28px, 5vw, 58px);
  width: 100%;
}

.site-page[hidden] {
  display: none;
}

.site-hero {
  position: relative;
  display: grid;
  align-items: center;
  min-height: clamp(560px, 74svh, 760px);
  overflow: hidden;
  padding: clamp(64px, 8vw, 108px) clamp(22px, 6vw, 82px);
  background:
    linear-gradient(90deg, rgba(244, 246, 245, 0.98) 0%, rgba(244, 246, 245, 0.92) 42%, rgba(244, 246, 245, 0.38) 100%),
    url("assets/onboarding/today.png") right clamp(18px, 7vw, 104px) center / min(42vw, 430px) auto no-repeat,
    linear-gradient(145deg, #f7f3e9, #e8f1ee 54%, #f7eee2);
  border-bottom: 1px solid var(--border);
}

.site-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 128px;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, var(--bg));
}

.site-hero-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 22px;
  width: min(660px, 100%);
}

.site-hero h1,
.site-page-hero h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(3.6rem, 10vw, 7.3rem);
  line-height: 0.92;
  font-weight: 900;
  letter-spacing: 0;
}

.site-page-hero h1 {
  font-size: clamp(2.6rem, 7vw, 5rem);
  line-height: 1;
}

.site-hero p,
.site-page-hero p,
.site-section-heading p,
.site-screenshot-band p {
  max-width: 680px;
  margin: 0;
  color: var(--ink-secondary);
  font-size: clamp(1.03rem, 2vw, 1.22rem);
  line-height: 1.65;
}

.site-hero-actions,
.store-button-row,
.site-doc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.store-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  min-width: min(210px, 100%);
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: color-mix(in srgb, var(--ink) 92%, #30433a);
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.store-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.store-button .icon {
  width: 1.55rem;
  height: 1.55rem;
}

.store-button small,
.store-button strong {
  display: block;
  line-height: 1.1;
}

.store-button small {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.72rem;
  font-weight: 700;
}

.store-button strong {
  font-size: 1.02rem;
  font-weight: 850;
}

.site-proof-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: -1px auto 0;
  width: min(1120px, calc(100% - 36px));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--border);
  box-shadow: var(--shadow-sm);
}

.site-proof-strip article {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 20px;
  background: color-mix(in srgb, var(--bg-elevated) 94%, var(--calendar-paper));
}

.site-proof-strip strong,
.site-feature-card strong,
.site-detail-grid strong,
.site-story-grid strong,
.site-list-showcase strong {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 850;
}

.site-proof-strip span,
.site-feature-card span,
.site-detail-grid span,
.site-story-grid span,
.site-list-showcase span {
  min-width: 0;
  color: var(--ink-secondary);
  line-height: 1.55;
}

.site-feature-band,
.site-legal-band,
.site-feature-story,
.site-screenshot-band,
.site-detail-grid,
.site-list-showcase {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
}

.site-feature-band,
.site-legal-band {
  display: grid;
  gap: 22px;
}

.site-section-heading {
  display: grid;
  gap: 9px;
  max-width: 760px;
}

.site-section-heading h2,
.site-screenshot-band h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.05;
  font-weight: 880;
  letter-spacing: 0;
}

.site-section-heading.compact h2 {
  font-size: clamp(1.7rem, 4vw, 2.5rem);
}

.site-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.site-feature-card,
.site-detail-grid article,
.site-story-grid article,
.site-list-showcase article {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--bg-elevated) 94%, var(--calendar-paper));
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.site-feature-card:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.site-screenshot-band {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  align-items: center;
  gap: clamp(24px, 5vw, 52px);
  padding: clamp(24px, 5vw, 46px) 0;
}

.site-phone-stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: clamp(8px, 2vw, 18px);
}

.site-phone-stack img,
.site-page-hero img {
  display: block;
  width: 100%;
  min-width: 0;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-lg);
}

.site-phone-stack img:nth-child(2) {
  transform: translateY(-22px);
}

.site-phone-stack img:nth-child(3) {
  transform: translateY(14px);
}

.site-legal-band {
  margin-bottom: clamp(28px, 5vw, 54px);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, transparent), transparent 42%),
    color-mix(in srgb, var(--bg-elevated) 94%, var(--calendar-paper));
}

.site-doc-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface-tint);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.site-doc-links a:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.site-page-hero {
  position: relative;
  display: grid;
  align-items: center;
  min-height: clamp(430px, 58svh, 620px);
  overflow: hidden;
  padding: clamp(58px, 8vw, 96px) clamp(22px, 6vw, 82px);
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(90deg, rgba(244, 246, 245, 0.98), rgba(244, 246, 245, 0.82) 56%, rgba(244, 246, 245, 0.46)),
    linear-gradient(145deg, #f8f3e7, #e8f1ee 62%, #edf3f7);
}

.site-page-hero.with-image img {
  position: absolute;
  right: clamp(20px, 8vw, 110px);
  bottom: -62px;
  width: min(30vw, 320px);
  pointer-events: none;
}

.site-page-hero.with-image.reverse img {
  right: auto;
  left: clamp(20px, 7vw, 96px);
}

.site-page-hero.with-image.reverse > div {
  justify-self: end;
  width: min(680px, 100%);
}

.site-feature-story {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 5vw, 54px);
}

.site-feature-story > img {
  width: 100%;
  max-width: 290px;
  justify-self: center;
}

.site-story-grid,
.site-detail-grid,
.site-list-showcase {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.site-story-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
}

.site-list-showcase article {
  overflow: hidden;
}

.site-list-showcase img {
  width: 100%;
  max-height: 150px;
  object-fit: contain;
  justify-self: center;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 28px clamp(18px, 5vw, 64px);
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 84%, var(--bg));
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

@media (max-width: 980px) {
  .site-card-grid,
  .site-story-grid,
  .site-detail-grid,
  .site-list-showcase {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-screenshot-band,
  .site-feature-story {
    grid-template-columns: 1fr;
  }

  .site-phone-stack {
    max-width: 720px;
  }
}

@media (max-width: 760px) {
  .site-header {
    min-height: 68px;
    padding: 12px 16px;
  }

  .site-brand small {
    display: none;
  }

  .site-menu-button {
    display: inline-flex;
  }

  .site-nav {
    position: fixed;
    top: 68px;
    right: 12px;
    left: 12px;
    display: none;
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: color-mix(in srgb, var(--bg-elevated) 96%, var(--calendar-paper));
    box-shadow: var(--shadow-lg);
  }

  body.site-nav-open .site-nav {
    display: grid;
  }

  .site-nav a {
    justify-content: center;
  }

  .site-hero {
    min-height: auto;
    padding: 42px 18px 330px;
    background:
      linear-gradient(180deg, rgba(244, 246, 245, 0.99) 0%, rgba(244, 246, 245, 0.9) 52%, rgba(244, 246, 245, 0.08) 100%),
      url("assets/onboarding/today.png") center bottom 24px / min(82vw, 320px) auto no-repeat,
      linear-gradient(145deg, #f8f3e7, #e8f1ee 58%, #f7eee2);
  }

  .site-hero-copy,
  .site-hero p,
  .site-page-hero p {
    width: 100%;
    max-width: none;
  }

  .site-hero h1 {
    font-size: clamp(3rem, 15vw, 4rem);
  }

  .site-proof-strip,
  .site-card-grid,
  .site-story-grid,
  .site-detail-grid,
  .site-list-showcase,
  .site-feature-band,
  .site-legal-band,
  .site-feature-story,
  .site-screenshot-band {
    width: min(100% - 28px, 560px);
  }

  .site-proof-strip,
  .site-card-grid,
  .site-story-grid,
  .site-detail-grid,
  .site-list-showcase {
    grid-template-columns: 1fr;
  }

  .site-screenshot-band {
    padding-top: 10px;
  }

  .site-phone-stack {
    grid-template-columns: 1fr 1fr;
  }

  .site-phone-stack img:nth-child(3) {
    display: none;
  }

  .site-page-hero {
    min-height: auto;
    padding: 46px 18px;
  }

  .site-page-hero.with-image {
    padding-bottom: 310px;
  }

  .site-page-hero.with-image img,
  .site-page-hero.with-image.reverse img {
    right: 50%;
    left: auto;
    bottom: -34px;
    width: min(78vw, 290px);
    transform: translateX(50%);
  }

  .site-page-hero.with-image.reverse > div {
    justify-self: start;
  }

  .store-button-row,
  .site-hero-actions,
  .site-doc-links {
    flex-direction: column;
    align-items: stretch;
  }

  .store-button,
  .site-hero-actions .primary-button,
  .site-hero-actions .ghost-button,
  .site-doc-links a {
    width: 100%;
    justify-content: center;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-footer nav {
    justify-content: flex-start;
  }
}

@media (max-width: 380px) {
  .site-header .wordmark {
    font-size: 0.92rem;
  }

  .site-hero {
    padding-bottom: 300px;
  }

  .site-hero h1 {
    font-size: 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .store-button:hover,
  .site-feature-card:hover,
  .site-phone-stack img {
    transform: none;
  }
}

/* ── Legal documents ────────────────────────────────────────── */
body.legal-page {
  min-height: 100vh;
  padding: 0;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 6%, var(--bg)) 0%, var(--bg) 28rem),
    var(--bg);
}

.legal-header,
.legal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(18px, 5vw, 64px);
}

.legal-header {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, white);
}

.legal-header .brand {
  margin: 0;
  padding: 0;
}

.legal-header nav,
.legal-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.legal-header a:not(.brand),
.legal-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 13px;
  color: var(--ink-secondary);
  font-size: 0.9rem;
  font-weight: 750;
  text-decoration: none;
}

.legal-header a:not(.brand):hover,
.legal-footer a:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.legal-document {
  width: min(860px, calc(100% - 36px));
  margin: 34px auto 48px;
  display: grid;
  gap: 20px;
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg-elevated) 95%, var(--calendar-paper));
  box-shadow: var(--shadow-sm);
}

.legal-document h1,
.legal-document h2 {
  margin: 0;
  color: var(--ink);
  letter-spacing: 0;
}

.legal-document h1 {
  font-size: clamp(2.3rem, 7vw, 4rem);
  line-height: 1;
}

.legal-document h2 {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
}

.legal-document p {
  margin: 0;
  color: var(--ink-secondary);
  line-height: 1.7;
}

.legal-document li {
  color: var(--ink-secondary);
  line-height: 1.65;
}

.legal-footer {
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 84%, var(--bg));
}

@media (max-width: 720px) {
  .legal-header,
  .legal-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .legal-header nav,
  .legal-footer nav {
    justify-content: flex-start;
  }
}

/* ── Responsive web app corrections ─────────────────────────── */
@media (min-width: 861px) {
  body.is-app-screen {
    display: block;
    min-height: 100vh;
    padding: 0;
  }

  body.is-app-screen .app-shell {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    grid-template-columns: 280px minmax(0, 1fr);
    overflow: visible;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body.is-app-screen .sidebar {
    position: sticky;
    inset: auto;
    top: 0;
    z-index: 40;
    display: flex !important;
    width: auto;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    padding: 22px 18px;
    border-right: 1px solid var(--border);
    border-radius: 0;
    background: color-mix(in srgb, var(--sidebar-bg) 92%, var(--bg-soft));
    box-shadow: none;
    transform: none;
  }

  body.is-app-screen .sidebar-overlay,
  body.is-app-screen .menu-button,
  body.is-app-screen .bottom-nav,
  body.is-app-screen .fab-button {
    display: none !important;
  }

  body.is-app-screen .main-content {
    width: 100%;
    max-width: 1220px;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 22px 24px 72px;
    overflow: visible;
    background: transparent;
  }

  body.is-app-screen .topbar {
    position: static !important;
    min-height: auto;
    padding: 4px 0 8px !important;
    border: 0 !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  body.is-app-screen .topbar-info {
    display: grid;
  }

  body.is-app-screen .topbar-brand {
    flex: 0 1 auto;
  }

  body.is-app-screen .section-heading .eyebrow,
  body.is-app-screen #calendar .section-heading > div:first-child {
    display: block;
  }

  body.is-app-screen #today .section-heading [data-open-event] {
    display: inline-flex;
  }
}

@media (max-width: 720px) {
  body.is-app-screen .main-content {
    padding-bottom: calc(148px + env(safe-area-inset-bottom)) !important;
  }

  #shopping-form,
  #chore-form,
  #meal-form {
    scroll-margin-bottom: calc(156px + env(safe-area-inset-bottom));
  }
}

.site-main {
  padding-bottom: clamp(56px, 8vw, 96px);
}

.site-footer {
  padding-bottom: calc(34px + env(safe-area-inset-bottom));
}

.legal-document {
  margin-bottom: clamp(64px, 8vw, 96px);
}

.calendar-search-row input.has-active-filters {
  border-color: color-mix(in srgb, var(--warning) 68%, var(--accent));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent),
    color-mix(in srgb, var(--warning) 10%, var(--bg-elevated));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning) 18%, transparent);
}

.calendar-filter-status {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: -2px 0 10px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--warning) 34%, var(--border));
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent),
    color-mix(in srgb, var(--warning) 12%, var(--bg-elevated));
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.calendar-filter-status[hidden] {
  display: none;
}

.calendar-filter-status strong,
.calendar-filter-status em {
  display: inline-flex;
  align-items: center;
}

.calendar-filter-status strong {
  margin-right: 7px;
  font-size: 0.82rem;
}

.calendar-filter-status span {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.calendar-filter-status em {
  min-height: 24px;
  padding: 0 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 253, 247, 0.76);
  color: var(--ink-secondary);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
}

.calendar-filter-status .ghost-button {
  min-height: 34px;
  padding: 0 12px;
  white-space: nowrap;
}

.week-calendar.has-span-events,
.month-calendar.has-span-events {
  position: relative;
}

.calendar-span-event {
  grid-column: var(--span-column-start) / var(--span-column-end);
  grid-row: var(--span-row);
  z-index: 4;
  display: flex;
  align-items: center;
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--member-color, var(--accent)) 38%, var(--border));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent),
    color-mix(in srgb, var(--member-color, var(--accent)) 22%, var(--calendar-paper));
  color: var(--ink);
  text-align: left;
  box-shadow: 0 3px 8px rgba(43, 51, 43, 0.08);
}

.calendar-span-event strong,
.calendar-span-event span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-span-event strong {
  font-weight: 850;
}

.calendar-span-event span {
  color: var(--ink-secondary);
}

.week-span-spacer {
  height: calc(var(--week-span-lanes, 0) * 27px);
  min-height: 0;
}

.week-span-event {
  min-height: 24px;
  margin: calc(50px + (var(--span-lane) * 27px)) 6px 0;
  padding: 3px 9px;
  border-left: 4px solid var(--member-color, var(--accent));
  border-radius: 11px;
  gap: 7px;
}

.week-span-event strong {
  font-size: 0.76rem;
}

.week-span-event span {
  font-size: 0.68rem;
}

.month-calendar.has-span-events .month-cell {
  padding-bottom: calc(7px + min(var(--month-span-lanes, 0), 2) * 17px);
}

.month-cell.has-events .month-cell-title span:first-child {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  margin: 0 auto;
  border-radius: var(--radius-full);
  background: #e4eee2;
}

.month-span-event {
  align-self: end;
  min-height: 17px;
  height: 17px;
  margin: 0 2px calc(4px + (var(--span-lane) * 19px));
  padding: 0 7px;
  border: 0;
  border-left: 4px solid var(--member-color, var(--accent));
  border-radius: 7px;
}

.month-span-event.continues-before {
  border-top-left-radius: 2px;
  border-bottom-left-radius: 2px;
}

.month-span-event.continues-after {
  border-top-right-radius: 2px;
  border-bottom-right-radius: 2px;
}

.month-span-event strong {
  font-size: 0.56rem;
  line-height: 1;
}

.month-span-event span {
  display: none;
}

@media (max-width: 720px) {
  .calendar-filter-status {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .calendar-filter-status .ghost-button {
    width: 100%;
  }

  .week-span-event {
    margin-inline: 3px;
  }
}

/* Calendar screenshot polish: compact month should read like the reference board. */
.month-cell:has(.month-event) .month-cell-title span:first-child,
.month-cell.has-events .month-cell-title span:first-child,
html[data-theme] .month-cell:has(.month-event) .month-cell-title span:first-child {
  display: inline;
  width: auto;
  height: auto;
  margin: 0;
  border-radius: 0;
  background: transparent;
}

.month-cell.is-selected .month-cell-title span:first-child,
html[data-theme] .month-cell.is-selected .month-cell-title span:first-child {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  margin: 0 auto;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 800;
}

.month-cell.is-today:not(.is-selected) .month-cell-title span:first-child {
  color: var(--accent-strong);
  font-weight: 850;
}

.month-calendar.is-compact .month-cell {
  min-height: 46px !important;
  padding: 4px 3px calc(10px + min(var(--month-span-lanes, 0), 2) * 8px);
}

.month-calendar.is-compact .month-event {
  display: inline-block;
  width: 6px;
  max-width: 6px;
  min-height: 6px;
  height: 6px;
  padding: 0;
  margin: 3px 1px 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--member-color, var(--accent));
  box-shadow: none;
  vertical-align: top;
}

.month-calendar.is-compact .month-event span,
.month-calendar.is-compact .month-event strong,
.month-calendar.is-compact .more-events {
  display: none !important;
}

.month-calendar.is-compact .month-span-event {
  align-self: end;
  min-height: 6px;
  height: 6px;
  margin: 0 2px calc(5px + (var(--span-lane) * 8px));
  padding: 0;
  border: 0;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--member-color, var(--accent)) 42%, var(--calendar-paper));
  box-shadow: none;
}

.month-calendar.is-compact .month-span-event strong,
.month-calendar.is-compact .month-span-event span {
  display: none !important;
}

.month-calendar.is-detail .month-cell {
  min-height: 82px !important;
}

.month-calendar.is-detail .month-span-event {
  height: 18px;
}

.month-agenda {
  grid-column: 1 / -1;
  grid-row: var(--month-agenda-row);
  display: grid;
  gap: 0;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 253, 247, 0.82);
  box-shadow: var(--shadow-sm);
  text-align: left;
}

.month-agenda-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}

.month-agenda-header strong {
  font-size: 0.84rem;
  font-weight: 850;
}

.month-agenda-header span {
  color: var(--ink-secondary);
  font-size: 0.72rem;
  font-weight: 800;
}

.month-agenda-list {
  display: grid;
  gap: 0;
}

.month-agenda-row {
  display: grid;
  grid-template-columns: 44px 10px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.month-agenda-row:last-child {
  border-bottom: 0;
}

.month-agenda-row time {
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 850;
}

.month-agenda-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--member-color, var(--accent));
}

.month-agenda-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.month-agenda-copy strong,
.month-agenda-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-agenda-copy strong {
  font-size: 0.84rem;
  font-weight: 850;
}

.month-agenda-copy small {
  color: var(--ink-secondary);
  font-size: 0.72rem;
}

.month-agenda .empty-state {
  margin: 10px;
  text-align: center;
}

@media (max-width: 720px) {
  body.is-app-screen[data-view="calendar"] .main-content {
    padding-top: max(34px, calc(22px + env(safe-area-inset-top))) !important;
  }
}
