/* ---------- Variables ---------- */
:root {
  --olivia: #F4511E;
  --everett: #039BE5;
  --sophia: #8E24AA;
  --teal: #0F5562;
  --gold: #F59E0B;
  --gold-dim: #FCD34D;

  --bg: #FAFAF7;
  --card: #FFFFFF;
  --ink: #1F2937;
  --muted: #6B7280;
  --line: #E5E7EB;

  --r: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lift: 0 4px 12px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.4;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------- Layout ---------- */
.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 80px;
}

.app-header {
  position: relative;
  padding: 6px 4px 14px;
  min-height: 56px;
  text-align: center;
}
.app-logo-mark {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 90px;
  height: auto;
}
.app-header-content {
  text-align: center;
  padding: 0 100px 0 100px;
}
@media (max-width: 480px) {
  .app-logo-mark { width: 72px; }
  .app-header-content { padding: 0 80px; }
}
.app-family {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.app-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.app-title .fam {
  color: var(--muted);
  font-weight: 500;
}
.app-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}
.app-tagline {
  font-size: 14px;
  color: var(--teal);
  font-weight: 600;
  margin-top: 4px;
}

/* ---------- Footer ---------- */
.app-footer {
  margin-top: 32px;
  padding: 18px 12px;
  background: var(--teal);
  color: #fff;
  border-radius: var(--r);
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.02em;
}

/* ---------- Dashboard kid cards ---------- */
.kid-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 720px) {
  .kid-grid { grid-template-columns: repeat(3, 1fr); }
}

.kid-card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 18px;
  border-top: 4px solid var(--c, var(--teal));
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow 120ms ease, transform 120ms ease;
}
.kid-card:active { transform: scale(0.99); }
.kid-card:hover { box-shadow: var(--shadow-lift); }

.kid-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kid-name {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.kid-emoji { font-size: 22px; }
.kid-age {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.kid-ring-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.kid-ring {
  flex-shrink: 0;
}
.kid-pct {
  font-size: 28px;
  font-weight: 700;
  color: var(--c);
}
.kid-pct-sub {
  font-size: 12px;
  color: var(--muted);
}

.streak-row {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
}
.streak-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
}
.streak-dot.filled {
  background: var(--c);
  border-color: var(--c);
  color: #fff;
}
.streak-dot.today {
  outline: 2px solid var(--c);
  outline-offset: 2px;
}

/* ---------- Weekly chart card ---------- */
.panel {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-top: 18px;
}
.panel h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 12px;
}
.panel .sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

/* ---------- Family Today (hero) ---------- */
.hero-panel {
  background: linear-gradient(135deg, var(--teal) 0%, #0a3f48 100%);
  color: #fff;
  border: 0;
}
.hero-panel h2 {
  color: #fff;
  opacity: 0.75;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 8px;
}
.family-hero {
  text-align: center;
  padding: 4px 0 18px;
}
.family-hero-num {
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}
.family-hero-sub {
  font-size: 13px;
  opacity: 0.8;
  margin-top: 8px;
}
.family-kid-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.family-kid-stat {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 6px;
  text-align: center;
}
.family-kid-stat .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c);
  margin: 0 auto 5px;
}
.family-kid-stat .name {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.85;
  letter-spacing: 0.02em;
}
.family-kid-stat .num {
  font-size: 18px;
  font-weight: 700;
  margin-top: 3px;
}

/* ---------- Streak leaderboard ---------- */
#streakPanel .streak-row-board {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
#streakPanel .streak-row-board:last-child { border-bottom: 0; }
#streakPanel .rank {
  font-size: 22px;
  text-align: center;
  line-height: 1;
}
#streakPanel .name {
  font-weight: 600;
  color: var(--c);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}
