:root {
  --bg: #0b0f12;
  --panel: #10161d;
  --panel-strong: #121b24;
  --muted: #9aa4ab;
  --text: #e6eef6;
  --accent: #7c5cff;
  --accent-2: #4dd0e1;
  --border: rgba(255, 255, 255, 0.08);
  --soft-glass: rgba(255, 255, 255, 0.03);
  --card-radius: 14px;
}
* {
  box-sizing: border-box;
}
html,
body {
  min-height: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top, rgba(124, 92, 255, 0.12), transparent 28%),
    linear-gradient(180deg, #060b12 0%, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-screen.hidden,
.dashboard-shell.hidden,
.startup-screen.hidden {
  display: none;
}
.startup-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(124, 92, 255, 0.1), transparent 42%),
    linear-gradient(180deg, #070b12 0%, #0b0f12 100%);
  color: var(--text);
}
.startup-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}
.startup-content {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 12px;
  animation: startup-rise 0.55s ease both;
}
.startup-mark {
  color: var(--accent-2);
  font-size: clamp(2.8rem, 12vw, 5.2rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-shadow: 0 0 34px rgba(77, 208, 225, 0.2);
}
.startup-rule {
  width: 72px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  animation: startup-rule 1.8s ease-in-out infinite;
}
.startup-kicker {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.startup-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.startup-dots {
  display: inline-block;
  width: 1.4em;
  text-align: left;
  animation: startup-dots 1.2s steps(4, end) infinite;
}
@keyframes startup-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes startup-rule {
  0%,
  100% {
    opacity: 0.5;
    transform: scaleX(0.72);
  }
  50% {
    opacity: 1;
    transform: scaleX(1);
  }
}
@keyframes startup-dots {
  0%,
  25% {
    opacity: 0.35;
  }
  50% {
    opacity: 0.65;
  }
  75%,
  100% {
    opacity: 1;
  }
}
.auth-card {
  width: min(100%, 420px);
  background: linear-gradient(
    180deg,
    rgba(17, 22, 30, 0.95),
    rgba(12, 17, 22, 0.96)
  );
  border: 1px solid rgba(124, 92, 255, 0.2);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow:
    0 20px 60px rgba(5, 8, 14, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  text-align: center;
}
.auth-form-card {
  text-align: left;
}
.auth-brand {
  font-size: 1.8rem;
  margin-bottom: 8px;
}
.auth-title {
  margin: 0 0 24px;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.08;
  color: var(--text);
}
.auth-subtitle {
  margin: 8px 0 16px;
  font-size: 1.8rem;
}
.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}
.auth-btn {
  width: 100%;
  justify-content: center;
}
.secondary {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.auth-input {
  width: 100%;
  margin-bottom: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  padding: 12px 14px;
}
.auth-error {
  min-height: 20px;
  color: #ff7a7a;
  font-size: 0.85rem;
  margin-bottom: 8px;
}
.password-field {
  position: relative;
}
.password-field .auth-input {
  padding-right: 68px;
}
.password-toggle {
  position: absolute;
  top: 12px;
  right: 10px;
  border: none;
  background: transparent;
  color: var(--accent-2);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 4px 6px;
  cursor: pointer;
}
.auth-note {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
  margin-top: 12px;
  line-height: 1.5;
}
.link-btn {
  border: none;
  background: transparent;
  color: var(--accent-2);
  text-align: center;
  width: 100%;
  margin-top: 10px;
  padding: 0;
  font-weight: 600;
}
.account-type-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 18px 0 18px;
}
.account-type-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(124, 92, 255, 0.2);
  border-radius: 16px;
  color: var(--text);
  text-align: left;
  padding: 18px 16px;
  display: block;
}
.account-type-card.selected {
  background: linear-gradient(
    90deg,
    rgba(124, 92, 255, 0.14),
    rgba(77, 208, 225, 0.08)
  );
  border-color: rgba(77, 208, 225, 0.35);
}
.account-type-title {
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}
.account-type-copy {
  color: var(--muted);
  line-height: 1.5;
}
.account-type-badge {
  display: inline-block;
  padding: 8px 12px;
  background: rgba(77, 208, 225, 0.08);
  border: 1px solid rgba(77, 208, 225, 0.25);
  border-radius: 999px;
  color: var(--accent-2);
  font-weight: 700;
  font-size: 0.8rem;
  margin-bottom: 12px;
}
.child-option-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 16px 0;
}
.child-option-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(124, 92, 255, 0.2);
  border-radius: 16px;
  color: var(--text);
  text-align: left;
  padding: 18px 16px;
  display: block;
}
.child-option-card:hover {
  border-color: rgba(77, 208, 225, 0.35);
}
.child-option-title {
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}
.child-option-copy {
  color: var(--muted);
  line-height: 1.5;
}
.dashboard-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  overflow: visible;
}
.main-content {
  width: min(980px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 14px 0 90px;
  min-height: 100vh;
  overflow: visible;
}
.desktop-only {
  display: none;
}
.mobile-only {
  display: flex;
}
.topbar {
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}
.brand {
  font-weight: 800;
  color: var(--accent);
  font-size: 1.2rem;
}
.coins-text {
  color: var(--muted);
  font-size: 0.95rem;
}
.view {
  display: none;
}
.view.active {
  display: block;
}
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.section-title {
  font-size: 1.25rem;
  font-weight: 800;
}
.section-sub {
  color: var(--muted);
  margin-top: 6px;
  font-size: 0.95rem;
}
.panel {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.028),
    rgba(255, 255, 255, 0.01)
  );
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--card-radius);
  padding: 16px;
  margin-bottom: 14px;
  min-width: 0;
  overflow-wrap: anywhere;
  box-shadow:
    0 6px 18px rgba(3, 6, 8, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.01);
}
/* Rewards shop styles */
.rewards-top {
  padding: 12px 16px;
}
.coin-badge {
  background: linear-gradient(
    90deg,
    rgba(124, 92, 255, 0.14),
    rgba(77, 208, 225, 0.06)
  );
  padding: 8px 12px;
  border-radius: 12px;
  font-weight: 800;
  color: var(--accent-2);
}
.rewards-tabs {
  display: flex;
  gap: 8px;
}
.tab-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 12px;
}
.tab-btn.active {
  background: linear-gradient(
    90deg,
    rgba(124, 92, 255, 0.12),
    rgba(77, 208, 225, 0.05)
  );
  color: var(--text);
  border-color: rgba(124, 92, 255, 0.16);
}
.rewards-panel {
  padding: 12px 12px 20px;
}
.rewards-grid {
  display: grid;
  gap: 14px;
}
@media (min-width: 1100px) {
  .rewards-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (min-width: 768px) and (max-width: 1099px) {
  .rewards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 767px) {
  .rewards-grid {
    grid-template-columns: 1fr;
  }
}
.reward-card {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.008)
  );
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 16px;
  box-shadow:
    0 8px 30px rgba(2, 6, 10, 0.5),
    0 0 18px rgba(124, 92, 255, 0.03);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.reward-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.reward-name {
  font-weight: 800;
  font-size: 1.05rem;
}
.reward-cost {
  color: var(--accent-2);
  font-weight: 800;
}
.reward-badge {
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.16);
}
.reward-badge.one {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03),
    rgba(255, 255, 255, 0.01)
  );
  color: var(--muted);
}
.reward-badge.repeat {
  background: linear-gradient(
    90deg,
    rgba(124, 92, 255, 0.16),
    rgba(77, 208, 225, 0.04)
  );
  color: var(--text);
}
.reward-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.history-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.summary-card,
.profile-summary,
.small-card,
.quick-actions,
.placeholder-panel {
  padding: 14px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.summary-label {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 5px;
}
.summary-value {
  font-size: 2rem;
  font-weight: 700;
}
.xp-group {
  margin-top: 18px;
}
.xp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 10px;
}
.xp-bar-bg {
  width: 100%;
  height: 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  overflow: hidden;
}
.xp-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 0%;
  transition: width 0.3s ease;
}
.task-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.006)
  );
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
  box-shadow: 0 6px 16px rgba(2, 6, 10, 0.45);
}
.home-quest-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 18.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  box-sizing: border-box;
}
.home-quest-preview .task-card {
  flex-shrink: 0;
}
.home-quest-preview .task-title,
.home-quest-preview .task-meta,
.home-quest-preview .small {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.task-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}
.task-title {
  font-weight: 800;
  font-size: 1.02rem;
  min-width: 0;
}
.task-meta {
  color: var(--muted);
  font-size: 0.88rem;
}
.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.btn {
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.028);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  min-height: 40px;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}
.btn:hover:not(.disabled) {
  transform: translateY(-2px);
  border-color: rgba(124, 92, 255, 0.45);
}
.btn.primary {
  background: linear-gradient(
    90deg,
    rgba(124, 92, 255, 0.98),
    rgba(77, 208, 225, 0.95)
  );
  border-color: rgba(124, 92, 255, 0.12);
  color: #021018;
  font-weight: 800;
  box-shadow:
    0 6px 18px rgba(76, 43, 208, 0.12),
    0 2px 6px rgba(77, 208, 225, 0.06);
}
.btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-small {
  padding: 6px 10px;
  min-height: 32px;
  font-size: 0.85rem;
  border-radius: 10px;
}
.btn-danger {
  color: #ff9b9b;
  border-color: rgba(255, 107, 107, 0.25);
}
.btn-danger:hover:not(.disabled) {
  border-color: rgba(255, 107, 107, 0.55);
}
.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-head .section-label {
  margin-bottom: 0;
}
.link-action {
  border: none;
  background: transparent;
  color: var(--accent-2);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0;
  cursor: pointer;
}
.link-action.hidden {
  display: none;
}
.quests-tabs-panel {
  padding: 12px 16px;
}
#questPanelActive.hidden,
#questPanelUpcoming.hidden,
#questPanelCompleted.hidden {
  display: none;
}
.small-card .tasks-list,
.quick-actions .tasks-list,
.panel .tasks-list {
  margin-top: 14px;
}
.quick-actions {
  padding: 16px;
}
.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.section-label,
.panel-title {
  font-size: 0.95rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.streak-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(
    90deg,
    rgba(124, 92, 255, 0.04),
    rgba(77, 208, 225, 0.02)
  );
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.streak-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}
.streak-icon {
  background: rgba(124, 92, 255, 0.15);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent);
}
.custom-days {
  margin-top: 12px;
}
.custom-days.hidden {
  display: none;
}
.field-row {
  margin-top: 12px;
}
.field-row.hidden {
  display: none;
}
.field-row > .label {
  display: block;
  margin-bottom: 6px;
}
.recurrence-summary {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(124, 92, 255, 0.08);
  border: 1px solid rgba(124, 92, 255, 0.18);
  color: var(--text);
}
.recurrence-summary.hidden {
  display: none;
}
.day-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.day-grid label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
}
.day-grid input {
  accent-color: var(--accent);
}
.label {
  font-size: 0.95rem;
  color: var(--muted);
}
.placeholder-panel {
  text-align: center;
}
.placeholder-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.placeholder-text {
  color: var(--muted);
  line-height: 1.6;
}
.parent-only.hidden,
.quest-create-control.hidden,
.reward-create-control.hidden,
.child-family-view.hidden,
#profileLinkCodePanel.hidden {
  display: none;
}
.child-family-name {
  color: var(--accent-2);
  font-size: 1.35rem;
  font-weight: 800;
}
.child-family-copy {
  color: var(--muted);
  margin: 6px 0 14px;
}
.family-members {
  display: grid;
  gap: 10px;
}
.family-member-card {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}
.family-member-card span {
  color: var(--muted);
  font-size: 0.9rem;
}
.family-code-panel {
  background: linear-gradient(
    145deg,
    rgba(77, 208, 225, 0.08),
    rgba(124, 92, 255, 0.1)
  );
}
.family-code-copy {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 14px;
}
.family-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.family-code-value {
  color: var(--accent-2);
  font-size: clamp(1.35rem, 4vw, 2rem);
  letter-spacing: 0.12em;
}
.family-code-input {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 800;
}
.family-children {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}
.child-card {
  background: linear-gradient(
    145deg,
    rgba(124, 92, 255, 0.12),
    rgba(77, 208, 225, 0.04) 55%,
    rgba(255, 255, 255, 0.02)
  );
  border: 1px solid rgba(77, 208, 225, 0.18);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(2, 6, 10, 0.4);
}
.child-card-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.child-card-name {
  font-size: 1.1rem;
  font-weight: 800;
}
.child-card-username {
  color: var(--accent-2);
  font-size: 0.88rem;
}
.child-card-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.child-card-stats div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.child-stat-label {
  color: var(--muted);
  font-size: 0.78rem;
}
.child-view-btn {
  width: 100%;
}
.managed-child-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.child-management-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.assign-recurring-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  margin-top: 12px;
}
.assign-recurring-label input {
  accent-color: var(--accent);
}
.assign-quest-note {
  margin-top: 8px;
}
.managed-child-stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.managed-child-stats div {
  display: grid;
  gap: 4px;
}
.managed-child-stats span {
  color: var(--muted);
  font-size: 0.8rem;
}
.managed-quest-list {
  display: grid;
  gap: 8px;
}
.managed-quest-item {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}
.child-form-content h3 {
  margin-bottom: 8px;
}
.form-eyebrow {
  color: var(--accent-2);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}
