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

:root {
  --line: rgba(68, 102, 164, 0.2);
  --line-strong: rgba(255, 171, 53, 0.38);
  --text: #23314d;
  --muted: #596a89;
  --gold: #ffab35;
  --mint: #21c7a8;
  --coral: #ff7f61;
  --berry: #d85ad2;
  --sky: #57b9ff;
  --sun: #ffd54f;
  --leaf: #67ce67;
  --cream: #fff6dc;
  --paper: #fff9ef;
  --shadow: 0 24px 60px rgba(67, 81, 147, 0.18);
  --nav-h: 52px;
}

html {
  font-size: 15px;
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 181, 73, 0.72) rgba(241, 233, 216, 0.95);
}
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: rgba(241, 233, 216, 0.95); }
::-webkit-scrollbar-thumb { background: rgba(245, 181, 73, 0.72); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(245, 181, 73, 0.95); }

body {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, #9fe2ff 0%, #b9e8ff 28%, #ffe89d 29%, #ffe89d 57%, #9ee17c 58%, #89d66b 100%);
  background-attachment: fixed;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.95;
  background-image: url("../background-scene.svg");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 14%, rgba(255, 255, 255, 0.45), transparent 12%),
    radial-gradient(circle at 84% 16%, rgba(255, 255, 255, 0.32), transparent 10%),
    repeating-linear-gradient(12deg, rgba(255,255,255,0.08) 0 2px, transparent 2px 16px),
    repeating-linear-gradient(-9deg, rgba(255,255,255,0.05) 0 2px, transparent 2px 22px);
  background-size: auto, auto, auto, auto;
  background-position: center top, center top, center top, center top;
  background-repeat: no-repeat, no-repeat, repeat, repeat;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: none; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }

input, select, textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(68, 102, 164, 0.16);
  background: rgba(255, 253, 247, 0.98);
  color: var(--text);
  padding: 0.52rem 0.65rem;
  outline: none;
}
textarea { resize: vertical; min-height: 88px; }
input:focus, select:focus, textarea:focus {
  border-color: rgba(72, 191, 174, 0.6);
  box-shadow: 0 0 0 3px rgba(72, 191, 174, 0.16);
}
input.editor-field-invalid,
select.editor-field-invalid,
textarea.editor-field-invalid,
.child-multi-picker.editor-field-invalid {
  border-color: #cf3f5b;
  box-shadow: 0 0 0 3px rgba(207, 63, 91, 0.16);
}
.post-photo-field.editor-field-invalid {
  border-radius: 12px;
  outline: 2px solid #cf3f5b;
  outline-offset: 4px;
}
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2.6rem;
  background-image:
    linear-gradient(135deg, transparent 50%, #ff9d2f 50%),
    linear-gradient(45deg, #ff9d2f 50%, transparent 50%),
    linear-gradient(180deg, rgba(255, 244, 219, 0.92), rgba(255, 232, 195, 0.92));
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px),
    0 0;
  background-size: 6px 6px, 6px 6px, 100% 100%;
  background-repeat: no-repeat;
}
input[type="date"] {
  color-scheme: light;
}
input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.85;
  filter: sepia(1) saturate(4) hue-rotate(332deg) brightness(1.02);
}

/* ── Navigation bar ── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--nav-h);
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  background:
    linear-gradient(135deg, rgba(255, 244, 196, 0.5), rgba(255, 224, 190, 0.42) 42%, rgba(255, 241, 213, 0.26));
  box-shadow: 0 10px 24px rgba(68, 102, 164, 0.08);
}
.nav-inner {
  width: min(1100px, calc(100vw - 32px));
  min-height: var(--nav-h);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.2rem 0;
}
.nav-brand { display: flex; flex: 1 1 auto; min-width: 0; flex-direction: column; line-height: 1; gap: 0.15rem; }
.nav-eyebrow {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #7a5a28;
  font-weight: 800;
}
.nav-title {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #21324f;
}
.nav-subtitle { font-size: 0.68rem; color: var(--muted); font-style: italic; letter-spacing: 0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-actions {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
  align-items: center;
  align-content: center;
  align-self: center;
  min-height: 100%;
}
.nav-actions > button {
  height: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(68, 102, 164, 0.16);
  box-shadow: 0 10px 20px rgba(68, 102, 164, 0.1);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
  padding: 0 0.72rem;
  line-height: 1;
}
.nav-actions > button:hover {
  transform: translateY(-1px);
  border-color: rgba(68, 102, 164, 0.26);
  box-shadow: 0 14px 24px rgba(68, 102, 164, 0.14);
}
#nav-add-btn,
#nav-login-btn {
  background: linear-gradient(135deg, rgba(255, 176, 63, 0.96), rgba(255, 133, 104, 0.95));
  color: #6b2f06;
  border-color: rgba(255, 146, 80, 0.28);
}
#nav-viewer {
  background: linear-gradient(135deg, rgba(255, 251, 241, 0.96), rgba(245, 238, 218, 0.94));
  color: #27405d;
  border-color: rgba(68, 102, 164, 0.18);
}
#nav-logout-btn {
  background: linear-gradient(135deg, rgba(255, 229, 221, 0.98), rgba(255, 201, 190, 0.96));
  color: #8f382f;
  border-color: rgba(201, 76, 63, 0.28);
}
#nav-logout-btn:hover {
  background: linear-gradient(135deg, rgba(255, 216, 207, 0.99), rgba(255, 185, 173, 0.98));
  border-color: rgba(201, 76, 63, 0.42);
}

/* Nav profile button */
.nav-profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  padding: 0 0.75rem 0 0.26rem;
  font-size: inherit;
}
.nav-profile-btn.has-attention {
  border-color: rgba(255, 171, 53, 0.5);
  background: linear-gradient(135deg, rgba(255, 244, 216, 0.98), rgba(255, 228, 192, 0.96));
  box-shadow: 0 0 0 3px rgba(255, 171, 53, 0.14), 0 14px 24px rgba(255, 171, 53, 0.12);
}
.nav-avatar-wrap {
  width: 26px; height: 26px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(72, 191, 174, 0.5), rgba(87, 185, 255, 0.5));
  font-size: 0.7rem; font-weight: 800; color: #1d6a61;
}
.nav-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nav-attention-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffab35, #ff7f61);
  color: #6b2f06;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 10px 18px rgba(255, 127, 97, 0.22);
}

