.auth-page {
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 211, 78, .22), transparent 26rem),
    radial-gradient(circle at 92% 18%, rgba(223, 245, 255, .85), transparent 28rem),
    var(--cream);
}

.auth-shell {
  width: min(980px, calc(100% - 28px));
  min-height: calc(100vh - 170px);
  margin: 0 auto;
  padding: 46px 0 70px;
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(560px, 100%);
  padding: 30px;
  border: 1px solid rgba(82, 22, 140, .09);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, .97);
  box-shadow: var(--shadow);
}

.auth-card.wide { width: min(920px, 100%); }
.auth-icon { font-size: 58px; line-height: 1; margin-bottom: 12px; text-align: center; }
.auth-card > h1, .auth-card > p { text-align: center; }
.auth-card > h1 { margin-bottom: 10px; font-size: clamp(2rem, 7vw, 3.2rem); }
.auth-card > p { margin-bottom: 24px; color: var(--muted); line-height: 1.55; }

.auth-form { display: grid; gap: 17px; }
.form-field { display: grid; gap: 7px; }
.form-field label { font-weight: 900; color: var(--ink); }
.form-field small { color: var(--muted); line-height: 1.4; }
.form-field input {
  width: 100%;
  min-height: 54px;
  padding: 0 15px;
  border: 2px solid #eadff1;
  border-radius: 16px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-field input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 4px rgba(114, 39, 184, .11);
}
.form-field input:disabled { opacity: .65; }

.password-field { position: relative; }
.password-field input { padding-right: 56px; }
.password-toggle {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: #f5eef9;
  cursor: pointer;
}

.auth-submit { width: 100%; margin-top: 4px; }
.auth-links {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  color: var(--purple-dark);
  font-weight: 900;
  text-align: center;
}
.auth-links a { text-decoration: underline; text-underline-offset: 3px; }