.form-intro {
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 18px;
}
.form-label {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 10px 0 6px;
}
.child-form-content input,
.child-form-content select {
  width: 100%;
}
.child-form-content .row.actions {
  flex-wrap: wrap;
}

/* Completed task styling */
.task-card.completed {
  opacity: 0.55;
  filter: grayscale(8%);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.01),
    rgba(255, 255, 255, 0.004)
  );
  box-shadow: none;
}
.task-card.completed .task-title {
  text-decoration: line-through;
  color: var(--muted);
  font-weight: 700;
}
.task-card:hover {
  transform: translateY(-4px);
}

/* XP and coins polish */
.summary-card {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
.xp-group {
  flex: 1;
  margin-left: 12px;
}
.xp-head {
  font-weight: 700;
}
.coins-text {
  font-weight: 700;
  color: var(--accent-2);
}

/* Form inputs */
input,
textarea,
select {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  outline: none;
}
textarea {
  min-height: 72px;
}
input::placeholder,
textarea::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

/* Modal form actions */
.row.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.nav-item {
  border: none;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 10px;
  width: 100%;
}
.nav-item.active,
.nav-item:hover {
  color: var(--text);
}
.nav-item.active .icon,
.nav-item:hover .icon {
  color: var(--accent);
}
.icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
}
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  /* flex (not a fixed-column grid) so it never wraps to a second row regardless of
     how many nav-items are visible (e.g. Family shown for parent/child accounts) */
  flex-wrap: nowrap;
  background: rgba(12, 16, 21, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
}
.bottom-nav .nav-item {
  flex: 1 1 0;
  min-width: 0;
}
.sidebar {
  background: rgba(13, 18, 24, 0.98);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  padding: 28px 18px;
  min-width: 240px;
  height: 100vh;
  position: sticky;
  top: 0;
}
.brand-block {
  margin-bottom: 32px;
}
.brand-sub {
  color: var(--muted);
  margin-top: 8px;
  font-size: 0.95rem;
}
.sidebar-nav {
  display: grid;
  gap: 10px;
}
.nav-item {
  border-radius: 16px;
  transition: background 0.2s ease;
}
.nav-item.active,
.nav-item:hover {
  background: rgba(124, 92, 255, 0.08);
}
.nav-item.hidden {
  display: none;
}
.main-content {
  padding-top: 20px;
}
@media (min-width: 900px) {
  .dashboard-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }
  .main-content {
    padding: 28px;
  }
  .desktop-only {
    display: block;
  }
  .mobile-only,
  .bottom-nav {
    display: none;
  }
}
@media (max-width: 640px) {
  .main-content {
    width: 100%;
    padding: 16px 12px 90px;
  }
  .summary-row {
    flex-direction: column;
    gap: 12px;
  }
  .quick-grid {
    grid-template-columns: 1fr;
  }
  .child-card-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
  .family-code-row {
    align-items: stretch;
    flex-direction: column;
  }
  .managed-child-summary {
    align-items: flex-start;
    flex-direction: column;
  }
  .child-management-actions {
    justify-content: flex-start;
  }
}