/* ── Page layout ── */
.page-layout {
  width: min(1100px, calc(100vw - 32px));
  margin: 12px auto 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  align-items: start;
}
.app-footer {
  width: min(1100px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 0 0 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  color: #34415c;
  font: 400 11px/1.4 ui-monospace, monospace;
  pointer-events: none;
  user-select: none;
}
.app-footer-content {
  grid-column: 1;
  text-align: center;
}
.app-footer-brand {
  color: #873800;
  font-weight: 700;
}
.feed-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feed-toolbar {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.feed-toolbar input { flex: 1; min-width: 200px; }
.feed-toolbar input[type="text"] { flex: 0 0 auto; width: 180px; min-width: 0; }
.feed-toolbar select { width: 180px; }
.feed-kicker-row { padding: 0 0.25rem; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
#mobile-family-settings,
.mobile-sidebar-head { display: none; }
#mobile-family-settings { width: 36px; padding: 0 !important; color: #27405d; }
.mobile-family-settings-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#feed-sidebar,
#guest-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: calc(var(--nav-h) + 12px);
}
.sidebar-meta { font-size: 0.82rem; color: var(--muted); margin-bottom: 0.55rem; line-height: 1.4; }

/* ── Panels ── */
.panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 0.72rem;
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.9), rgba(255, 245, 225, 0.9));
  box-shadow: var(--shadow), inset 0 0 0 4px rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(10px);
}
.sidebar-stats-panel { background: linear-gradient(180deg, rgba(229, 247, 255, 0.92), rgba(206, 238, 255, 0.9)); }
.guest-promo-panel {
  display: flex;
  flex-direction: column;
  gap: 0.58rem;
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.94), rgba(244, 252, 232, 0.9));
}
.promo-card {
  display: grid;
  gap: 0.2rem;
  padding: 0.58rem 0.66rem;
  border: 1px solid rgba(68, 102, 164, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.2);
}
.promo-card.accent-orange,
.promo-card.accent-cyan,
.promo-card.accent-green,
.promo-card.accent-slate { border-left-width: 4px; }
.promo-card strong { font-size: 0.92rem; }
.promo-card p { margin: 0; color: var(--muted); font-size: 0.84rem; line-height: 1.38; }
.guest-promo-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.12rem;
}

.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.65rem; margin-bottom: 0.55rem; }
.panel-head h2 { font-size: 1rem; }
.dialog-heading { display: flex; align-items: baseline; gap: 0.5rem; min-width: 0; }
.panel-kicker, .strip-label, .meta-line { color: var(--muted); font-size: 0.82rem; }
.eyebrow {
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: #7a5a28;
  font-weight: 800;
}