.form-message {
  margin: 0 0 17px;
  padding: 14px 16px;
  border-radius: 15px;
  line-height: 1.45;
  font-weight: 800;
}
.form-message[hidden] { display: none; }
.form-message.info { background: #edf8ff; color: #23546d; }
.form-message.success { background: #e8f9eb; color: #246335; }
.form-message.error { background: #fff0f0; color: #8a2630; }

.auth-state-card { text-align: center; }
.auth-state-card .auth-icon { font-size: 72px; }
.pending-email {
  display: inline-block;
  margin: 4px 0 22px;
  padding: 9px 13px;
  border-radius: 999px;
  background: #f5eef9;
  color: var(--purple-dark);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.account-loading {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 40px 20px;
  color: var(--muted);
  font-weight: 900;
}
.loading-spinner {
  width: 44px;
  height: 44px;
  border: 5px solid #eadff1;
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: lila-spin .8s linear infinite;
}
@keyframes lila-spin { to { transform: rotate(360deg); } }

.account-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.account-heading h1 { margin-bottom: 7px; font-size: clamp(2rem, 6vw, 3.2rem); }
.account-heading p { margin-bottom: 0; color: var(--muted); }
.account-avatar {
  flex: 0 0 auto;
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border-radius: 25px;
  background: linear-gradient(145deg, #ffe892, #f5dcff);
  font-size: 40px;
}

.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.account-panel {
  padding: 22px;
  border: 1px solid rgba(82, 22, 140, .08);
  border-radius: 22px;
  background: #fffdf9;
}
.account-panel h2 { margin-bottom: 16px; font-size: 1.35rem; }
.data-list { display: grid; gap: 13px; }
.data-row {
  display: grid;
  grid-template-columns: minmax(110px, .7fr) minmax(0, 1.3fr);
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed #eadff1;
}
.data-row:last-child { padding-bottom: 0; border-bottom: 0; }
.data-label { color: var(--muted); font-size: .9rem; font-weight: 900; }
.data-value { min-width: 0; font-weight: 900; overflow-wrap: anywhere; }
.subscription-status {
  display: inline-flex;
  width: fit-content;
  padding: 7px 11px;
  border-radius: 999px;
  background: #f2e8fa;
  color: var(--purple-dark);
}
.subscription-status[data-status="active"] { background: #e4f8e8; color: #246335; }
.subscription-status[data-status="past_due"] { background: #fff1d3; color: #754d00; }
.subscription-status[data-status="canceled"],
.subscription-status[data-status="refunded"],
.subscription-status[data-status="expired"] { background: #fff0f0; color: #8a2630; }

.future-panel {
  margin-top: 18px;
  padding: 20px;
  border-radius: 22px;
  background: linear-gradient(135deg, #f7efff, #edfaff);
  text-align: center;
}
.future-panel h2 { margin-bottom: 8px; font-size: 1.35rem; }
.future-panel p { margin-bottom: 0; color: var(--muted); line-height: 1.5; }
.account-actions { margin-top: 22px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }

@media (max-width: 700px) {
  .auth-shell { padding: 28px 0 48px; }
  .auth-card { padding: 24px 18px; border-radius: 25px; }
  .account-grid { grid-template-columns: 1fr; }
  .account-heading { align-items: center; }
  .account-avatar { width: 64px; height: 64px; border-radius: 20px; font-size: 32px; }
  .data-row { grid-template-columns: 1fr; gap: 3px; }
  .account-actions { flex-direction: column; }
  .account-actions .primary-btn, .account-actions .secondary-btn { width: 100%; }
}

/* V9 — Perfis infantis */
.account-shell { width: min(1120px, calc(100% - 28px)); }
.account-shell .auth-card.wide { width: 100%; }
.children-panel {
  margin-top: 20px;
  padding: 24px;
  border: 1px solid rgba(82, 22, 140, .08);
  border-radius: 24px;
  background: linear-gradient(145deg, #fffdf8, #f9f2ff);
}
.children-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.children-panel-heading h2 { margin-bottom: 7px; font-size: clamp(1.65rem, 4vw, 2.35rem); }
.children-panel-heading p { max-width: 670px; margin-bottom: 0; color: var(--muted); line-height: 1.5; }
.compact-btn { min-height: 48px; padding: 0 17px; flex: 0 0 auto; }
.children-loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 22px; color: var(--muted); font-weight: 900; }
.loading-spinner.small { width: 30px; height: 30px; border-width: 4px; }
.children-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.child-profile-card {
  padding: 16px;
  border: 1px solid rgba(82, 22, 140, .09);
  border-radius: 21px;
  background: white;
  box-shadow: 0 10px 24px rgba(66, 30, 88, .08);
}
.child-profile-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.profile-avatar, .chooser-avatar {
  flex: 0 0 auto;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffe992, #eadcff);
  box-shadow: 0 7px 18px rgba(66, 30, 88, .14);
}
.profile-avatar { width: 72px; height: 72px; }
.profile-avatar img, .chooser-avatar img { width: 100%; height: 100%; object-fit: cover; }
.emoji-profile-avatar { font-size: 36px; }
.child-profile-info { min-width: 0; }
.child-profile-info h3 { margin-bottom: 4px; font-size: 1.28rem; overflow-wrap: anywhere; }
.child-profile-info p { margin-bottom: 7px; color: var(--muted); font-size: .9rem; line-height: 1.35; }
.child-locale-pill { display: inline-flex; padding: 5px 9px; border-radius: 999px; background: #f2e8fa; color: var(--purple-dark); font-size: .76rem; font-weight: 900; }
.child-card-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.child-action {
  min-height: 37px;
  padding: 0 10px;
  border: 0;
  border-radius: 11px;
  background: #f5eef9;
  color: var(--purple-dark);
  font-size: .82rem;
  font-weight: 900;
  cursor: pointer;
}
.child-action.play { background: #e8f8ec; color: #246335; }
.child-action.danger { background: #fff0f0; color: #8a2630; }
.children-empty { padding: 30px 18px; border: 2px dashed #e5d5ef; border-radius: 21px; text-align: center; background: rgba(255,255,255,.62); }
.children-empty > span { display: block; margin-bottom: 8px; font-size: 48px; }
.children-empty h2, .children-empty h3 { margin-bottom: 8px; }
.children-empty p { max-width: 560px; margin: 0 auto 18px; color: var(--muted); line-height: 1.5; }
.privacy-note { margin: 16px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.5; text-align: center; }

.child-dialog {
  width: min(760px, calc(100% - 24px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: white;
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(35, 15, 49, .35);
}
.child-dialog::backdrop { background: rgba(38, 16, 52, .68); backdrop-filter: blur(8px); }
.child-form { display: grid; gap: 18px; padding: 26px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-heading h2 { margin-bottom: 0; font-size: clamp(1.7rem, 5vw, 2.4rem); }
.dialog-close { width: 42px; height: 42px; border: 0; border-radius: 13px; background: #f5eef9; color: var(--purple-dark); font-size: 28px; line-height: 1; cursor: pointer; }
.form-field select {
  width: 100%;
  min-height: 54px;
  padding: 0 42px 0 15px;
  border: 2px solid #eadff1;
  border-radius: 16px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  outline: none;
}
.form-field select:focus { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(114, 39, 184, .11); }
.form-grid.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.avatar-fieldset { margin: 0; padding: 0; border: 0; }
.avatar-fieldset legend { margin-bottom: 10px; font-weight: 900; }
.avatar-options { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px; }
.avatar-option { position: relative; display: grid; justify-items: center; gap: 6px; min-width: 0; padding: 8px 5px 9px; border: 2px solid #eadff1; border-radius: 17px; background: #fff; color: var(--muted); font-size: .76rem; font-weight: 900; cursor: pointer; }
.avatar-option input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-option:has(input:checked) { border-color: var(--purple); background: #faf4ff; color: var(--purple-dark); box-shadow: 0 0 0 3px rgba(114,39,184,.09); }
.avatar-visual { width: 58px; height: 58px; overflow: hidden; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(145deg,#ffe992,#eadcff); }
.avatar-visual img { width: 100%; height: 100%; object-fit: cover; }
.emoji-avatar { font-size: 31px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 3px; }
body.dialog-open { overflow: hidden; }

.profile-picker-page { min-height: 100vh; }
.profile-picker-shell { width: min(1050px, calc(100% - 28px)); min-height: calc(100vh - 168px); margin: 0 auto; padding: 48px 0 65px; display: grid; place-items: center; }
.profile-picker-card { width: 100%; padding: 34px; border: 1px solid rgba(82,22,140,.09); border-radius: 32px; background: rgba(255,255,255,.97); box-shadow: var(--shadow); }
.picker-heading { max-width: 700px; margin: 0 auto 27px; text-align: center; }
.picker-heading h1 { margin-bottom: 10px; }
.picker-heading p { margin-bottom: 0; color: var(--muted); font-size: 1.07rem; line-height: 1.5; }
.chooser-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.chooser-profile-card { min-width: 0; padding: 22px 14px; border: 2px solid #eadff1; border-radius: 25px; background: linear-gradient(160deg,#fff,#fffaf1); color: var(--ink); display: grid; justify-items: center; gap: 8px; cursor: pointer; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.chooser-profile-card:hover { transform: translateY(-4px); border-color: var(--purple); box-shadow: 0 17px 30px rgba(66,30,88,.15); }
.chooser-profile-card:active { transform: scale(.98); }
.chooser-avatar { width: 128px; height: 128px; margin-bottom: 4px; font-size: 65px; }
.chooser-profile-card strong { max-width: 100%; font-size: 1.35rem; overflow-wrap: anywhere; }
.chooser-profile-card > span:last-child { color: var(--purple); font-size: .86rem; font-weight: 900; }
.picker-footer-actions { margin-top: 24px; display: flex; justify-content: center; }

@media (max-width: 780px) {
  .children-panel-heading { flex-direction: column; }
  .compact-btn { width: 100%; }
  .children-grid { grid-template-columns: 1fr; }
  .avatar-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chooser-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .children-panel { padding: 19px 15px; }
  .child-profile-card { padding: 14px; }
  .child-profile-main { align-items: flex-start; }
  .profile-avatar { width: 64px; height: 64px; }
  .child-card-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .child-action { width: 100%; }
  .child-action.play { grid-column: 1 / -1; }
  .child-form { padding: 21px 16px; }
  .form-grid.two-fields { grid-template-columns: 1fr; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .primary-btn, .dialog-actions .secondary-btn { width: 100%; }
  .profile-picker-shell { padding: 28px 0 45px; }
  .profile-picker-card { padding: 25px 15px; border-radius: 26px; }
  .chooser-grid { gap: 11px; }
  .chooser-profile-card { padding: 17px 8px; border-radius: 21px; }
  .chooser-avatar { width: 104px; height: 104px; font-size: 53px; }
  .chooser-profile-card strong { font-size: 1.14rem; }
}
