:root {
  --blue: #1A4D8F; --drop: #D6EAF8; --pick: #FDEBD0; --ink: #1b1b1b; --muted: #5d5d5d;
  --line: #d9d9d9; --bg: #f4f5f7; --card: #fff;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
button, a, select, summary, .day { touch-action: manipulation; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 18px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input, select, textarea { font: inherit; color: inherit; }
.loading { text-align: center; margin-top: 30vh; color: var(--muted); }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 5; background: var(--blue); color: #fff;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.top h1 { font-size: 24px; margin: 0; }
.top .links { display: flex; gap: 6px; }
.linkbtn {
  background: rgba(255,255,255,.16); color: #fff; border: 0; border-radius: 10px;
  padding: 8px 12px; font-size: 16px; cursor: pointer;
}
.wrap { max-width: 640px; margin: 0 auto; padding: 12px 12px 40px; }
.banner { background: #fff3cd; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; font-size: 16px; }
.tools { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

/* ---------- buttons & forms ---------- */
.btn {
  background: var(--blue); color: #fff; border: 0; border-radius: 12px; padding: 13px 18px;
  font-weight: 600; cursor: pointer; min-height: 48px;
}
.btn.ghost { background: #fff; color: var(--blue); border: 2px solid var(--blue); }
.btn.small { padding: 8px 12px; min-height: 40px; font-size: 16px; }
.btn.danger { background: #fff; color: #a30000; border: 2px solid #a30000; }
.btn:disabled { opacity: .5; }
.fld { display: block; margin: 10px 0; }
.fld > span { display: block; font-size: 15px; color: var(--muted); margin-bottom: 3px; font-weight: 600; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 11px 12px; border: 2px solid #b9bec6; border-radius: 10px; background: #fff; min-height: 48px;
}
.fld input[hidden] { display: none; }
.fld input + input, .fld select + input { margin-top: 6px; }
.err { color: #a30000; font-weight: 600; min-height: 1.4em; }
.center { max-width: 420px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 40px) 20px 40px; text-align: center; }
.center h1 { color: var(--blue); }
.pin { text-align: center; font-size: 32px; letter-spacing: .3em; }
.whogrid { display: grid; gap: 10px; margin: 18px 0; }
.who { background: #fff; border: 3px solid; border-radius: 14px; padding: 14px; font-size: 22px; font-weight: 700; cursor: pointer; }

/* ---------- day cards ---------- */
.day {
  background: var(--card); border-radius: 16px; margin: 0 0 12px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.14); cursor: pointer; border: 3px solid transparent;
}
.day.today { border-color: var(--blue); }
.day header { display: flex; align-items: center; gap: 8px; padding: 10px 12px 6px; }
.day h2 { margin: 0; font-size: 22px; flex: 1; }
.badge { font-size: 14px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--blue); color: #fff; }
.badge.cm { background: #fff; color: var(--ink); border: 2px solid #999; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 8px 8px; }
.col h3 { margin: 2px 4px 4px; font-size: 18px; }
.blk { border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; min-height: 84px; }
.blk.drop { background: var(--drop); }
.blk.pick { background: var(--pick); }
.blk .t { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #333; }
.blk .time { font-size: 17px; font-weight: 600; margin: 2px 0 3px; }
.blk .carer { font-size: 20px; font-weight: 800; }
.dim { color: #777; font-weight: 500; }
.note { margin: 0; padding: 0 12px 11px; font-size: 17px; font-style: italic; }
.day.hol { background: #e4e4e4; color: #666; box-shadow: none; }
.day.hol .holrow { padding: 4px 12px 14px; font-size: 20px; font-weight: 700; }
.week { margin: 18px 4px 8px; color: var(--muted); font-weight: 700; font-size: 15px; text-transform: uppercase; letter-spacing: .05em; }
.hint { color: var(--muted); font-size: 15px; text-align: center; margin: 16px 0; }

/* ---------- sheet ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: #fff; width: 100%; max-width: 640px; max-height: 94vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  border-radius: 20px 20px 0 0; padding: 14px 16px calc(env(safe-area-inset-bottom) + 20px);
}
.sheet h2 { margin: 0 0 6px; font-size: 24px; }
.sheet .bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.kidbox { border-radius: 12px; border: 2px solid var(--line); padding: 4px 12px 8px; margin: 10px 0; }
.kidbox h3 { margin: 8px 0 0; font-size: 20px; }
.kidbox .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.kidbox .grid > .fld:nth-child(odd) { }
.drop-bg { background: var(--drop); border-radius: 10px; padding: 0 8px; }
.pick-bg { background: var(--pick); border-radius: 10px; padding: 0 8px; }
.cmt { background: #f2f3f5; border-radius: 10px; padding: 8px 10px; margin: 8px 0; }
.cmt b { font-weight: 800; }
.cmt small { color: var(--muted); }
.cmt button { float: right; border: 0; background: none; font-size: 20px; color: #a30000; }
.check { display: flex; gap: 10px; align-items: center; margin: 14px 0; font-weight: 600; }
.check input { width: 26px; height: 26px; }
.contact { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.contact a.btn { text-decoration: none; display: inline-block; text-align: center; }

/* ---------- settings ---------- */
details { background: #fff; border-radius: 14px; margin: 10px 0; padding: 0 14px; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
summary { font-weight: 700; font-size: 20px; padding: 14px 0; cursor: pointer; }
details > div { padding-bottom: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.person { border-top: 1px solid var(--line); padding: 10px 0; }
.person b { font-size: 20px; }
.wd { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 10px; }
.wd h4 { margin: 4px 0; font-size: 19px; }
.loglist { font-size: 14px; color: var(--muted); }

#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%) translateY(120px);
  background: #222; color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 50; max-width: 90vw;
  transition: transform .25s; font-size: 17px; text-align: center;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ---------- phone polish ---------- */
.sheet { overscroll-behavior: contain; }
.savebar { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)); background: #fff; padding: 10px 0 6px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; border-top: 1px solid var(--line); z-index: 2; }
.btn.wa { display: block; text-decoration: none; text-align: center; background: #fff; border: 3px solid; margin: 8px 0; font-size: 20px; }
.kidbox .bar { margin: 4px 0; }
.kidbox .bar h3 { margin: 0; }
@media (max-width: 340px) {
  .top h1 { font-size: 20px; white-space: nowrap; } .linkbtn { padding: 8px 9px; }
  body { font-size: 17px; }
  .blk .time { font-size: 16px; } .blk .carer { font-size: 18px; } .cols { gap: 6px; padding: 0 6px 6px; }
}
@media (min-width: 700px) {
  .wrap { max-width: 720px; }
  .overlay { align-items: center; } .sheet { border-radius: 20px; max-height: 90vh; }
}
