/* Common — design tokens & UI. Calm, warm, mobile-first. */
:root {
  --bg: #FAF8F5;
  --surface: #FFFDFB;
  --surface-alt: #FFFFFF;
  --text: #10121F;
  --text-soft: #171A2B;
  --muted: #61708D;
  --border: #E6E0DA;
  --border-soft: #EFE9E2;

  --lavender: #9A86D6;
  --lavender-deep: #8672C9;
  --lavender-soft: #EDE9F8;
  --lavender-tint: #F5F2FB;
  --mint: #8FC7A6;
  --mint-soft: #E4F1E8;
  --mint-tint: #F1F8F3;
  --peach: #F0B09A;
  --peach-soft: #FBE9E0;
  --blue: #A9BCE8;
  --blue-soft: #E8EEF9;
  --blue-tint: #F2F5FC;
  --cream: #F2E7D6;
  --cream-soft: #F7EFE3;

  --radius: 16px;
  --radius-sm: 14px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(20,15,10,0.05), 0 4px 14px rgba(20,15,10,0.05);
  --shadow-sm: 0 1px 2px rgba(20,15,10,0.05);

  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
  min-height: 100vh;
}
a { color: var(--lavender-deep); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

.app { display: flex; min-height: 100vh; }

/* ---------------------------------------------------------------- sidebar */
.sidebar {
  width: 260px; flex-shrink: 0;
  padding: 28px 20px;
  display: flex; flex-direction: column; gap: 26px;
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #FBF9F6, #FAF8F5);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 13px;
  background: var(--lavender); color: #fff;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 26px; font-weight: 600;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--text-soft); }
.brand-tag { font-size: 12px; color: var(--muted); }

.side-nav { display: flex; flex-direction: column; gap: 6px; }
.side-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px;
  color: var(--muted); font-weight: 500; font-size: 15px;
  transition: background .15s, color .15s;
}
.side-item:hover { background: var(--lavender-tint); color: var(--text); }
.side-item.on { background: var(--lavender-soft); color: var(--lavender-deep); font-weight: 600; }
.side-ico { font-size: 18px; }

.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 16px; }
.side-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.side-status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--mint); }
.side-user { display: flex; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--lavender-soft); color: var(--lavender-deep);
  display: grid; place-items: center; font-weight: 600; font-size: 15px;
}
.side-user-text { display: flex; flex-direction: column; font-size: 13px; line-height: 1.3; }
.side-link { color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------------- main */
.view-root {
  flex: 1;
  max-width: 780px;
  margin: 0 auto;
  padding: 40px 28px 120px;
  min-width: 0;
}
.view { display: flex; flex-direction: column; gap: 20px; }

.screen-head h1 { font-family: var(--serif); font-size: 32px; font-weight: 600; color: var(--text-soft); letter-spacing: -0.5px; }
.screen-head h1 .moon { color: #E8B33C; }
.screen-head .sub { color: var(--muted); margin-top: 4px; }
.eyebrow { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--lavender-deep); font-weight: 600; }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card.tinted-mint { background: linear-gradient(120deg, var(--mint-tint), #FFF); }
.card.tinted-lavender { background: linear-gradient(120deg, var(--lavender-tint), #FFF); }
.card.tinted-peach { background: linear-gradient(120deg, var(--peach-soft), #FFF); }
.card.tinted-blue { background: linear-gradient(120deg, var(--blue-tint), #FFF); }
.card-title { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 16px; color: var(--text-soft); }
.card-title .ic { font-size: 18px; }
.card-body { margin-top: 10px; color: var(--muted); font-size: 14px; }

.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.spread { justify-content: space-between; }

/* summary stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.stat-badge { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; }
.stat-badge.mint { background: var(--mint-soft); color: var(--mint); }
.stat-badge.lavender { background: var(--lavender-soft); color: var(--lavender-deep); }
.stat-badge.blue { background: var(--blue-soft); color: #6d84c4; }
.stat-num { font-family: var(--serif); font-size: 30px; font-weight: 600; color: var(--text-soft); line-height: 1; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-link { font-size: 13px; font-weight: 600; color: var(--lavender-deep); }

/* home visual */
.home-visual {
  border-radius: var(--radius-lg); overflow: hidden;
  background: linear-gradient(160deg, #DDE7F5 0%, #E9E4F4 45%, #F4EFE6 100%);
  padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.home-visual svg { width: 100%; max-width: 340px; height: auto; }
.home-caption { text-align: center; font-size: 14px; color: var(--text-soft); max-width: 460px; }

.metrics { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.metric-row { display: flex; align-items: center; gap: 12px; }
.metric-row .m-label { width: 92px; font-size: 14px; color: var(--muted); }
.metric-track { flex: 1; height: 10px; background: var(--border-soft); border-radius: 999px; overflow: hidden; }
.metric-fill { height: 100%; border-radius: 999px; }
.metric-fill.lavender { background: var(--lavender); }
.metric-fill.mint { background: var(--mint); }
.metric-num { font-weight: 600; font-size: 14px; color: var(--text-soft); width: 30px; text-align: right; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-soft); font-weight: 600; font-size: 14px;
  padding: 11px 18px; border-radius: var(--radius-sm);
  transition: transform .1s, background .15s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: #fff; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--lavender); border-color: var(--lavender); color: #fff; }
.btn.primary:hover { background: var(--lavender-deep); }
.btn.dark { background: var(--text-soft); border-color: var(--text-soft); color: #fff; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.full { width: 100%; justify-content: center; }
.btn.sm { padding: 8px 14px; font-size: 13px; }
.btn.soft-lavender { background: var(--lavender-soft); border-color: var(--lavender-soft); color: var(--lavender-deep); }
.btn-row { display: flex; gap: 10px; }

/* action rows (Tell Common something / What's covered) */
.action-row {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; border-radius: var(--radius);
  cursor: pointer; font-weight: 600; color: var(--text-soft);
  transition: transform .1s;
}
.action-row:hover { transform: translateY(-1px); }
.action-row.lavender { background: var(--lavender-soft); }
.action-row.white { background: var(--surface); border: 1px solid var(--border); }
.action-row .a-ico { font-size: 20px; }
.action-row .a-sub { font-weight: 400; font-size: 13px; color: var(--muted); }
.action-row .chev { margin-left: auto; color: var(--lavender-deep); }

/* check-in options */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px;
  font-size: 14px; font-weight: 600; color: var(--text-soft);
  box-shadow: var(--shadow-sm);
}
.choice:hover { border-color: var(--lavender); }
.choice.sel { background: var(--lavender); border-color: var(--lavender); color: #fff; }

/* reward rows */
.reward-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border-soft); }
.reward-row:first-of-type { border-top: none; }
.reward-emoji { font-size: 24px; }
.reward-info { flex: 1; }
.reward-name { font-weight: 600; font-size: 14px; color: var(--text-soft); }
.reward-sub { font-size: 12px; color: var(--muted); }
.reward-progress { flex: 0 0 90px; height: 8px; background: var(--border-soft); border-radius: 999px; overflow: hidden; }
.reward-pct { width: 42px; text-align: right; font-size: 13px; color: var(--muted); }

/* lists / success rows */
.success-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border-soft); font-size: 14px; color: var(--text-soft); }
.success-row .ck { color: var(--mint); font-weight: 700; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border-soft); }
.list-row:first-of-type { border-top: none; }

/* tags/chips */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.chip.lavender { background: var(--lavender-soft); color: var(--lavender-deep); }
.chip.mint { background: var(--mint-soft); color: #4a8a63; }
.chip.peach { background: var(--peach-soft); color: #b56a4e; }

/* drawers (collapsible) */
.drawer { border-top: 1px solid var(--border-soft); padding: 4px 0 0; }
.drawer summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px 0; font-weight: 600; color: var(--text-soft); }
.drawer summary::-webkit-details-marker { display: none; }
.drawer summary .chev { margin-left: auto; transition: transform .15s; color: var(--muted); }
.drawer[open] summary .chev { transform: rotate(90deg); }

/* ------------------------------------------------------------------ reset */
.reset-cards { display: flex; flex-wrap: wrap; gap: 10px; }
.reset-ck { flex: 1 1 45%; background: var(--mint-tint); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; color: var(--text-soft); }

/* ------------------------------------------------------------------ forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 14px; font-weight: 600; color: var(--text-soft); }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 15px; font-family: inherit; background: var(--surface);
  color: var(--text-soft);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--lavender); box-shadow: 0 0 0 3px var(--lavender-soft); }
.hint { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------------ auth */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-col { width: 448px; max-width: 100%; text-align: center; }
.auth-logo { width: 58px; height: 58px; border-radius: 16px; background: var(--lavender); margin: 0 auto 18px; display: grid; place-items: center; color: #fff; font-family: var(--serif); font-size: 32px; font-weight: 600; }
.auth-title { font-family: var(--serif); font-size: 32px; font-weight: 600; color: var(--text-soft); }
.auth-sub { color: var(--muted); margin-top: 6px; font-size: 16px; }
.auth-card { margin-top: 30px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow-sm); text-align: left; }
.auth-foot { margin-top: 22px; font-size: 14px; color: var(--muted); }
.or-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 18px 0; }
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ------------------------------------------------------------------ modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,16,30,.4); display: grid; place-items: center; padding: 20px; z-index: 100; }
.modal { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border); width: 480px; max-width: 100%; padding: 24px; box-shadow: var(--shadow); }

/* -------------------------------------------------------------- onboarding */
.step-dots { display: flex; gap: 6px; justify-content: center; margin: 8px 0 20px; }
.step-dot { height: 9px; width: 9px; border-radius: 50%; background: var(--border); }
.step-dot.on { background: var(--lavender); width: 24px; border-radius: 999px; }
.child-add { display: flex; flex-direction: column; gap: 16px; }
.child-box { border: 1px dashed var(--border); border-radius: var(--radius); padding: 16px; }

/* -------------------------------------------------------------- loading */
.loading { display: grid; place-items: center; min-height: 40vh; color: var(--muted); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--lavender); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; background: var(--text-soft); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; z-index: 200; box-shadow: var(--shadow); }
.toast.bad { background: #b3503c; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .view-root { padding: 28px 18px 130px; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 520px) {
  .screen-head h1 { font-size: 26px; }
  .stat-grid { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-num { font-size: 26px; }
}

/* bottom nav (mobile) */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: none;
  background: rgba(255,253,251,.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-soft);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  z-index: 50;
  justify-content: space-around;
}
.nav-btn {
  background: none; border: none; display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--muted); font-size: 11px; padding: 8px 12px; border-radius: 12px;
}
.nav-btn .nav-ico { font-size: 22px; filter: grayscale(1); opacity: .7; }
.nav-btn.on { color: var(--lavender-deep); font-weight: 600; }
.nav-btn.on .nav-ico { filter: none; opacity: 1; }
@media (max-width: 900px) {
  .bottom-nav { display: flex; }
}