#streakPanel .name .emoji { font-size: 18px; }
#streakPanel .value {
  text-align: right;
}
#streakPanel .value .current {
  font-size: 16px;
  font-weight: 700;
  color: var(--c);
}
#streakPanel .value .zero {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}
#streakPanel .value .longest {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ---------- Sports Bonus tally ---------- */
.bonus-panel {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 1px solid var(--gold-dim);
}
.bonus-panel h2 { color: #92400E; }
#bonusTally {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.bonus-tile {
  background: #fff;
  border-radius: 10px;
  padding: 14px 8px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.bonus-tile .bonus-name {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}
.bonus-tile .bonus-stars {
  font-size: 22px;
  color: var(--gold);
  line-height: 1;
}
.bonus-tile .bonus-num {
  font-size: 26px;
  font-weight: 800;
  color: #92400E;
  margin-top: 4px;
  line-height: 1;
}
.bonus-tile .bonus-sub {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* ---------- Allowance ---------- */
.allowance-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
}
@media (min-width: 540px) {
  .allowance-row { grid-template-columns: repeat(3, 1fr); }
}
.allowance-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}
.allowance-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--c, var(--ink));
  margin-bottom: 6px;
}
.allowance-bar {
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.allowance-bar > div {
  height: 100%;
  background: var(--c, var(--teal));
  transition: width 240ms ease;
}
.allowance-amount {
  font-size: 13px;
  margin-top: 6px;
  color: var(--muted);
}
.allowance-amount strong { color: var(--ink); }

/* ---------- Kid page top bar ---------- */
.kid-top {
  background: var(--c, var(--teal));
  color: #fff;
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.kid-top-name {
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.kid-top-meta {
  font-size: 13px;
  opacity: 0.9;
}
.kid-top a.back {
  font-size: 16px;
  font-weight: 600;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.kid-top a.back:active { background: rgba(255, 255, 255, 0.3); }

/* ---------- Tab bar ---------- */
.tabs {
  display: flex;
  gap: 4px;
  background: #fff;
  border-radius: 10px;
  padding: 4px;
  border: 1px solid var(--line);
  margin-bottom: 16px;
}
.tabs button {
  flex: 1;
  background: transparent;
  border: 0;
  padding: 10px 8px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  min-height: 44px;
}
.tabs button.active {
  background: var(--c, var(--teal));
  color: #fff;
}

/* ---------- Task sections ---------- */
.section {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.section-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-title .badge {
  font-size: 10px;
  background: #FEF3C7;
  color: #92400E;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.05em;
  font-weight: 700;
}
.section.bonus {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 1px solid var(--gold-dim);
}
.section.bonus .section-title { color: #92400E; }

/* ---------- Task row ---------- */
.task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.task:last-child { border-bottom: 0; }

.checkbox {
  width: 28px;
  height: 28px;
  border: 2px solid var(--line);
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  transition: background 120ms, border-color 120ms, transform 120ms;
}
.task.checked .checkbox {
  background: var(--c, var(--teal));
  border-color: var(--c, var(--teal));
}
.task.checked .checkbox::after {
  content: "✓";
}
.section.bonus .task.checked .checkbox {
  background: var(--gold);
  border-color: var(--gold);
}
.section.bonus .task.checked .checkbox::after {
  content: "★";
}

.task-label {
  font-size: 15px;
  flex: 1;
}
.task.checked .task-label {
  color: var(--muted);
  text-decoration: line-through;
}

.approval {
  font-size: 10px;
  background: #FEE2E2;
  color: #991B1B;
  padding: 3px 7px;
  border-radius: 999px;
  letter-spacing: 0.03em;
  font-weight: 700;
}
.task.checked .approval.approved {
  background: #D1FAE5;
  color: #065F46;
}

/* ---------- Week grid ---------- */
.week-grid {
  overflow-x: auto;
  margin-top: 8px;
}
.week-grid table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.week-grid th, .week-grid td {
  padding: 8px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.week-grid th:first-child, .week-grid td:first-child {
  text-align: left;
  font-weight: 500;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.week-grid .cell-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 2px solid var(--line);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}
.week-grid .cell-state.completed-approved {
  background: var(--c);
  border-color: var(--c);
}
.week-grid .cell-state.completed-approved::after {
  content: "✓";
}
.week-grid .cell-state.completed-only {
  background: transparent;
  border-color: var(--c);
}

.row-optional {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: #F3F4F6;
  border-radius: 999px;
  padding: 2px 6px;
  margin-left: 6px;
  vertical-align: middle;
}

.tag-optional {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: #F3F4F6;
  padding: 3px 8px;
  border-radius: 999px;
}
.week-grid .col-pct {
  font-size: 11px;
  font-weight: 700;
  color: var(--c);
}

.weekly-totals {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
}
@media (min-width: 540px) {
  .weekly-totals { grid-template-columns: repeat(4, 1fr); }
}
.weekly-totals .stat {
  padding: 10px;
  border-radius: 10px;
  background: #F3F4F6;
}
.weekly-totals .stat .v {
  font-size: 20px;
  font-weight: 700;
  color: var(--c);
}
.weekly-totals .stat .k {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---------- All Time ---------- */
.all-time-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.all-time-stats .stat {
  padding: 12px;
  border-radius: 10px;
  background: #F3F4F6;
  text-align: center;
}
.all-time-stats .stat .v {
  font-size: 22px;
  font-weight: 700;
  color: var(--c);
}
.all-time-stats .stat .k {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* ---------- PIN modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fade-in 120ms ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: #fff;
  border-radius: var(--r);
  padding: 22px;
  max-width: 320px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}
.modal h3 {
  margin: 0 0 6px;
  font-size: 18px;
}
.modal .hint {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}
.modal-pin-display {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 12px 0 18px;
}
.modal-pin-display .dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line);
}
.modal-pin-display .dot.filled {
  background: var(--teal);
  border-color: var(--teal);
}
.modal.shake {
  animation: shake 320ms ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.keypad button {
  height: 56px;
  border: 0;
  border-radius: 10px;
  background: #F3F4F6;
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  min-width: 44px;
}
.keypad button:active { background: #E5E7EB; }
.keypad button.cancel {
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}
.keypad button.clear {
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Misc ---------- */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Settings link in header ---------- */
.app-settings-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--teal);
  font-weight: 600;
  text-decoration: none;
}
.app-settings-link:hover { text-decoration: underline; }

/* ---------- Motivation card (kid page, top) ---------- */
.motivation-card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
  border-top: 4px solid var(--c, var(--teal));
}

/* Daily-100 mode (Sophia) */
.motivation-card.daily-100 .mot-big-pct {
  font-size: 44px;
  font-weight: 800;
  color: var(--c);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.mot-progress-bar {
  height: 12px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.mot-progress-bar.small { height: 8px; }
.mot-progress-bar > div {
  height: 100%;
  background: var(--c, var(--teal));
  border-radius: 999px;
  transition: width 240ms ease;
}
.mot-progress-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

.mot-extras {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.mot-chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--c);
  color: #fff;
}
.mot-chip.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

/* Streaks mode (Olivia) */
.motivation-card.streaks .streak-hero {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.motivation-card.streaks .streak-num {
  font-size: 48px;
  font-weight: 800;
  color: var(--c);
  line-height: 1;
}
.motivation-card.streaks .streak-num .flame { font-size: 28px; margin-right: 6px; }
.motivation-card.streaks .streak-label {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}
.motivation-card.streaks .streak-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0 14px;
}

/* Points-bank mode (Everett) */
.motivation-card.bank .bank-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 12px;
}
.motivation-card.bank .bank-num {
  font-size: 44px;
  font-weight: 800;
  color: var(--c);
  line-height: 1;
}
.motivation-card.bank .bank-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-top: 4px;
}
.motivation-card.bank .bank-today-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--c);
  text-align: right;
}
.motivation-card.bank .bank-today-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  text-align: right;
}
.motivation-card.bank .bank-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
}
.motivation-card.bank .bank-hint a { color: var(--c); font-weight: 600; }

/* ---------- Tier 1 Hero section ---------- */
.section.tier1-hero {
  background: linear-gradient(135deg, color-mix(in srgb, var(--c, var(--teal)) 8%, #fff) 0%, #fff 60%);
  border: 2px solid var(--c, var(--teal));
  position: relative;
}
.tier1-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.tier1-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c);
}
.tier1-title {
  font-size: 16px;
  font-weight: 700;
  margin-top: 3px;
  color: var(--ink);
}
.tier1-count {
  font-size: 14px;
  font-weight: 800;
  color: var(--c);
}
.tier1-progress-bar {
  height: 10px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}
.tier1-progress-bar > div {
  height: 100%;
  background: var(--c);
  transition: width 240ms ease;
}

/* ---------- Collapsible sections ---------- */
.section.collapsible { padding: 0; }
.section-toggle {
  width: 100%;
  background: transparent;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
  min-height: 52px;
}
.section-toggle:hover { background: rgba(0,0,0,0.02); }
.section-toggle .section-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.section-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.section-toggle .chev {
  display: inline-block;
  transition: transform 180ms ease;
  font-size: 14px;
  color: var(--muted);
}
.section-toggle.expanded .chev { transform: rotate(180deg); }

.section-body { padding: 0 16px 12px; }
.section-body.collapsed { display: none; }

/* ---------- Task row tweaks (points, PM tag) ---------- */
.task-points {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: var(--c, var(--teal));
  background: color-mix(in srgb, var(--c, var(--teal)) 12%, transparent);
  padding: 3px 7px;
  border-radius: 999px;
}
.task.checked .task-points { opacity: 0.55; }
.tag-pm {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #6B7280;
  background: #E5E7EB;
  padding: 3px 7px;
  border-radius: 999px;
}

/* ---------- Settings page ---------- */
.settings-kid {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  border-top: 4px solid var(--c, var(--teal));
  padding: 18px;
  margin-bottom: 16px;
}
.settings-kid-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 6px;
}
.settings-kid-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--c);
}
.settings-kid-bank {
  font-size: 14px;
  color: var(--muted);
}
.settings-kid-bank .bank-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--c);
  margin-right: 4px;
}
.settings-kid-bank .muted { font-size: 12px; }

