/* ============================================================
   Moon's Family — Mobile-first family scheduler
   Design: Linear/Notion/Apple HIG inspired, calm & minimal
   ============================================================ */

:root {
  /* Palette */
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f5f5f4;
  --surface-3: #ebebe9;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --text: #1c1917;
  --text-2: #57534e;
  --text-3: #a8a29e;

  /* Accents */
  --accent: #2563eb;        /* Blue 600 — primary action */
  --accent-soft: #dbeafe;
  --danger: #dc2626;
  --warn: #ea580c;
  --ok: #16a34a;

  /* Family member colors */
  --mom: #ec4899;       /* pink */
  --mom-soft: #fce7f3;
  --dad: #2563eb;       /* blue */
  --dad-soft: #dbeafe;
  --kid: #f59e0b;       /* amber */
  --kid-soft: #fef3c7;
  --shared: #8b5cf6;    /* violet */
  --shared-soft: #ede9fe;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.10);

  /* Sizing */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --tabbar-h: 64px;
  --topbar-h: 52px;

  /* Type */
  --font: 'Pretendard', 'Inter', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0a09;
    --surface: #1c1917;
    --surface-2: #292524;
    --surface-3: #44403c;
    --border: #292524;
    --border-strong: #44403c;
    --text: #fafaf9;
    --text-2: #d6d3d1;
    --text-3: #78716c;
    --accent-soft: #1e3a8a;
    --mom-soft: #831843;
    --dad-soft: #1e3a8a;
    --kid-soft: #78350f;
    --shared-soft: #4c1d95;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; padding: 0; }
input, textarea, select { font-family: inherit; font-size: 15px; }

#app {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-top: calc(var(--topbar-h) + env(safe-area-inset-top));
}

/* ===== Top bar ===== */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: color-mix(in oklab, var(--surface) 85%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  max-width: 720px; margin: 0 auto;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; color: inherit;
  margin: 0;
}
.brand-mark {
  width: 30px; height: 30px; display: block;
  flex-shrink: 0;
}
.brand-text {
  display: inline-flex; flex-direction: column;
  line-height: 1;
}
.brand-name {
  font-size: 15px; font-weight: 700; letter-spacing: -0.02em;
  color: var(--text);
}
.brand-tag {
  font-size: 10px; font-weight: 500; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-top: 3px;
}
.icon-btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.icon-btn:active { background: var(--surface-2); }

/* ===== Main screen ===== */
.screen {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  min-height: calc(100dvh - var(--topbar-h) - var(--tabbar-h));
}

/* ===== Bottom tab bar ===== */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in oklab, var(--surface) 90%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--border);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--text-3); font-size: 11px; font-weight: 500;
  height: var(--tabbar-h);
  transition: color 120ms ease;
}
.tab.active { color: var(--accent); }
.tab-ico { width: 22px; height: 22px; }

/* ===== Page header ===== */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin: 4px 0 16px;
}
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.page-sub { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.page-actions { display: flex; gap: 8px; }

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 12px; }
.card-title {
  font-size: 13px; font-weight: 600; color: var(--text-2);
  letter-spacing: 0.02em; text-transform: uppercase;
  margin: 0 0 10px;
}
.card-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.card-row:first-of-type { border-top: none; padding-top: 4px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px;
  background: var(--surface-2); color: var(--text);
  transition: transform 80ms ease, background 120ms ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { background: color-mix(in oklab, var(--accent) 88%, black); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; }

.fab {
  position: fixed; right: 16px;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: 30;
  font-size: 28px; line-height: 1;
}
.fab:active { transform: scale(0.94); }

/* ===== Avatars / chips ===== */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; color: #fff; font-size: 13px;
  flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 12px; }
.avatar-lg { width: 44px; height: 44px; font-size: 16px; }
.avatar.mom { background: var(--mom); }
.avatar.dad { background: var(--dad); }
.avatar.kid { background: var(--kid); }
.avatar.shared { background: var(--shared); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
  background: var(--surface-2); color: var(--text-2);
}
.chip-mom { background: var(--mom-soft); color: var(--mom); }
.chip-dad { background: var(--dad-soft); color: var(--dad); }
.chip-kid { background: var(--kid-soft); color: var(--kid); }
.chip-shared { background: var(--shared-soft); color: var(--shared); }

