@import url("tokens.css");
@import url("base.css");

/* Family portal + login */
body.family-page {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-y: auto;
}

.family-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding:
    calc(42px + env(safe-area-inset-top, 0px))
    max(0px, env(safe-area-inset-right, 0px))
    calc(64px + env(safe-area-inset-bottom, 0px))
    max(0px, env(safe-area-inset-left, 0px));
}

.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%),
    radial-gradient(circle at 85% 15%, rgba(99, 102, 241, 0.18), transparent 30%),
    linear-gradient(135deg, rgba(11, 18, 32, 0.94), rgba(7, 12, 21, 0.92));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.family-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.08), transparent 42%);
}

.family-brand {
  position: relative;
  z-index: 1;
  display: block;
}

.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 {
  position: relative;
  z-index: 1;
  margin: 18px 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.family-hero-copy {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0;
  color: var(--muted-strong);
  font-size: 1.08rem;
  line-height: 1.65;
}

.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-identity-panel {
  max-width: none;
}

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

.family-workflow.is-member-locked .family-panel {
  opacity: 0.46;
  filter: saturate(0.75);
}

.family-workflow.is-member-locked .family-empty h3 {
  color: var(--muted-strong);
}

.family-member-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 2px;
}

.family-member-option {
  appearance: none;
  font: inherit;
  min-width: 0;
  width: 100%;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 10px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)),
    rgba(8, 13, 22, 0.76);
  cursor: pointer;
  text-align: center;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.family-member-option:hover {
  transform: translateY(-1px);
  border-color: rgba(56, 189, 248, 0.42);
}

.family-member-option:focus-visible {
  outline: none;
  border-color: rgba(56, 189, 248, 0.85);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
}

.family-member-option span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #f9fbff;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-indigo));
  box-shadow: 0 12px 28px rgba(59, 130, 246, 0.24);
  font-weight: 900;
}

.family-member-option strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.family-member-option.is-selected,
.family-member-option[aria-selected="true"] {
  border-color: rgba(124, 227, 171, 0.74);
  background:
    linear-gradient(135deg, rgba(124, 227, 171, 0.18), rgba(59, 130, 246, 0.08)),
    rgba(8, 13, 22, 0.88);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.24), 0 0 0 1px rgba(124, 227, 171, 0.12) inset;
}

.family-panel input,
.family-panel textarea,
.family-panel select {
  width: 100%;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: rgba(6, 11, 20, 0.72);
  outline: none;
  padding: 13px 14px;
}

.family-panel input:focus,
.family-panel textarea:focus,
.family-panel select:focus {
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.16);
}

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

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

/* Shared buttons — family page uses .btn.primary / .btn.secondary (not admin .primary alone) */
.btn {
  appearance: none;
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  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: var(--brand-text);
  border-color: rgba(56, 189, 248, 0.28);
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-indigo));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 14px 30px rgba(59, 130, 246, 0.28);
}

.btn.primary:hover,
.btn.primary:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(56, 189, 248, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 18px 36px rgba(59, 130, 246, 0.38);
}

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

.btn.secondary {
  color: var(--muted-strong);
  border-color: rgba(56, 189, 248, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(11, 17, 28, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.btn.secondary:hover,
.btn.secondary:focus-visible {
  transform: translateY(-1px);
  color: var(--text);
  border-color: rgba(56, 189, 248, 0.45);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(14, 21, 34, 0.9);
}

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

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

.family-section-heading .btn {
  min-height: 36px;
  padding: 7px 14px;
  font-size: 0.88rem;
}

.family-push-banner .btn {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 14px;
  font-size: 0.88rem;
}

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

.family-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 16px;
}

.family-section-heading h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.family-search-input {
  font-size: 1.08rem;
  position: relative;
}

.family-search-panel .family-search-input {
  position: relative;
}

.family-search-input-wrap {
  position: relative;
}

.family-search-input-wrap::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 0 0 12px 12px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(56, 189, 248, 0.95) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  background-position: 200% 0;
  opacity: 0;
  transition: opacity 160ms ease;
  pointer-events: none;
}

.family-search-panel.is-searching .family-search-input-wrap::after {
  opacity: 1;
  animation: family-search-progress 1.05s linear infinite;
}

@keyframes family-search-progress {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.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 rgba(56, 189, 248, 0.35);
  border-top-color: rgba(56, 189, 248, 0.95);
  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-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.family-skeleton {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 16px;
  min-height: 222px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.025);
  overflow: hidden;
}

.family-skeleton-poster,
.family-skeleton-line {
  position: relative;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.family-skeleton-poster {
  width: 112px;
  height: 168px;
  border-radius: 12px;
}

.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%,
    rgba(255, 255, 255, 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: 112px minmax(0, 1fr);
  gap: 16px;
  min-height: 222px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(8, 13, 22, 0.72);
}

.family-card-poster,
.family-poster-placeholder {
  width: 112px;
  height: 168px;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 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 rgba(124, 227, 171, 0.45);
  background: rgba(8, 18, 14, 0.88);
  color: rgba(218, 255, 233, 0.96);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.2;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.family-poster-badge.is-tracked {
  border-color: rgba(97, 166, 255, 0.55);
  color: rgba(214, 232, 255, 0.96);
}

.family-poster-badge.is-requested {
  border-color: rgba(247, 177, 74, 0.55);
  color: rgba(255, 225, 176, 0.96);
}

.family-poster-badge.is-available {
  border-color: rgba(124, 227, 171, 0.55);
}

.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.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.family-card h3 {
  margin: 6px 0 4px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.26rem;
  letter-spacing: -0.03em;
}

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

.family-genres {
  font-size: 0.9rem;
  font-weight: 700;
}

.family-overview {
  display: -webkit-box;
  margin-top: 8px;
  min-height: 44px;
  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: rgba(56, 189, 248, 0.12);
  color: var(--muted-strong);
  font-size: 0.75rem;
  font-weight: 800;
}

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

.family-card-state {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 10px 0 0;
  padding: 8px 10px;
  border: 1px solid rgba(124, 227, 171, 0.28);
  border-radius: 14px;
  background: rgba(124, 227, 171, 0.1);
  color: rgba(218, 255, 233, 0.92);
  font-size: 0.78rem;
  font-weight: 900;
}

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

.family-card-state.is-tracked {
  border-color: rgba(97, 166, 255, 0.34);
  background: rgba(40, 95, 190, 0.16);
}

.family-card-state.is-requested {
  border-color: rgba(247, 177, 74, 0.35);
  background: rgba(247, 177, 74, 0.13);
  color: rgba(255, 225, 176, 0.95);
}

.family-card-state.is-available {
  border-color: rgba(124, 227, 171, 0.34);
  background: rgba(124, 227, 171, 0.12);
}

.family-card-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.family-card-actions .btn {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 0.88rem;
}

.family-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
}

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

.family-degraded-banner {
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(247, 177, 74, 0.35);
  background: rgba(247, 177, 74, 0.12);
  color: rgba(255, 225, 176, 0.96);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.45;
}

.family-push-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(99, 102, 241, 0.08);
  flex-wrap: wrap;
}
.family-push-banner p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  flex: 1;
  min-width: 160px;
}