.settings-section {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}
.settings-section:first-of-type { border-top: 0; padding-top: 0; }
.settings-section h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 10px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
}
.setting-row label { color: var(--ink); font-weight: 500; }
.setting-row select {
  font-size: 14px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: 36px;
}
.setting-row input[type=checkbox] {
  width: 20px;
  height: 20px;
}

/* Reward rows */
.reward-list { margin-bottom: 10px; }
.reward-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 8px;
}
.reward-row:last-child { border-bottom: 0; }
.reward-info { flex: 1; min-width: 180px; }
.reward-name {
  font-size: 14px;
  font-weight: 600;
}
.reward-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.reward-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Add-reward inline form */
details.add-reward {
  margin-top: 10px;
}
details.add-reward summary {
  cursor: pointer;
  color: var(--c, var(--teal));
  font-weight: 600;
  font-size: 13px;
  padding: 6px 0;
  list-style: none;
}
details.add-reward summary::-webkit-details-marker { display: none; }
.add-reward-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
  padding: 12px;
  background: #F9FAFB;
  border-radius: 10px;
}
@media (min-width: 540px) {
  .add-reward-form {
    grid-template-columns: 2fr 1fr 1fr 2fr auto;
    align-items: center;
  }
}
.add-reward-form input,
.add-reward-form select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  min-height: 38px;
}