/* ── Buttons ── */
.primary-btn, .ghost-btn { border-radius: 10px; padding: 0.52rem 0.72rem; font-weight: 700; }
.primary-btn { background: linear-gradient(135deg, #ffab35, #ff7f61); color: #6b2f06; box-shadow: 0 12px 24px rgba(255, 127, 97, 0.2); }
.ghost-btn { border: 1px solid rgba(68, 102, 164, 0.18); background: rgba(255, 252, 245, 0.92); color: var(--text); }
.danger-btn { border-color: rgba(255, 127, 97, 0.38); color: #9c4135; }
.small-btn { padding: 0.4rem 0.58rem; font-size: 0.86rem; }
.modal-close-btn {
  flex: 0 0 auto;
  width: 1.95rem;
  height: 1.95rem;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(68, 102, 164, 0.18);
  border-radius: 50%;
  background: rgba(255, 252, 245, 0.94);
  color: var(--text);
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1;
  box-shadow: 0 5px 14px rgba(58, 79, 112, 0.1);
}
.modal-close-btn:hover { background: #fff; border-color: rgba(255, 127, 97, 0.42); color: #9c4135; }
.modal-close-btn:focus-visible { outline: 3px solid rgba(72, 191, 174, 0.25); outline-offset: 2px; }
.inline-error { min-height: 0; margin-top: 0.18rem; color: #c44b63; font-size: 0.86rem; }
.inline-error:empty { display: none; }
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 300;
  transform: translateX(-50%) translateY(4px);
  width: max-content;
  max-width: min(220px, calc(100vw - 32px));
  padding: 0.42rem 0.62rem;
  border-radius: 12px;
  border: 1px solid rgba(68, 102, 164, 0.16);
  background: linear-gradient(180deg, rgba(255, 249, 237, 0.98), rgba(255, 228, 201, 0.98));
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 18px 36px rgba(58, 79, 112, 0.18);
  transition: opacity 160ms ease, transform 160ms ease;
}
[data-tooltip]::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  z-index: 301;
  width: 10px;
  height: 10px;
  background: rgba(255, 239, 219, 0.98);
  border-right: 1px solid rgba(68, 102, 164, 0.14);
  border-bottom: 1px solid rgba(68, 102, 164, 0.14);
  transform: translateX(-50%) rotate(45deg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
[data-tooltip]:hover::before,
[data-tooltip]:focus-visible::before {
  opacity: 1;
}
.actions-row, .auth-actions, .toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

/* ── Stats ── */
.stats-grid { display: grid; gap: 0.42rem; }
.stats-grid-three { grid-template-columns: 1fr; }
.stat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.58rem 0.72rem;
  border-radius: 14px;
  border: 1px solid rgba(68, 102, 164, 0.12);
  background: rgba(255, 252, 246, 0.98);
}
.stat-card-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.stat-card strong { font-size: 1.6rem; font-weight: 800; line-height: 1; white-space: nowrap; flex-shrink: 0; }
.stat-card small { font-size: 0.72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-label { font-size: 0.74rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.accent-orange { border-left: 3px solid rgba(255, 171, 53, 0.7); }
.accent-orange strong { color: #c47800; }
.accent-cyan { border-left: 3px solid rgba(87, 185, 255, 0.7); }
.accent-cyan strong { color: #1a6fa8; }
.accent-green { border-left: 3px solid rgba(103, 206, 103, 0.7); }
.accent-green strong { color: #2a7a3a; }
.accent-slate { border-left: 3px solid rgba(216, 90, 210, 0.5); }
.accent-slate strong { color: #7a2a80; }
.summary-strips { display: grid; gap: 0.6rem; margin-top: 0.6rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.3rem; }

/* ── Chips & tags ── */
.viewer-chip, .status-pill, .data-chip, .tag-chip { border-radius: 999px; padding: 0.3rem 0.55rem; }
.viewer-chip { border: 1px solid rgba(72, 191, 174, 0.22); background: rgba(72, 191, 174, 0.12); color: #1d6a61; font-weight: 700; }
.data-chip, .tag-chip { border: 1px solid rgba(68, 102, 164, 0.14); background: rgba(255, 252, 246, 0.98); color: var(--text); font-size: 0.82rem; }
.tag-chip.favorite-chip { border-color: rgba(255, 171, 53, 0.34); background: rgba(255, 236, 182, 0.98); color: #8b5805; }
.tag-chip.public-chip { border-color: rgba(87, 185, 255, 0.34); background: rgba(200, 232, 255, 0.98); color: #1a5280; }
.tag-chip.mood-golden { border-color: rgba(255, 193, 7, 0.4); background: rgba(255, 248, 200, 0.98); color: #7a5800; }
.tag-chip.mood-chaotic { border-color: rgba(255, 80, 80, 0.3); background: rgba(255, 220, 220, 0.98); color: #8b1a1a; }
.tag-chip.mood-sweet { border-color: rgba(255, 150, 200, 0.3); background: rgba(255, 230, 245, 0.98); color: #8b3060; }
.tag-chip.mood-legendary { border-color: rgba(130, 90, 200, 0.3); background: rgba(220, 210, 255, 0.98); color: #4a2080; }
.tag-chip.mood-hilarious { border-color: rgba(255, 180, 0, 0.3); background: rgba(255, 245, 180, 0.98); color: #7a5000; }
.tag-chip.mood-heartwarming { border-color: rgba(255, 120, 160, 0.3); background: rgba(255, 225, 235, 0.98); color: #8b2040; }
.tag-chip.mood-facepalm { border-color: rgba(150, 150, 150, 0.3); background: rgba(230, 230, 230, 0.98); color: #444; }
.tag-chip.mood-proud { border-color: rgba(80, 160, 80, 0.3); background: rgba(210, 240, 210, 0.98); color: #1a5a1a; }
.tag-chip.mood-custom { border-color: rgba(100,100,100,0.2); background: rgba(230,230,230,0.98); color: #555; }
.badge { padding: 0.28rem 0.5rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; background: rgba(100,100,100,0.12); color: #555; }
.badge.said { background: rgba(33, 199, 168, 0.18); color: #157465; }
.badge.did { background: rgba(255, 127, 97, 0.18); color: #9a4539; }
.badge.mixed { background: rgba(216, 90, 210, 0.18); color: #8b3f83; }
.badge.milestone { background: rgba(255, 193, 7, 0.22); color: #7a5800; }
.badge.oops { background: rgba(255, 80, 80, 0.18); color: #8b1a1a; }
.badge.wisdom { background: rgba(80, 130, 230, 0.18); color: #1a3f8b; }
.badge.art { background: rgba(120, 200, 100, 0.20); color: #2a6a10; }
.badge.bedtime { background: rgba(130, 90, 200, 0.18); color: #4a2080; }
.badge.custom { background: rgba(100,100,100,0.12); color: #555; }

/* ── Feed entries ── */
.stack-list { display: grid; gap: 7px; }
.feed-loading {
  min-height: clamp(190px, 32vh, 310px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.86rem;
  letter-spacing: 0.02em;
}
.feed-loading-sun {
  width: 64px;
  height: 64px;
  overflow: visible;
  filter: drop-shadow(0 7px 12px rgba(130, 82, 8, 0.2));
}
.feed-loading-spoke {
  opacity: 0;
  animation: feed-sun-spokes 2.4s ease-in-out infinite;
}
.feed-loading-spoke-2 { animation-delay: -0.6s; }
.feed-loading-spoke-3 { animation-delay: -1.2s; }
.feed-loading-spoke-4 { animation-delay: -1.8s; }
@keyframes feed-sun-spokes {
  0%, 16%, 68%, 100% { opacity: 0; }
  27%, 56% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .feed-loading-spoke {
    opacity: 1;
    animation: none;
  }
}
.list-item, .empty-state { border-radius: 20px; border: 1px solid rgba(68, 102, 164, 0.12); background: rgba(255, 252, 246, 0.95); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.2); }
.entry-content {
  margin-top: 0.45rem;
  font-family: Georgia, 'Palatino Linotype', serif;
  font-size: 1rem;
  line-height: 1.6;
  color: #5f4d3e;
  text-align: justify;
  text-justify: inter-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  white-space: pre-wrap;
}
.entry-photo {
  display: block;
  width: 100%;
  max-height: 520px;
  margin-top: 0.55rem;
  border-radius: 14px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(68, 102, 164, 0.12);
}
.list-item { padding: 0.68rem 0.75rem; }
.list-item-head { display: flex; justify-content: space-between; gap: 0.8rem; align-items: start; }
.list-item-title { font-size: 1rem; font-weight: 700; line-height: 1.4; }
.public-entry-link { display: inline-block; color: inherit; text-decoration: none; }
.public-entry-link:hover { color: #1a7f73; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.18em; }
.inline-emoticon { display: inline-block; width: 1.45em; height: 1.45em; margin: 0 0.06em; vertical-align: -0.38em; }
.list-item-title .inline-emoticon { width: 1.35em; height: 1.35em; vertical-align: -0.34em; }
.entry-meta { display: flex; flex-wrap: wrap; gap: 0.32rem; margin-top: 0.45rem; }
.entry-actions { margin-top: 0.55rem; display: flex; gap: 0.45rem; justify-content: flex-end; }
.secondary-link { background: rgba(68,102,164,0.08); color: #1a7f73; padding: 0.3rem 0.85rem; border-radius: 99px; font-size: 0.8rem; font-weight: 600; border: 1px solid rgba(68,102,164,0.15); }
.secondary-link:hover { background: rgba(68,102,164,0.15); }
.post-detail-dialog {
  width: min(760px, calc(100vw - 32px));
  height: fit-content;
  max-height: min(92vh, 980px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(68, 102, 164, 0.16);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 249, 237, 0.99), rgba(255, 235, 211, 0.99));
  color: var(--text);
  box-shadow: 0 32px 90px rgba(58, 79, 112, 0.28), inset 0 0 0 4px rgba(255, 255, 255, 0.24);
}
.post-detail-dialog[data-server-rendered][open] {
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  z-index: 4000;
  box-shadow: 0 0 0 100vmax rgba(68, 83, 108, 0.72), 0 32px 90px rgba(58, 79, 112, 0.28);
}
body:has(.post-detail-dialog[data-server-rendered][open]) { overflow: hidden; }
.post-detail-dialog::backdrop {
  background: rgba(68, 83, 108, 0.42);
  backdrop-filter: blur(10px);
}
.post-detail-header,
.post-detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
}
.post-detail-header { border-bottom: 1px solid rgba(68, 102, 164, 0.12); }
.post-detail-header .eyebrow { margin: 0; }
.post-detail-body { padding: 0.8rem; overflow-y: auto; max-height: calc(92vh - 128px); }
.post-detail-body .list-item { box-shadow: none; }
.post-detail-body .entry-photo { max-height: 68vh; }
.post-detail-footer { border-top: 1px solid rgba(68, 102, 164, 0.12); }
.post-detail-footer:has(#post-detail-share[hidden]):has(.post-detail-share-status:empty) { display: none; }
.post-detail-share-status { color: var(--muted); font-size: 0.82rem; }
body.post-detail-open { overflow: hidden; }
.empty-state { padding: 0.72rem; color: var(--muted); line-height: 1.5; }
.invite-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 171, 53, 0.32);
  background: linear-gradient(180deg, rgba(255, 248, 223, 0.96), rgba(255, 232, 197, 0.96));
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.22);
  color: inherit;
  text-align: left;
}
.invite-alert:hover {
  border-color: rgba(255, 171, 53, 0.48);
  background: linear-gradient(180deg, rgba(255, 245, 214, 0.98), rgba(255, 226, 186, 0.98));
}
.invite-alert-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.24rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 171, 53, 0.2);
  color: #8b5805;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}
.invite-alert-copy {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}
.invite-alert-copy strong {
  font-size: 0.95rem;
  line-height: 1.4;
}
.invite-alert-copy small {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* ── Auth card (used inside auth modal) ── */
.auth-card {
  position: relative;
  width: min(460px, calc(100vw - 32px));
  border-radius: 28px;
  padding: 0.9rem;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 251, 240, 0.96), rgba(255, 236, 205, 0.96));
  box-shadow: var(--shadow), inset 0 0 0 4px rgba(255,255,255,0.24);
}
.auth-card > .modal-close-btn { position: absolute; top: 0.55rem; right: 0.55rem; }
.auth-card > .eyebrow { padding-right: 2.8rem; }
.auth-card h1 { font-size: clamp(1.3rem, 2vw, 1.8rem); letter-spacing: -0.03em; }
.auth-copy { margin-top: 0.4rem; color: var(--muted); line-height: 1.45; font-size: 0.9rem; }
.auth-form { display: grid; gap: 0.55rem; margin-top: 0.65rem; }
.auth-form[hidden], .auth-field[hidden], .auth-mode-tabs[hidden] { display: none !important; }
.auth-mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; margin-top: 0.7rem; }
.auth-mode-tabs .is-active { background: rgba(255, 171, 53, 0.2); border-color: rgba(255, 127, 97, 0.42); }
.auth-field { display: grid; gap: 0.25rem; color: var(--muted); font-size: 0.75rem; font-weight: 700; }
.auth-link-btn {
  border: 0;
  padding: 0.45rem 0.2rem;
  background: transparent;
  color: #376d84;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.auth-link-btn:hover { color: #c65f42; }
.inline-success { min-height: 1em; color: #26705f; font-size: 0.82rem; font-weight: 700; line-height: 1.4; }

/* ── Editor form ── */
.editor-intro {
  margin: -0.05rem 0 0.6rem;
  color: var(--muted);
  line-height: 1.45;
}
.config-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.config-grid label, .config-grid .field-group { display: flex; flex-direction: column; gap: 0.28rem; }
.config-grid label span, .config-grid .field-group > span { font-size: 0.82rem; color: var(--muted); }
.config-grid .wide { grid-column: 1 / -1; }
.child-picker-stack {
  display: grid;
  gap: 0.38rem;
}
.child-multi-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
  min-height: 38px;
  padding: 0.38rem;
  border: 1px solid rgba(68, 102, 164, 0.16);
  border-radius: 12px;
  background: rgba(255, 253, 247, 0.98);
}
.child-choice {
  position: relative;
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.34rem !important;
  padding: 0.34rem 0.56rem;
  border: 1px solid rgba(68, 102, 164, 0.16);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}
.child-choice input {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}
.child-choice span { color: var(--text) !important; }
.child-picker-empty {
  align-self: center;
  padding: 0.12rem 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
}
.field-hint {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}
.editor-inline-tools {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}
.text-format-toolbar {
  display: flex;
  gap: 0.28rem;
  flex: 0 0 auto;
}
.text-format-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(68, 102, 164, 0.16);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.92);
  color: #4f4660;
  font-family: Georgia, serif;
  font-size: 0.92rem;
}
.text-format-btn:hover { border-color: rgba(72, 191, 174, 0.55); background: #f5fffb; }
.text-format-btn:focus-visible { outline: 3px solid rgba(72, 191, 174, 0.22); outline-offset: 2px; }
.format-bold { font-weight: 800; }
.format-italic { font-style: italic; }
.format-underline { text-decoration: underline; }
.format-strike { text-decoration: line-through; }
.inline-emote-picker {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 0.28rem;
  min-width: 0;
  overflow-x: auto;
  padding: 0.12rem 0.1rem;
  scrollbar-width: none;
}
.inline-emote-picker::-webkit-scrollbar { display: none; }
.inline-emote-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 3px;
  border: 1px solid rgba(68, 102, 164, 0.16);
  border-radius: 10px;
  background: rgba(255, 253, 247, 0.92);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}
.inline-emote-btn svg { width: 27px; height: 27px; }
.inline-emote-btn:hover { transform: translateY(-1px); border-color: rgba(255, 171, 53, 0.5); background: #fffaf0; }
.inline-emote-btn:focus-visible { outline: 3px solid rgba(72, 191, 174, 0.22); outline-offset: 2px; }
.post-photo-field { display: grid; gap: 0.35rem; }
.post-photo-label { font-size: 0.82rem; color: var(--muted); }
.post-photo-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.post-photo-upload { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.post-photo-preview {
  display: block;
  width: min(100%, 460px);
  max-height: 320px;
  border-radius: 14px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(68, 102, 164, 0.14);
}
.post-photo-preview[hidden] { display: none; }
.public-post-brand { color: inherit; text-decoration: none; }
.public-post-main {
  width: min(760px, calc(100vw - 24px));
  margin: 14px auto 32px;
}
.public-post-card { padding: 1rem; }
.public-post-card h1 { font-size: clamp(1.35rem, 3vw, 2rem); }
.public-post-home { text-decoration: none; }
.child-age-preview {
  color: #1d6a61;
  font-weight: 700;
}
.editor-advanced-toggle-row {
  display: flex;
  justify-content: flex-end;
}
.editor-advanced-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.editor-advanced-toggle::before {
  content: '+';
  font-weight: 800;
  line-height: 1;
}
.editor-advanced-toggle[aria-expanded="true"]::before {
  content: '-';
}
.editor-advanced {
  display: grid;
  gap: 0.6rem;
  padding: 0.65rem;
  border: 1px dashed rgba(68, 102, 164, 0.22);
  border-radius: 18px;
  background: rgba(255, 252, 245, 0.72);
}
.editor-advanced-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}
.checkbox-row { flex-direction: row !important; align-items: center; }
.checkbox-card {
  position: relative;
  display: grid !important;
  grid-template-columns: auto 1fr;
  gap: 0.6rem;
  padding: 0.65rem 0.72rem;
  border: 1px solid rgba(68, 102, 164, 0.16);
  border-radius: 16px;
  background: rgba(255, 253, 245, 0.96);
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.checkbox-card:hover { transform: translateY(-1px); border-color: rgba(245, 181, 73, 0.24); }
.checkbox-card input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.check-indicator {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1px solid rgba(75, 112, 156, 0.2);
  background: rgba(255, 255, 255, 0.98);
  margin-top: 0.12rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.check-copy strong { display: block; font-size: 0.94rem; color: var(--text); }
.check-copy small { display: block; margin-top: 0.12rem; font-size: 0.78rem; color: var(--muted); line-height: 1.35; }
.checkbox-card input:checked + .check-indicator {
  border-color: rgba(245, 181, 73, 0.4);
  background: linear-gradient(180deg, rgba(245, 181, 73, 0.96), rgba(239, 127, 109, 0.95));
  box-shadow: 0 0 0 4px rgba(245, 181, 73, 0.14);
}
.checkbox-card input:checked + .check-indicator::after {
  content: '';
  display: block;
  width: 6px;
  height: 11px;
  margin: 3px 0 0 7px;
  border-right: 2px solid #5d3512;
  border-bottom: 2px solid #5d3512;
  transform: rotate(40deg);
}
.checkbox-card input:focus-visible + .check-indicator {
  box-shadow: 0 0 0 4px rgba(72, 191, 174, 0.16);
  border-color: rgba(72, 191, 174, 0.5);
}

/* ── Auth modal overlay ── */
#auth-modal {
  position: fixed;
  inset: 0;
  z-index: 2800;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(89, 109, 138, 0.28);
  backdrop-filter: blur(10px);
}

/* ── Confirm overlay ── */
#confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3000;
  align-items: center;
  justify-content: center;
  background: rgba(89, 109, 138, 0.24);
  backdrop-filter: blur(10px);
}
#confirm-overlay.active { display: flex; }
#confirm-dialog {
  width: min(420px, calc(100vw - 32px));
  border-radius: 24px;
  padding: 0.85rem;
  border: 1px solid rgba(68, 102, 164, 0.16);
  background: linear-gradient(180deg, rgba(255, 249, 237, 0.96), rgba(255, 228, 201, 0.96));
  box-shadow: 0 30px 70px rgba(58, 79, 112, 0.2), inset 0 0 0 4px rgba(255,255,255,0.24);
}
.confirm-eyebrow { margin-bottom: 0.3rem; text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.68rem; color: var(--gold); }
#confirm-title { font-size: 1.25rem; line-height: 1.3; }
#confirm-message { margin-top: 0.4rem; color: var(--muted); line-height: 1.5; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.75rem; }
#confirm-cancel, #confirm-ok { border-radius: 10px; padding: 0.52rem 0.75rem; font-weight: 700; }
#confirm-cancel { border: 1px solid rgba(75, 112, 156, 0.16); background: rgba(255, 249, 241, 0.96); color: var(--text); }
#confirm-ok { background: linear-gradient(135deg, #ff7f61, #ffab35); color: #5d3512; }

/* ── Editor overlay ── */
#editor-overlay {
  display: none;
  position: fixed;
  top: var(--editor-viewport-top, 0px);
  right: 0;
  bottom: auto;
  left: 0;
  height: var(--editor-viewport-height, 100dvh);
  z-index: 2900;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(89, 109, 138, 0.28);
  backdrop-filter: blur(10px);
}
#editor-overlay.active { display: flex; }
#editor-dialog {
  width: min(960px, calc(100vw - 32px));
  max-height: min(90dvh, 1100px);
  overflow: auto;
}
.editor-dialog-head {
  position: sticky;
  top: -0.72rem;
  z-index: 5;
  margin: -0.72rem -0.72rem 0.55rem;
  padding: 0.72rem;
  border-bottom: 1px solid rgba(68, 102, 164, 0.12);
  background: rgba(255, 249, 237, 0.98);
  box-shadow: 0 8px 18px rgba(68, 102, 164, 0.08);
}
body.editor-open, body.profile-open { overflow: hidden; }
.editor-actions { margin-top: 0.65rem; align-items: center; }

/* ── Profile modal ── */
#profile-modal {
  position: fixed;
  inset: 0;
  z-index: 2800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(89, 109, 138, 0.28);
  backdrop-filter: blur(10px);
}
.profile-card {
  width: min(420px, calc(100vw - 32px));
  max-height: min(90vh, 720px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0.58rem !important;
}
.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding-bottom: 0.4rem;
  margin-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}
.avatar-upload-wrap {
  position: relative;
  width: 72px; height: 72px;
  cursor: pointer;
}
.avatar-large {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.avatar-initials-large {
  width: 72px; height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(72, 191, 174, 0.28), rgba(87, 185, 255, 0.28));
  border: 2px solid rgba(72, 191, 174, 0.3);
  font-size: 1.7rem;
  font-weight: 800;
  color: #1d6a61;
  letter-spacing: -0.03em;
}
.avatar-upload-hint {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(245, 181, 73, 0.98), rgba(239, 127, 109, 0.96));
  border: 2px solid rgba(255, 250, 242, 0.96);
  color: #5d3512;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(58, 79, 112, 0.16);
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.avatar-upload-hint:hover,
.avatar-upload-hint:focus-visible {
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 14px 28px rgba(58, 79, 112, 0.2);
}
.avatar-upload-hint::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(4px);
  min-width: max-content;
  max-width: 180px;
  padding: 0.45rem 0.65rem;
  border-radius: 12px;
  border: 1px solid rgba(68, 102, 164, 0.16);
  background: linear-gradient(180deg, rgba(255, 249, 237, 0.98), rgba(255, 228, 201, 0.98));
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 18px 36px rgba(58, 79, 112, 0.18);
  transition: opacity 160ms ease, transform 160ms ease;
}
.avatar-upload-hint::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  width: 10px;
  height: 10px;
  background: rgba(255, 239, 219, 0.98);
  border-right: 1px solid rgba(68, 102, 164, 0.14);
  border-bottom: 1px solid rgba(68, 102, 164, 0.14);
  transform: translateX(-50%) rotate(45deg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
.avatar-upload-wrap:hover .avatar-upload-hint::after,
.avatar-upload-hint:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.avatar-upload-wrap:hover .avatar-upload-hint::before,
.avatar-upload-hint:focus-visible::before {
  opacity: 1;
  transform: translateX(-50%) rotate(45deg);
}
.avatar-upload-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  line-height: 1;
}
#avatar-file-input { display: none; }
.profile-section { display: grid; gap: 0.35rem; padding-bottom: 0.1rem; }
.profile-section .actions-row { margin-top: 0.1rem; }
.profile-attention-section {
  padding: 0.6rem 0.7rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 171, 53, 0.34);
  background: linear-gradient(180deg, rgba(255, 248, 223, 0.98), rgba(255, 232, 197, 0.98));
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.24);
}
.profile-attention-section .profile-section-head {
  color: #8b5805;
}
.profile-attention-section .profile-person-row {
  border-color: rgba(255, 171, 53, 0.22);
  background: rgba(255, 253, 245, 0.96);
}
.profile-section-head {
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 700;
}
.profile-field { display: flex; flex-direction: column; gap: 0.25rem; }
.profile-field > span { font-size: 0.82rem; color: var(--muted); }
.profile-field input[readonly] { background: rgba(240, 235, 225, 0.7); color: var(--muted); cursor: default; }
.profile-divider { height: 1px; background: var(--line); margin: 0.35rem 0; }
.profile-success { color: #2a7a3a !important; }
.profile-subsection { display: grid; gap: 0.3rem; margin-top: 0.12rem; }
.profile-subhead {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}
.profile-list { display: grid; gap: 0.3rem; }
.profile-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}
.profile-person-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.48rem 0.55rem;
  border-radius: 14px;
  border: 1px solid rgba(75, 112, 156, 0.14);
  background: rgba(255, 253, 245, 0.92);
}
.profile-person-meta {
  min-width: 0;
  display: grid;
  gap: 0.2rem;
}
.profile-person-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  font-size: 0.92rem;
}
.profile-person-sub {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
  word-break: break-word;
}
.profile-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.48rem;
  border-radius: 999px;
  background: rgba(72, 191, 174, 0.14);
  color: #1d6a61;
  font-size: 0.7rem;
  font-weight: 700;
}
.profile-row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}
.profile-row-actions .ghost-btn,
.profile-row-actions .primary-btn {
  white-space: nowrap;
}

/* ── Kids panel ── */
.kids-panel { background: linear-gradient(180deg, rgba(236, 255, 237, 0.92), rgba(210, 248, 213, 0.9)); }
.kid-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0;
  border-bottom: 1px solid var(--line);
}
.kid-row:last-child { border-bottom: none; }
.kid-name { flex: 1; font-weight: 700; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kid-dob { font-size: 0.76rem; color: var(--muted); white-space: nowrap; }
.kid-delete-btn {
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0.18rem 0.38rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 120ms, background 120ms;
}
.kid-delete-btn:hover { color: #c44b63; background: rgba(196, 75, 99, 0.09); }
.kid-panel-empty { color: var(--muted); font-size: 0.86rem; padding: 0.3rem 0 0.6rem; }
.kid-add-form { display: flex; gap: 0.35rem; margin-top: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }
.kid-add-form input[type="text"] { flex: 1; min-width: 90px; }
.kid-add-form input[type="date"] { width: 145px; }
.kid-add-form button { margin-left: auto; }

/* ── Responsive ── */
@media (max-width: 860px) {
  .page-layout { grid-template-columns: 1fr; }
  .app-footer { grid-template-columns: 1fr; }
  #guest-sidebar { position: static; }
  #mobile-family-settings { display: inline-flex; }
  .mobile-sidebar-head {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 2;
    align-items: center;
    justify-content: space-between;
    margin: -0.7rem -0.7rem 0;
    padding: 0.7rem;
    border-bottom: 1px solid rgba(68, 102, 164, 0.14);
    background: rgba(246, 251, 239, 0.98);
    box-shadow: 0 8px 18px rgba(68, 102, 164, 0.08);
  }
  #feed-sidebar {
    display: none !important;
    position: fixed;
    inset: 0;
    z-index: 120;
    padding: 0.7rem;
    overflow-y: auto;
    background: rgba(246, 251, 239, 0.98);
  }
  #feed-sidebar.mobile-open { display: flex !important; }
  body.mobile-family-settings-open { overflow: hidden; }
}

@media (max-width: 600px) {
  html { font-size: 14px; }

  /* Nav */
  .site-nav { height: auto; }
  .nav-inner { width: calc(100vw - 20px); min-height: var(--nav-h); padding: 0.35rem 0; align-items: flex-start; gap: 0.5rem; }
  .nav-eyebrow { display: none; }
  .nav-subtitle { display: none; }
  .nav-title { font-size: 1rem; }
  .nav-actions { gap: 0.3rem; max-width: 58%; }
  /* Hide the display-name text in profile chip, show avatar only */
  #nav-viewer-name { display: none; }
  .nav-profile-btn { padding: 0 0.3rem; }

  /* Page */
  .page-layout { width: calc(100vw - 12px); margin-top: 6px; gap: 8px; }
  .app-footer { width: calc(100vw - 12px); }

  /* Feed toolbar */
  .feed-toolbar { flex-direction: column; gap: 0.5rem; }
  .feed-toolbar input, .feed-toolbar select { width: 100%; min-width: 0; }

  /* Entry cards */
  .list-item-head { flex-direction: column; gap: 0.4rem; }
  .entry-actions { flex-wrap: wrap; gap: 0.4rem; }
  .post-detail-dialog {
    width: calc(100vw - 16px);
    height: fit-content;
    max-height: calc(100dvh - 16px);
    border-radius: 18px;
  }
  .post-detail-body { max-height: calc(100dvh - 144px); }
  .post-detail-footer .primary-btn { min-width: 7rem; }
  .invite-alert { flex-direction: column; padding: 0.6rem 0.7rem; }
  .invite-alert-badge { align-self: flex-start; }

  /* Stat cards - tighten a touch */
  .stat-card { align-items: flex-start; padding: 0.5rem 0.65rem; }
  .stat-card strong { font-size: 1.4rem; }
  .stat-card small { white-space: normal; }

  /* Buttons */
  .config-grid { grid-template-columns: 1fr; }
  .editor-advanced-grid { grid-template-columns: 1fr; }
  .auth-actions > button,
  .editor-actions > button,
  .profile-section .actions-row > button,
  .confirm-actions > button {
    width: 100%;
  }
  .profile-person-row { flex-direction: column; }
  .profile-row-actions {
    width: 100%;
    justify-content: stretch;
  }
  .profile-row-actions .ghost-btn,
  .profile-row-actions .primary-btn {
    flex: 1 1 100%;
    width: 100%;
    text-align: center;
  }
  .kid-add-form input[type="date"],
  .kid-add-form button {
    width: 100%;
  }
  .avatar-upload-hint::after {
    min-width: 0;
    max-width: min(180px, calc(100vw - 48px));
    white-space: normal;
  }

  /* Auth card */
  .auth-card { padding: 0.75rem; border-radius: 20px; }

  /* Editor - near full-screen sheet */
  #editor-overlay {
    padding: max(env(safe-area-inset-top), 4px) 0 max(env(safe-area-inset-bottom), 0px);
    align-items: stretch;
  }
  #editor-dialog {
    width: 100vw;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    overflow-y: auto;
  }

  /* Profile modal - full visible viewport */
  #profile-modal {
    inset: auto 0 auto 0;
    top: var(--profile-viewport-top, 0px);
    width: 100vw;
    height: var(--profile-viewport-height, 100dvh);
    padding: max(env(safe-area-inset-top), 4px) 0 max(env(safe-area-inset-bottom), 0px);
    align-items: stretch;
  }
  .profile-card {
    width: 100vw !important;
    height: 100%;
    max-height: 100%;
    border-radius: 0 !important;
  }
  .profile-card > .panel-head {
    position: sticky;
    top: -0.58rem;
    z-index: 2;
    margin: -0.58rem -0.58rem 0.55rem;
    padding: 0.58rem;
    background: rgba(255, 249, 237, 0.98);
    border-bottom: 1px solid rgba(68, 102, 164, 0.12);
    box-shadow: 0 8px 18px rgba(68, 102, 164, 0.08);
  }

  /* Confirm dialog */
  #confirm-dialog { width: calc(100vw - 24px); }
}

@media (max-width: 400px) {
  .nav-inner { width: calc(100vw - 16px); }
  .nav-title { font-size: 0.9rem; }
  .nav-actions { max-width: 62%; }
  .small-btn { padding: 0.42rem 0.55rem; font-size: 0.82rem; }
  .kid-row { flex-wrap: wrap; }
  .kid-name {
    flex-basis: 100%;
    white-space: normal;
  }
  .kid-dob { white-space: normal; }
  /* Stack confirm actions vertically */
  .confirm-actions { flex-direction: column-reverse; }
  #confirm-cancel, #confirm-ok { width: 100%; text-align: center; }
}
