:root {
  --accent: #185FA5;
  --accent-fill: #378ADD;
  --accent-bg: #E6F1FB;
  --success: #3B6D11;
  --success-bg: #EAF3DE;
  --away: #E4E2DA;
  --bg: #F4F5F9;
  --card: #ffffff;
  --border: #E8E8EF;
  --text: #1E2430;
  --text-muted: #6B7280;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #85B7EB;
    --accent-fill: #378ADD;
    --accent-bg: #0C2B45;
    --success: #97C459;
    --success-bg: #17300A;
    --away: #3A3D46;
    --bg: #14161C;
    --card: #1D2029;
    --border: #2C303B;
    --text: #F1F1F4;
    --text-muted: #9CA0AC;
  }
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 76px;
}
h1 { font-size: 20px; font-weight: 600; margin: 4px 0 14px; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) 16px 14px;
  border-bottom: 0.5px solid var(--border);
  font-size: 14px; background: var(--card);
}
.topbar-logout { color: var(--text-muted); text-decoration: none; }

.page { max-width: 480px; margin: 0 auto; padding: 16px; }

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; background: var(--card); border-top: 0.5px solid var(--border);
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
}
.bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 2px; text-decoration: none; color: var(--text-muted); font-size: 11px; padding: 4px 0;
}
.bottomnav a.active { color: var(--accent); }
.bottomnav .icon { font-size: 19px; }
.nav-icon-wrap { position: relative; display: inline-block; }
.nav-badge {
  position: absolute; top: -6px; right: -10px; min-width: 15px; height: 15px;
  border-radius: 8px; background: var(--accent-fill); color: #fff; font-size: 10px;
  font-weight: 700; line-height: 15px; text-align: center; padding: 0 3px;
}

/* login */
.login-box { max-width: 340px; margin: 60px auto 0; text-align: center; }
.login-box form { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; text-align: left; }
.login-box label { font-size: 13px; color: var(--text-muted); }
.error { color: #A32D2D; font-size: 14px; }

select, input[type=text], input[type=password] {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 0.5px solid var(--border); background: var(--bg); color: var(--text); font-size: 15px;
}
button {
  border: 0.5px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 10px; padding: 10px 14px; font-size: 14px; cursor: pointer;
}
button.primary { background: var(--accent-fill); color: #fff; border: none; }

/* shared: card + icon chip */
.card { background: var(--card); border: 0.5px solid var(--border); border-radius: 16px; padding: 12px 14px; }
.icon-chip {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  background: var(--accent-bg);
}
.icon-chip.chip-muted { background: var(--away); }
.round-btn {
  width: 34px; height: 34px; border-radius: 10px; border: none;
  background: var(--accent-fill); color: #fff; font-size: 18px;
  display: flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0;
}

/* min uge */
.day-list { display: flex; flex-direction: column; gap: 10px; }
.day-row { padding: 12px 14px; }
.day-row-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.day-row-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.day-title { margin: 0; font-weight: 600; font-size: 14px; }
.day-meal { margin: 1px 0 0; font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.switch {
  width: 42px; height: 24px; border-radius: 20px; border: none;
  background: var(--away); position: relative; padding: 0; cursor: pointer; flex-shrink: 0;
}
.switch.on { background: var(--accent-fill); }
.switch-knob {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: left .15s ease;
}
.switch.on .switch-knob { left: 21px; }

.guest-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 0.5px solid var(--border); }
.stepper {
  display: flex; align-items: center; gap: 6px; background: var(--bg);
  border-radius: 20px; padding: 1px 8px; margin-left: auto;
}
.stepper button { border: none; background: none; font-size: 14px; padding: 1px 3px; }
.stepper span { min-width: 16px; text-align: center; font-weight: 600; font-size: 12px; }

/* familien */
.familien-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

.meal-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 14px; }
.meal-card {
  min-width: 100px; background: var(--card); border: 0.5px solid var(--border);
  border-radius: 14px; padding: 9px;
}
.meal-card.today { background: var(--accent-fill); border-color: var(--accent-fill); }
.meal-card-date { margin: 0 0 3px; font-size: 11px; color: var(--text-muted); }
.meal-card.today .meal-card-date { color: rgba(255,255,255,.85); }
.meal-card-text { margin: 0; font-size: 12px; }
.meal-card.today .meal-card-text { color: #fff; font-weight: 500; }

.grid-wrap { overflow-x: auto; }
.familien-grid { border-collapse: collapse; width: 100%; font-size: 12px; }
.familien-grid td { padding: 7px 4px; text-align: center; border-top: 0.5px solid var(--border); }
.grid-head { color: var(--text-muted); border-top: none !important; }
.grid-totals-row td { border-top: 1.5px solid var(--border); font-weight: 600; }
.grid-total { color: var(--accent); font-size: 13px; }
.grid-name { text-align: left; white-space: nowrap; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.dot.home { background: var(--accent-fill); }
.dot.away { background: var(--away); }
.cell-wrap { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; }
.dot-guests { font-size: 9px; line-height: 1; color: var(--accent); font-weight: 600; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 10;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--card); border-radius: 16px; padding: 16px; width: 100%; max-width: 360px;
  max-height: 80vh; overflow-y: auto;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-head button { border: none; background: none; font-size: 16px; }
.modal label { display: block; font-size: 12px; color: var(--text-muted); margin: 8px 0 3px; }
.modal .primary { width: 100%; margin-top: 14px; }

/* indkøb */
.add-item-form { display: flex; gap: 6px; margin-bottom: 14px; }
.add-item-form[hidden] { display: none; }
.add-item-form input { flex: 1; }
.add-item-form button { width: 42px; font-size: 18px; }
.item-list { display: flex; flex-direction: column; gap: 8px; }
.item-row { padding: 11px 14px; display: flex; align-items: center; gap: 11px; }
.item-swatch {
  width: 28px; height: 28px; border-radius: 8px; background: var(--away);
  border: none; flex-shrink: 0; padding: 0; font-size: 14px; color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.item-swatch.checked { background: var(--accent-fill); }
.item-text { margin: 0; font-size: 14px; }
.item-meta { margin: 0; font-size: 11px; color: var(--text-muted); }
.item-row.bought .item-text { text-decoration: line-through; color: var(--text-muted); }

/* indstillinger */
.settings-section { margin-bottom: 12px; }
.pill-choice { display: flex; gap: 6px; margin: 8px 0 0; }
.pill-choice button { flex: 1; }
.pill-choice button.active-home { background: var(--accent-fill); color: #fff; border: none; }
.pill-choice button.active-away { background: var(--away); color: var(--text); border: none; }
.pin-form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.notice { background: var(--success-bg); color: var(--success); padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.settings-row { display: flex; align-items: center; gap: 10px; }
.settings-row-title { font-size: 13px; font-weight: 600; margin: 0; }
.settings-link-btn { margin-left: auto; background: none; border: none; color: var(--accent); font-size: 13px; font-weight: 600; padding: 0; }
