@import url("tokens.css");
@import url("image-fallback.css");
@import url("base.css");
@import url("recently_added_strip.css");
@import url("family-fonts.css");

/* ==========================================================================
   Family portal — Apple-first request app (BAK-46)
   Login page styles preserved at bottom.
   ========================================================================== */

body.family-page {
  --family-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --family-tabbar-h: 64px;
  --family-topbar-h: 56px;
  --family-radius: 16px;
  --family-radius-lg: 22px;
  --family-surface: oklch(16% 0.018 250 / 0.72);
  --family-surface-solid: oklch(17% 0.016 250);
  --family-hairline: oklch(88% 0.02 250 / 0.14);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  font-family: var(--family-font);
  background:
    radial-gradient(120% 80% at 50% -10%, oklch(42% 0.08 230 / 0.28), transparent 55%),
    radial-gradient(90% 60% at 100% 0%, oklch(35% 0.04 200 / 0.18), transparent 45%),
    linear-gradient(180deg, oklch(12% 0.022 250) 0%, oklch(9% 0.016 250) 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  padding: 0;
}

body.family-page.family-login-page {
  padding:
    env(safe-area-inset-top, 0px)
    env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px)
    env(safe-area-inset-left, 0px);
}

body.family-page:not(.family-login-page) {
  padding-bottom: calc(var(--family-tabbar-h) + env(safe-area-inset-bottom, 0px) + 12px);
}

body.family-page.family-settings-open {
  overflow: hidden;
}

/* ----- Top bar ----- */
.family-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: calc(var(--family-topbar-h) + env(safe-area-inset-top, 0px));
  padding:
    calc(8px + env(safe-area-inset-top, 0px))
    max(16px, env(safe-area-inset-right, 0px))
    8px
    max(16px, env(safe-area-inset-left, 0px));
  background: oklch(11% 0.018 250 / 0.82);
  border-bottom: 1px solid var(--family-hairline);
  backdrop-filter: saturate(1.4) blur(18px);
  -webkit-backdrop-filter: saturate(1.4) blur(18px);
}

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

.family-topbar-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex: 0 0 auto;
}

.family-topbar-titles {
  min-width: 0;
}

