* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #EDE6DC;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  color: #2B241E;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; padding: 0; }
input { font-family: inherit; }

:root { --accent: #E8663F; }

#app {
  width: 100%;
  max-width: 430px;
  /* min-height: 100vh is the fallback for browsers without dvh support;
     height: 100dvh (the actual visible viewport, accounting for iOS Safari's
     collapsing address bar and, in an installed PWA, the home indicator
     area) pins the shell to exactly the visible window everywhere it's
     supported, instead of letting the whole app grow a little taller than
     the screen and forcing a page-level scroll — that's what made the app
     need scrolling on an iPhone. overflow: hidden means the shell itself
     never scrolls; only .content (below) does, so the header and bottom
     nav stay put and the app fills the window exactly. */
  min-height: 100vh;
  height: 100dvh;
  overflow: hidden;
  margin: 0 auto;
  background: #FBF7F2;
  display: flex;
  flex-direction: column;
  position: relative;
}

.header {
  padding: calc(22px + env(safe-area-inset-top, 0px)) 20px 16px;
  background: #FFFFFF;
  border-bottom: 1px solid #E8DFD5;
  flex-shrink: 0;
}
.header-title { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 19px; line-height: 1.15; color: #2B241E; }
.header-sub { font-size: 13px; color: #7A7067; margin-top: 2px; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.header-signout { font-size: 12px; font-weight: 600; color: #7A7067; }
.header-signout:hover { color: #2B241E; }

.content { flex: 1; min-height: 0; padding: 20px; padding-bottom: 32px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.week-strip { display: flex; gap: 8px; margin-bottom: 22px; overflow-x: auto; padding-bottom: 2px; }
.day-chip {
  flex: 0 0 auto; min-width: 52px; padding: 10px 6px; border-radius: 14px; text-align: center;
  background: #FFFFFF; border: 1px solid #E8DFD5;
}
.day-chip.day-selected { background: var(--accent); border-color: var(--accent); }
.day-chip.day-selected .day-label, .day-chip.day-selected .day-num { color: #FFFFFF; }
.day-chip.day-cancelled { opacity: .55; }
.day-label { font-size: 12px; font-weight: 600; color: #7A7067; }
.day-num { font-size: 13px; font-weight: 600; color: #2B241E; margin-top: 2px; }
.day-dot { width: 5px; height: 5px; border-radius: 50%; margin: 5px auto 0; }
.dot-accent { background: #FFFFFF; }
.dot-cancelled { background: #C1443B; }

.section-heading { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 18px; margin-bottom: 14px; }
.section-title { font-size: 13px; font-weight: 600; color: #7A7067; text-transform: uppercase; letter-spacing: .04em; margin: 20px 0 10px; }

.leg-list { display: flex; flex-direction: column; gap: 12px; }
.leg-card {
  width: 100%; text-align: left; display: flex; flex-direction: column; gap: 12px;
  background: #FFFFFF; border: 1px solid #E8DFD5; border-radius: 18px; padding: 16px;
  box-shadow: 0 1px 2px rgba(43,36,30,.05);
}
.leg-card.leg-cancelled { opacity: .6; }
.leg-card.leg-cancelled .leg-title { text-decoration: line-through; }
.leg-badge {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 13px;
}
.leg-card-top { display: flex; align-items: center; gap: 12px; }
.leg-card-titles { flex: 1; min-width: 0; }
.leg-title { font-weight: 600; font-size: 15px; }
.leg-time { font-size: 13px; color: #7A7067; margin-top: 1px; }
.chevron { flex-shrink: 0; color: #B7ADA1; }
.leg-card-bottom { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-chip { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; }
.subline { font-size: 13px; font-weight: 500; }
.cancel-reason { font-size: 12px; color: #C1443B; }

.detail-header { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.icon-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 10px; color: #2B241E; flex-shrink: 0; }
.icon-btn:hover { background: #F3EDE6; }
.detail-title { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 17px; }
.detail-time { font-size: 13px; color: #7A7067; }
.route-note { font-size: 13px; color: #7A7067; margin: 6px 0 18px 48px; }

.kid-banner { border-radius: 16px; padding: 14px 16px; border: 1px solid transparent; display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.kid-banner-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kid-banner-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; opacity: .75; }
.kid-banner-text { font-weight: 600; font-size: 14px; margin-top: 1px; }
.kid-banner-body { flex: 1; min-width: 0; }
.banner-action { flex-shrink: 0; border: none; background: #FFFFFF; color: #4A4038; font-size: 12px; font-weight: 600; padding: 7px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.banner-action:disabled { opacity: .5; cursor: default; }
.kid-banner-skip { color: #C94F2B; }

.driver-list { display: flex; flex-direction: column; gap: 12px; }
.driver-card { background: #FFFFFF; border: 1px solid #E8DFD5; border-radius: 16px; padding: 14px; }
.driver-top { display: flex; align-items: center; gap: 12px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 15px; flex-shrink: 0; }
.avatar-other { background: #F3EDE6; color: #4A413A; }
.avatar-me { background: var(--accent); color: #FFFFFF; }
.avatar-kid { background: #FBE4DA; color: #C94F2B; font-family: 'Fredoka', sans-serif; font-size: 18px; }
.driver-info { flex: 1; min-width: 0; }
.driver-name { font-weight: 600; font-size: 14px; }
.driver-seats { font-size: 12px; color: #7A7067; margin-top: 1px; }
.driver-action { flex-shrink: 0; text-align: right; }
.info-text { font-size: 12px; color: #7A7067; font-weight: 500; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { font-size: 12px; font-weight: 500; padding: 5px 10px; border-radius: 999px; background: #F3EDE6; color: #7A7067; }
.driver-note { font-size: 12px; color: #7A7067; font-style: italic; margin-top: 10px; }

.all-set-line { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #3F9142; padding: 10px 2px; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 14px; font-weight: 600; font-size: 14px; padding: 13px; min-height: 44px; }
.btn-primary { background: var(--accent); color: #FFFFFF; }
.btn-secondary { background: #FFFFFF; border: 1.5px solid #E8DFD5; color: #2B241E; }
.btn-text { color: #7A7067; }
.btn-danger { background: #C1443B; color: #FFFFFF; }
.btn-text-danger { color: #C1443B; }
.btn[disabled] { opacity: .5; cursor: default; }
.full-width { width: 100%; }
.claim-btn { background: var(--accent); color: #FFFFFF; font-size: 13px; font-weight: 600; padding: 9px 14px; border-radius: 12px; min-height: 36px; }

.bottom-nav { flex-shrink: 0; display: flex; border-top: 1px solid #E8DFD5; background: #FFFFFF; padding-bottom: env(safe-area-inset-bottom, 0px); }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 0 12px; font-size: 11px; font-weight: 600; min-height: 44px; }

.kid-card { display: flex; align-items: center; gap: 14px; background: #FFFFFF; border: 1px solid #E8DFD5; border-radius: 18px; padding: 16px; margin-bottom: 10px; }
.kid-card-wrap { margin-bottom: 10px; }
.kid-card-wrap .kid-card { margin-bottom: 0; border-radius: 18px 18px 0 0; }
.kid-defaults { background: #FBF8F3; border: 1px solid #E8DFD5; border-top: 1px dashed #E8DFD5; border-radius: 0 0 18px 18px; padding: 10px 16px 14px; display: flex; flex-direction: column; gap: 8px; }
.kid-defaults .checkbox-row { font-size: 13px; font-weight: 500; color: #4A4038; }
.kid-name { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 16px; }
.tag-row { display: flex; gap: 6px; margin-top: 6px; }
.tag { font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 999px; }
.tag-judo { background: #FBE4DA; color: #C94F2B; }
.tag-wp { background: #DEEFEE; color: #1F6B6B; }

.week-rows { display: flex; flex-direction: column; gap: 2px; background: #FFFFFF; border: 1px solid #E8DFD5; border-radius: 16px; overflow: hidden; }
.week-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid #F0EAE2; }
.week-row:last-child { border-bottom: none; }
.week-row-title { font-size: 13px; font-weight: 600; }
.week-row-status { font-size: 13px; font-weight: 600; }

.driving-card { background: #FFFFFF; border: 1px solid #E8DFD5; border-radius: 16px; padding: 14px 16px; margin-bottom: 10px; }
.driving-title { font-weight: 600; font-size: 14px; }
.driving-info { font-size: 13px; color: #7A7067; margin-top: 3px; }

.sheet-overlay { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(30,24,18,.4); }
.sheet-panel {
  position: relative; width: 100%; max-width: 430px; background: #FFFFFF; border-radius: 22px 22px 0 0;
  padding: 14px 20px calc(22px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -8px 24px rgba(43,36,30,.15);
  display: flex; flex-direction: column; gap: 14px;
  max-height: 90dvh; overflow-y: auto;
}
.sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: #E8DFD5; margin: 0 auto; }
.sheet-title { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 18px; }
.sheet-sub { font-size: 13px; color: #7A7067; margin-top: 3px; line-height: 1.35; }
.stepper-row { display: flex; align-items: center; justify-content: space-between; }
.stepper-label { font-size: 14px; font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper-btn { width: 34px; height: 34px; border-radius: 50%; background: #F3EDE6; display: flex; align-items: center; justify-content: center; color: #2B241E; }
.stepper-value { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 18px; min-width: 18px; text-align: center; }
.note-input, .text-input {
  width: 100%; border: 1.5px solid #E8DFD5; border-radius: 12px; padding: 12px 14px;
  font-size: 13px; color: #2B241E; background: #FBF7F2;
}
.note-input::placeholder, .text-input::placeholder { color: #B7ADA1; }
.offer-hint { font-size: 12px; font-weight: 600; color: var(--accent); }

.kid-pick-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1.5px solid #E8DFD5; border-radius: 12px; }
.kid-pick-row + .kid-pick-row { margin-top: 8px; }
.checkbox-row { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; }
.checkbox-row input { width: 18px; height: 18px; }

.center-screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px; padding-top: calc(32px + env(safe-area-inset-top, 0px)); padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); gap: 18px; }
.login-title { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 24px; }
.login-sub { font-size: 14px; color: #7A7067; max-width: 300px; }
.google-btn {
  display: flex; align-items: center; gap: 10px; background: #FFFFFF; border: 1.5px solid #E8DFD5;
  border-radius: 14px; padding: 13px 22px; font-weight: 600; font-size: 14px; color: #2B241E;
  box-shadow: 0 1px 2px rgba(43,36,30,.06);
}
.google-btn:hover { background: #F9F5F0; }
.error-banner { background: #FBE6E2; color: #C1443B; border-radius: 12px; padding: 12px 14px; font-size: 13px; font-weight: 500; margin-bottom: 14px; }
.empty-note { font-size: 13px; color: #7A7067; padding: 8px 2px 16px; }

.admin-hint { font-size: 13px; color: #7A7067; margin-bottom: 16px; }
.admin-day-card { background: #FFFFFF; border: 1px solid #E8DFD5; border-radius: 16px; margin-bottom: 10px; overflow: hidden; }
.admin-day-header { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; text-align: left; color: #2B241E; }
.admin-day-date { font-weight: 600; font-size: 14px; }
.admin-day-status { font-size: 12px; font-weight: 600; color: #C94F2B; margin-top: 2px; }
.admin-day-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 10px; border-top: 1px dashed #E8DFD5; padding-top: 14px; }
.admin-leg-form { background: #FBF8F3; border: 1px solid #E8DFD5; border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.admin-leg-kind { font-size: 12px; font-weight: 600; color: #7A7067; text-transform: uppercase; letter-spacing: .03em; }
.admin-time-row { display: flex; align-items: center; gap: 8px; }
.admin-time-row .text-input { width: auto; flex: 1; }
.admin-leg-actions { display: flex; gap: 8px; }
.admin-leg-actions .btn { flex: 1; padding: 10px; font-size: 13px; min-height: 38px; }
.admin-delete-confirm { background: #FBE6E2; border: 1px solid #F2C6BF; border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.admin-delete-confirm-text { font-size: 12px; color: #8E362E; line-height: 1.4; }
.admin-leg-form-new { border-style: dashed; }

.admin-cal-extend { display: flex; gap: 8px; margin-bottom: 16px; }
.admin-cal-extend .text-input { width: 70px; flex: none; }
.admin-cal-extend .btn { flex: 1; }
.admin-cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.admin-cal-nav .btn { padding: 6px 14px; font-size: 16px; min-height: 32px; }
.admin-cal-month-label { font-weight: 600; font-size: 14px; }
.admin-cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 11px; color: #7A7067; font-weight: 600; margin-bottom: 4px; }
.admin-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 16px; }
.admin-cal-cell { position: relative; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 10px; border: 1px solid #E8DFD5; background: #FFFFFF; color: #2B241E; font-size: 13px; }
.admin-cal-cell-empty { visibility: hidden; border: none; background: none; }
.admin-cal-cell-today { border-color: var(--accent); border-width: 1.5px; font-weight: 700; }
.admin-cal-cell-has-day { background: #FBF3ED; }
.admin-cal-cell-cancelled { background: #FBE6E2; color: #8E362E; }
.admin-cal-cell-selected { outline: 2px solid var(--accent); outline-offset: -2px; }
.admin-cal-daynum { line-height: 1; }
.admin-cal-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.admin-day-detail { margin-top: 4px; }
.admin-day-detail-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 0; }

.admin-pending-card { background: #FFF7ED; border: 1px solid #F3D9B8; border-radius: 16px; padding: 14px 16px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.admin-pending-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 500; }
.admin-pending-row .btn { padding: 8px 14px; font-size: 13px; min-height: 34px; }

.pending-card { background: #FFFFFF; border: 1px solid #E8DFD5; border-radius: 16px; padding: 28px 20px; margin-top: 40px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.pending-title { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 19px; }
.pending-text { font-size: 14px; color: #7A7067; max-width: 320px; line-height: 1.5; }
