:root {
  --teal: #31c9b2;
  --teal-dark: #23a08d;
  --orange: #fe6402;
  --ink: #22313a;
  --muted: #6b7d84;
  --border: #e2e8e6;
  --bg: #f6f9f8;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  /* Expliciete eis (06-sprint-3-hoofdscherm.md): het hoofdscherm zelf mag niet
     scrollen, enkel losse onderdelen. */
  overflow: hidden;
}

.screen {
  height: 100dvh;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

button { font: inherit; cursor: pointer; }
h2 { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 0 0 0.5rem; }

/* --- Geen sessie --- */
.no-session-box {
  margin: auto;
  text-align: center;
  max-width: 320px;
  padding: 2rem;
}
.no-session-box img { border-radius: 20%; margin-bottom: 1rem; }

.button {
  display: inline-block;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  text-decoration: none;
}
.button-secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 1.2rem;
}

/* --- Header --- */
.app-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--teal);
  color: #fff;
  flex-wrap: wrap;
}
.family-icon {
  background: none;
  border: none;
  padding: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 auto;
}
.family-icon img { width: 100%; height: 100%; object-fit: cover; }
.active-member-name {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 8px;
  padding: 0.3rem 0.7rem;
}
.member-row {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
  flex-wrap: wrap;
}
.member-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}
.member-avatar.active { border-color: #fff; }

/* --- Main --- */
.app-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  gap: 0.75rem;
  overflow: hidden;
}

.today-section { flex: 3 1 0; min-height: 0; display: flex; flex-direction: column; }
.deliveries-section { flex: 2 1 0; min-height: 0; display: flex; flex-direction: column; }
.tell-me-section { flex: 0 0 auto; }

.scrollable { flex: 1 1 auto; min-height: 0; overflow-y: auto; }

.empty-state { color: var(--muted); font-size: 0.9rem; }

/* --- Planning --- */
.travel-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0.25rem 0.25rem 0.25rem 0.1rem;
}
.travel-bar .bar { flex: 1; height: 4px; background: repeating-linear-gradient(90deg, var(--border) 0 6px, transparent 6px 10px); border-radius: 2px; }

.now-marker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--teal-dark);
  font-weight: 700;
  font-size: 0.8rem;
  margin: 0.25rem 0;
}
.now-marker .line { flex: 1; height: 2px; background: var(--teal); }

.planning-item {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  margin-bottom: 0.4rem;
  text-align: left;
  width: 100%;
}
.planning-item .time { flex: 0 0 auto; font-weight: 700; font-size: 0.85rem; color: var(--teal-dark); white-space: nowrap; }
.planning-item .body { flex: 1; min-width: 0; }
.planning-item .title { font-weight: 600; }
.planning-item .meta { color: var(--muted); font-size: 0.82rem; }
.planning-item .members { display: flex; gap: 0.25rem; margin-top: 0.3rem; }
.planning-item .members .chip { background: var(--bg); border-radius: 999px; padding: 0.1rem 0.5rem; font-size: 0.75rem; color: var(--muted); }

/* --- Deliveries --- */
.delivery-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  margin-bottom: 0.4rem;
}
.delivery-item .title { font-weight: 600; }
.delivery-item .meta { color: var(--muted); font-size: 0.82rem; margin-bottom: 0.4rem; }
.status-track { display: flex; gap: 0.3rem; }
.status-dot {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
}
.status-dot.done { background: var(--orange); }

/* --- Tell me --- */
.tell-me-hint { margin: 0 0 0.4rem; font-size: 0.85rem; color: var(--muted); }
.tell-me-form { display: flex; gap: 0.5rem; }
#tell-me-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  font: inherit;
}
.send-button {
  flex: 0 0 auto;
  width: 44px;
  border: none;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  font-size: 1.1rem;
}

/* --- PIN modal --- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 20;
}
.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  max-width: 320px;
  width: 100%;
}
#pin-modal-input {
  width: 100%;
  font-size: 1.4rem;
  letter-spacing: 0.3em;
  text-align: center;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0.75rem 0;
}
.modal-error { color: #c0392b; font-size: 0.85rem; }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }

/* --- Cookiemelding --- */
.cookie-banner {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  background: var(--ink);
  color: #fff;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  z-index: 30;
}
.cookie-banner p { margin: 0; font-size: 0.85rem; flex: 1 1 240px; }

@media (min-width: 640px) {
  .screen { max-width: 480px; margin: 0 auto; box-shadow: 0 0 0 1px var(--border); }
}

/* =========================================================================
   Detailschermen (sprint 4): family-info, familymembers, planning-edit,
   package-edit. Zelfde niet-scrollend-schild-patroon als het hoofdscherm,
   enkel .detail-main scrollt.
   ========================================================================= */

.detail-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--teal);
  color: #fff;
}
.detail-header .back-link {
  color: #fff;
  text-decoration: none;
  font-size: 1.3rem;
  line-height: 1;
}
.detail-header h1 { font-size: 1.05rem; margin: 0; font-weight: 700; }

.detail-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem;
  margin-bottom: 0.9rem;
}

.form-row { margin-bottom: 0.8rem; }
.form-row label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.3rem; }
.form-row input[type="text"],
.form-row input[type="date"],
.form-row input[type="time"],
.form-row input[type="password"],
.form-row input[type="number"],
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}
.form-row.readonly input { background: var(--bg); color: var(--muted); }
.form-row .hint { font-size: 0.78rem; color: var(--muted); margin-top: 0.25rem; }
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }

.checkbox-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.checkbox-row label { font-size: 0.9rem; margin: 0; color: var(--ink); }

.icon-picker { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.icon-option {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  overflow: hidden;
}
.icon-option.selected { border-color: var(--teal); background: #e6f8f4; }
.icon-option img { width: 100%; height: 100%; object-fit: cover; }

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item .label { font-weight: 600; }
.list-item .meta { font-size: 0.78rem; color: var(--muted); }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
}
.badge.active { background: #e6f8f4; color: var(--teal-dark); }

.link-button {
  background: none;
  border: none;
  color: var(--teal-dark);
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
}
.danger-text { color: #c0392b; }
.danger-zone { border-color: #f3c9c2; }

.pagination-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.8rem; }
.pagination-nav .position { font-weight: 700; }
.pagination-nav button { background: none; border: 1px solid var(--border); border-radius: 50%; width: 36px; height: 36px; }

.source-item { border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem; margin-bottom: 0.5rem; }
.source-item summary { cursor: pointer; font-weight: 600; font-size: 0.85rem; }
.source-item .source-body { margin-top: 0.5rem; font-size: 0.85rem; white-space: pre-wrap; color: var(--muted); }

.status-checklist { display: flex; flex-direction: column; gap: 0.4rem; }
.status-checklist .checkbox-row.done .label { color: var(--teal-dark); font-weight: 700; }

.error-text { color: #c0392b; font-size: 0.85rem; margin: 0.4rem 0; }
.success-text { color: var(--teal-dark); font-size: 0.85rem; margin: 0.4rem 0; }
