/* ==========================================================================
   Hoot — School Parent Companion
   Design tokens derived from the mascot: cap blue, bill gold, feather cream,
   walnut brown, coral cheek blush.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Inter:wght@400;500;600;700;800&display=swap');

:root{
  /* --- Palette (from the mascot) --- */
  --cap-blue:        #2F6FED;
  --cap-blue-dark:   #1E4FC4;
  --bill-gold:       #F5B700;
  --bill-gold-dark:  #DA9E00;
  --feather-cream:   #FBF1DC;
  --feather-cream-2: #F6E7C8;
  --walnut:          #5C3A21;
  --walnut-light:    #8B5A2B;
  --cheek-coral:     #F2784B;
  --alert-red:       #E8483C;
  --leaf-green:      #3FA34D;
  --ink:             #2B2118;
  --ink-soft:        #6B5C4C;
  --paper:           #FFFDF8;
  --line:            #EDE2CC;

  /* --- Type --- */
  --font-display: 'Fredoka', ui-rounded, system-ui, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* --- Shape / rhythm --- */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --shadow-card: 0 2px 10px rgba(92,58,33,0.08), 0 1px 2px rgba(92,58,33,0.06);
  --shadow-pop: 0 10px 30px rgba(30,79,196,0.18);
  --tabbar-h: 68px;
  --topbar-h: 60px;
}

*{ box-sizing:border-box; -webkit-tap-highlight-color: transparent; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--font-body);
  background: var(--feather-cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
h1,h2,h3,h4{ font-family: var(--font-display); margin:0; color: var(--ink); font-weight:600; }
p{ margin:0; }
a{ color:inherit; text-decoration:none; }
button{ font-family: var(--font-body); }
ul{ margin:0; padding:0; list-style:none; }
img{ max-width:100%; display:block; }

::selection{ background: var(--bill-gold); color: var(--ink); }

:focus-visible{
  outline: 3px solid var(--cap-blue);
  outline-offset: 2px;
  border-radius: 6px;
}

/* --- App shell --- */
.app{
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--paper);
  position: relative;
  display:flex;
  flex-direction:column;
  box-shadow: 0 0 60px rgba(92,58,33,0.08);
}

.screen{
  flex:1;
  padding: calc(var(--topbar-h) + 16px) 18px calc(var(--tabbar-h) + 28px);
  min-height: 100vh;
}
.screen.no-tabbar{ padding-bottom: 32px; }
.screen.no-topbar{ padding-top: 20px; }

/* --- Top bar --- */
.topbar{
  position: fixed;
  top:0; left:50%; transform: translateX(-50%);
  width:100%; max-width:480px;
  height: var(--topbar-h);
  background: var(--paper);
  display:flex; align-items:center; justify-content:space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  z-index: 40;
}
.topbar-title{ display:flex; align-items:center; gap:10px; }
.topbar-title img{ width:32px; height:32px; border-radius:9px; }
.topbar-title span{ font-family: var(--font-display); font-size:1.05rem; font-weight:600; }
.topbar-actions{ display:flex; gap:8px; align-items:center; }
.icon-btn{
  width:38px; height:38px; border-radius: var(--radius-pill);
  border:none; background: var(--feather-cream-2);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; color: var(--walnut);
  position:relative;
}
.icon-btn:active{ transform: scale(0.94); }
.icon-btn .dot{
  position:absolute; top:6px; right:6px; width:8px; height:8px;
  border-radius:50%; background: var(--alert-red); border:1.5px solid var(--paper);
}
.back-btn{
  width:38px; height:38px; border-radius:var(--radius-pill); border:none;
  background:var(--feather-cream-2); display:flex; align-items:center; justify-content:center;
  cursor:pointer; color:var(--walnut);
}

