/* 자녀 학원 스케줄 — 아기자기 디자인 */
:root {
  --bg: #FAF7F2;
  --card: #ffffff;
  --border: #EEE7DD;
  --divider: #F5F0E8;
  --ink: #1F1812;
  --muted: #8D8278;
  --soft: #C4B8AA;
  --accent: #FF7BA3;
  --accent-soft: #FFE9EF;
  --r-card: 16px;
  --r-pill: 999px;
  --header-h: 52px;
  --tabbar-h: 78px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.03);
  --font-display: "Jua", -apple-system, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Pretendard', 'Segoe UI', 'Malgun Gothic', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

body {
  padding-top: calc(var(--header-h) + var(--safe-top));
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bot));
  min-height: 100vh;
}

/* ===== Header ===== */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(var(--header-h) + var(--safe-top));
  padding: var(--safe-top) 20px 0;
  background: rgba(250,247,242,0.92);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  display: flex; align-items: center; justify-content: space-between;
  z-index: 100;
}
.app-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.5px;
  font-weight: 400;
}
.header-btn {
  width: 36px; height: 36px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--ink);
}
.header-btn.accent { background: var(--accent); color: #fff; border: none; }
.header-btn:active { transform: scale(0.94); }

/* ===== Tabbar ===== */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--tabbar-h) + var(--safe-bot));
  padding-bottom: calc(22px + var(--safe-bot));
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 100;
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: #B5ABA2;
  font-size: 10px;
  font-weight: 700;
}
.tab svg { width: 20px; height: 20px; }
.tab.active { color: var(--accent); }

/* ===== Page scaffolding ===== */
main { padding: 0; }
.scr {
  padding: 4px 0 8px;
  min-height: 100vh;
  background: var(--bg);
}

/* ===== Common card ===== */
.card {
  background: var(--card);
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  padding: 16px;
  overflow: hidden;
}
.card-list { padding: 0; }
.card-list > * {
  padding: 14px 16px;
  border-bottom: 1px solid var(--divider);
}
.card-list > *:last-child { border-bottom: none; }

.sec-block { padding: 0 20px 16px; }
.sec-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px; margin-bottom: 10px;
}
.sec-head h2 {
  margin: 0; font-size: 14px; font-weight: 800; color: var(--ink); letter-spacing: -0.2px;
}
.sec-head .sec-meta { font-size: 12px; font-weight: 700; color: var(--muted); }

.num { font-family: var(--font-display); font-weight: 400; }
.tabular { font-variant-numeric: tabular-nums; }