.family-topbar-kicker {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.family-topbar-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.family-icon-btn {
  appearance: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: var(--muted-strong);
  background: oklch(100% 0 0 / 0.06);
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.family-icon-btn:hover,
.family-icon-btn:focus-visible {
  color: var(--text);
  background: oklch(100% 0 0 / 0.1);
  outline: none;
}

.family-icon-btn:active {
  transform: scale(0.96);
}

/* ----- Shell / views ----- */
.family-shell {
  width: min(720px, 100%);
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin: 0 auto;
  padding:
    18px
    max(16px, env(safe-area-inset-right, 0px))
    28px
    max(16px, env(safe-area-inset-left, 0px));
}

.family-view {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

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

.family-intro {
  margin-bottom: 18px;
}

.family-intro-title {
  margin: 0;
  font-size: clamp(1.45rem, 4.6vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.family-intro-copy {
  margin: 8px 0 0;
  max-width: 36ch;
  color: var(--muted-strong);
  font-size: 0.98rem;
  line-height: 1.45;
}

.family-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.family-view-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.family-requests-head-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.family-pending-count {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: oklch(70% 0.12 75 / 0.18);
  color: oklch(86% 0.12 75);
  font-size: 0.82rem;
  font-weight: 750;
}

.family-request-group {
  display: grid;
  gap: 10px;
}

.family-request-group + .family-request-group {
  margin-top: 16px;
}

.family-request-group-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
}

.family-request-group-head .family-muted {
  margin: 4px 0 0;
}

.family-refresh-btn {
  /* BAK-567: 44px is the mobile-design-system tap-target floor. */
  min-height: 44px !important;
  padding: 7px 14px !important;
  font-size: 0.88rem !important;
}

/* ----- Grouped iOS-style blocks ----- */
.family-group {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--family-hairline);
  border-radius: var(--family-radius-lg);
  background: var(--family-surface);
  box-shadow: 0 10px 30px oklch(0% 0 0 / 0.18);
}

.family-group-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.family-group-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.family-group-meta {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.family-group-lead {
  margin: 0 0 12px;
}

.family-muted {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.family-degraded-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 12px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid oklch(82% 0.12 75 / 0.55);
  background: oklch(38% 0.08 75 / 0.42);
  color: oklch(97% 0.02 95);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.45;
}

.family-degraded-banner[hidden] {
  display: none !important;
}

.family-degraded-banner p {
  margin: 0;
  flex: 1 1 auto;
  color: inherit;
}

.family-degraded-banner .family-refresh-btn {
  flex: 0 0 auto;
}

.family-degraded-banner .family-refresh-btn[hidden] {
  display: none !important;
}

.family-stale-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid oklch(78% 0.12 75 / 0.4);
  background: oklch(55% 0.12 75 / 0.16);
  color: oklch(92% 0.06 85);
}

.family-stale-banner p {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.45;
}

.family-stale-banner .family-refresh-btn {
  flex: 0 0 auto;
}

.family-member-picker .family-empty,
.family-member-picker > .family-muted {
  grid-column: 1 / -1;
}

.family-requests-more {
  width: 100%;
  margin-top: 4px;
}

.family-skeleton-row {
  min-height: 72px;
}

.family-cal-skeleton {
  display: grid;
  gap: 10px;
}

.family-week-strip {
  display: grid;
  gap: 12px;
  margin: 0 0 14px;
  padding: 2px 0 18px;
  border-bottom: 1px solid var(--family-hairline);
}

.family-week-strip[hidden] {
  display: none;
}

.family-week-head {
  display: grid;
  gap: 4px;
}

.family-week-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.family-week-lead {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.family-week-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.family-week-card {
  appearance: none;
  position: relative;
  flex: 0 0 148px;
  scroll-snap-align: start;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 0;
  padding: 0 0 10px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--family-hairline);
  background: var(--family-surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: default;
}

.family-week-card.is-more {
  min-height: 268px;
  align-content: center;
  padding: 16px;
  cursor: pointer;
}

.family-week-card.is-skeleton {
  pointer-events: none;
  min-height: 268px;
  background: oklch(100% 0 0 / 0.06);
}

.family-week-poster {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: oklch(100% 0 0 / 0.06);
}

.family-week-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.family-week-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 0 10px;
}

.family-week-day {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  padding: 4px 8px;
  border-radius: 999px;
  background: oklch(12% 0.02 250 / 0.82);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}

.family-week-card.is-more .family-week-day {
  position: static;
  padding: 0;
  background: none;
  color: var(--muted);
  backdrop-filter: none;
}

.family-week-cue {
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.family-week-name {
  font-size: 0.95rem;
  font-weight: 750;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.family-week-more {
  font-size: 0.9rem;
  font-weight: 750;
}

@media (max-width: 720px) {
  .family-week-card {
    flex-basis: 132px;
  }

  .family-week-card.is-more,
  .family-week-card.is-skeleton {
    min-height: 236px;
  }
}

@media (min-width: 900px) {
  .family-week-card {
    flex-basis: 168px;
  }

  .family-week-title {
    font-size: 1.28rem;
  }
}

.family-week-card.is-interested {
  border-color: oklch(78% 0.12 75 / 0.45);
}

.week-strip-sheet[hidden] {
  display: none !important;
}

.week-strip-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  align-items: end;
}

.week-strip-sheet-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: oklch(8% 0.02 250 / 0.62);
}

.week-strip-sheet-panel {
  position: relative;
  display: grid;
  gap: 12px;
  width: min(440px, calc(100vw - 24px));
  margin: 0 auto 18px;
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-radius: 18px;
  border: 1px solid var(--family-hairline);
  background: var(--family-surface-solid);
}

.week-strip-sheet-panel h3 {
  margin: 0;
}

.week-strip-sheet-meta {
  margin: 0;
  color: var(--muted);
}

.week-strip-sheet-actions {
  display: grid;
  gap: 8px;
}

.week-strip-sheet-action,
.week-strip-sheet-cancel {
  width: 100%;
  min-height: 44px;
}

.week-strip-sheet-action {
  border-radius: 12px;
  border: 1px solid var(--family-hairline);
  background: oklch(100% 0 0 / 0.05);
  color: inherit;
  font-weight: 650;
}

.family-request-row.is-week-strip-focus {
  outline: 2px solid oklch(78% 0.12 75 / 0.7);
  outline-offset: 2px;
}

.family-cal-day.is-focused {
  display: grid;
  border-color: oklch(78% 0.12 75 / 0.55);
  box-shadow: 0 0 0 1px oklch(78% 0.12 75 / 0.18);
}

.family-cal-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.family-cal-filters[hidden] {
  display: none !important;
}

.family-cal-filter-chip {
  appearance: none;
  font: inherit;
  min-height: 34px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid var(--family-hairline);
  background: oklch(100% 0 0 / 0.045);
  color: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.family-cal-filter-chip strong {
  min-width: 22px;
  min-height: 22px;
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: oklch(100% 0 0 / 0.08);
  font-size: 0.72rem;
}

.family-cal-filter-chip.is-active {
  border-color: oklch(72% 0.1 240 / 0.55);
  background: oklch(72% 0.1 240 / 0.16);
}

.family-cal-filter-chip:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ----- Member picker (compact avatar grid; BAK-571: no horizontal scroll from
   360px up — a 4-column grid, 5th+ member wraps to the next row instead) ----- */
.family-member-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 2px 2px 6px;
}

.family-member-option {
  appearance: none;
  font: inherit;
  width: 100%;
  min-width: 0;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 4px;
  color: var(--text);
  border: 1px solid var(--family-hairline);
  border-radius: 16px;
  background: oklch(100% 0 0 / 0.035);
  cursor: pointer;
  text-align: center;
  box-sizing: border-box;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .family-member-option:hover {
    transform: translateY(-1px);
    border-color: oklch(78% 0.12 230 / 0.45);
  }
}

.family-member-option:focus-visible {
  outline: none;
  border-color: oklch(78% 0.14 230 / 0.85);
  box-shadow: 0 0 0 3px oklch(62% 0.16 250 / 0.22);
}

.family-member-option > span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: oklch(98% 0.01 250);
  border-radius: 999px;
  background: var(--family-avatar-color, linear-gradient(145deg, oklch(68% 0.14 230), oklch(52% 0.16 255)));
  font-weight: 700;
  font-size: 0.92rem;
  overflow: hidden;
}

/* A curated emoji reads better a little larger than a single initial letter. */
.family-member-option > span.family-member-avatar--emoji {
  font-size: 1.15rem;
  line-height: 1;
}

.family-member-option > span.family-member-avatar--photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.family-member-option strong {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.family-member-option .family-member-label {
  flex: 1 1 0%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.family-member-option .family-member-unread-badge {
  flex-shrink: 0;
}

.family-member-option.is-selected,
.family-member-option[aria-selected="true"] {
  border-color: oklch(82% 0.12 155 / 0.65);
  background: oklch(70% 0.1 155 / 0.12);
}

/* ----- Workflow lock ----- */
.family-workflow.is-member-locked {
  pointer-events: none;
  user-select: none;
}

.family-workflow.is-member-locked .family-group,
.family-workflow.is-member-locked .family-empty {
  opacity: 0.48;
  filter: saturate(0.7);
}

/* ----- Forms / buttons ----- */
.family-group input,
.family-group textarea,
.family-group select,
.family-panel input,
.family-panel textarea,
.family-panel select {
  width: 100%;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: oklch(8% 0.015 250 / 0.7);
  outline: none;
  padding: 13px 14px;
}

.family-group input:focus,
.family-group textarea:focus,
.family-group select:focus,
.family-panel input:focus,
.family-panel textarea:focus,
.family-panel select:focus {
  border-color: oklch(78% 0.14 230 / 0.7);
  box-shadow: 0 0 0 3px oklch(62% 0.16 250 / 0.18);
}

.family-group input:disabled,
.family-group textarea:disabled,
.family-group select:disabled,
.family-group button:disabled,
.family-panel input:disabled,
.family-panel textarea:disabled,
.family-panel select:disabled,
.family-panel button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn[hidden] {
  display: none !important;
}

.btn {
  appearance: none;
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease, opacity 140ms ease;
}

.btn.primary {
  color: oklch(99% 0.01 250);
  border-color: oklch(78% 0.12 230 / 0.28);
  background: linear-gradient(145deg, oklch(62% 0.16 245), oklch(52% 0.15 255));
  box-shadow: 0 12px 28px oklch(45% 0.14 250 / 0.28);
}

@media (hover: hover) and (pointer: fine) {
  .btn.primary:hover,
  .btn.primary:focus-visible {
    transform: translateY(-1px);
  }
}

.btn.primary:active {
  transform: translateY(0);
}

.btn.secondary {
  color: var(--muted-strong);
  border-color: var(--family-hairline);
  background: oklch(100% 0 0 / 0.05);
}

@media (hover: hover) and (pointer: fine) {
  .btn.secondary:hover,
  .btn.secondary:focus-visible {
    color: var(--text);
    border-color: oklch(78% 0.12 230 / 0.4);
  }
}

.btn:disabled,
.btn.disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.family-issue-form > .btn.primary {
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
}

/* ----- Search ----- */
.family-search-field {
  position: relative;
  display: block;
}

.family-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.family-search-input,
.family-search-panel .family-search-input {
  width: 100%;
  min-height: 48px;
  padding: 12px 48px 12px 42px;
  font-size: 1.05rem;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: oklch(8% 0.015 250 / 0.75);
  color: var(--text);
}

.family-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.family-search-clear {
  appearance: none;
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: var(--muted-strong);
  background: transparent;
  cursor: pointer;
}

.family-search-clear:hover,
.family-search-clear:focus-visible {
  color: var(--text);
  background: oklch(100% 0 0 / 0.08);
  outline: none;
}

.family-search-clear:active {
  transform: translateY(-50%) scale(0.96);
}

.family-search-clear[hidden] {
  display: none;
}

.family-search-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.family-search-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid oklch(78% 0.12 230 / 0.3);
  border-top-color: oklch(78% 0.14 230);
  animation: family-search-spin 0.85s linear infinite;
}

.family-search-panel.is-searching .family-search-spinner {
  display: inline-block;
}

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

.family-search-hints {
  display: grid;
  gap: 18px;
  margin-top: 16px;
}

.family-search-hints-block {
  display: grid;
  gap: 10px;
}

.family-search-hints-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.family-search-hints-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.family-search-hints-clear {
  appearance: none;
  margin: 0;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--muted-strong);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
}

.family-search-hints-clear:hover,
.family-search-hints-clear:focus-visible {
  color: var(--text);
  outline: none;
}

.family-search-hints-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.family-search-hint-chip {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 4px 0 2px;
  border-radius: 999px;
  border: 1px solid var(--family-hairline);
  background: oklch(100% 0 0 / 0.04);
}

.family-search-hint-query,
.family-search-hint-remove {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.family-search-hint-query {
  min-height: 36px;
  padding: 0 4px 0 12px;
  font-size: 0.92rem;
  font-weight: 650;
}

.family-search-hint-query svg {
  color: var(--muted);
  flex: 0 0 auto;
}

.family-search-hint-remove {
  width: 32px;
  height: 32px;
  justify-content: center;
  border-radius: 999px;
  color: var(--muted-strong);
}

.family-search-hint-remove:hover,
.family-search-hint-remove:focus-visible {
  color: var(--text);
  background: oklch(100% 0 0 / 0.08);
  outline: none;
}

.family-more-like-rows {
  display: grid;
  gap: 16px;
  margin: 12px 0 8px;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.family-more-like-block {
  min-width: 0;
  max-width: 100%;
}

.family-more-like-rows[hidden] {
  display: none !important;
}

.family-more-like-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.family-more-like-head > div:first-child {
  min-width: 0;
}

.family-more-like-eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.family-more-like-title {
  margin: 4px 0 0;
  font-size: 1.05rem;
  overflow-wrap: anywhere;
  min-width: 0;
}

.family-more-like-unpin {
  min-height: 44px;
  min-width: 44px;
  flex-shrink: 0;
}

.family-more-like-empty {
  margin: 0 0 4px;
  font-size: 0.95rem;
  color: var(--muted);
}

.family-more-like-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.family-more-like-card {
  flex: 0 0 140px;
  width: 140px;
  display: grid;
  gap: 8px;
  scroll-snap-align: start;
  cursor: pointer;
}

.family-more-like-poster img,
.family-more-like-fallback {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  object-fit: cover;
}

.family-search-suggestions {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  align-items: start;
  padding-bottom: 4px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.family-search-suggestion {
  appearance: none;
  flex: 0 0 120px;
  width: 120px;
  min-width: 0;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
}

.family-search-suggestion-poster {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--family-hairline);
  background: oklch(100% 0 0 / 0.04);
}

.family-search-suggestion-img,
.family-search-suggestion-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.family-search-suggestion-fallback {
  display: grid;
  place-items: center;
}

.family-poster-placeholder.family-search-suggestion-fallback {
  width: 100%;
  height: 100%;
}

.family-search-suggestion-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.family-search-suggestion-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.family-search-suggestion-copy small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.family-search-suggestion:focus-visible .family-search-suggestion-poster {
  outline: 2px solid oklch(78% 0.12 230);
  outline-offset: 2px;
}

.family-results {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

@media (min-width: 720px) {
  .family-results {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

/* ----- Result cards / skeletons ----- */
.family-skeleton {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  min-height: 180px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--family-hairline);
  background: oklch(100% 0 0 / 0.03);
  overflow: hidden;
}

.family-skeleton-poster,
.family-skeleton-line {
  position: relative;
  border-radius: 10px;
  background: oklch(100% 0 0 / 0.06);
  overflow: hidden;
}

.family-skeleton-poster {
  width: 96px;
  height: 144px;
}

.family-skeleton-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.family-skeleton-line { height: 12px; width: 100%; }
.family-skeleton-line.short { width: 40%; }
.family-skeleton-line.medium { width: 70%; }
.family-skeleton-line.tall { height: 16px; }

.family-skeleton-poster::after,
.family-skeleton-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, oklch(100% 0 0 / 0.08) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: family-skeleton-shimmer 1.4s ease-in-out infinite;
}

@keyframes family-skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.family-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  min-height: 180px;
  padding: 12px;
  border: 1px solid var(--family-hairline);
  border-radius: 16px;
  background: oklch(100% 0 0 / 0.035);
}

.family-card-poster,
.family-poster-placeholder {
  width: 96px;
  height: 144px;
  border-radius: 12px;
  overflow: hidden;
  background: oklch(100% 0 0 / 0.06);
}

.family-card-poster { position: relative; }

.family-poster-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  max-width: calc(100% - 16px);
  padding: 4px 7px;
  border-radius: 999px;
  border: 1px solid oklch(82% 0.12 155 / 0.45);
  background: oklch(18% 0.04 150 / 0.88);
  color: oklch(94% 0.04 150);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.family-poster-badge.is-tracked {
  border-color: oklch(75% 0.12 240 / 0.55);
  color: oklch(92% 0.04 240);
}

.family-poster-badge.is-requested {
  border-color: oklch(80% 0.12 75 / 0.55);
  color: oklch(92% 0.06 85);
}

.family-poster-badge.is-available {
  border-color: oklch(82% 0.12 155 / 0.55);
}

.family-poster-badge.is-unavailable {
  border-color: oklch(70% 0.12 20 / 0.55);
  color: oklch(90% 0.06 20);
}

.family-card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.family-poster-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
}

.family-card-body { min-width: 0; }

.family-card-meta,
.family-chip-row,
.family-card-actions,
.family-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.family-card-meta {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.family-card h3 {
  margin: 6px 0 4px;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.family-genres,
.family-overview,
.family-reason {
  margin: 0;
  color: var(--muted);
}

.family-genres {
  font-size: 0.88rem;
  font-weight: 650;
}

.family-overview {
  display: -webkit-box;
  margin-top: 8px;
  min-height: 40px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.45;
}

.family-chip-row { margin-top: 10px; }

.family-chip,
.family-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  background: oklch(70% 0.08 230 / 0.14);
  color: var(--muted-strong);
  font-size: 0.74rem;
  font-weight: 700;
}

.family-reason {
  margin-top: 8px;
  color: var(--warn);
  font-size: 0.86rem;
  font-weight: 650;
}

.family-card-state {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 10px 0 0;
  padding: 8px 10px;
  border: 1px solid oklch(82% 0.12 155 / 0.28);
  border-radius: 12px;
  background: oklch(70% 0.1 155 / 0.1);
  color: oklch(92% 0.04 150);
  font-size: 0.78rem;
  font-weight: 750;
}

.family-card-state span {
  color: var(--muted);
  font-weight: 650;
  line-height: 1.35;
}

.family-card-state.is-tracked {
  border-color: oklch(75% 0.12 240 / 0.34);
  background: oklch(45% 0.1 250 / 0.18);
}

.family-card-state.is-requested {
  border-color: oklch(80% 0.12 75 / 0.35);
  background: oklch(70% 0.1 75 / 0.14);
  color: oklch(92% 0.06 85);
}

.family-card-state.is-available {
  border-color: oklch(82% 0.12 155 / 0.34);
  background: oklch(70% 0.1 155 / 0.12);
}

.family-card-state.is-unavailable {
  border-color: oklch(70% 0.12 20 / 0.34);
  background: oklch(45% 0.1 20 / 0.16);
}

.family-card-actions {
  margin-top: 12px;
  align-items: center;
}

.family-card-actions .btn {
  /* BAK-567: 44px is the mobile-design-system tap-target floor. */
  min-height: 44px;
  padding: 8px 14px;
  font-size: 0.9rem;
}

.family-help-glossary {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

/* ----- Push card ----- */
.family-push-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  margin-bottom: 14px;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--family-hairline);
  border-radius: var(--family-radius);
  background: oklch(55% 0.08 230 / 0.12);
}

.family-push-card[hidden] {
  display: none !important;
}

.family-push-card.is-emphasized {
  border-color: oklch(78% 0.12 230 / 0.45);
  box-shadow: 0 0 0 1px oklch(78% 0.12 230 / 0.12) inset;
}

.family-push-copy {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.family-push-copy strong {
  display: block;
  font-size: 0.98rem;
}

.family-push-copy p {
  margin: 4px 0 0;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.4;
}

.family-push-card .btn {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  white-space: normal;
  text-align: center;
  overflow-wrap: anywhere;
}

/* ----- Requests + Leita intro ----- */
/* Portrait 2:3 + cover is owned by recently_added_strip.css. Do not let
   landscape stills (e.g. Modern Family) size the Family home/Beiðnir row. */
.family-page .recently-added-tile {
  flex: 0 0 88px;
  width: 88px;
  min-width: 0;
}

.family-page .recently-added-poster-wrap {
  aspect-ratio: 2 / 3;
  overflow: hidden;
}

.family-page .recently-added-poster {
  object-fit: cover;
  object-position: center;
}

@media (max-width: 960px) {
  .family-page .recently-added-tile {
    flex-basis: 72px;
    width: 72px;
  }
}

.family-view[data-family-view="search"] .recently-added-strip {
  margin: 16px 0 0;
}

.family-view[data-family-view="requests"] .recently-added-strip {
  margin: 0 0 14px;
}

.family-page .recently-added-empty,
.family-page .recently-added-when,
.family-page .recently-added-kind {
  color: var(--muted);
}

.family-request-list {
  display: grid;
  gap: 10px;
}

.family-request-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--family-hairline);
  border-radius: 16px;
  background: oklch(100% 0 0 / 0.03);
}

.family-request-thumb {
  width: 48px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  background: oklch(100% 0 0 / 0.06);
}

.family-request-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.family-request-title {
  margin: 0;
  color: var(--text);
  font-weight: 700;
}

.family-request-detail {
  margin: 3px 0 0;
  color: oklch(82% 0.12 75);
  font-size: 0.82rem;
  font-weight: 650;
}

.family-request-delete {
  margin-top: 8px;
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.family-status.is-available {
  background: oklch(70% 0.1 155 / 0.16);
  color: var(--good);
}

.family-status.is-failed,
.family-status.is-declined,
.family-status.is-not_available {
  background: oklch(65% 0.14 20 / 0.16);
  color: var(--bad);
}

.family-status.is-processing,
.family-status.is-approved {
  background: oklch(70% 0.1 230 / 0.16);
  color: var(--accent-soft);
}

.family-status.is-match-hold {
  background: oklch(78% 0.12 75 / 0.22);
  color: oklch(92% 0.06 90);
}

.family-match-candidates {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.family-match-candidate {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.family-match-poster img,
.family-match-thumb,
.family-match-poster-fallback {
  display: block;
  width: 42px;
  height: 62px;
  border-radius: 6px;
  object-fit: cover;
  background: oklch(30% 0.02 250);
}

.family-match-candidate strong {
  font-size: 0.92rem;
}

.family-match-ids,
.family-match-overview {
  margin: 2px 0 0;
  color: var(--muted, oklch(78% 0.02 250));
  font-size: 0.78rem;
  line-height: 1.35;
}

/* ----- Issue form / picker ----- */
.family-issue-form {
  display: grid;
  gap: 10px;
}

.family-form-row {
  display: grid;
  grid-template-columns: 1fr 0.7fr;
}

.family-picker { position: relative; }

.family-picker-toggle {
  appearance: none;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: oklch(100% 0 0 / 0.03);
  border: 1px solid var(--line-strong);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.family-picker-toggle:hover,
.family-picker[data-state="open"] .family-picker-toggle {
  border-color: oklch(78% 0.12 230 / 0.55);
  background: oklch(70% 0.08 230 / 0.1);
}

.family-picker-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.family-picker-caret {
  font-size: 0.8rem;
  color: var(--muted);
  transition: transform 160ms ease;
}

.family-picker[data-state="open"] .family-picker-caret {
  transform: rotate(180deg);
}

.family-picker-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: oklch(14% 0.02 250 / 0.98);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 14px 32px oklch(0% 0 0 / 0.45);
  max-height: 320px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.family-picker-panel[hidden] { display: none; }

.family-picker-filter {
  appearance: none;
  width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: oklch(100% 0 0 / 0.04);
  color: var(--text);
  font: inherit;
}

.family-picker-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  max-height: 240px;
}

.family-picker-item {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.family-picker-item:hover,
.family-picker-item:focus-visible {
  background: oklch(70% 0.08 230 / 0.12);
  border-color: oklch(78% 0.12 230 / 0.3);
}

.family-picker-poster {
  width: 40px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: oklch(100% 0 0 / 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--muted);
}

.family-picker-poster-placeholder { font-size: 1.2rem; }

.family-picker-item-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.family-picker-item-body strong {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.family-picker-loading,
.family-picker-empty { margin: 4px 4px 0; }

.family-picker-truncated {
  margin: 0 4px 8px;
  font-size: 0.78rem;
}

.family-empty {
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  color: var(--muted);
  background: oklch(100% 0 0 / 0.025);
}

.family-empty.compact { padding: 16px; }
.family-empty h3,
.family-empty p { margin: 0; }
.family-empty p { margin-top: 6px; }
.family-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.family-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--family-tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
  transform: translateX(-50%);
  z-index: 280;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: oklch(12% 0.02 250 / 0.94);
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.family-login-page .family-toast {
  bottom: 22px;
  left: auto;
  right: 22px;
  transform: none;
}

.family-toast.is-success { border-color: oklch(82% 0.12 155 / 0.34); }
.family-toast.is-error { border-color: oklch(70% 0.14 20 / 0.4); }

/* ----- Tab bar ----- */
.family-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-height: calc(var(--family-tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding:
    6px 8px
    calc(6px + env(safe-area-inset-bottom, 0px));
  background: oklch(11% 0.018 250 / 0.88);
  border-top: 1px solid var(--family-hairline);
  backdrop-filter: saturate(1.4) blur(20px);
  -webkit-backdrop-filter: saturate(1.4) blur(20px);
}

.family-tab {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  padding: 6px 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.58rem;
  font-weight: 650;
  line-height: 1.1;
  min-width: 0;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease;
}

.family-tab svg { display: block; }

.family-tab.is-active,
.family-tab[aria-current="page"] {
  color: oklch(82% 0.1 230);
  background: oklch(70% 0.08 230 / 0.1);
}

@media (max-width: 1280px) {
  .family-tabbar {
    padding-inline: 4px;
    flex-wrap: nowrap;
  }

  .family-tab {
    min-width: 0;
    padding: 6px 2px;
    gap: 2px;
    font-size: clamp(0.5rem, 2.6vw, 0.58rem);
    letter-spacing: -0.02em;
  }

  .family-tab svg {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 360px) {
  .family-tabbar {
    padding-inline: 2px;
  }

  .family-tab {
    padding: 6px 1px;
    font-size: 0.5rem;
    letter-spacing: -0.03em;
  }

  .family-tab span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .family-tab svg {
    width: 20px;
    height: 20px;
  }
}

/* ----- Dagatal (BAK-75 grid) ----- */
.family-cal-header {
  align-items: flex-start;
  flex-wrap: wrap;
}

.family-cal-lead {
  margin: 4px 0 0;
  max-width: 42ch;
}

.family-cal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  margin: 0 0 12px;
}

.family-cal-nav-footer {
  justify-content: flex-end;
  margin-top: 16px;
  margin-bottom: 0;
  padding-right: 56px;
}

.family-cal-scroll-top {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(var(--family-tabbar-h, 64px) + 16px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--family-hairline);
  background: var(--family-surface-solid);
  color: var(--text);
  box-shadow: 0 16px 36px oklch(0% 0 0 / 0.28);
  cursor: pointer;
}

.family-cal-scroll-top[hidden] {
  display: none;
}

.family-cal-scroll-top svg {
  width: 18px;
  height: 18px;
}

.family-calendar {
  display: grid;
  gap: 12px;
}

.family-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  overflow-anchor: none;
}

.family-cal-weekday {
  padding: 0 4px 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-strong, oklch(82% 0.02 250));
}

.family-cal-day {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 168px;
  padding: 10px;
  border: 1px solid var(--family-hairline);
  border-radius: 16px;
  background:
    linear-gradient(180deg, oklch(100% 0 0 / 0.045), oklch(100% 0 0 / 0.02)),
    var(--family-surface);
}

.family-cal-day.is-today {
  border-color: oklch(72% 0.1 240 / 0.55);
  box-shadow: 0 0 0 1px oklch(72% 0.1 240 / 0.22);
  scroll-margin-top: 84px;
}

.family-cal-day.is-quiet {
  min-height: 72px;
  opacity: 0.72;
}

.family-cal-day.is-empty {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.family-cal-day-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px;
}

.family-cal-day-number {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}

.family-cal-day.is-today .family-cal-day-number,
.family-cal-day.is-today .family-cal-day-weekday,
.family-cal-day.is-today .family-cal-day-long {
  color: oklch(86% 0.06 230);
}

.family-cal-day-weekday {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: capitalize;
  color: var(--muted-strong, oklch(82% 0.02 250));
}

.family-cal-day-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.family-cal-day-long {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--muted-strong, oklch(82% 0.02 250));
  text-transform: capitalize;
}

.family-cal-day-body {
  display: grid;
  gap: 8px;
}

.family-cal-day-empty {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--muted);
}

.family-cal-entry {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  background: oklch(100% 0 0 / 0.04);
  border: 1px solid oklch(100% 0 0 / 0.05);
}

.family-cal-entry.is-requested {
  border-color: oklch(78% 0.12 75 / 0.45);
  box-shadow: 0 0 0 1px oklch(78% 0.12 75 / 0.18);
}

.family-cal-poster {
  aspect-ratio: 2 / 3;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  background: oklch(100% 0 0 / 0.06);
}

.family-cal-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.family-cal-date-chip {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  padding: 4px 8px;
  border-radius: 999px;
  background: oklch(12% 0.02 250 / 0.82);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  backdrop-filter: blur(8px);
}

.family-cal-body {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 0 8px 10px;
}

.family-cal-title {
  margin: 0;
  font-weight: 700;
  line-height: 1.25;
}

.family-cal-cue {
  margin: 0;
  color: oklch(82% 0.12 75);
  font-size: 0.78rem;
  font-weight: 650;
}

.family-cal-entry.is-tv .family-cal-cue {
  color: oklch(82% 0.06 230);
}

.family-cal-requested {
  font-size: 0.72rem;
  font-weight: 750;
  color: oklch(86% 0.1 75);
}

body.family-page:has([data-family-view="overview"].is-active) .family-shell {
  width: min(1080px, 100%);
}

@media (max-width: 860px) {
  .family-cal-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .family-cal-weekday,
  .family-cal-day.is-empty,
  .family-cal-day.is-quiet:not(.is-today):not(.is-focused) {
    display: none;
  }

  .family-cal-day.is-today.is-quiet {
    min-height: 0;
  }

  .family-cal-day {
    min-height: 0;
    padding: 14px;
  }

  .family-cal-day-number {
    font-size: 2.1rem;
  }

  .family-cal-day-long {
    font-size: 0.95rem;
  }

  .family-cal-day-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .family-cal-nav-footer {
    justify-content: stretch;
  }

  .family-cal-nav-footer .family-refresh-btn {
    flex: 1;
  }
}

@media (min-width: 861px) {
  .family-cal-day-long {
    display: none;
  }

  .family-cal-day-body {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 720px) {
  .family-cal-header {
    flex-wrap: nowrap;
  }
}

/* ----- Settings sheet ----- */
.family-sheet[hidden] { display: none !important; }

.family-sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
}

.family-sheet-backdrop {
  appearance: none;
  position: absolute;
  inset: 0;
  border: 0;
  margin: 0;
  padding: 0;
  background: oklch(0% 0 0 / 0.55);
  cursor: pointer;
}

.family-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(88dvh, 720px);
  display: flex;
  flex-direction: column;
  padding:
    8px
    max(16px, env(safe-area-inset-right, 0px))
    calc(18px + env(safe-area-inset-bottom, 0px))
    max(16px, env(safe-area-inset-left, 0px));
  border-radius: 22px 22px 0 0;
  background: oklch(15% 0.018 250);
  border: 1px solid var(--family-hairline);
  border-bottom: 0;
  box-shadow: 0 -20px 50px oklch(0% 0 0 / 0.4);
  animation: family-sheet-up 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes family-sheet-up {
  from { transform: translateY(18%); opacity: 0.85; }
  to { transform: translateY(0); opacity: 1; }
}

.family-sheet-grab {
  width: 36px;
  height: 4px;
  margin: 4px auto 10px;
  border-radius: 999px;
  background: oklch(100% 0 0 / 0.18);
}

.family-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.family-sheet-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.family-sheet-body {
  overflow-y: auto;
  display: grid;
  gap: 18px;
  padding-bottom: 8px;
}

.family-settings-label {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.family-settings-list {
  border: 1px solid var(--family-hairline);
  border-radius: 16px;
  overflow: hidden;
  background: oklch(100% 0 0 / 0.03);
}

.family-settings-row {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--family-hairline);
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.family-settings-row:last-child { border-bottom: 0; }

.family-settings-row strong {
  display: block;
  font-size: 0.98rem;
  font-weight: 650;
}

.family-settings-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
}

.family-settings-row.is-danger strong { color: oklch(72% 0.16 20); }

.family-settings-chevron {
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
}

.family-settings-block .family-login-status {
  text-align: left;
  margin-top: 8px;
  min-height: 1.2em;
}

.family-language-toggle {
  display: flex;
  gap: 8px;
  border: 1px solid var(--family-hairline);
  border-radius: 16px;
  padding: 4px;
  background: oklch(100% 0 0 / 0.03);
}

.family-language-option {
  flex: 1 1 0;
  appearance: none;
  min-height: var(--ms-tap, 44px);
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.family-language-option[aria-pressed="true"] {
  color: oklch(99% 0.01 250);
  border-color: oklch(78% 0.12 230 / 0.28);
  background: linear-gradient(145deg, oklch(62% 0.16 245), oklch(52% 0.15 255));
}

.family-avatar-editor {
  display: grid;
  gap: 14px;
}

.family-avatar-editor[hidden] { display: none !important; }

.family-avatar-editor-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.family-avatar-preview {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: oklch(98% 0.01 250);
  background: var(--family-avatar-color, linear-gradient(145deg, oklch(68% 0.14 230), oklch(52% 0.16 255)));
  font-weight: 700;
  font-size: 1.6rem;
  overflow: hidden;
}

.family-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.family-avatar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
}

.family-avatar-upload-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--ms-tap, 44px);
  cursor: pointer;
}

.family-avatar-emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

@media (max-width: 420px) {
  .family-avatar-emoji-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.family-avatar-emoji-option {
  appearance: none;
  width: 100%;
  min-height: var(--ms-tap, 44px);
  display: grid;
  place-items: center;
  border: 1px solid var(--family-hairline);
  border-radius: 12px;
  background: oklch(100% 0 0 / 0.03);
  font-size: 1.2rem;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.family-avatar-emoji-option[aria-pressed="true"] {
  border-color: oklch(82% 0.12 155 / 0.65);
  background: oklch(70% 0.1 155 / 0.12);
}

.family-avatar-status {
  min-height: 1.2em;
  margin: 0;
}

.family-admin-details {
  border: 1px solid var(--family-hairline);
  border-radius: 16px;
  padding: 12px 14px;
  background: oklch(100% 0 0 / 0.025);
}

.family-admin-details > summary {
  font-weight: 650;
  cursor: pointer;
  list-style: none;
  color: var(--muted-strong);
}

.family-admin-details > summary::-webkit-details-marker { display: none; }

.family-admin-details[hidden] { display: none !important; }

/* ----- Devices / audit (admin nest) ----- */
.family-devices-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.family-device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--family-hairline);
  background: oklch(100% 0 0 / 0.03);
}

.family-device-meta { display: grid; gap: 2px; }
.family-device-label { font-weight: 650; }
.family-device-sub { font-size: 0.85rem; color: var(--muted-strong); }
.family-device-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.family-device-action {
  appearance: none;
  font: inherit;
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--family-hairline);
  color: var(--muted-strong);
  background: transparent;
  cursor: pointer;
}

.family-device-action:hover {
  color: var(--text);
  border-color: oklch(78% 0.12 230 / 0.5);
}

.family-device-action.is-danger:hover {
  color: oklch(72% 0.16 20);
  border-color: oklch(70% 0.14 20 / 0.5);
}

.family-add-device:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.family-audit {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--family-hairline);
  background: oklch(100% 0 0 / 0.02);
}