/* ===== Form ===== */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 120ms ease;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.field-row .field { margin-bottom: 0; min-width: 0; }
.field-row .field input { width: 100%; min-width: 0; }
.sheet input[type="date"], .sheet input[type="time"] {
  appearance: none; -webkit-appearance: none;
  font-variant-numeric: tabular-nums;
}

/* ===== Checklist ===== */
.checklist { list-style: none; padding: 0; margin: 0; }
.checkitem {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.checkitem:first-child { border-top: none; }
.checkbox {
  width: 24px; height: 24px; border-radius: 8px;
  border: 1.8px solid var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 120ms ease;
}
.checkbox.checked {
  background: var(--accent); border-color: var(--accent);
}
.checkbox.checked::after {
  content: ''; width: 12px; height: 7px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
}
.checkitem-label { flex: 1; font-size: 15px; }
.checkitem.done .checkitem-label {
  text-decoration: line-through; color: var(--text-3);
}
.checkitem-meta { font-size: 12px; color: var(--text-3); }

/* Today 리스트 — 일정 항목 */
.schedule-item { cursor: pointer; }
.schedule-bar {
  width: 4px; align-self: stretch; border-radius: 2px;
  flex-shrink: 0;
  min-height: 28px;
}
.schedule-bar.mom { background: var(--mom); }
.schedule-bar.dad { background: var(--dad); }
.schedule-bar.kid { background: var(--kid); }
.schedule-bar.shared { background: var(--shared); }

/* ===== Empty state ===== */
.empty {
  text-align: center; padding: 40px 20px;
  color: var(--text-3);
}
.empty-icon { font-size: 36px; margin-bottom: 8px; opacity: 0.5; }
.empty-text { font-size: 14px; }

/* ===== Time Blocks calendar ===== */
.cal-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.cal-nav { display: flex; gap: 4px; align-items: center; }
.cal-date { font-size: 18px; font-weight: 600; min-width: 140px; text-align: center; }
.cal-view-toggle {
  display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 2px;
}
.cal-view-toggle button {
  padding: 6px 12px; font-size: 13px; font-weight: 500; color: var(--text-2);
  border-radius: 6px;
}
.cal-view-toggle button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.timeline {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.timeline-grid {
  position: relative;
  height: calc(18 * 60px); /* 06:00 ~ 24:00, 60px per hour */
}
.timeline-hour {
  position: absolute; left: 0; right: 0;
  height: 60px;
  border-top: 1px solid var(--border);
  display: flex;
}
.timeline-hour:first-child { border-top: none; }
.timeline-hour-label {
  width: 48px; flex-shrink: 0;
  padding: 4px 0 0 8px;
  font-size: 11px; color: var(--text-3); font-weight: 500;
}
.timeline-hour-slot {
  flex: 1; cursor: pointer;
}
.timeline-hour-slot:active { background: var(--surface-2); }

.timeline-now {
  position: absolute; left: 48px; right: 0;
  height: 2px; background: var(--danger);
  z-index: 5; pointer-events: none;
}
.timeline-now::before {
  content: ''; position: absolute; left: -4px; top: -4px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--danger);
}

.event-block {
  position: absolute;
  left: 52px; right: 8px;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px; font-weight: 500;
  color: #fff;
  overflow: hidden;
  border-left: 3px solid rgba(0,0,0,0.2);
  cursor: pointer;
  z-index: 2;
}
.event-block.mom { background: var(--mom); }
.event-block.dad { background: var(--dad); }
.event-block.kid { background: var(--kid); }
.event-block.shared { background: var(--shared); }
.event-block-time { font-size: 11px; opacity: 0.85; font-weight: 500; }
.event-block-title { font-weight: 600; }

/* Month view */
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.month-head {
  display: contents;
}
.month-head > div {
  background: var(--surface);
  padding: 8px 0;
  text-align: center;
  font-size: 11px; font-weight: 600;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
}
.month-head .sun { color: #ef4444; }
.month-head .sat { color: #3b82f6; }

.month-cell {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  min-height: 84px;
  padding: 4px 4px 6px;
  display: flex; flex-direction: column;
  gap: 2px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.month-cell:nth-child(7n+2) { border-left: none; }
.month-cell.other-month { background: var(--surface); opacity: 0.4; }

.month-day-num {
  font-size: 13px; font-weight: 500;
  color: var(--text);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  text-align: center;
  margin-bottom: 2px;
}
.month-day-num.sun { color: #ef4444; }
.month-day-num.sat { color: #3b82f6; }
.month-day-num.today {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 22px; height: 22px;
  margin: 0 auto 2px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

.month-pill {
  display: block;
  font-size: 9.5px; font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
.month-pill.mom { background: var(--mom); }
.month-pill.dad { background: var(--dad); }
.month-pill.kid { background: var(--kid); }
.month-pill.shared { background: var(--shared); }
.month-more {
  font-size: 9px;
  color: var(--text-3);
  font-weight: 500;
  padding: 0 4px;
}

/* 월 셀 상단: 날짜 + 픽업 차 */
.month-day-num-row {
  display: flex; align-items: center; justify-content: center;
  gap: 2px; min-height: 22px;
  margin-bottom: 1px;
}
.pickup-car {
  font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  filter: hue-rotate(0deg);
}
.pickup-car.mom {
  background: #ef4444; /* 빨강 */
  filter: drop-shadow(0 0 1px rgba(239, 68, 68, 0.5));
}
.pickup-car.dad {
  background: #3b82f6; /* 파랑 */
  filter: drop-shadow(0 0 1px rgba(59, 130, 246, 0.5));
}

/* 픽업 등원/하원 split (홈 배너) */
.pickup-banner-split {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin-bottom: 14px;
}
.pickup-banner-split .pickup-banner {
  margin-bottom: 0;
  padding: 14px;
}
.pickup-banner-split .pickup-banner-who { font-size: 20px; }

/* 픽업 등원/하원 split (픽업 화면 카드) */
.pickup-split {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.pickup-half {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 12px;
}
.pickup-half.mom { background: color-mix(in oklab, #ef4444 14%, var(--surface-2)); }
.pickup-half.dad { background: color-mix(in oklab, #3b82f6 14%, var(--surface-2)); }
.pickup-half-label {
  font-size: 11px; font-weight: 600; color: var(--text-3);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.pickup-half-who {
  font-size: 16px; font-weight: 700;
  margin-top: 4px;
  display: flex; align-items: center; gap: 6px;
}
.pickup-half-time {
  font-size: 12px; color: var(--text-2); margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* 픽업 상세 행 */
.pickup-detail-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  margin: 4px 0 8px;
}
.pickup-detail-row.mom { background: color-mix(in oklab, #ef4444 14%, var(--surface-2)); }
.pickup-detail-row.dad { background: color-mix(in oklab, #3b82f6 14%, var(--surface-2)); }

/* 근무 점 (월 셀 하단) */
.month-dots {
  display: flex; justify-content: center; gap: 3px;
  margin-top: auto; padding-top: 2px;
}
.month-dot {
  width: 5px; height: 5px; border-radius: 50%;
}
.month-dot.mom { background: var(--mom); }
.month-dot.dad { background: var(--dad); }
.month-dot.kid { background: var(--kid); }
.month-dot.shared { background: var(--shared); }

.month-cell.selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  z-index: 1;
}

/* 선택된 날의 상세 카드 (월 뷰 하단) */
.day-detail {
  margin-top: 14px;
}
.day-detail-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.day-detail-date {
  font-size: 16px; font-weight: 700; letter-spacing: -0.01em;
}
.day-detail-count {
  font-size: 12px; color: var(--text-3); margin-top: 2px;
}
.day-detail-list { padding-top: 4px; }
.day-detail-row {
  display: grid;
  grid-template-columns: 4px 60px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  align-items: center;
  cursor: pointer;
}
.day-detail-row:first-child { border-top: none; }

/* 이번주 미니 캘린더 (홈) */
.week-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.week-mini-day {
  background: var(--surface-2);
  border-radius: 6px;
  padding: 6px 3px 5px;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  cursor: pointer;
  transition: transform 80ms ease;
}
.week-mini-day:active { transform: scale(0.97); }
.week-mini-day.today {
  background: color-mix(in oklab, var(--accent) 12%, var(--surface-2));
  outline: 1px solid color-mix(in oklab, var(--accent) 35%, transparent);
}
.week-mini-head {
  font-size: 10px; font-weight: 600; color: var(--text-2);
  text-align: center;
  margin-bottom: 1px;
}
.week-mini-head.sun { color: #ef4444; }
.week-mini-head.sat { color: #3b82f6; }
.week-mini-num {
  font-size: 14px; font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
.week-mini-num.today {
  background: var(--accent); color: #fff;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 4px;
  font-size: 12px;
}
.week-mini-num.sun { color: #ef4444; }
.week-mini-num.sat { color: #3b82f6; }
.week-mini-events {
  display: flex; flex-direction: column; gap: 2px;
  flex: 1;
}
.week-mini-pill {
  font-size: 9px; font-weight: 600;
  padding: 1px 3px;
  border-radius: 3px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
.week-mini-pill.mom { background: var(--mom); }
.week-mini-pill.dad { background: var(--dad); }
.week-mini-pill.kid { background: var(--kid); }
.week-mini-pill.shared { background: var(--shared); }
.week-mini-more {
  font-size: 8px;
  color: var(--text-3);
  font-weight: 500;
  text-align: center;
}
.week-mini-dots {
  display: flex; justify-content: center; gap: 2px;
  margin-top: auto;
  padding-top: 2px;
}

/* 이번주 일정 - 날짜별 그룹 */
.week-day-block {
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.week-day-block:first-of-type { border-top: none; padding-top: 4px; }
.week-day-label {
  font-size: 12px; font-weight: 600; color: var(--text-2);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.week-day-block.today .week-day-label { color: var(--accent); }

/* 홈에 임베드된 미니 월 캘린더 (점 표시) */
.month-cell.home-cell { min-height: 44px; padding: 4px 2px; }
.home-cell .month-day-num { font-size: 12px; }
.home-cell .month-day-num.today { width: 20px; height: 20px; font-size: 11px; }
.home-dots {
  display: flex; justify-content: center; gap: 2px;
  margin-top: 2px;
}
.home-dot {
  width: 4px; height: 4px; border-radius: 50%;
}
.home-dot.mom { background: var(--mom); }
.home-dot.dad { background: var(--dad); }
.home-dot.kid { background: var(--kid); }
.home-dot.shared { background: var(--shared); }

/* Week view */
.week-grid {
  display: grid;
  grid-template-columns: 40px repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.week-head {
  background: var(--surface-2);
  padding: 8px 4px;
  text-align: center;
  font-size: 11px; font-weight: 600; color: var(--text-2);
}
.week-head.today { color: var(--accent); }
.week-day-num { display: block; font-size: 16px; margin-top: 2px; color: var(--text); }
.week-head.today .week-day-num { color: var(--accent); font-weight: 700; }
.week-hour-label {
  background: var(--surface);
  padding: 4px 4px 0;
  font-size: 10px; color: var(--text-3); text-align: right;
  height: 40px;
}
.week-cell {
  background: var(--surface);
  height: 40px;
  position: relative;
}
.week-event {
  position: absolute;
  left: 1px; right: 1px;
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 10px; font-weight: 500;
  color: #fff;
  overflow: hidden;
  z-index: 2;
}
.week-event.mom { background: var(--mom); }
.week-event.dad { background: var(--dad); }
.week-event.kid { background: var(--kid); }
.week-event.shared { background: var(--shared); }

/* ===== Home dashboard ===== */
.hero-card {
  background: linear-gradient(135deg, var(--accent) 0%, color-mix(in oklab, var(--accent) 70%, var(--shared)) 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
}
.hero-label { font-size: 12px; opacity: 0.85; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.hero-title { font-size: 22px; font-weight: 700; margin: 6px 0 4px; letter-spacing: -0.01em; }
.hero-sub { font-size: 14px; opacity: 0.9; }
.hero-meta {
  display: flex; gap: 12px; align-items: center;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.2);
  font-size: 13px;
}

.stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.stat-label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.stat-value { font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: -0.01em; }
.stat-foot { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ===== List items (events, tasks) ===== */
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.list-item:first-child { border-top: none; }
.list-item-bar {
  width: 4px; align-self: stretch; border-radius: 2px;
  flex-shrink: 0;
}
.list-item-bar.mom { background: var(--mom); }
.list-item-bar.dad { background: var(--dad); }
.list-item-bar.kid { background: var(--kid); }
.list-item-bar.shared { background: var(--shared); }
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-size: 15px; font-weight: 500; }
.list-item-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.list-item-time { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ===== Modal / Sheet ===== */
.scrim {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.4);
  opacity: 0; pointer-events: none;
  transition: opacity 200ms ease;
}
.scrim.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 101;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 88dvh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 260ms cubic-bezier(0.32, 0.72, 0, 1);
  max-width: 720px; margin: 0 auto;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
}
.sheet.open { transform: translateY(0); }
.sheet-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--surface-3);
  margin: 8px auto 16px;
}
.sheet-title {
  font-size: 18px; font-weight: 700; margin: 0 0 16px;
}
.sheet-actions {
  display: flex; gap: 8px; margin-top: 16px;
}
.sheet-actions .btn { flex: 1; padding: 14px; font-size: 15px; }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px);
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  animation: toast-in 200ms ease, toast-out 200ms ease 1.6s forwards;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(-50%) translateY(8px); }
}

/* ===== More menu (grid of links) ===== */
.more-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.more-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 14px;
  text-align: left;
  display: flex; flex-direction: column; gap: 8px;
  transition: transform 80ms ease;
}
.more-tile:active { transform: scale(0.98); }
.more-tile-ico {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.more-tile-title { font-size: 15px; font-weight: 600; }
.more-tile-sub { font-size: 12px; color: var(--text-3); }

/* ===== Hero header (홈 상단 인사) ===== */
.hero-header {
  padding: 4px 4px 16px;
}
.hero-date {
  font-size: 13px; color: var(--text-3); font-weight: 500;
  letter-spacing: 0.02em;
}
.hero-greet {
  font-size: 24px; font-weight: 700; letter-spacing: -0.02em;
  margin-top: 2px; color: var(--text);
}

/* ===== Pickup banner (오늘 픽업 강조) ===== */
.pickup-banner {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 14px;
  color: #fff;
  overflow: hidden;
}
.pickup-banner.mom { background: linear-gradient(135deg, var(--mom) 0%, color-mix(in oklab, var(--mom) 70%, var(--shared)) 100%); }
.pickup-banner.dad { background: linear-gradient(135deg, var(--dad) 0%, color-mix(in oklab, var(--dad) 70%, var(--shared)) 100%); }
.pickup-banner::before {
  content: '🚗'; position: absolute; right: -10px; bottom: -20px;
  font-size: 110px; opacity: 0.12;
}
.pickup-banner-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; opacity: 0.85; text-transform: uppercase; }
.pickup-banner-who { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -0.02em; }
.pickup-banner-detail { font-size: 13px; opacity: 0.92; margin-top: 2px; }

/* ===== Daily keys (오늘 꼭) ===== */
.daily-keys {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.daily-keys-head {
  font-size: 12px; font-weight: 700; color: var(--text-2);
  letter-spacing: 0.06em; text-transform: uppercase;
  margin-bottom: 10px; padding: 0 2px;
}
.daily-keys-grid { display: grid; gap: 8px; }
.daily-keys-grid.keys-1 { grid-template-columns: 1fr; }
.daily-keys-grid.keys-2 { grid-template-columns: 1fr 1fr; }
.daily-keys-grid.keys-3 { grid-template-columns: 1fr 1fr 1fr; }
/* 4개 이상은 3열 자동 줄바꿈 */
.daily-keys-grid.keys-4,
.daily-keys-grid.keys-5,
.daily-keys-grid.keys-6,
.daily-keys-grid.keys-7,
.daily-keys-grid.keys-8 { grid-template-columns: 1fr 1fr 1fr; }

.key-slot {
  position: relative;
  border: 1.5px solid var(--border-strong);
  border-radius: 14px;
  padding: 12px 10px;
  background: var(--surface);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  gap: 2px 0;
  text-align: left;
  transition: all 160ms cubic-bezier(0.32, 0.72, 0, 1);
  min-height: 88px;
}
.key-slot:active { transform: scale(0.97); }
.key-slot.done {
  background: linear-gradient(135deg, var(--ok) 0%, color-mix(in oklab, var(--ok) 70%, var(--accent)) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px color-mix(in oklab, var(--ok) 35%, transparent);
}
.key-slot-emoji {
  grid-column: 1; grid-row: 1;
  font-size: 22px; line-height: 1;
}
.key-slot-check {
  grid-column: 2; grid-row: 1;
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--text-3);
  align-self: start;
}
.key-slot.done .key-slot-check {
  background: rgba(255,255,255,0.28);
  border-color: rgba(255,255,255,0.55);
  position: relative;
}
.key-slot.done .key-slot-check::after {
  content: ''; position: absolute;
  left: 5px; top: 4px;
  width: 7px; height: 4px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}
.key-slot-label {
  grid-column: 1 / -1; grid-row: 2;
  font-size: 14px; font-weight: 700;
  margin-top: 6px;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.key-slot-by {
  grid-column: 1 / -1; grid-row: 3;
  font-size: 11px; opacity: 0.75;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* ===== Day strip (오늘 일정 미니 타임라인) ===== */
.day-card { padding: 14px 14px 8px; }
.day-strip {
  position: relative;
  margin-bottom: 12px;
}
.strip-hours {
  position: relative;
  height: 14px;
  font-size: 10px;
  color: var(--text-3);
  font-weight: 500;
  margin-bottom: 4px;
}
.strip-hours span {
  position: absolute;
  transform: translateX(-50%);
  font-variant-numeric: tabular-nums;
}
.strip-tracks {
  position: relative;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 4px;
  min-height: 20px;
}
.strip-track {
  position: relative;
  height: 10px;
  margin: 2px 0;
}
.strip-bar {
  position: absolute;
  top: 0; bottom: 0;
  border-radius: 4px;
  opacity: 0.92;
}
.strip-bar.mom { background: var(--mom); }
.strip-bar.dad { background: var(--dad); }
.strip-bar.kid { background: var(--kid); }
.strip-bar.shared { background: var(--shared); }
.strip-now {
  position: absolute;
  top: -2px; bottom: -2px;
  width: 2px;
  background: var(--danger);
  z-index: 5;
  pointer-events: none;
}
.strip-now::before {
  content: ''; position: absolute; top: -3px; left: -3px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--danger);
}

/* ===== Event row (홈 일정 리스트) ===== */
.day-events { padding: 0; }
.event-row {
  display: grid;
  grid-template-columns: 4px 56px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  align-items: center;
  cursor: pointer;
}
.event-row:first-child { border-top: none; }
.event-row-bar {
  width: 4px; align-self: stretch; border-radius: 2px;
  min-height: 28px;
}
.event-row-bar.mom { background: var(--mom); }
.event-row-bar.dad { background: var(--dad); }
.event-row-bar.kid { background: var(--kid); }
.event-row-bar.shared { background: var(--shared); }
.event-row-time {
  font-size: 12px; font-weight: 600; color: var(--text-2);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.event-row-title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.event-row-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }

/* ===== Meal card (홈 식단) ===== */
.meal-card { padding: 12px 16px; }
.meal-card .meal-row { padding: 10px 0; border-top: 1px dashed var(--border); }
.meal-card .meal-row:first-of-type { border-top: none; }

/* ===== Quick grid (홈 하단 4타일) ===== */
.quick-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-top: 16px;
}
.quick-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: left;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  row-gap: 4px;
  cursor: pointer;
  transition: transform 80ms ease;
}
.quick-tile:active { transform: scale(0.98); }
.quick-tile-ico { grid-column: 2; grid-row: 1; font-size: 22px; }
.quick-tile-label { grid-column: 1; grid-row: 1; font-size: 12px; color: var(--text-2); font-weight: 600; }
.quick-tile-value {
  grid-column: 1 / -1; grid-row: 2;
  font-size: 22px; font-weight: 700; letter-spacing: -0.02em;
  margin-top: 2px;
}
.quick-tile-unit { font-size: 13px; color: var(--text-3); font-weight: 500; }
.quick-tile-sub {
  grid-column: 1 / -1; grid-row: 3;
  font-size: 11px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.empty-card { padding: 24px; text-align: center; }
.empty-text-sm { font-size: 13px; color: var(--text-3); }

/* ===== Dog meal hero (legacy, 호환용) ===== */
.dogmeal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 14px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.dogmeal-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.dogmeal-emoji { font-size: 24px; }
.dogmeal-title { font-size: 14px; font-weight: 600; }
.dogmeal-sub { font-size: 11px; color: var(--text-3); }
.dogmeal-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.dogmeal-slot {
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  padding: 12px;
  text-align: left;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface);
  transition: all 140ms ease;
}
.dogmeal-slot.done {
  background: linear-gradient(135deg, var(--ok), color-mix(in oklab, var(--ok) 70%, var(--accent)));
  border-color: transparent;
  color: #fff;
}
.dogmeal-slot:active { transform: scale(0.98); }
.dogmeal-slot-time {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-weight: 500; opacity: 0.7;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.dogmeal-slot-name { font-size: 16px; font-weight: 700; margin-top: 2px; }
.dogmeal-slot-by { font-size: 11px; opacity: 0.85; margin-top: 2px; min-height: 14px; }
.dogmeal-slot .check-mark {
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--text-3);
  display: inline-flex; align-items: center; justify-content: center;
}
.dogmeal-slot.done .check-mark {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.5);
}
.dogmeal-slot.done .check-mark::after {
  content: '✓'; color: #fff; font-size: 12px; font-weight: 700;
}

/* ===== Pet card ===== */
.pet-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.pet-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.pet-emoji {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}
.pet-name { font-size: 16px; font-weight: 600; }
.pet-species { font-size: 12px; color: var(--text-3); }
.pet-progress {
  height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden;
  margin-top: 8px;
}
.pet-progress-bar {
  height: 100%; background: var(--ok);
  transition: width 220ms ease;
}

/* ===== Anniversary item ===== */
.anniv-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.anniv-item:first-child { border-top: none; }
.anniv-day {
  width: 56px; flex-shrink: 0;
  text-align: center;
  padding: 6px 0;
  border-radius: 10px;
  background: var(--surface-2);
}
.anniv-day-num { font-size: 20px; font-weight: 700; line-height: 1; }
.anniv-day-label { font-size: 10px; color: var(--text-3); margin-top: 2px; }
.anniv-day.soon { background: var(--accent-soft); color: var(--accent); }
.anniv-day.soon .anniv-day-num { color: var(--accent); }
.anniv-body { flex: 1; }
.anniv-title { font-size: 15px; font-weight: 500; }
.anniv-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ===== Pickup card ===== */
.pickup-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  margin-bottom: 12px;
}
.pickup-when { font-size: 12px; color: var(--text-3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.pickup-who { font-size: 28px; font-weight: 700; margin: 8px 0 4px; letter-spacing: -0.01em; }
.pickup-detail { font-size: 14px; color: var(--text-2); }
.pickup-actions { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }

/* ===== Meal day card ===== */
.meal-day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.meal-day-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.meal-day-date { font-weight: 600; font-size: 15px; }
.meal-day-date.today { color: var(--accent); }
.meal-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-top: 1px dashed var(--border);
}
.meal-row:first-of-type { border-top: none; }
.meal-tag {
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2);
  flex-shrink: 0;
}
.meal-name { flex: 1; font-size: 14px; }
.meal-name.empty { color: var(--text-3); font-style: italic; }

/* ===== Helpers ===== */
.section-title {
  font-size: 13px; font-weight: 600; color: var(--text-2);
  margin: 18px 0 8px; padding: 0 4px;
  display: flex; align-items: center; justify-content: space-between;
}
.section-title-link { font-size: 12px; color: var(--accent); font-weight: 500; }
.spacer-sm { height: 8px; }
.spacer-md { height: 16px; }
.muted { color: var(--text-3); }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grow { flex: 1; }