/* ===== Chip / pill filters ===== */
.chip-row {
  display: flex; gap: 6px; overflow-x: auto;
  padding: 0 16px 14px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: #fff;
  border: 1px solid var(--border);
  font-size: 12px; font-weight: 700; color: var(--ink);
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; user-select: none;
}
.chip.active { background: var(--ink); color: #fff; border: none; }
.chip-dot { width: 6px; height: 6px; border-radius: 3px; }

/* ===== Home: profile row ===== */
.profile-row {
  padding: 0 20px 20px;
  display: flex; gap: 12px; overflow-x: auto;
  scrollbar-width: none;
}
.profile-row::-webkit-scrollbar { display: none; }
.profile {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer;
}
.profile-avatar {
  width: 56px; height: 56px; border-radius: 28px; overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: var(--muted);
  transition: all 0.15s;
}
.profile.active .profile-avatar {
  border: 2px solid var(--accent);
  color: var(--accent);
}
.profile-name { font-size: 11px; font-weight: 700; color: var(--muted); }
.profile.active .profile-name { color: var(--ink); }
.profile-add .profile-avatar {
  border-style: dashed;
  color: var(--accent);
  font-size: 22px;
  font-weight: 300;
}

/* ===== Weather widget ===== */
.weather-card {
  margin: 0 20px 16px;
  background: linear-gradient(135deg, #F0F6FF 0%, #E8F0FE 100%);
  border: 1px solid #E0EAFF;
  border-radius: var(--r-card);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 12px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.weather-card .wc-main { display: flex; align-items: center; gap: 14px; }
.weather-card.has-upcoming { padding-bottom: 12px; }
.weather-card.sunny   { background: linear-gradient(135deg, #FFF6E0, #FFE9A8); border-color: #FFE0A0; }
.weather-card.partly  { background: linear-gradient(135deg, #F3F9FF, #E6EEFF); border-color: #DCE6FF; }
.weather-card.cloudy  { background: linear-gradient(135deg, #EEF0F4, #DEE3EA); border-color: #D5DCE5; }
.weather-card.fog     { background: linear-gradient(135deg, #ECEEF1, #D6DAE0); border-color: #CED3DA; }
.weather-card.drizzle { background: linear-gradient(135deg, #E4EEF7, #D3E2F2); border-color: #C9DCF0; }
.weather-card.rain    { background: linear-gradient(135deg, #D8E3F0, #BBCFE4); border-color: #B0C6DE; }
.weather-card.shower  { background: linear-gradient(135deg, #CEDDEE, #A9C2DF); border-color: #9FB9D8; }
.weather-card.snow    { background: linear-gradient(135deg, #F4F7FB, #E0E8F0); border-color: #D8E1EB; }
.weather-card.storm   { background: linear-gradient(135deg, #4A5568, #2D3748); border-color: #1A202C; color:#fff; }

.weather-card .wc-emoji {
  font-size: 44px; line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08));
  position: relative;
  z-index: 2;
}
.weather-card.sunny   .wc-emoji { animation: wSun 4s linear infinite; }
.weather-card.partly  .wc-emoji,
.weather-card.cloudy  .wc-emoji,
.weather-card.fog     .wc-emoji { animation: wFloat 3.2s ease-in-out infinite; }
.weather-card.rain    .wc-emoji,
.weather-card.drizzle .wc-emoji,
.weather-card.shower  .wc-emoji { animation: wShake 1.2s ease-in-out infinite; }
.weather-card.snow    .wc-emoji { animation: wFloat 3.5s ease-in-out infinite; }
.weather-card.storm   .wc-emoji { animation: wStorm 1.6s steps(4) infinite; }

@keyframes wSun   { 0%{transform:rotate(0)} 100%{transform:rotate(360deg)} }
@keyframes wFloat { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-4px)} }
@keyframes wShake { 0%,100%{transform:rotate(-3deg)} 50%{transform:rotate(3deg)} }
@keyframes wStorm { 0%,20%,40%,100%{opacity:1} 30%,50%{opacity:0.4} }

.weather-card .wc-info { flex: 1; position: relative; z-index: 2; }
.weather-card .wc-temp {
  font-family: var(--font-display);
  font-size: 26px; color: var(--ink); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.weather-card.storm .wc-temp { color: #fff; }
.weather-card .wc-name { font-size: 13px; color: var(--muted); margin-top: 4px; font-weight: 700; }
.weather-card.storm .wc-name { color: rgba(255,255,255,0.85); }
.weather-card .wc-sub {
  font-size: 11px; color: var(--muted); margin-top: 2px; font-weight: 600;
}
.weather-card.storm .wc-sub { color: rgba(255,255,255,0.7); }
.weather-card .wc-loading {
  font-size: 13px; color: var(--muted); font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.weather-card .wc-loading::before {
  content: ''; width: 14px; height: 14px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 빗방울 오버레이 (rain/drizzle/shower) */
.weather-card .rain-layer {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}
.rain-drop {
  position: absolute; top: -14px;
  width: 2px; height: 10px;
  background: linear-gradient(to bottom, rgba(100,130,180,0.0), rgba(80,110,160,0.65));
  border-radius: 2px;
  animation: rainFall linear infinite;
}
@keyframes rainFall {
  0%   { transform: translateY(-20px) translateX(0); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(140px) translateX(-6px); opacity: 0; }
}

/* 눈송이 오버레이 */
.snow-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.snow-flake {
  position: absolute; top: -14px;
  font-size: 10px; color: #fff;
  text-shadow: 0 0 4px rgba(150,180,220,0.4);
  animation: snowFall linear infinite;
}
@keyframes snowFall {
  0%   { transform: translateY(-12px) rotate(0deg); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 0.8; }
  100% { transform: translateY(120px) rotate(360deg) translateX(12px); opacity: 0; }
}

/* 번개 플래시 */
.weather-card.storm::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.7);
  opacity: 0;
  pointer-events: none;
  animation: stormFlash 6s ease-in-out infinite;
}
@keyframes stormFlash {
  0%, 92%, 100% { opacity: 0; }
  94% { opacity: 0.9; }
  96% { opacity: 0.3; }
  98% { opacity: 0.7; }
}

/* 태양빛 효과 */
.weather-card.sunny::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 140px; height: 140px;
  background: radial-gradient(circle, rgba(255,220,120,0.55) 0%, transparent 65%);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .weather-card .wc-emoji,
  .rain-drop, .snow-flake,
  .weather-card.storm::after { animation: none !important; }
}

/* 강수 예보 알림 (비/눈 시작 예정) */
.wc-upcoming {
  position: relative;
  z-index: 2;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.wc-upcoming.warn { border-left: 3px solid #4A90E2; }
.wc-upcoming.clear { border-left: 3px solid #F5A623; }
.weather-card.storm .wc-upcoming {
  background: rgba(255,255,255,0.92);
}
.wc-upcoming-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: wcDotPulse 1.6s ease-in-out infinite;
}
.wc-upcoming.clear .wc-upcoming-dot { background: #F5A623; }
.wc-upcoming.warn .wc-upcoming-dot { background: #4A90E2; }
.wc-upcoming-text { flex: 1; line-height: 1.3; }
.wc-upcoming-prob {
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: rgba(0,0,0,0.05);
  padding: 2px 6px;
  border-radius: 8px;
  flex-shrink: 0;
}
@keyframes wcDotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.3); opacity: 0.7; }
}
@media (prefers-reduced-motion: reduce) {
  .wc-upcoming-dot { animation: none !important; }
}

/* ===== Home: date header ===== */
.home-date-head { padding: 6px 20px 20px; }
.home-date-head .sub {
  font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.2px;
}
.home-date-head .big {
  font-family: var(--font-display);
  font-size: 26px; color: var(--ink); margin-top: 4px; line-height: 1.3;
}
.home-date-head .big em {
  font-style: normal;
  color: var(--accent);
}

/* ===== Home: plan card ===== */
.plan-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 18px;
  cursor: pointer;
}
.plan-card + .plan-card { margin-top: 10px; padding: 16px; }
.plan-card .plan-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.plan-card .plan-label {
  font-size: 11px; font-weight: 800; letter-spacing: 0.5px;
  color: var(--accent);
  display: inline-flex; align-items: center; gap: 4px;
}
.plan-card .plan-label.next { color: var(--muted); }
.plan-card .plan-time { font-size: 12px; font-weight: 700; color: var(--muted); }
.plan-card .plan-title {
  font-family: var(--font-display);
  font-size: 20px; color: var(--ink);
}
.plan-card.small .plan-title {
  font-family: inherit; font-size: 15px; font-weight: 800;
}
.plan-card .plan-sub {
  font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 600;
}
.plan-card.small .plan-sub { margin-top: 3px; font-size: 11px; }

/* ===== List row (schedule item / payment row) ===== */
.list-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
}
.list-row:last-child { border-bottom: none; }
.list-row.done { opacity: 0.45; }
.list-row .time-col {
  min-width: 54px;
}
.list-row .time-col .t-start {
  font-family: var(--font-display);
  font-size: 15px; color: var(--ink); line-height: 1.1;
}
.list-row .time-col .t-end {
  font-size: 10px; color: var(--muted); margin-top: 2px; font-weight: 600;
}
.list-row .kid-bar {
  width: 3px; height: 28px; border-radius: 2px;
}
.list-row .info { flex: 1; min-width: 0; }
.list-row .info .name { font-weight: 700; font-size: 14px; color: var(--ink); }
.list-row .info .meta {
  font-size: 11px; color: var(--muted); margin-top: 2px; font-weight: 600;
  display: flex; align-items: center; gap: 5px;
}
.list-row .info .meta .kid-dot { width: 6px; height: 6px; border-radius: 3px; }
.list-row .done-tag { font-size: 11px; font-weight: 700; color: var(--muted); }

/* ===== Payment (D-badge) ===== */
.pay-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--divider); cursor: pointer; }
.pay-row:last-child { border-bottom: none; }
.pay-row .d-col { min-width: 48px; text-align: center; }
.pay-row .d-col .d-label { font-size: 10px; font-weight: 700; color: var(--muted); }
.pay-row .d-col .d-label.close { color: var(--accent); }
.pay-row .d-col .d-day { font-family: var(--font-display); font-size: 18px; color: var(--ink); line-height: 1.1; }
.pay-row .p-info { flex: 1; }
.pay-row .p-info .p-name { font-weight: 700; font-size: 14px; color: var(--ink); }
.pay-row .p-info .p-meta { font-size: 11px; color: var(--muted); margin-top: 1px; font-weight: 600; }
.pay-row .p-amount { font-family: var(--font-display); font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ===== Weekly grid ===== */
.week-nav {
  padding: 0 20px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.week-nav-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-weight: 700; font-size: 18px;
  cursor: pointer; background: transparent; border: 0;
}
.week-nav-label { text-align: center; }
.week-nav-label .main {
  font-family: var(--font-display); font-size: 18px; color: var(--ink);
}
.week-nav-label .sub {
  font-size: 11px; color: var(--muted); font-weight: 600;
}

.week-card {
  margin: 0 16px;
  background: #fff;
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  padding: 12px;
}
.week-header-row {
  display: grid;
  grid-template-columns: 56px repeat(7, 1fr);
  margin-bottom: 4px; padding-bottom: 8px;
  border-bottom: 1px solid var(--divider);
}
.week-header-row .day {
  text-align: center;
}
.week-header-row .day .dn { font-size: 10px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.week-header-row .day .dt {
  font-family: var(--font-display); font-size: 13px;
  width: 22px; height: 22px; border-radius: 11px;
  margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink);
}
.week-header-row .day.today .dt {
  background: var(--accent); color: #fff;
}

.week-grid {
  display: grid;
  grid-template-columns: 56px repeat(7, 1fr);
  position: relative;
}
.week-grid .hour-col {
  display: flex; flex-direction: column;
}
.week-grid .hour-col .h-label {
  height: var(--hour-height, 54px);
  font-size: 11px; font-weight: 700; color: var(--muted);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 4px;
}
.week-grid .day-col {
  position: relative; border-left: 1px solid var(--divider);
}
.week-grid .day-col .slot {
  height: var(--hour-height, 54px);
  border-bottom: 1px solid var(--divider);
}

.w-block {
  position: absolute;
  left: 3px; right: 3px;
  background: var(--bg);
  border-radius: 8px;
  padding: 6px 8px;
  overflow: hidden;
  cursor: pointer;
}
.w-block .wb-title {
  font-size: 12px; font-weight: 700; color: var(--ink); line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: keep-all;
}
.w-block .wb-time {
  font-size: 10px; color: var(--muted); font-weight: 600; margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

.now-marker {
  position: absolute;
  height: 0;
  z-index: 3;
  pointer-events: none;
  display: flex;
  align-items: center;
}
.now-marker { justify-content: center; }
.now-marker .now-kid {
  flex-shrink: 0;
  width: 48px; height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 6px rgba(255,123,163,0.35);
  animation: kidWalk 1.1s ease-in-out infinite;
  transform-origin: bottom center;
}
.now-marker .now-kid svg,
.now-marker .now-kid img { display: block; }
.now-marker .now-kid img {
  box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0,0,0,0.22);
  border-radius: 50%;
}
.now-marker .now-dash {
  flex: 1;
  height: 0;
  border-top: 2px dashed var(--accent);
  opacity: 0.55;
  margin-left: -2px;
}
@keyframes kidWalk {
  0%   { transform: translateY(0) rotate(-6deg); }
  25%  { transform: translateY(-3px) rotate(0deg); }
  50%  { transform: translateY(0) rotate(6deg); }
  75%  { transform: translateY(-3px) rotate(0deg); }
  100% { transform: translateY(0) rotate(-6deg); }
}
@media (prefers-reduced-motion: reduce) {
  .now-marker .now-kid { animation: none; }
}

.week-summary { padding: 18px 20px 20px; }
.week-summary-card {
  background: #fff; border-radius: var(--r-card); border: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(3, 1fr);
}
.week-summary-cell {
  padding: 14px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border-right: 1px solid var(--divider);
}
.week-summary-cell:last-child { border-right: none; }
.week-summary-cell .name { font-size: 11px; font-weight: 700; color: var(--muted); }
.week-summary-cell .count {
  font-family: var(--font-display); font-size: 18px; color: var(--ink);
}
.week-summary-cell .count .unit { font-size: 10px; color: var(--muted); margin-left: 2px; }

/* ===== Academy ===== */
.acad-stat-card {
  margin: 0 20px 16px;
  background: #fff; border-radius: var(--r-card); border: 1px solid var(--border);
  padding: 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.acad-stat-card .cell .label {
  font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: 0.3px;
}
.acad-stat-card .cell .value {
  font-family: var(--font-display); color: var(--ink); margin-top: 2px;
}
.acad-stat-card .cell .value .suf { font-size: 13px; margin-left: 3px; color: var(--muted); }
.acad-stat-card .divider { width: 1px; height: 32px; background: #F0EAE0; }

.acad-list { padding: 0 20px; display: flex; flex-direction: column; gap: 10px; }
.acad-item {
  background: #fff; border-radius: var(--r-card); border: 1px solid var(--border);
  padding: 16px;
  cursor: pointer;
}
.acad-item .head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.acad-item .head .av {
  width: 36px; height: 36px; border-radius: 18px; overflow: hidden; flex-shrink: 0;
}
.acad-item .head .title-col { flex: 1; min-width: 0; }
.acad-item .head .title-col .t {
  font-family: var(--font-display); font-size: 16px; color: var(--ink);
}
.acad-item .head .title-col .m {
  font-size: 11px; color: var(--muted); margin-top: 2px; font-weight: 600;
}
.acad-item .addr { font-size: 11px; color: var(--muted); margin-bottom: 10px; font-weight: 600; }
.acad-item .day-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.acad-item .day-chips { display: flex; gap: 3px; }
.acad-item .day-chip {
  width: 20px; height: 20px; border-radius: 6px;
  background: var(--divider); color: var(--soft);
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.acad-item .day-chip.on { background: var(--ink); color: #fff; }
.acad-item .time-text { font-size: 11px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.acad-item .foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; border-top: 1px solid var(--divider);
}
.acad-item .foot .payday { font-size: 11px; font-weight: 700; color: var(--muted); }
.acad-item .foot .fee { font-family: var(--font-display); font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }
.acad-item .foot a { color: var(--accent); text-decoration: none; font-weight: 700; }

/* ===== Billing ===== */
.bill-month-nav {
  padding: 0 20px 16px;
  display: flex; align-items: center; justify-content: center; gap: 16px;
}
.bill-month-nav button {
  font-size: 18px; color: var(--muted); font-weight: 700;
  background: transparent; border: 0; padding: 4px 10px; cursor: pointer;
}
.bill-month-nav .m-label { font-family: var(--font-display); font-size: 20px; color: var(--ink); }

.bill-total-card {
  margin: 0 20px 16px;
  background: #fff; border-radius: var(--r-card); border: 1px solid var(--border);
  padding: 20px;
}
.bill-total-card .label {
  font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: 0.3px;
}
.bill-total-card .amount {
  font-family: var(--font-display); font-size: 32px; color: var(--ink);
  margin-top: 4px; letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.bill-total-card .bar {
  margin-top: 14px; background: var(--divider); border-radius: 999px; height: 6px; overflow: hidden;
}
.bill-total-card .bar > span {
  display: block; height: 100%; background: var(--accent); border-radius: 999px;
  transition: width 0.3s;
}
.bill-total-card .bar-meta {
  margin-top: 8px; display: flex; justify-content: space-between; font-size: 12px; font-weight: 700;
}
.bill-total-card .bar-meta .paid-amt { color: var(--accent); }
.bill-total-card .bar-meta .left-amt { color: var(--muted); }

.by-kid-card {
  margin: 0 20px 16px;
  background: #fff; border-radius: var(--r-card); border: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(3, 1fr);
}
.by-kid-cell {
  padding: 14px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border-right: 1px solid var(--divider);
}
.by-kid-cell:last-child { border-right: none; }
.by-kid-cell .av { width: 32px; height: 32px; border-radius: 16px; overflow: hidden; }
.by-kid-cell .kn { font-size: 11px; font-weight: 700; color: var(--ink); }
.by-kid-cell .cnt { font-size: 10px; color: var(--muted); font-weight: 600; }
.by-kid-cell .amt { font-family: var(--font-display); font-size: 14px; color: var(--ink); }

.pay-check {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
}
.pay-check:last-child { border-bottom: none; }
.pay-check.done { opacity: 0.5; }
.pay-check .ch {
  width: 22px; height: 22px; border-radius: 11px;
  border: 1.5px solid #D8CEBF; background: #fff;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.pay-check.done .ch { background: var(--accent); border-color: var(--accent); }
.pay-check .d { min-width: 40px; text-align: center; font-family: var(--font-display); font-size: 14px; color: var(--ink); }
.pay-check .info { flex: 1; min-width: 0; }
.pay-check .info .nm { font-weight: 700; font-size: 14px; color: var(--ink); }
.pay-check.done .info .nm { text-decoration: line-through; }
.pay-check .info .mt {
  font-size: 11px; color: var(--muted); margin-top: 1px; font-weight: 600;
  display: flex; align-items: center; gap: 5px;
}
.pay-check .info .mt .kd { width: 6px; height: 6px; border-radius: 3px; }
.pay-check .amt { font-family: var(--font-display); font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }
.pay-check.done .amt { text-decoration: line-through; }

/* ===== Settings ===== */
.settings-section { padding: 0 20px 16px; }
.child-tile {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; background: #fff; border-radius: var(--r-card);
  border: 1px solid var(--border); margin-bottom: 8px;
  cursor: pointer;
}
.child-tile .av { width: 44px; height: 44px; border-radius: 22px; overflow: hidden; flex-shrink: 0; }
.child-tile .name { flex: 1; font-weight: 700; font-size: 14px; color: var(--ink); }
.child-tile .sub { font-size: 12px; color: var(--muted); font-weight: 600; }

.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
}
.setting-row:last-child { border-bottom: none; }
.setting-row .label { font-weight: 700; font-size: 14px; color: var(--ink); }
.setting-row.danger .label { color: #E74C5F; }
.setting-row .sub { font-size: 12px; color: var(--muted); margin-top: 2px; font-weight: 600; }

/* ===== Buttons ===== */
.btn {
  border: 0; border-radius: 12px;
  padding: 12px 18px;
  font-size: 14px; font-weight: 800;
  cursor: pointer; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  letter-spacing: -0.1px;
}
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--border); }
.btn-sub { background: var(--divider); color: var(--ink); }
.btn-danger { background: #E74C5F; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn:active { transform: scale(0.97); }

/* ===== FAB ===== */
.fab {
  position: fixed; right: 20px;
  bottom: calc(var(--tabbar-h) + var(--safe-bot) + 16px);
  width: 52px; height: 52px; border-radius: 26px; border: 0;
  background: var(--accent); color: #fff;
  font-size: 26px; font-weight: 300;
  box-shadow: 0 6px 18px rgba(255,123,163,0.4);
  cursor: pointer;
  z-index: 50;
}
.fab:active { transform: scale(0.92); }

/* ===== Modal ===== */
#modal-root:empty { display: none; }
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(31,24,18,0.4);
  z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal {
  background: #fff;
  width: 100%; max-width: 560px;
  border-top-left-radius: 20px; border-top-right-radius: 20px;
  max-height: 92vh; overflow-y: auto;
  padding: 18px 20px calc(28px + var(--safe-bot));
  animation: slideUp 0.22s ease-out;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.modal-head h2 {
  margin: 0; font-family: var(--font-display); font-size: 19px; color: var(--ink); font-weight: 400;
}
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

/* ===== Form ===== */
.field { margin-bottom: 12px; }
.field > label {
  display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px;
  letter-spacing: 0.2px;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px;
  font-size: 15px;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fff; color: var(--ink); font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,123,163,0.15);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.hour-range {
  display: flex; gap: 8px; align-items: center;
}
.hour-range > input { flex: 1; }
.hour-range .dash { color: var(--muted); }

.day-chk-row {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  margin-top: 4px;
}
.sched-row { transition: background 0.15s; }
.sched-row .sched-del { opacity: 0.55; transition: opacity 0.15s; }
.sched-row:hover .sched-del { opacity: 1; }
.day-chk {
  padding: 10px 0; text-align: center;
  border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; font-weight: 700; font-size: 13px;
  background: #fff; color: var(--muted); user-select: none;
  transition: all 0.15s;
}
.day-chk:hover { border-color: var(--accent); color: var(--ink); }
.day-chk.selected {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(255, 123, 163, 0.35);
}

.char-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 4px; }
.char-picker .cp-item {
  aspect-ratio: 1; border-radius: 14px; border: 2px solid transparent;
  overflow: hidden; cursor: pointer; padding: 2px;
}
.char-picker .cp-item.selected { border-color: var(--accent); }

/* Cropper */
.cropper-stage {
  position: relative;
  width: 280px; height: 280px;
  margin: 0 auto 14px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  border-radius: 14px;
  overflow: hidden;
}
#cropper-canvas {
  display: block;
  cursor: grab;
  touch-action: none;
  width: 100%;
  height: 100%;
}
#cropper-canvas:active { cursor: grabbing; }
.cropper-hint {
  position: absolute;
  bottom: 10px; left: 50%; transform: translateX(-50%);
  color: #fff;
  font-size: 11px;
  background: rgba(0,0,0,0.55);
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 600;
  pointer-events: none;
}
.cropper-zoom {
  display: flex; align-items: center; gap: 12px;
  margin: 4px 4px 12px;
  font-size: 13px;
  color: var(--muted);
}
.cropper-zoom input[type=range] {
  flex: 1;
  accent-color: var(--accent);
  height: 22px;
}

/* Photo picker */
.photo-picker {
  display: flex; align-items: center; gap: 16px;
  padding: 12px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.photo-preview {
  width: 84px; height: 84px; border-radius: 42px;
  overflow: hidden;
  background: #fff;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.photo-preview img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.photo-preview .photo-placeholder {
  width: 84px; height: 84px;
  display: flex; align-items: center; justify-content: center;
}
.photo-actions {
  flex: 1;
  display: flex; flex-direction: column; gap: 6px;
  align-items: stretch;
}
.photo-actions .btn { justify-content: center; }

/* ===== Toast ===== */
#toast-root {
  position: fixed; left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bot) + 20px);
  transform: translateX(-50%);
  z-index: 300; pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 20px;
  font-size: 13px; font-weight: 700;
  margin-top: 8px; animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } }

/* ===== Empty state ===== */
.empty {
  text-align: center; padding: 60px 16px;
  color: var(--muted);
}
.empty-emoji { font-size: 48px; margin-bottom: 12px; }
.empty h3 { margin: 0; font-family: var(--font-display); font-size: 20px; color: var(--ink); font-weight: 400; }
.empty p { margin: 4px 0; font-weight: 600; }

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