.family-audit > summary {
  font-weight: 650;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.family-audit > summary::-webkit-details-marker { display: none; }

.family-audit > summary::before {
  content: "›";
  display: inline-block;
  transition: transform 160ms ease;
  color: var(--muted-strong);
}

.family-audit[open] > summary::before { transform: rotate(90deg); }

.family-audit > p {
  margin: 6px 0 10px;
  font-size: 0.85rem;
}

.family-audit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.family-audit-row {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: oklch(100% 0 0 / 0.03);
  border: 1px solid var(--family-hairline);
}

.family-audit-row.is-failure {
  background: color-mix(in oklch, var(--bad) 10%, transparent);
  border-color: color-mix(in oklch, var(--bad) 30%, transparent);
}

.family-audit-row.is-rate-limited {
  background: color-mix(in oklch, var(--warn) 10%, transparent);
  border-color: color-mix(in oklch, var(--warn) 30%, transparent);
}

.family-audit-label { font-weight: 650; }
.family-audit-meta { font-size: 0.8rem; color: var(--muted-strong); }

.family-help {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--family-hairline);
  background: oklch(100% 0 0 / 0.03);
  color: var(--text);
  font-size: 0.92rem;
}

.family-help > summary,
.family-login-help > summary {
  font-weight: 650;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.family-help > summary::-webkit-details-marker,
.family-login-help > summary::-webkit-details-marker { display: none; }

.family-help > summary::before,
.family-login-help > summary::before {
  content: "›";
  display: inline-block;
  transition: transform 160ms ease;
  color: var(--muted-strong);
}

.family-help[open] > summary::before,
.family-login-help[open] > summary::before { transform: rotate(90deg); }

.family-help ol,
.family-help ul,
.family-login-help ul {
  margin: 10px 0 4px;
  padding-left: 22px;
  display: grid;
  gap: 6px;
  color: var(--muted-strong);
}

.family-help li,
.family-login-help li { line-height: 1.5; }

@media (prefers-reduced-motion: reduce) {
  .family-sheet-panel,
  .family-member-option,
  .btn,
  .family-search-spinner,
  .family-search-clear,
  .family-search-hint-chip,
  .family-search-suggestion,
  .family-skeleton-poster::after,
  .family-skeleton-line::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Desktop: wider shell, keep tab bar as compact footer nav */
@media (min-width: 860px) {
  .family-shell {
    width: min(880px, calc(100vw - 48px));
    padding-top: 24px;
  }

  .family-request-row {
    grid-template-columns: 48px minmax(0, 1fr) auto;
  }

  .family-push-card {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .family-push-card .btn {
    width: auto;
    min-width: 200px;
  }
}

@media (max-width: 520px) {
  .family-request-row {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .family-status {
    grid-column: 2;
    width: fit-content;
  }

  .family-card {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .family-card-poster,
  .family-poster-placeholder {
    width: 84px;
    height: 126px;
  }
}

/* ==========================================================================
   Legacy login layout (family_login.html)
   ========================================================================== */

.family-hero {
  position: relative;
  display: grid;
  gap: 18px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    radial-gradient(circle at 20% 10%, rgba(56, 189, 248, 0.20), transparent 34%),
    linear-gradient(135deg, rgba(11, 18, 32, 0.94), rgba(7, 12, 21, 0.92));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.family-brand .family-brand-banner {
  display: block;
  width: min(100%, 344px);
  max-width: 100%;
  height: auto;
  border-radius: 22px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.32);
}

.family-hero-title {
  margin: 18px 0 0;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 700;
}

.family-hero-copy {
  max-width: 720px;
  margin: 0;
  color: var(--muted-strong);
  font-size: 1.05rem;
  line-height: 1.6;
}

.family-panel {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018)),
    rgba(11, 17, 28, 0.78);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

.family-login-shell {
  width: min(540px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 64px 0 48px;
}

.family-login-hero { padding: 28px; }

.family-login-panel {
  display: grid;
  gap: 22px;
  padding: 24px;
}

.family-login-warning {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 180, 60, 0.45);
  background: linear-gradient(135deg, rgba(255, 170, 50, 0.18), rgba(220, 110, 30, 0.10));
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.45;
}

.family-login-warning strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1rem;
}

.family-login-biometric {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(56, 189, 248, 0.32);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(56, 189, 248, 0.08));
}

.family-login-biometric-button {
  appearance: none;
  font: inherit;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: 14px;
  color: var(--text);
  background: linear-gradient(135deg, var(--brand-blue), oklch(52% 0.15 255));
  box-shadow: 0 14px 30px rgba(59, 130, 246, 0.32);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.family-login-biometric-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(59, 130, 246, 0.42);
}

.family-login-biometric-button:active { transform: translateY(0); }
.family-login-biometric-button svg { width: 22px; height: 22px; }

.family-login-form { display: grid; gap: 18px; }

.family-login-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted-strong);
}

