/* ===== TOKENS ===== */
:root {
  --bg: #F6F8FA;
  --bg-2: #FFFFFF;
  --white: #FFFFFF;
  --teal: #2DC0C5;
  --teal-deep: #178F94;
  --teal-soft: #C2EBEC;
  --teal-mist: #E8F7F8;
  --coral: #FF7E7E;
  --coral-soft: #FFD2D2;
  --pink: #FFB0CB;
  --pink-soft: #FFE3EE;
  --sun: #FFCD3A;
  --sun-soft: #FFF1B8;
  --lavender: #B79AE7;
  --lavender-soft: #E6D9F8;
  --ink: #1A1F36;
  --ink-soft: #6B7280;
  --ink-faint: #9CA3AF;
  --cloud: #E5E8EF;
  --shadow: 0 8px 24px rgba(26, 31, 54, 0.06);
  --shadow-lift: 0 12px 32px rgba(26, 31, 54, 0.09);
  --radius: 14px;
  --radius-lg: 22px;
}

/* ===== RESET / BASE ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
body {
  background-image:
    radial-gradient(circle at 12% 10%, rgba(45, 192, 197, 0.07), transparent 40%),
    radial-gradient(circle at 88% 85%, rgba(255, 126, 126, 0.06), transparent 45%);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--teal-deep); text-decoration: none; }

h1, h2, h3, h4 { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 500; letter-spacing: -0.02em; }
em.accent { color: var(--coral); font-style: italic; font-weight: 400; }

/* ===== APP SHELL (mobile-first, framed on desktop) ===== */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg-2);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lift);
}
@media (max-width: 520px) {
  #app { box-shadow: none; max-width: 100%; }
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  min-height: 100vh;
}
.screen.has-nav { padding-bottom: 84px; }
.screen-body { flex: 1; padding: 20px 22px; }

/* ===== APP HEADER ===== */
.app-header {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 22px 4px;
}
.app-header .back {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; background: var(--bg);
  color: var(--ink-soft); font-size: 18px;
}
.app-header h3 { flex: 1; font-size: 16px; }

/* ===== AUTH SCREENS ===== */
.auth-wrap {
  flex: 1;
  background: linear-gradient(180deg, var(--white) 0%, var(--teal-mist) 100%);
  display: flex; flex-direction: column;
  padding: 50px 28px 32px;
  min-height: 100vh;
}
.logo-mark {
  width: 84px; height: 84px;
  margin: 12px auto 24px;
  border-radius: 50%;
  background: var(--teal);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(45, 192, 197, 0.3);
}
.logo-mark svg { width: 46px; height: 46px; }
.brand { text-align: center; font-family: 'Bricolage Grotesque', sans-serif; font-weight: 500; font-size: 34px; letter-spacing: -0.02em; }
.tagline { text-align: center; color: var(--ink-soft); font-size: 14px; margin-bottom: 36px; }

.field {
  background: var(--white);
  border: 1px solid var(--cloud);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
  display: flex; flex-direction: column;
}
.field label {
  font-size: 10px; color: var(--ink-soft);
  letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 4px; font-weight: 600;
}
.field input, .field select {
  border: none; outline: none; background: transparent;
  font-size: 15px; color: var(--ink); font-weight: 500;
  width: 100%;
}
.field input::placeholder { color: var(--ink-faint); font-weight: 400; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 22px; border-radius: 100px;
  font-weight: 600; font-size: 14px;
  width: 100%; transition: transform 0.1s, opacity 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn-primary { background: var(--teal); color: var(--white); }
.btn-secondary { background: var(--white); color: var(--ink); border: 1px solid var(--cloud); }
.btn-coral { background: var(--coral); color: var(--white); }
.btn-ghost { background: transparent; color: var(--teal-deep); }

.btn + .btn { margin-top: 10px; }

.secondary-link { text-align: center; margin-top: 22px; font-size: 13px; color: var(--ink-soft); }
.secondary-link a { color: var(--coral); font-weight: 600; }

.error {
  background: var(--coral-soft);
  color: #8B3A3A;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}
.notice {
  background: var(--teal-mist);
  color: var(--teal-deep);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* ===== PROFILE PICKER ===== */
.picker {
  background: linear-gradient(180deg, var(--white) 0%, var(--teal-mist) 100%);
  flex: 1; display: flex; flex-direction: column;
  padding-top: 50px;
}
.picker-greet { text-align: center; padding: 20px 30px 28px; }
.picker-greet .eyebrow {
  font-size: 11px; color: var(--coral); letter-spacing: 0.18em;
  text-transform: uppercase; font-weight: 600; margin-bottom: 10px;
}
.picker-greet h2 { font-size: 30px; margin-bottom: 4px; }
.picker-greet p { font-size: 13px; color: var(--ink-soft); }

.picker-cards { padding: 12px 22px; display: grid; gap: 14px; }
.picker-card {
  background: var(--white); border: 1px solid var(--cloud);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow);
  text-align: left; width: 100%;
}
.avatar {
  width: 58px; height: 58px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bricolage Grotesque', sans-serif; font-size: 24px;
  color: var(--white); flex-shrink: 0;
}
.picker-card .info { flex: 1; }
.picker-card .who { font-family: 'Bricolage Grotesque', sans-serif; font-size: 20px; font-weight: 500; }
.picker-card .pending { font-size: 12px; color: var(--ink-soft); }
.picker-card .arrow {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft);
}
.picker-footer { margin-top: auto; padding: 24px; text-align: center; }
.picker-footer button { color: var(--ink-soft); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }

/* ===== PARENT DASHBOARD ===== */
.dash-greeting { padding: 20px 22px 16px; }
.dash-greeting .hello { font-family: 'Bricolage Grotesque', sans-serif; font-size: 26px; font-weight: 500; letter-spacing: -0.02em; }
.dash-greeting .date { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }

.kid-card {
  margin: 0 22px 12px;
  padding: 18px;
  border-radius: var(--radius-lg);
  display: flex; gap: 14px; align-items: center;
  background: var(--white); border: 1px solid var(--cloud);
  width: calc(100% - 44px);
  text-align: left;
}
.kid-card .info { flex: 1; }
.kid-card .name { font-family: 'Bricolage Grotesque', sans-serif; font-size: 17px; font-weight: 500; }
.kid-card .meta { font-size: 12px; color: var(--ink-soft); margin-bottom: 8px; }
.kid-card .progress { display: flex; align-items: center; gap: 8px; }
.kid-card .bar { flex: 1; height: 6px; background: var(--bg); border-radius: 100px; overflow: hidden; }
.kid-card .bar .fill { height: 100%; border-radius: 100px; background: var(--teal); }
.kid-card .stat { font-size: 11px; color: var(--ink-soft); font-weight: 600; }
.kid-card .chev { color: var(--ink-soft); font-size: 18px; }

.dash-section { padding: 16px 22px 0; }
.dash-section .label {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 10px; font-weight: 600;
}
.empty-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 22px 18px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
}
.empty-card strong { color: var(--ink); display: block; margin-bottom: 4px; font-family: 'Bricolage Grotesque', sans-serif; font-weight: 500; font-size: 15px; }