/* --- Bottom tab nav --- */
.tabbar{
  position: fixed; bottom:0; left:50%; transform:translateX(-50%);
  width:100%; max-width:480px; height: var(--tabbar-h);
  background: var(--paper);
  border-top:1px solid var(--line);
  display:flex; z-index:40;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab{
  flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:3px; color: var(--ink-soft); font-size:0.66rem; font-weight:600;
  padding-top:6px;
}
.tab svg{ width:22px; height:22px; }
.tab.active{ color: var(--cap-blue); }
.tab .tab-fab{
  width:48px; height:48px; margin-top:-26px; border-radius:50%;
  background: linear-gradient(160deg, var(--bill-gold), var(--bill-gold-dark));
  display:flex; align-items:center; justify-content:center;
  box-shadow: var(--shadow-pop); color: var(--walnut);
}
.tab .tab-fab svg{ width:24px; height:24px; }

/* --- Buttons --- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  border:none; border-radius: var(--radius-md);
  padding: 14px 20px; font-weight:700; font-size:0.95rem;
  cursor:pointer; font-family: var(--font-body);
  transition: transform .12s ease;
}
.btn:active{ transform: scale(0.97); }
.btn-block{ width:100%; }
.btn-primary{ background: var(--cap-blue); color:#fff; box-shadow: 0 6px 18px rgba(47,111,237,0.3); }
.btn-primary:hover{ background: var(--cap-blue-dark); }
.btn-gold{ background: var(--bill-gold); color: var(--walnut); box-shadow: 0 6px 18px rgba(245,183,0,0.35); }
.btn-ghost{ background: var(--feather-cream-2); color: var(--walnut); }
.btn-outline{ background:transparent; border:1.5px solid var(--line); color: var(--ink); }
.btn-danger{ background: rgba(232,72,60,0.1); color: var(--alert-red); }
.btn-sm{ padding:9px 14px; font-size:0.82rem; border-radius: var(--radius-sm); }

/* --- Cards --- */
.card{
  background: var(--paper); border:1px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px; box-shadow: var(--shadow-card);
}
.card + .card{ margin-top:12px; }

/* --- Mascot guide bubble --- */
.mascot-guide{
  display:flex; align-items:flex-end; gap:10px; margin: 6px 0 18px;
}
.mascot-guide img{ width:56px; height:56px; border-radius:16px; flex-shrink:0; }
.speech-bubble{
  background: var(--feather-cream-2); border-radius: 16px 16px 16px 4px;
  padding:12px 14px; font-size:0.86rem; color: var(--walnut); line-height:1.4;
  font-weight:500;
}

/* --- Hero header (index/splash) --- */
.hero{
  background: radial-gradient(120% 100% at 50% 0%, #EAF1FF 0%, var(--feather-cream) 60%);
  padding: 56px 24px 40px; text-align:center;
}
.hero img.mascot-lg{ width:190px; margin: 0 auto 18px; filter: drop-shadow(0 12px 20px rgba(92,58,33,0.18)); }
.hero h1{ font-size:1.9rem; line-height:1.15; }
.hero p.tag{ color: var(--ink-soft); margin-top:8px; font-size:0.95rem; }
.brand-lockup{ display:flex; align-items:center; justify-content:center; gap:8px; margin-bottom:14px; }
.brand-lockup img{ width:30px; height:30px; border-radius:8px; }
.brand-lockup span{ font-family: var(--font-display); font-weight:700; font-size:1.15rem; letter-spacing:-0.02em; }

/* --- Form fields --- */
.field{ margin-bottom:14px; }
.field label{ display:block; font-size:0.78rem; font-weight:700; color: var(--ink-soft); margin-bottom:6px; text-transform:uppercase; letter-spacing:0.03em; }
.field input, .field select, .field textarea{
  width:100%; padding:13px 14px; border-radius: var(--radius-md);
  border: 1.5px solid var(--line); background: var(--paper); font-size:0.95rem;
  font-family: var(--font-body); color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus{ border-color: var(--cap-blue); }
.field-row{ display:flex; gap:10px; }
.field-row .field{ flex:1; }

/* --- Section headers --- */
.section-head{ display:flex; align-items:center; justify-content:space-between; margin: 22px 0 12px; }
.section-head h2{ font-size:1.1rem; }
.section-head .link{ font-size:0.82rem; font-weight:700; color: var(--cap-blue); }
.eyebrow{ font-size:0.72rem; font-weight:700; color: var(--cap-blue); text-transform:uppercase; letter-spacing:0.06em; margin-bottom:4px; display:block;}

/* --- Stat / summary tiles --- */
.stat-row{ display:flex; gap:10px; }
.stat-tile{
  flex:1; background: var(--paper); border:1px solid var(--line); border-radius: var(--radius-md);
  padding:14px; box-shadow: var(--shadow-card);
}
.stat-tile .num{ font-family: var(--font-display); font-size:1.4rem; color: var(--cap-blue); }
.stat-tile .label{ font-size:0.72rem; color: var(--ink-soft); font-weight:600; margin-top:2px; }
.stat-tile.warn .num{ color: var(--alert-red); }
.stat-tile.good .num{ color: var(--leaf-green); }

/* --- List rows --- */
.row-item{
  display:flex; align-items:center; gap:12px; padding:13px 4px; border-bottom:1px solid var(--line);
}
.row-item:last-child{ border-bottom:none; }
.row-icon{
  width:42px; height:42px; border-radius:12px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center; background: var(--feather-cream-2); color: var(--cap-blue);
}
.row-icon.gold{ background: rgba(245,183,0,0.18); color: var(--bill-gold-dark); }
.row-icon.coral{ background: rgba(242,120,75,0.15); color: var(--cheek-coral); }
.row-icon.red{ background: rgba(232,72,60,0.12); color: var(--alert-red); }
.row-icon.green{ background: rgba(63,163,77,0.14); color: var(--leaf-green); }
.row-body{ flex:1; min-width:0; }
.row-body .title{ font-weight:700; font-size:0.92rem; }
.row-body .sub{ font-size:0.78rem; color: var(--ink-soft); margin-top:2px; }
.row-trail{ font-size:0.78rem; color: var(--ink-soft); font-weight:700; text-align:right; white-space:nowrap; }

/* --- Badges / chips --- */
.badge{ display:inline-flex; align-items:center; padding:4px 10px; border-radius: var(--radius-pill); font-size:0.7rem; font-weight:700; }
.badge-red{ background: rgba(232,72,60,0.12); color: var(--alert-red); }
.badge-green{ background: rgba(63,163,77,0.14); color: var(--leaf-green); }
.badge-gold{ background: rgba(245,183,0,0.2); color: var(--bill-gold-dark); }
.badge-blue{ background: rgba(47,111,237,0.12); color: var(--cap-blue); }

.chip-row{ display:flex; gap:8px; overflow-x:auto; padding-bottom:4px; scrollbar-width:none; }
.chip-row::-webkit-scrollbar{ display:none; }
.chip{
  flex-shrink:0; padding:8px 15px; border-radius: var(--radius-pill); background: var(--feather-cream-2);
  font-size:0.82rem; font-weight:700; color: var(--ink-soft); border:1.5px solid transparent; cursor:pointer;
}
.chip.active{ background: var(--cap-blue); color:#fff; }

/* --- Child avatar cards --- */
.child-scroll{ display:flex; gap:12px; overflow-x:auto; padding-bottom:6px; scrollbar-width:none; }
.child-scroll::-webkit-scrollbar{ display:none; }
.child-card{
  flex-shrink:0; width:118px; background:var(--paper); border:1px solid var(--line); border-radius: var(--radius-md);
  padding:12px; text-align:center; box-shadow: var(--shadow-card); cursor:pointer;
}
.child-card .avatar{
  width:52px; height:52px; border-radius:50%; margin:0 auto 8px; display:flex; align-items:center; justify-content:center;
  font-family: var(--font-display); font-weight:700; font-size:1.1rem; color:#fff;
}
.child-card .name{ font-weight:700; font-size:0.85rem; }
.child-card .grade{ font-size:0.7rem; color: var(--ink-soft); margin-top:2px; }
.child-card.add{ display:flex; flex-direction:column; align-items:center; justify-content:center; border-style:dashed; color: var(--cap-blue); }

/* --- Calendar --- */
.month-nav{ display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.month-nav .icon-btn{ width:34px; height:34px; }
.cal-grid{ display:grid; grid-template-columns: repeat(7,1fr); gap:6px; text-align:center; }
.cal-dow{ font-size:0.68rem; font-weight:700; color: var(--ink-soft); padding-bottom:6px; }
.cal-day{
  aspect-ratio:1; display:flex; flex-direction:column; align-items:center; justify-content:center;
  border-radius:10px; font-size:0.82rem; font-weight:600; position:relative; cursor:pointer; color: var(--ink);
}
.cal-day.muted{ color:#D8CBB0; }
.cal-day.today{ background: var(--feather-cream-2); }
.cal-day.selected{ background: var(--cap-blue); color:#fff; }
.cal-day .dot-wrap{ display:flex; gap:2px; margin-top:2px; }
.cal-day .evt-dot{ width:4px; height:4px; border-radius:50%; }

/* --- Empty state --- */
.empty-state{ text-align:center; padding: 30px 10px; }
.empty-state img{ width:110px; margin:0 auto 14px; }
.empty-state h3{ font-size:1rem; }
.empty-state p{ font-size:0.85rem; color: var(--ink-soft); margin-top:6px; }

/* --- Fab --- */
.fab{
  position: fixed; bottom: calc(var(--tabbar-h) + 16px); right: calc(50% - 240px + 18px);
  width:56px; height:56px; border-radius:50%; border:none;
  background: var(--cap-blue); color:#fff; display:flex; align-items:center; justify-content:center;
  box-shadow: var(--shadow-pop); z-index: 45; cursor:pointer;
}
@media (max-width: 480px){ .fab{ right:18px; } }

/* --- Sheet / modal --- */
.sheet-overlay{
  position: fixed; inset:0; background: rgba(43,33,24,0.45); z-index:60;
  display:flex; align-items:flex-end; justify-content:center; opacity:0; pointer-events:none; transition:opacity .2s;
}
.sheet-overlay.open{ opacity:1; pointer-events:auto; }
.sheet{
  background: var(--paper); width:100%; max-width:480px; border-radius: 24px 24px 0 0;
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .25s ease;
  max-height: 85vh; overflow-y:auto;
}
.sheet-overlay.open .sheet{ transform: translateY(0); }
.sheet-handle{ width:40px; height:5px; background: var(--line); border-radius:3px; margin: 6px auto 16px; }
.sheet h3{ margin-bottom:16px; }

/* --- Toast --- */
.toast{
  position: fixed; bottom: calc(var(--tabbar-h) + 16px); left:50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color:#fff; padding: 12px 20px; border-radius: var(--radius-pill);
  font-size:0.85rem; font-weight:600; z-index:80; opacity:0; pointer-events:none; transition: all .25s ease;
  display:flex; align-items:center; gap:8px; white-space:nowrap;
}
.toast.show{ opacity:1; transform: translateX(-50%) translateY(0); }

/* --- Progress bar --- */
.progress{ height:8px; background: var(--feather-cream-2); border-radius: var(--radius-pill); overflow:hidden; }
.progress > div{ height:100%; background: linear-gradient(90deg, var(--cap-blue), var(--leaf-green)); border-radius: var(--radius-pill); }

/* --- Toggle switch --- */
.toggle{ position:relative; width:46px; height:26px; }
.toggle input{ opacity:0; width:0; height:0; }
.toggle .track{ position:absolute; inset:0; background: var(--line); border-radius: var(--radius-pill); transition:.2s; cursor:pointer; }
.toggle .track::before{ content:''; position:absolute; width:20px; height:20px; left:3px; top:3px; background:#fff; border-radius:50%; transition:.2s; box-shadow:0 1px 3px rgba(0,0,0,0.2); }
.toggle input:checked + .track{ background: var(--cap-blue); }
.toggle input:checked + .track::before{ transform: translateX(20px); }
.settings-row{ display:flex; align-items:center; justify-content:space-between; padding:14px 4px; border-bottom:1px solid var(--line); }
.settings-row:last-child{ border-bottom:none; }
.settings-row .txt .title{ font-weight:700; font-size:0.9rem; }
.settings-row .txt .sub{ font-size:0.76rem; color:var(--ink-soft); margin-top:2px; }

/* --- Auth screens --- */
.auth-tabs{ display:flex; background: var(--feather-cream-2); border-radius: var(--radius-pill); padding:4px; margin-bottom:22px; }
.auth-tab{ flex:1; text-align:center; padding:10px; border-radius: var(--radius-pill); font-weight:700; font-size:0.85rem; color:var(--ink-soft); cursor:pointer; }
.auth-tab.active{ background: var(--paper); color: var(--cap-blue); box-shadow: var(--shadow-card); }
.divider-or{ display:flex; align-items:center; gap:10px; margin:18px 0; color: var(--ink-soft); font-size:0.75rem; font-weight:700; }
.divider-or::before, .divider-or::after{ content:''; flex:1; height:1px; background: var(--line); }

/* --- Utility --- */
.text-center{ text-align:center; }
.muted{ color: var(--ink-soft); }
.mt-8{ margin-top:8px; } .mt-16{ margin-top:16px; } .mt-24{ margin-top:24px; }
.flex-between{ display:flex; align-items:center; justify-content:space-between; }
.small{ font-size:0.78rem; }
.pill-btn{ border-radius: var(--radius-pill) !important; }

/* --- Splash / install --- */
.splash-actions{ display:flex; flex-direction:column; gap:10px; padding: 0 22px 30px; }
.trust-row{ display:flex; justify-content:center; gap:22px; margin-top:22px; }
.trust-row .t{ text-align:center; }
.trust-row .t .n{ font-family: var(--font-display); font-size:1.2rem; color: var(--cap-blue); }
.trust-row .t .l{ font-size:0.68rem; color: var(--ink-soft); font-weight:600; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  *{ animation-duration:0.001ms !important; transition-duration:0.001ms !important; }
}