.family-login-display {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding: 12px 0;
}

.family-login-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  background: transparent;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.family-login-dot.is-filled {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  transform: scale(1.06);
}

.family-login-dot-optional { opacity: 0.55; }

.family-login-input {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.family-login-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.family-login-key {
  appearance: none;
  font: inherit;
  font-size: 1.4rem;
  font-weight: 600;
  padding: 18px 0;
  border-radius: 16px;
  border: 1px solid rgba(170, 195, 230, 0.18);
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01)),
    rgba(11, 17, 28, 0.78);
  cursor: pointer;
  transition: transform 100ms ease, background 140ms ease, border-color 140ms ease;
}

.family-login-key:hover { border-color: rgba(56, 189, 248, 0.45); }

.family-login-key:active {
  transform: scale(0.97);
  background: rgba(59, 130, 246, 0.22);
}

.family-login-key-secondary {
  font-size: 1rem;
  color: var(--muted-strong);
}

.family-login-submit {
  appearance: none;
  font: inherit;
  font-weight: 600;
  padding: 14px 20px;
  border-radius: 14px;
  border: none;
  color: var(--text);
  background: linear-gradient(135deg, var(--brand-blue), oklch(52% 0.15 255));
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
  box-shadow: 0 14px 30px rgba(59, 130, 246, 0.32);
}

