/* Family onboarding shares the app's Cairo type, book mascot and teal/gold palette. */
.family-flow {
  --family-brand: #005078;
  --family-ink: #14394b;
  --family-muted: #587584;
  --family-line: #d8e5e9;
  --family-surface: #f3f8fb;
  --family-gold: #ffb800;
  font-family: Cairo, Arial, sans-serif;
  color: var(--family-ink);
  font-size: 16px;
  line-height: 1.8;
  direction: rtl;
  text-align: right;
}
.family-flow * {
  box-sizing: border-box;
}
.family-flow [hidden] {
  display: none !important;
}
.family-flow h1,
.family-flow h2,
.family-flow p {
  margin: 0;
}
.family-flow button,
.family-flow input {
  font: inherit;
}
.family-flow button,
.family-flow a,
.family-flow input {
  touch-action: manipulation;
}
.family-flow a {
  color: var(--family-brand);
}
.family-flow a:focus-visible,
.family-flow button:focus-visible,
.family-flow input:focus-visible {
  outline: 3px solid var(--family-gold);
  outline-offset: 4px;
}
.family-flow button {
  cursor: pointer;
}
.family-flow button:disabled {
  cursor: wait;
  opacity: 0.65;
}
.family-flow .family-muted,
.family-flow .family-heading p {
  color: var(--family-muted);
}
.family-flow .family-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 12px 20px;
  border: 0;
  border-radius: 16px;
  background: var(--family-brand);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
}
.family-flow .family-primary:hover {
  background: #003a57;
}
.family-flow .family-alert {
  padding: 12px 16px;
  margin-bottom: 16px;
  border: 1px solid #efd4d9;
  border-radius: 14px;
  background: #fff4f5;
  color: #943a48;
  font-size: 15px;
}
.family-flow .family-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 24px;
  margin-top: 26px;
  font-size: 14px;
}
.family-flow .family-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  text-decoration: none;
}
.family-entry {
  padding: 44px 20px;
  background: var(--family-surface);
}
.family-entry-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  max-width: 940px;
  margin: auto;
  border: 1px solid var(--family-line);
  border-radius: 28px;
  overflow: hidden;
  background: white;
  box-shadow: 0 12px 40px #14394b0b;
}
.family-entry-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 34px 28px;
  background: linear-gradient(145deg, #005078, #087ca1);
  color: #fff;
  text-align: center;
}
.family-flow .family-entry-hero .family-brand {
  color: white;
}
.family-entry-hero .family-brand img {
  background: white;
  padding: 4px;
  border-radius: 10px;
  object-fit: contain;
}
.family-entry-hero .family-mascot {
  width: 188px;
  height: auto;
  object-fit: contain;
}
.family-flow .family-entry-hero h1 {
  font-size: 36px;
  line-height: 1.55;
  font-weight: 800;
  color: #fff;
}
.family-entry-hero h1 em {
  font-style: normal;
  color: var(--family-gold);
}
.family-entry-hero p {
  color: #e0f3fb;
  font-size: 15px;
}
.family-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  max-width: 340px;
}
.family-features span {
  padding: 4px 11px;
  border-radius: 30px;
  background: #ffffff1c;
}
.family-entry-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 40px 28px;
  text-align: center;
}
.family-flow .family-entry-form h2 {
  font-size: 26px;
  font-weight: 800;
  color: var(--family-ink);
}
.family-google {
  display: flex;
  justify-content: center;
  min-height: 44px;
  width: 100%;
}
.family-google[aria-busy="true"] {
  pointer-events: none;
  opacity: 0.65;
}
.family-privacy-link {
  font-size: 14px;
  text-underline-offset: 4px;
}
.family-profiles {
  min-height: 70vh;
  background: var(--family-surface);
  padding: 28px 20px 42px;
}
.family-shell {
  max-width: 900px;
  margin: auto;
}
.family-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 24px;
  font-size: 14px;
}
.family-toolbar > div {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.family-owner {
  color: var(--family-muted);
}
.family-owner strong {
  display: inline-block;
  margin-inline-start: 5px;
  color: var(--family-ink);
}
.family-heading {
  text-align: center;
  margin: 4px 0 28px;
}
.family-heading > img {
  object-fit: contain;
  margin-bottom: 10px;
}
.family-flow .family-heading h1 {
  font-size: 30px;
  line-height: 1.5;
  font-weight: 800;
  color: var(--family-ink);
  margin-bottom: 6px;
}
.family-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
}
.family-profile-entry {
  display: flex;
  flex-direction: column;
  background: white;
  border: 1px solid var(--family-line);
  border-radius: 24px;
}
.family-profile-entry .family-profile-card {
  flex: 1;
  width: 100%;
  border: 0;
}
.family-profile-manage {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-evenly;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--family-line);
}
.family-profile-manage button {
  min-height: 40px;
  padding: 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  color: var(--family-brand);
}
.family-profile-manage button:hover {
  background: var(--family-surface);
}
.family-profile-manage .family-delete-link {
  color: #a82f3c;
}
.family-delete-dialog {
  width: min(460px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  margin: auto;
  padding: 28px;
  border: 1px solid var(--family-line);
  border-radius: 24px;
  color: var(--family-ink);
  font-family: inherit;
  text-align: right;
}
.family-delete-dialog::backdrop {
  background: #14394b80;
}
.family-flow .family-delete-dialog h2 {
  font-size: 24px;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.family-delete-dialog p {
  color: var(--family-muted);
  font-size: 16px;
  line-height: 1.9;
}
.family-delete-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}
.family-delete-actions button {
  flex: 1 1 auto;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--family-line);
  border-radius: 14px;
  background: white;
  color: var(--family-brand);
  font-weight: 700;
}
.family-delete-actions .family-danger {
  background: #a82f3c;
  border-color: #a82f3c;
  color: white;
}
.family-delete-actions button:disabled {
  opacity: 0.65;
}
.family-profile-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 16px 18px;
  min-height: 276px;
  background: white;
  border: 1px solid var(--family-line);
  border-radius: 24px;
  color: var(--family-ink);
  text-align: center;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.family-profile-card:hover {
  border-color: var(--family-brand);
  box-shadow: 0 8px 24px #0050780f;
}
.family-profile-card > strong {
  font-size: 20px;
  overflow-wrap: anywhere;
}
.family-profile-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: #e7f3f8;
}
.family-profile-avatar img {
  object-fit: contain;
}
.family-profile-grade {
  color: var(--family-muted);
  font-size: 14px;
}
.family-profile-stats {
  font-size: 12px;
  color: var(--family-muted);
}
.family-profile-action {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-top: auto;
  padding-top: 12px;
  width: 100%;
  border-top: 1px solid #e9f0f4;
  color: var(--family-brand);
  font-size: 14px;
  font-weight: 700;
}
.family-current {
  position: absolute;
  top: 0;
  transform: translateY(-50%);
  padding: 1px 12px;
  border-radius: 20px;
  background: #e6f4ed;
  color: #18734e;
  font-size: 12px;
}
.family-add-card {
  justify-content: center;
  background: #ffffff80;
  border: 2px dashed #b9cdd7;
}
.family-add-icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #e7f3f8;
  color: var(--family-brand);
  font-size: 38px;
  font-weight: 400;
  line-height: 1;
}
.family-setup {
  max-width: 600px;
  margin: 0 auto;
}
.family-back {
  display: block;
  margin-bottom: 14px;
  padding: 6px 0;
  color: var(--family-brand);
  background: none;
  border: 0;
  font-size: 14px !important;
}
.family-steps {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin: 0 0 20px;
  color: var(--family-muted);
  font-size: 13px;
}
.family-steps .is-current {
  font-weight: 700;
  color: var(--family-brand);
}
.family-form-card {
  padding: 28px;
  border: 1px solid var(--family-line);
  border-radius: 24px;
  background: white;
}
.family-form-heading {
  margin-bottom: 24px;
}
.family-flow .family-form-heading h1 {
  font-size: 26px;
  line-height: 1.6;
  font-weight: 800;
  color: var(--family-ink);
}
.family-field {
  display: block;
  margin: 0 0 22px;
  padding: 0;
  border: 0;
  min-width: 0;
}
.family-field > label,
.family-field > legend {
  display: block;
  float: none;
  width: auto;
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 10px;
  padding: 0;
  color: var(--family-ink);
}
.family-field > input[type="text"] {
  width: 100%;
  min-height: 54px;
  padding: 12px 16px;
  border: 1px solid var(--family-line);
  border-radius: 14px;
  background: #f3f8fb;
  color: var(--family-ink);
  text-align: right;
  direction: rtl;
  font-size: 18px;
}
.family-field > input[type="text"]::placeholder {
  color: #75909e;
  font-size: 16px;
}
.family-avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  max-width: 480px;
  margin: auto;
}
.family-avatar-choice {
  position: relative;
  display: flex;
  justify-content: center;
  cursor: pointer;
}
.family-avatar-choice > input,
.family-stage-choice > input,
.family-grade-choice > input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.family-avatar-choice > span {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 66px;
  height: 66px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: #eef6fa;
}
.family-avatar-choice img {
  object-fit: contain;
  width: 44px;
  height: 44px;
}
.family-avatar-choice > input:checked + span {
  border-color: var(--family-brand);
  background: #e3f2fa;
}
.family-avatar-check {
  display: none;
  position: absolute;
  bottom: -2px;
  inset-inline-end: -2px;
  background: var(--family-gold);
  border: 2px solid white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 12px;
  line-height: 18px;
  font-weight: 800;
  color: var(--family-ink);
}
.family-avatar-choice > input:checked + span > .family-avatar-check {
  display: block;
}
.family-stage-grid,
.family-grade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 9px;
}
.family-stage-choice,
.family-grade-choice {
  position: relative;
  cursor: pointer;
  min-width: 0;
}
.family-stage-choice > span,
.family-grade-choice > span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 8px;
  border: 1px solid var(--family-line);
  border-radius: 12px;
  color: var(--family-ink);
  background: #fff;
  text-align: center;
  font-size: 14px;
}
.family-stage-choice > input:checked + span {
  background: var(--family-brand);
  border-color: var(--family-brand);
  color: white;
  font-weight: 700;
}
.family-grade-choice > input:checked + span {
  background: #fff4cd;
  border-color: #e9b34c;
  font-weight: 700;
}
.family-avatar-choice > input:focus-visible + span,
.family-stage-choice > input:focus-visible + span,
.family-grade-choice > input:focus-visible + span {
  outline: 3px solid var(--family-gold);
  outline-offset: 3px;
}
.family-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #ffffff70;
  border-top-color: white;
  animation: family-spin 0.7s linear infinite;
}
@keyframes family-spin {
  to {
    transform: rotate(360deg);
  }
}
.family-consent-shell {
  margin: 0;
  background: #f3f8fb;
}
.family-consent {
  max-width: 540px;
  margin: 48px auto;
  padding: 30px;
  border: 1px solid #d8e5e9;
  border-radius: 24px;
  background: white;
  box-shadow: 0 12px 40px #14394b0b;
}
.family-consent .family-brand {
  justify-content: flex-start;
  margin-bottom: 24px;
}
.family-flow.family-consent h1 {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.5;
  color: var(--family-ink);
  margin-bottom: 18px;
}
.family-consent .family-notice {
  padding: 20px;
  background: #f3f8fb;
  border: 1px solid var(--family-line);
  border-radius: 18px;
  margin-bottom: 24px;
}
.family-consent .family-notice p {
  font-size: 18px;
  line-height: 1.9;
  margin-bottom: 14px;
}
.family-consent .family-notice a {
  font-size: 14px;
  text-underline-offset: 4px;
}
.family-consent .family-secondary {
  display: block;
  width: 100%;
  margin-top: 14px;
  border: 1px solid var(--family-line);
  border-radius: 14px;
  padding: 12px 16px;
  background: white;
  color: var(--family-brand);
  font-weight: 700;
}
.family-consent .family-small {
  font-size: 14px;
  color: var(--family-muted);
  margin-top: 14px;
}
.family-consent #message:empty {
  display: none;
}
.family-consent #message {
  margin: 16px 0;
  color: #943a48;
  font-size: 15px;
}
@media (max-width: 680px) {
  .family-entry {
    padding: 20px 12px;
  }
  .family-entry-grid {
    grid-template-columns: 1fr;
    border-radius: 24px;
  }
  .family-entry-hero {
    padding: 24px 18px;
    gap: 14px;
  }
  .family-entry-hero .family-mascot {
    width: 132px;
  }
  .family-flow .family-entry-hero h1 {
    font-size: 29px;
  }
  .family-entry-form {
    padding: 26px 16px;
    gap: 20px;
  }
  .family-flow .family-entry-form h2 {
    font-size: 23px;
  }
  .family-features {
    font-size: 12px;
    max-width: 300px;
  }
  .family-profiles {
    padding: 20px 12px 30px;
  }
  .family-toolbar {
    align-items: flex-start;
    font-size: 12px;
    padding-bottom: 22px;
    gap: 8px;
  }
  .family-toolbar > div {
    gap: 10px;
    justify-content: flex-end;
  }
  .family-owner {
    max-width: 58%;
  }
  .family-flow .family-heading h1 {
    font-size: 27px;
  }
  .family-profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 10px;
  }
  .family-profile-card {
    padding: 23px 10px 14px;
    min-height: 255px;
    border-radius: 20px;
    gap: 8px;
  }
  .family-profile-card > strong {
    font-size: 18px;
  }
  .family-profile-avatar {
    width: 76px;
    height: 76px;
  }
  .family-profile-avatar img {
    width: 54px;
    height: 54px;
  }
  .family-profile-action {
    font-size: 12px;
    gap: 8px;
  }
  .family-form-card {
    padding: 22px 18px;
    border-radius: 20px;
  }
  .family-flow .family-form-heading h1 {
    font-size: 23px;
  }
  .family-avatar-grid {
    gap: 4px;
  }
  .family-avatar-choice > span {
    width: 43px;
    height: 43px;
  }
  .family-avatar-choice img {
    width: 32px;
    height: 32px;
  }
  .family-avatar-check {
    width: 18px;
    height: 18px;
    line-height: 14px;
    font-size: 10px;
  }
  .family-stage-grid,
  .family-grade-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .family-consent {
    margin: 20px 12px;
    padding: 24px 20px;
  }
  .family-flow.family-consent h1 {
    font-size: 25px;
  }
  .family-consent .family-notice {
    padding: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .family-flow * {
    animation: none !important;
    transition: none !important;
  }
}
