* { box-sizing: border-box; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0; background: #f4f6fb; color: #1e293b;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: #1e293b; color: #fff;
  position: sticky; top: 0; z-index: 10;
}
.topbar a { color: #fff; text-decoration: none; }
.brand { font-weight: 700; font-size: 1.05rem; }
.topbar nav { display: flex; gap: 12px; align-items: center; font-size: .9rem; }
.topbar .me { display: flex; gap: 6px; align-items: center; }
.linklike {
  background: none; border: none; color: #fff; font-size: .9rem;
  cursor: pointer; text-decoration: underline; padding: 0;
}
main { max-width: 900px; margin: 0 auto; padding: 14px; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 1.4rem; color: #fff; flex: none;
}
.avatar.sm { width: 26px; height: 26px; font-size: 1rem; }
.avatar.xs { width: 22px; height: 22px; font-size: .9rem; }
.avatar.big { width: 48px; height: 48px; font-size: 1.7rem; cursor: pointer; }

.monthnav { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 12px; }
.monthnav h1 { font-size: 1.25rem; margin: 0; }
.btn {
  display: inline-block; padding: 8px 14px; border-radius: 8px;
  background: #e2e8f0; color: #1e293b; text-decoration: none; border: none;
  font-size: .95rem; cursor: pointer;
}
.btn.primary { background: #3b82f6; color: #fff; }
.btn.danger { background: #fee2e2; color: #b91c1c; }

.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; font-size: .9rem; }
.legend-item { display: flex; gap: 5px; align-items: center; }

.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dow { text-align: center; font-size: .75rem; color: #64748b; padding: 4px 0; }
.cell {
  min-height: 64px; background: #fff; border-radius: 8px; padding: 4px;
  text-decoration: none; color: inherit; border: 2px solid transparent;
  overflow: hidden;
}
.cell.empty { background: transparent; }
.cell.today { border-color: #3b82f6; }
.daynum { font-size: .8rem; font-weight: 700; color: #475569; }
.entry { display: flex; align-items: center; gap: 3px; margin-top: 3px; font-size: .72rem; }
.etime { white-space: nowrap; }

.card {
  background: #fff; border-radius: 12px; padding: 16px;
  margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.card.narrow { max-width: 480px; margin: 20px auto; }
.card h1 { margin-top: 0; font-size: 1.3rem; }
.muted { color: #64748b; }
.center { text-align: center; }
.error { color: #b91c1c; background: #fee2e2; padding: 8px 12px; border-radius: 8px; }
.ok { color: #166534; background: #dcfce7; padding: 8px 12px; border-radius: 8px; }
.flash { padding: 10px 14px; border-radius: 8px; font-weight: 600; }
.flash.ok { background: #dcfce7; color: #166534; }
.flash.err { background: #fee2e2; color: #b91c1c; }

.form label { display: block; margin-bottom: 12px; font-weight: 600; font-size: .95rem; }
.form input[type=text], .form input[type=password], .form input[type=time],
.form input[type=date], .form select.sel,
.editor input[type=text], .editor input[type=time] {
  width: 100%; padding: 10px; margin-top: 4px; font-size: 1rem;
  border: 1px solid #cbd5e1; border-radius: 8px;
  background: #fff;
}
.form button, .editor .btn { font-size: 1rem; }
.form button[type=submit] {
  width: 100%; padding: 12px; background: #3b82f6; color: #fff;
  border: none; border-radius: 8px; font-size: 1.05rem; cursor: pointer;
}
fieldset { border: 1px solid #e2e8f0; border-radius: 8px; margin: 0 0 12px; padding: 10px; }
legend { font-weight: 600; font-size: .9rem; padding: 0 6px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice input { display: none; }
.choice input:checked + .avatar, .choice input:checked + .swatch {
  outline: 3px solid #1e293b; outline-offset: 2px;
}
.swatch { width: 40px; height: 40px; border-radius: 50%; display: inline-block; cursor: pointer; }

.person-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.person-head .current { margin-top: 4px; }
.editor label { display: block; margin-bottom: 10px; font-weight: 600; font-size: .9rem; }
.row { display: flex; gap: 8px; }

@media (max-width: 560px) {
  .cell { min-height: 56px; }
  .etime { display: none; }   /* initials only on small screens; tap day for times */
  .topbar nav a:not(.me) { display: none; }
}

/* repeating pickups */
.pill {
  display: inline-block; font-size: .68rem; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; margin-left: 6px;
  background: #e0e7ff; color: #3730a3; vertical-align: middle;
}
.pill.once { background: #f1f5f9; color: #475569; }
.wdays { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.wdays label {
  display: flex; align-items: center; gap: 6px;
  background: #f1f5f9; border-radius: 8px; padding: 8px 12px;
  font-size: .9rem; font-weight: 600; cursor: pointer; margin: 0;
}
.wdays input { width: 18px; height: 18px; accent-color: #3b82f6; }
.card.rule { display: flex; gap: 12px; align-items: center; }
.btnrow { flex-wrap: wrap; }

/* pickup person: pink = Mom, blue = Dad — kept bright on purpose so the
   pickup parent is obvious at a glance */
.pk-mom { background: #ec4899; color: #fff; }
.pk-dad { background: #2563eb; color: #fff; }
/* month entries: the kid's initial carries the picker's color —
   a blue M means Dad picks up Marisa, a pink M means Mom does */
.entry.pk-mom, .entry.pk-dad { background: none; color: inherit; border-radius: 6px; padding: 2px 5px; }
.entry.pk-mom .kid-initial { color: #ec4899; }
.entry.pk-dad .kid-initial { color: #2563eb; }
.pkword-mom { color: #db2777; }
.pkword-dad { color: #2563eb; }
.pk-badge {
  display: inline-block; font-size: .72rem; font-weight: 700;
  padding: 2px 10px; border-radius: 999px; margin-left: 6px;
  vertical-align: middle; white-space: nowrap;
}
.picker-legend { font-size: .85rem; color: #475569; margin: 0 0 8px; }
.pickerow { display: flex; gap: 8px; margin-top: 6px; }
.pkbtn {
  flex: 1; padding: 10px; border-radius: 10px; font-size: 1rem; font-weight: 700;
  cursor: pointer; border: 2px solid transparent;
}
.pkbtn.pk-mom { background: #fce7f3; color: #831843; }
.pkbtn.pk-dad { background: #dbeafe; color: #1e3a8a; }
.pkbtn.pk-mom.sel { background: #ec4899; border-color: #be185d; color: #fff; }
.pkbtn.pk-dad.sel { background: #2563eb; border-color: #1e40af; color: #fff; }
.kid-initial { font-weight: 800; font-size: .85rem; min-width: 1em; text-align: center; }
.kid-initial.lg {
  width: 26px; height: 26px; border-radius: 50%; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem; flex: none;
}

/* roles */
.role-badge {
  display: inline-block; font-size: .72rem; font-weight: 700;
  padding: 2px 10px; border-radius: 999px; margin-left: 6px;
  vertical-align: middle;
}
.role-admin { background: #1e293b; color: #fff; }
.role-editor { background: #e0e7ff; color: #3730a3; }
.role-basic { background: #f1f5f9; color: #475569; }
select.sel {
  padding: 10px; font-size: 1rem; border: 1px solid #cbd5e1;
  border-radius: 8px; background: #fff;
}

/* week view: one week per screen, inline editors, no drilling into days */
.wk-day {
  background: #fff; border-radius: 12px; padding: 12px 14px;
  margin-bottom: 0; box-shadow: 0 1px 3px rgba(0,0,0,.08);
  border: 2px solid #e5e7eb;
}
.wk-day.today { border-color: #3b82f6; }
.wk-dayhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.wk-dayhead a { text-decoration: none; color: inherit; font-size: 1.05rem; }
.wk-kid {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px 0; border-top: 1px solid #f1f5f9;
}
.wk-kid input[type="time"] {
  width: 108px; padding: 8px; font-size: 1rem;
  border: 1px solid #cbd5e1; border-radius: 8px; background: #fff;
}
.wk-loc {
  flex: 1 1 100%; padding: 8px 10px; font-size: 1rem;
  border: 1px solid #cbd5e1; border-radius: 8px; background: #fff;
}
.pkseg { display: inline-flex; border-radius: 10px; overflow: hidden; }
.pkseg .pkbtn { border-radius: 0; padding: 8px 14px; font-size: .95rem; flex: none; }
.btn.sm { padding: 8px 16px; font-size: .95rem; }
.wk-status { flex: 1 1 100%; display: flex; gap: 14px; align-items: center; font-size: .85rem; }
.wk-readonly { font-size: 1rem; }
.linklike.dark { color: #475569; }
.linklike.danger-t { color: #b91c1c; }

/* ---- Infinite feed ---- */
.feed-top { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 10px; }
.feed-top h1 { font-size: 1.35rem; margin: 0; }
#feed { display: flex; flex-direction: column; gap: 12px; }
#sentinel-bottom { min-height: 2px; }
.wk-day.today { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.22); }
.wk-day.editing { border-color: #a78bfa; }
.wk-day { margin-bottom: 0; }
.wk-head-right { display: flex; align-items: center; gap: 8px; }
.wk-view { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; flex: 1; min-width: 0; font-size: 1rem; }
.vevent { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; flex: 1 1 100%; }
.xhead { flex: 1 1 100%; margin-top: 10px; font-size: .85rem; font-weight: 700; color: #475569; }
.edit-block {
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px;
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.edit-block-title {
  flex: 1 1 100%;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #64748b;
}
.xadd { margin-top: 8px; }
.iconbtn {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 12px;
  min-width: 48px;
  height: 48px;
  padding: 0 12px;
  font-size: 1.3rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
}
.iconbtn.save { color: #15803d; }
.iconbtn.del { color: #64748b; }
.iconbtn.del.armed { background: #dc2626; border-color: #dc2626; color: #fff; }
/* The hidden attribute must win over display rules (flex etc.), or
   toggled sections never actually hide. */
[hidden] { display: none !important; }
.vtime { font-size: 1.25rem; font-weight: 700; }
.vloc { color: #374151; }
.pkword-mom { color: #db2777; font-weight: 700; }
.pkword-dad { color: #2563eb; font-weight: 700; }
.fab {
  position: fixed; right: 16px; bottom: 20px; z-index: 50;
  border: none; border-radius: 999px; padding: 12px 20px;
  background: #3b82f6; color: #fff; font-weight: 700; font-size: 1rem;
  box-shadow: 0 4px 14px rgba(0,0,0,.28); cursor: pointer;
}
.fab[hidden] { display: none; }
.wk-day { cursor: pointer; }
.tap-hint { color: #6b7280; font-size: .85rem; margin: 0 0 10px; }