.family-login-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.family-login-submit:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(59, 130, 246, 0.42);
}

.family-login-status {
  min-height: 1.2em;
  margin: 0;
  text-align: center;
  font-size: 0.95rem;
  color: var(--muted-strong);
}

.family-login-status.is-error { color: #ff8a8a; }

.family-login-help {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(170, 195, 230, 0.16);
  background: rgba(9, 14, 22, 0.55);
  color: var(--text);
  font-size: 0.92rem;
}

@media (max-width: 480px) {
  .family-login-shell { padding: 32px 0 40px; }
  .family-login-key {
    padding: 16px 0;
    font-size: 1.25rem;
  }
}

.login-product-kicker {
  margin: 0 0 6px;
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(125, 211, 252, 0.92);
  text-align: center;
}

.login-product-canonical {
  margin: 14px 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: rgba(203, 213, 225, 0.82);
  text-align: center;
}

.login-product-canonical strong {
  color: #f8fafc;
  font-weight: 600;
}

/* Admin PIN login (scout hostname) — mirrors family keypad styling */
.admin-login-shell {
  padding: 40px 0 48px;
}

.admin-login-form {
  display: grid;
  gap: 18px;
}

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

.admin-face-id-enrol {
  display: grid;
  gap: 14px;
  margin: 4px 0 18px;
  padding: 18px 16px;
  border-radius: 16px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(11, 17, 28, 0.86);
  color: var(--text);
}

.admin-face-id-enrol[hidden] {
  display: none;
}

.admin-face-id-enrol-title {
  margin: 0;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 650;
  line-height: 1.35;
}

.admin-face-id-enrol-actions {
  display: grid;
  gap: 8px;
}

.admin-face-id-enrol-secondary {
  appearance: none;
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(170, 195, 230, 0.28);
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.admin-login-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted-strong);
}