.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(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.family-request-thumb {
  width: 48px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

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

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

.family-request-detail {
  margin: 3px 0 0;
  color: rgba(247, 177, 74, 0.9);
  font-size: 0.82rem;
  font-weight: 800;
}

.family-status.is-available {
  background: rgba(124, 227, 171, 0.16);
  color: var(--good);
}

.family-status.is-failed,
.family-status.is-declined {
  background: rgba(255, 141, 148, 0.14);
  color: var(--bad);
}

.family-status.is-processing,
.family-status.is-approved {
  background: rgba(56, 189, 248, 0.16);
  color: var(--accent-soft);
}

.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: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 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: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.08);
}

.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: rgba(15, 17, 22, 0.97);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 14px 32px rgba(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: rgba(255, 255, 255, 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;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.family-picker-item:hover,
.family-picker-item:focus-visible {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
}

.family-picker-poster {
  width: 40px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 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: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
}

.family-empty.compact {
  padding: 16px;
}

.family-empty h3,
.family-empty p {
  margin: 0;
}

.family-empty p {
  margin-top: 6px;
}

.family-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 44px));
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: rgba(9, 14, 23, 0.94);
  color: var(--text);
  box-shadow: var(--shadow);
}

.family-toast.is-success {
  border-color: rgba(124, 227, 171, 0.34);
}

.family-toast.is-error {
  border-color: rgba(255, 141, 148, 0.38);
}
/* ===== Family login page (PIN + WebAuthn) ===== */

.family-login-shell {
  width: min(540px, calc(100vw - 32px));
  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(99, 102, 241, 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), var(--brand-indigo));
  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), var(--brand-indigo));
  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;
}

@media (max-width: 480px) {
  .family-login-shell {
    padding: 32px 0 40px;
  }

  .family-login-key {
    padding: 16px 0;
    font-size: 1.25rem;
  }
}

/* ===== Family devices panel ===== */

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

.family-device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(170, 195, 230, 0.16);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    rgba(11, 17, 28, 0.7);
}

.family-device-meta {
  display: grid;
  gap: 2px;
}

.family-device-label {
  font-weight: 600;
}

.family-device-sub {
  font-size: 0.85rem;
  color: var(--muted-strong);
}

.family-device-actions {
  display: flex;
  gap: 6px;
}

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

.family-device-action:hover {
  color: var(--text);
  border-color: rgba(56, 189, 248, 0.5);
}

.family-device-action.is-danger:hover {
  color: #ff8a8a;
  border-color: rgba(255, 130, 130, 0.5);
}

.family-add-device {
  appearance: none;
  font: inherit;
  font-weight: 600;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px dashed rgba(170, 195, 230, 0.32);
  color: var(--text);
  background: transparent;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.family-add-device:hover {
  border-color: rgba(120, 170, 255, 0.6);
  background: rgba(60, 100, 220, 0.12);
}

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

.family-audit {
  margin-top: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(170, 195, 230, 0.16);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.005)),
    rgba(9, 14, 22, 0.6);
}

.family-audit > summary {
  font-weight: 600;
  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: 320px;
  overflow-y: auto;
}

.family-audit-row {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(11, 17, 28, 0.45);
  border: 1px solid rgba(170, 195, 230, 0.1);
}

.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: 600;
}

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

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

.family-help > summary,
.family-login-help > summary {
  font-weight: 600;
  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 (max-width: 860px) {
  .family-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 18px;
  }

  .family-hero,
  .family-panel {
    border-radius: 22px;
    padding: 18px;
  }

  .family-grid,
  .family-card,
  .family-form-row {
    grid-template-columns: 1fr;
  }

  .family-card-poster,
  .family-poster-placeholder {
    width: 100%;
    height: 260px;
  }

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

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