.action-tile {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 8px;
  width: 100%;
  text-align: left;
}
.action-tile .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--sun); flex-shrink: 0; }
.action-tile .txt { flex: 1; }
.action-tile .what { font-size: 13px; font-weight: 600; }
.action-tile .when { font-size: 11px; color: var(--ink-soft); }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-top: 1px solid var(--cloud);
  display: flex; justify-content: space-around;
  padding: 12px 8px 22px;
  max-width: 480px;
  margin: 0 auto;
}
.bottom-nav .item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10px; color: var(--ink-soft); letter-spacing: 0.04em;
  font-weight: 600;
}
.bottom-nav .item .ic { font-size: 18px; }
.bottom-nav .item.active { color: var(--teal-deep); }

/* ===== DANI'S TODAY ===== */
.today-head { padding: 20px 22px 14px; }
.today-head .hello { font-family: 'Bricolage Grotesque', sans-serif; font-size: 24px; font-weight: 500; letter-spacing: -0.02em; }
.calm-note {
  display: inline-flex; gap: 8px; align-items: center;
  margin-top: 12px;
  background: var(--teal-soft);
  padding: 10px 14px;
  border-radius: 100px;
  font-size: 12px; color: var(--teal-deep); font-weight: 500;
}
.section-lbl {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 600;
  padding: 16px 22px 8px;
}
.chunk {
  margin: 0 22px 10px;
  padding: 14px;
  background: var(--white);
  border: 1px solid var(--cloud);
  border-radius: var(--radius);
  display: flex; gap: 12px; align-items: center;
  width: calc(100% - 44px);
  text-align: left;
}
.chunk.locked { opacity: 0.55; }
.chunk.done { background: var(--teal-mist); border-color: var(--teal-soft); }
.chunk.overdue { border-color: var(--coral); background: var(--coral-soft); }
.chunk.overdue .ic { background: var(--coral); color: white; }
.chunk .ic {
  width: 38px; height: 38px;
  background: var(--bg);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.chunk.done .ic { background: var(--teal); color: white; }
.chunk .info { flex: 1; }
.chunk .name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.chunk .meta { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.chunk .play {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--teal); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.chunk.locked .play { background: var(--cloud); color: var(--ink-soft); }

/* ===== DEVICE PAIRING ===== */
.pair-code {
  font-family: 'JetBrains Mono', 'Bricolage Grotesque', monospace;
  font-size: 48px;
  letter-spacing: 0.16em;
  text-align: center;
  background: var(--teal-mist);
  border-radius: var(--radius-lg);
  padding: 28px 16px;
  margin: 18px 0;
  color: var(--teal-deep);
  font-weight: 600;
}
.pair-expiry { text-align: center; color: var(--ink-soft); font-size: 12px; margin-bottom: 18px; }

/* ===== LOADING ===== */
.loading {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft); font-size: 13px;
}
.spinner {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 3px solid var(--cloud);
  border-top-color: var(--teal);
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}
.loading-block { display: flex; flex-direction: column; align-items: center; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== UTILITY ===== */
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.muted { color: var(--ink-soft); }
.center { text-align: center; }
.mt-auto { margin-top: auto; }
.hidden { display: none !important; }