/* Payout rows */
.payout-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.payout-row:last-child { border-bottom: 0; }
.payout-name { flex: 1; font-size: 14px; }
.payout-name .muted { color: var(--muted); font-size: 12px; }
.payout-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Generic button */
.btn {
  background: var(--c, var(--teal));
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
}
.btn:active { transform: scale(0.97); }
.btn.small { padding: 6px 10px; font-size: 12px; min-height: 32px; }
.btn.ghost { background: transparent; color: var(--c, var(--teal)); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: #B91C1C; border: 1px solid #FCA5A5; }

.muted { color: var(--muted); }

/* ---------- Login page ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg);
}
.login-card {
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  padding: 28px 24px 22px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-logo {
  width: 140px;
  height: auto;
  margin: 0 auto 4px;
  display: block;
}
.login-tagline {
  text-align: center;
  font-size: 13px;
  color: var(--teal);
  font-weight: 600;
  margin-bottom: 8px;
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.login-field span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}
.login-field input {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 16px; /* 16+ avoids iOS zoom on focus */
  background: #fff;
}
.login-field input:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
  border-color: transparent;
}
.login-submit {
  background: var(--teal);
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  margin-top: 4px;
  min-height: 48px;
  width: 100%;
}
.login-error {
  display: none;
  font-size: 13px;
  color: #B91C1C;
  background: #FEE2E2;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: center;
}