/* Modal styles */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 6, 8, 0.5);
  z-index: 9999;
  pointer-events: auto;
}
.modal.hidden {
  display: none;
}
.modal-content {
  background: linear-gradient(180deg, var(--panel), var(--panel-strong));
  border-radius: 18px;
  padding: 28px;
  width: min(640px, 96%);
  max-height: 90vh;
  overflow: auto;
  position: relative;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.62),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(124, 92, 255, 0.2);
  animation: modal-rise 0.22s ease both;
}
.modal-heading {
  padding-right: 34px;
  margin-bottom: 24px;
}
.modal-eyebrow {
  color: var(--accent-2);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.modal-content h3 {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2rem);
  line-height: 1.1;
}
.modal-intro {
  color: var(--muted);
  line-height: 1.5;
  margin: 8px 0 0;
}
.form-section {
  display: grid;
  gap: 10px;
  padding: 18px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.form-section-heading {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 800;
  margin-bottom: 2px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.form-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.form-field-inline {
  grid-template-columns: minmax(110px, 0.45fr) minmax(0, 1fr);
  align-items: center;
}
.form-field-inline .label {
  margin: 0;
}
.modal-content input,
.modal-content textarea,
.modal-content select {
  width: 100%;
  min-height: 44px;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.22);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}
.modal-content textarea {
  min-height: 86px;
  resize: vertical;
}
.modal-content input:focus,
.modal-content textarea:focus,
.modal-content select:focus {
  border-color: rgba(77, 208, 225, 0.65);
  box-shadow: 0 0 0 3px rgba(77, 208, 225, 0.1);
}
.xp-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(77, 208, 225, 0.18);
  border-radius: 12px;
  background: linear-gradient(
    90deg,
    rgba(77, 208, 225, 0.08),
    rgba(124, 92, 255, 0.08)
  );
  color: var(--muted);
}
.xp-preview strong {
  color: var(--accent-2);
  font-size: 1.05rem;
}
.notification-section {
  padding-bottom: 4px;
}
.reward-preview-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
  padding: 14px;
  border: 1px solid rgba(124, 92, 255, 0.22);
  border-radius: 14px;
  background: linear-gradient(
    135deg,
    rgba(124, 92, 255, 0.14),
    rgba(77, 208, 225, 0.06)
  );
}
.reward-preview-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: var(--accent-2);
  background: rgba(3, 6, 8, 0.24);
}
.reward-preview-icon .icon {
  width: 23px;
  height: 23px;
}
.reward-preview-label {
  color: var(--muted);
  font-size: 0.75rem;
  margin-bottom: 3px;
}
.reward-preview-name {
  overflow-wrap: anywhere;
  font-weight: 800;
}
.reward-preview-cost {
  display: grid;
  justify-items: end;
  color: var(--accent-2);
  font-size: 1.25rem;
  font-weight: 900;
}
.reward-preview-cost small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.modal-primary-action {
  min-width: 140px;
}
@keyframes modal-rise {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.modal-close {
  position: absolute;
  right: 10px;
  top: 8px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
}
.modal-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}
body.modal-open {
  overflow: hidden;
}
@media (max-width: 640px) {
  .modal {
    align-items: flex-end;
  }
  .modal-content {
    width: 100%;
    max-height: 94vh;
    padding: 24px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    border-radius: 18px 18px 0 0;
  }
  .form-grid,
  .reward-form-grid {
    grid-template-columns: 1fr;
  }
  .form-field-inline {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .row.actions {
    display: grid;
    grid-template-columns: 1fr 1.35fr;
  }
  .row.actions .btn {
    width: 100%;
  }
  .modal-primary-action {
    min-width: 0;
  }
}