.admin-login-display {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding: 12px 0;
}

.admin-login-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  background: transparent;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.admin-login-dot.is-filled {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  transform: scale(1.06);
}

.admin-login-dot-optional {
  opacity: 0.55;
}

.admin-login-input {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.admin-login-keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.admin-login-key {
  appearance: none;
  font: inherit;
  font-size: 1.35rem;
  font-weight: 600;
  min-height: 44px;
  min-width: 44px;
  padding: 12px 0;
  border-radius: 16px;
  border: 1px solid rgba(170, 195, 230, 0.18);
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01)),
    rgba(11, 17, 28, 0.78);
  cursor: pointer;
  transition: transform 100ms ease, background 140ms ease, border-color 140ms ease;
}

.admin-login-key:hover {
  border-color: rgba(56, 189, 248, 0.45);
}

.admin-login-key:active {
  transform: scale(0.97);
  background: rgba(59, 130, 246, 0.22);
}

.admin-login-key-secondary {
  font-size: 1rem;
  color: var(--muted-strong);
}

.admin-login-submit {
  appearance: none;
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: 14px 20px;
  border-radius: 14px;
  border: none;
  color: var(--text);
  background: linear-gradient(135deg, var(--brand-blue), oklch(52% 0.15 255));
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
  box-shadow: 0 14px 30px rgba(59, 130, 246, 0.32);
}

