:root {
  --gold: #c9a84c;
  --gold-dark: #a9852f;
  --gold-soft: rgba(201, 168, 76, 0.14);
  --bg: #121214;
  --card: #1e1e22;
  --card-alt: #26262b;
  --text: #f2ede3;
  --muted: #9a938a;
  --border: #333138;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: env(safe-area-inset-bottom);
}

header {
  padding: calc(env(safe-area-inset-top) + 20px) 20px 16px;
  background: #17171a;
  color: var(--gold);
  border-bottom: 1px solid var(--border);
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.header-subtitle {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

.date-label {
  color: var(--muted);
  opacity: 1;
  font-size: 0.95rem;
  margin-top: 4px;
  text-transform: capitalize;
}

.streak-label {
  color: var(--gold);
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 4px;
}

main {
  padding: 16px;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
  max-width: 480px;
  margin: 0 auto;
}

h2 {
  font-size: 1rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 24px 0 10px;
}

.pill-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pill-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pill-item.taken {
  background: var(--gold-soft);
  border-color: var(--gold);
}

.pill-name {
  font-size: 1.05rem;
  font-weight: 600;
}

.pill-sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 2px;
}

.pill-note {
  font-size: 0.8rem;
  color: var(--gold);
  margin-top: 2px;
  font-style: italic;
}

.take-btn {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  background: var(--gold);
  color: #1a1a1d;
  min-width: 96px;
}

.take-btn.taken {
  background: var(--gold-dark);
  color: #f2ede3;
}

.take-btn:active {
  transform: scale(0.96);
}

.later .pill-item {
  opacity: 0.6;
}

.later .pill-sub {
  font-weight: 500;
}

.banner {
  background: var(--card-alt);
  border: 1px solid var(--gold-dark);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.banner p {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: var(--text);
}

.banner button {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  background: var(--gold);
  color: #1a1a1d;
}

.status-msg {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 24px;
}

#todayList:empty::after {
  content: "Niets gepland vandaag 🎉";
  color: var(--muted);
  display: block;
  padding: 8px 0;
}

/* ---- Pillen beheren ---- */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 10px;
}

.section-header h2 {
  margin: 0;
}

.add-btn {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 0.85rem;
  background: var(--gold);
  color: #1a1a1d;
}

.manage-item .pill-sub {
  color: var(--muted);
}

.manage-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  border: none;
  background: none;
  font-size: 1.2rem;
  padding: 8px;
  line-height: 1;
  border-radius: 10px;
}

.icon-btn:active {
  background: var(--card-alt);
}

#manageList:empty::after {
  content: "Nog geen pillen toegevoegd.";
  color: var(--muted);
  display: block;
  padding: 8px 0;
}

/* ---- Formulier overlay ---- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
}

.overlay[hidden] {
  display: none;
}

.form-card {
  background: var(--card);
  width: 100%;
  max-width: 480px;
  border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--gold-dark);
}

.form-card h3 {
  margin: 0 0 16px;
  color: var(--gold);
}

.form-label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.text-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  margin-bottom: 18px;
  background: var(--card-alt);
  color: var(--text);
  color-scheme: dark;
}

.text-input::placeholder {
  color: var(--muted);
}

.anchor-row {
  margin-bottom: 4px;
}

.freq-choice {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.radio-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.98rem;
  color: var(--text);
}

.radio-row input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
}

.checkbox-row {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
  flex-shrink: 0;
}

.days-input {
  width: 56px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  text-align: center;
  background: var(--card-alt);
  color: var(--text);
}

.time-select-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
}

.time-select {
  flex: 1;
  padding: 12px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  background: var(--card-alt);
  color: var(--text);
  text-align: center;
}

.time-colon {
  font-weight: 700;
  color: var(--muted);
}

.form-actions {
  display: flex;
  gap: 10px;
}

.primary-btn, .secondary-btn {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 13px;
  font-weight: 700;
  font-size: 0.95rem;
}

.primary-btn {
  background: var(--gold);
  color: #1a1a1d;
}

.secondary-btn {
  background: var(--card-alt);
  color: var(--text);
}

/* ---- Onderste navigatiebalk ---- */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  background: #17171a;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  z-index: 50;
}

.bottom-nav::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--gold-dark), var(--gold), transparent);
  opacity: 0.6;
}

.nav-btn {
  position: relative;
  border: none;
  background: none;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.nav-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 36px;
  border-radius: 999px;
  transition: background-color 0.15s ease;
}

.nav-icon-wrap svg {
  width: 22px;
  height: 22px;
}

.nav-btn.active {
  color: #1a1a1d;
}

.nav-btn.active .nav-icon-wrap {
  background: var(--gold);
}

.nav-btn:not(.active) .nav-icon-wrap {
  color: var(--muted);
}

.today-tag {
  color: var(--gold);
  font-weight: 600;
}

/* ---- Kalender ---- */

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cal-month-label {
  font-weight: 600;
  text-transform: capitalize;
}

.cal-nav-btn {
  border: none;
  background: var(--card);
  color: var(--gold);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 1.1rem;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 6px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 20px;
}

.cal-day {
  aspect-ratio: 1;
  border: 1px solid transparent;
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  font-size: 0.9rem;
  position: relative;
}

.cal-day.cal-has-due::after {
  content: "";
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
}

.cal-day.cal-today {
  border-color: var(--gold);
}

.cal-day.cal-selected {
  background: var(--gold);
  color: #1a1a1d;
}

.cal-day.cal-selected.cal-has-due::after {
  background: #1a1a1d;
}

.cal-detail h3 {
  font-size: 1rem;
  text-transform: capitalize;
  margin: 0 0 10px;
  color: var(--gold);
}

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