/* ---------- Logout footer (settings page) ---------- */
.logout-row {
  text-align: center;
  margin: 24px 0 8px;
}
.logout-row form { display: inline; }
.logout-row .btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 10px 18px;
}

/* ---------- Goals section (kid page) ---------- */
.goals-section {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
  border-top: 4px solid var(--c, var(--teal));
}
.goals-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
  flex-wrap: wrap;
}
.goals-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c);
}
.goals-cycle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}
.goal-panels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 540px) {
  .goal-panels { grid-template-columns: repeat(3, 1fr); }
}
.goal-panel {
  background: #F9FAFB;
  border-radius: 10px;
  padding: 10px;
}
.goal-panel-head {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.goal-card {
  background: #fff;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  transition: background 200ms ease, transform 200ms ease;
}
.goal-card:last-child { margin-bottom: 0; }
.goal-card.empty {
  border: 1px dashed var(--line);
  background: transparent;
  cursor: pointer;
}
.goal-card.empty:hover { background: rgba(0,0,0,0.02); }
.goal-empty {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}
.goal-status {
  background: transparent;
  border: 0;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}
.goal-text {
  flex: 1;
  cursor: pointer;
}
.goal-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}
.goal-card.done .goal-title { text-decoration: line-through; color: var(--muted); }
.goal-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.4;
}
.goal-card.reading {
  background: color-mix(in srgb, var(--c, var(--teal)) 8%, #fff);
  transform: translateX(3px);
  box-shadow: 0 0 0 2px var(--c, var(--teal));
}

/* ---------- Goal pill on dashboard kid card ---------- */
.kid-goals-pill {
  margin-top: 4px;
  padding: 6px 10px;
  background: #F3F4F6;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}
.kid-goals-pill.empty {
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--c, var(--teal));
}

/* ---------- Check-in banner ---------- */
.checkin-banner {
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  border: 1px solid var(--gold-dim);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.checkin-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #92400E;
}
.checkin-status {
  font-size: 15px;
  font-weight: 700;
  color: #92400E;
  margin-top: 3px;
}
.checkin-prompts {
  font-size: 12px;
  color: #92400E;
  margin-top: 6px;
  line-height: 1.5;
}
.checkin-prompts em {
  font-style: normal;
  font-weight: 500;
}
.checkin-actions { flex-shrink: 0; }
.checkin-banner .btn { background: #92400E; }

/* ---------- Goals settings (tips + per-kid editor) ---------- */
.goals-tips {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.goals-tips summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--teal);
  padding: 4px 0;
  list-style: none;
}
.goals-tips summary::-webkit-details-marker { display: none; }
.tips-body {
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.55;
}
.tips-body ul {
  padding-left: 18px;
  margin: 0;
}
.tips-body li { margin-bottom: 6px; }
.tips-body em {
  font-style: italic;
  color: var(--muted);
}

.settings-goal-cycle-select {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
}
.settings-goal-cycle-select label {
  color: var(--muted);
  font-weight: 500;
}
.settings-goal-category {
  margin-bottom: 14px;
}
.settings-goal-cat-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 8px 0;
}
.settings-goal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  background: #F9FAFB;
  border-radius: 8px;
  margin-bottom: 6px;
  gap: 10px;
  flex-wrap: wrap;
}
.settings-goal-row.empty {
  border: 1px dashed var(--line);
  background: transparent;
}
.settings-goal-text { flex: 1; min-width: 180px; font-size: 13px; }
.settings-goal-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.settings-goal-status { font-size: 11px; color: var(--muted); margin-top: 4px; }
.settings-goal-actions { display: flex; gap: 6px; }


.empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}