.admin-login-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.admin-login-submit:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(59, 130, 246, 0.42);
}

.admin-login-status {
  min-height: 1.2em;
  margin: 0;
  text-align: center;
  font-size: 0.95rem;
  color: var(--muted-strong);
}

.admin-login-status.is-error {
  color: #ff8a8a;
}

.admin-login-biometric-button {
  appearance: none;
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--text);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(99, 102, 241, 0.12));
  cursor: pointer;
}

.admin-login-help {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(170, 195, 230, 0.16);
  background: rgba(9, 14, 22, 0.55);
  color: var(--text);
  font-size: 0.92rem;
}

.admin-login-warning {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(247, 177, 74, 0.35);
  background: rgba(247, 177, 74, 0.1);
  font-size: 0.9rem;
  line-height: 1.45;
}

/* BAK-580 — family Trailers tab */
.family-trailer-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.family-trailer-filter {
  min-height: 44px;
  min-width: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted-strong);
  font-weight: 600;
}

.family-trailer-filter.is-active {
  border-color: var(--focus-border-strong);
  background: var(--focus-surface);
  color: var(--text);
}

.family-trailers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.family-trailer-card {
  min-width: 0;
}

.family-trailer-open {
  width: 100%;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.family-trailer-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.family-trailer-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.family-trailer-poster img[hidden] {
  display: none !important;
}

.family-trailer-poster-fallback {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 8px;
  font-size: 0.85rem;
  text-align: center;
}

.bak590-status-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 3;
  max-width: calc(100% - 12px);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.15;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

.bak590-status-badge.is-plex {
  background: #14532d;
  color: #ecfdf5;
  border-color: #4ade80;
}

.bak590-status-badge.is-waiting {
  background: rgba(8, 12, 18, 0.55);
  color: #fbbf24;
  border-color: #fbbf24;
}

.bak590-status-badge.is-requested {
  background: #1e3a5f;
  color: #e0f2fe;
  border-color: #38bdf8;
}

.bak590-compilation-card {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: var(--surface);
}

.bak590-compilation-card .family-trailer-open {
  display: flex;
  gap: 12px;
  align-items: stretch;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  cursor: pointer;
}

.bak590-compilation-card .bak590-compilation-thumb {
  flex: 0 0 88px;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(135deg, #1e293b, #0f172a);
}

.bak590-compilation-card .bak590-compilation-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.bak590-compilation-card h3 {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.25;
}

.bak590-compilation-card p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.family-trailer-time {
  position: absolute;
  bottom: 8px;
  right: 8px;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(8, 12, 18, 0.82);
}

.family-trailer-meta {
  padding: 8px 2px 0;
}

.family-trailer-title {
  margin: 0;
  font-family: "IBM Plex Sans", var(--family-font, system-ui), sans-serif;
  font-size: 0.92rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.family-trailer-source {
  margin: 4px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.family-trailer-card-foot {
  display: grid;
  gap: 8px;
  padding: 0 2px 4px;
}

.family-trailer-card-overview {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.family-trailer-card-request {
  width: 100%;
  min-height: 44px;
}

.family-trailers-empty {
  padding: 24px 12px;
  text-align: center;
}

.family-trailer-player.bak590-player-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: max(8px, env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px))
    max(8px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
  background: rgba(0, 0, 0, 0.92);
}

.family-trailer-player[hidden] {
  display: none !important;
}

.family-trailer-player-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.bak590-player-dialog {
  position: relative;
  z-index: 1;
  width: min(1080px, 100%);
  max-height: min(667px, 96vh, 100%);
  min-height: 145px;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--family-surface-solid, var(--surface));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  font-family: "IBM Plex Sans", var(--family-font, system-ui), sans-serif;
}

.family-view[data-family-view="trailers"] .family-view-title,
.family-view[data-family-view="trailers"] .family-view-subtitle,
.bak590-player-context-title,
.bak590-player-title {
  font-family: "Space Grotesk", var(--family-font, system-ui), sans-serif;
}

.bak590-player-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--family-hairline, var(--line));
  flex-shrink: 0;
}

.bak590-player-header-text {
  flex: 1;
  min-width: 0;
}

.bak590-player-kicker {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.bak590-player-context-title {
  margin: 2px 0 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.25;
}

.bak590-player-updated {
  margin: 4px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.bak590-player-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: auto;
}

.bak590-player-stage {
  flex-shrink: 0;
  background: #000;
  aspect-ratio: 16 / 9;
  width: 100%;
  position: relative;
  display: grid;
  place-items: stretch;
}

.bak590-player-stage .trailer-resume-play {
  position: absolute;
  inset: 0;
  z-index: 6;
  margin: auto;
  width: max-content;
  max-width: calc(100% - 24px);
  min-height: 44px;
  min-width: 44px;
  height: max-content;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(8, 12, 20, 0.9);
  color: #f4f7fb;
  font: 600 15px/1.2 system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.family-trailer-player-frame iframe,
.family-trailer-player-iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.family-trailer-embed-blocked {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  min-height: 100%;
  text-align: center;
  background: linear-gradient(180deg, #0f172a 0%, #020617 100%);
  color: #94a3b8;
}

.family-trailer-embed-blocked[hidden] {
  display: none !important;
}

.family-trailer-open-youtube {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bak590-player-info {
  padding: 14px;
  display: grid;
  gap: 12px;
  min-width: 0;
}

.bak590-player-info-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
}

.bak590-player-poster {
  flex: 0 0 72px;
  width: 72px;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.bak590-player-poster.is-fallback {
  display: grid;
  place-items: center;
  padding: 6px;
  font-size: 0.62rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  color: var(--muted-strong);
}

.bak590-player-poster-fallback {
  display: none;
  grid-column: 1;
  grid-row: 1;
  place-self: center;
  padding: 6px;
  font-size: 0.62rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  color: var(--muted-strong);
}

.bak590-player-poster.is-fallback .bak590-player-poster-fallback:not([hidden]) {
  display: block;
}

.bak590-player-stage.is-blocked .family-trailer-embed-blocked {
  display: flex;
}

.bak590-player-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bak590-player-meta {
  flex: 1;
  min-width: 0;
}

.bak590-player-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.bak590-player-subline {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--muted-strong);
}

.bak590-player-overview {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted-strong);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bak590-player-overview.is-empty {
  font-style: italic;
  color: var(--muted);
}

.bak590-player-info .bak590-status-badge:not([hidden]) {
  position: static;
  display: inline-block;
  max-width: 100%;
  margin-top: 8px;
}

.bak590-player-youtube-wrap {
  margin-top: 4px;
  width: 100%;
}

.bak590-player-youtube-wrap .btn {
  width: 100%;
  min-height: 48px;
  justify-content: center;
}

.bak590-player-cta-wrap {
  margin-top: 4px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bak590-player-cta-wrap .btn {
  width: 100%;
  min-height: 48px;
  justify-content: center;
}

.bak590-player-reason[hidden] {
  display: none !important;
}

.bak590-player-reason {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: oklch(100% 0 0 / 0.05);
  border: 1px solid var(--line);
  font-family: "IBM Plex Sans", var(--family-font, system-ui), sans-serif;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--muted-strong);
  white-space: normal;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

@media (min-width: 360px) and (max-width: 430px) {
  .family-trailer-player.bak590-player-overlay .bak590-player-dialog {
    width: 100%;
    max-height: min(667px, calc(100dvh - 16px));
    min-height: 145px;
  }
}

.bak590-player-reason.is-error {
  border-color: #f87171;
  background: rgba(127, 29, 29, 0.35);
  color: #fecaca;
}

.bak590-player-reason.is-progress {
  border-color: #38bdf8;
  background: rgba(12, 74, 110, 0.35);
  color: #e0f2fe;
}

@media (min-width: 960px) {
  .bak590-player-body {
    flex-direction: row;
    align-items: stretch;
    overflow: hidden;
  }

  .bak590-player-stage {
    flex: 1.35;
    min-width: 0;
    aspect-ratio: auto;
    min-height: 280px;
  }

  .bak590-player-info {
    flex: 0 0 min(360px, 38%);
    border-left: 1px solid var(--family-hairline, var(--line));
    overflow-y: auto;
    align-content: start;
  }
}

@media (max-height: 500px) {
  .family-trailer-player.bak590-player-overlay {
    padding: 6px;
    align-items: center;
  }

  .bak590-player-dialog {
    max-height: min(500px, calc(100dvh - 12px));
    height: min(500px, calc(100dvh - 12px));
  }

  .bak590-player-header {
    padding: 8px 10px 6px;
  }

  .bak590-player-context-title {
    font-size: 0.88rem;
  }

  .bak590-player-body {
    flex-direction: row;
    align-items: stretch;
    overflow: hidden;
    flex: 1;
    min-height: 0;
  }

  .bak590-player-stage {
    flex: 1.1;
    min-width: 0;
    width: auto;
    aspect-ratio: auto;
    height: auto;
    max-height: 100%;
    align-self: stretch;
  }

  .bak590-player-info {
    flex: 0 0 46%;
    max-width: 46%;
    border-left: 1px solid var(--family-hairline, var(--line));
    overflow: hidden;
    padding: 10px;
    gap: 8px;
    align-content: start;
  }

  .bak590-player-poster {
    flex: 0 0 56px;
    width: 56px;
  }

  .bak590-player-title {
    font-size: 0.92rem;
  }

  .bak590-player-overview {
    font-size: 0.72rem;
    line-height: 1.35;
    -webkit-line-clamp: unset;
    overflow: visible;
    display: block;
  }

  .bak590-player-info:has(.bak590-player-reason:not([hidden])) .bak590-player-overview {
    display: none;
  }

  .bak590-player-info {
    overflow-y: auto;
  }

  .bak590-player-cta-wrap .btn {
    min-height: 44px;
    font-size: 0.82rem;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .bak590-player-reason {
    padding: 8px 10px;
    font-size: 0.76rem;
    line-height: 1.3;
    margin-top: 0;
  }

  .bak590-player-meta .bak590-status-badge:not([hidden]) {
    margin-top: 4px;
    font-size: 0.7rem;
    padding: 4px 8px;
  }
}

@media (max-width: 400px) {
  .bak590-player-dialog {
    border-radius: 14px;
  }

  .bak590-status-badge {
    font-size: 0.74rem;
    padding: 5px 8px;
  }
}

/* Pick-title sheet must sit above the in-app player (z-index 200) for taps and keyboard. */
body.family-trailer-match-open .family-trailer-match-sheet {
  z-index: 250;
}

/* The YouTube iframe can take taps through a higher sibling on iOS. The sheet covers the player. */
body.family-trailer-match-open .family-trailer-player {
  pointer-events: none;
}

.family-trailer-match-panel {
  display: flex;
  flex-direction: column;
  max-height: min(88dvh, 720px);
}

.family-trailer-match-footer {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(
    180deg,
    oklch(15% 0.018 250 / 0) 0%,
    oklch(15% 0.018 250 / 0.92) 24%,
    oklch(15% 0.018 250) 100%
  );
  border-top: 1px solid var(--family-hairline);
}

.family-trailer-match-sheet .family-trailer-match-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px));
  max-height: min(72vh, 520px);
  overflow: auto;
}

.family-trailer-match-search-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.family-trailer-match-search {
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 1rem;
}

.family-trailer-match-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.family-trailer-match-error {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.35;
  color: oklch(78% 0.14 25);
}

.family-trailer-match-error[hidden] {
  display: none !important;
}

.family-trailer-match-row {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
  touch-action: manipulation;
}

.family-trailer-match-row:active {
  background: color-mix(in oklab, var(--accent) 12%, var(--surface));
}

.family-trailer-match-poster {
  width: 44px;
  height: 66px;
  border-radius: 6px;
  overflow: hidden;
  flex: 0 0 auto;
  background: var(--surface-2);
}

.family-trailer-match-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.family-trailer-match-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.family-trailer-match-copy strong {
  display: block;
  font-size: 0.95rem;
  line-height: 1.25;
}

.family-trailer-match-copy span {
  font-size: 0.78rem;
  color: var(--muted);
}

.family-trailer-match-empty {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.family-trailer-match-none {
  min-height: 44px;
  width: 100%;
  touch-action: manipulation;
}

.family-trailer-pick-cta {
  min-height: 44px;
  width: 100%;
}

body.family-trailer-player-open {
  overflow: hidden;
}
