:root {
  --bg: #f5efe6;
  --surface: #fffcf7;
  --surface-2: #f3ebdf;
  --text: #2b231c;
  --muted: #76685a;
  --faint: #a8998a;
  --line: #e8dccb;
  --accent: #b4532a;
  --accent-soft: #f5e2d4;
  --sun: #d98a1c;
  --rain: #4d7ea8;
  --warn: #b4532a;
  --radius: 18px;
  --shadow: 0 1px 1px rgb(80 50 20 / 0.04), 0 8px 24px -12px rgb(80 50 20 / 0.12);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1814;
    --surface: #25201b;
    --surface-2: #2e2821;
    --text: #f1e8dc;
    --muted: #b3a595;
    --faint: #7d7064;
    --line: #3a322a;
    --accent: #e39a6f;
    --accent-soft: #43301f;
    --sun: #f0b54f;
    --rain: #8fb6d9;
    --warn: #e39a6f;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  max-width: 1280px;
  margin-inline: auto;
}

button, input { font: inherit; color: inherit; }

/* ---------- Kop ---------- */
.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin: 8px 0 20px;
}
.eyebrow {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}
h1 {
  margin: 4px 0 6px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(30px, 5.5vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.015em;
}
.summary { margin: 0; color: var(--muted); }
.top-side { display: flex; align-items: center; gap: 12px; }
.now {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--muted);
  white-space: nowrap;
}
.now > div { display: flex; flex-direction: column; line-height: 1.2; }
.now strong { color: var(--text); font-family: var(--serif); font-size: 26px; font-weight: 500; }
.now .wx-desc { font-size: 13px; }
.now .wx-icon { width: 36px; height: 36px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  color: var(--muted);
}
.icon-btn:hover { color: var(--text); }
.icon-btn.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.notice {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Dagen ---------- */
.days {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.day {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.day.today {
  grid-column: 1 / -1;
  padding: 22px 24px;
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 55%, transparent), transparent 140px),
    var(--surface);
}
.day-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.day-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 21px;
  letter-spacing: -0.01em;
}
.today .day-head h2 { font-size: 28px; }
.day-date { margin: 0; color: var(--muted); font-size: 13px; }
.today .day-date { color: var(--accent); font-weight: 600; }

.wx {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: right;
  flex-shrink: 0;
}
/* Iconen */
.ico { display: inline-grid; place-items: center; flex: 0 0 auto; }
.ico svg { width: 100%; height: 100%; }
.ico .sun { color: var(--sun); }
.ico .drop, .ico .bolt { color: var(--rain); }
.ico .cloud-fill { fill: var(--surface); }
.wx-icon { width: 30px; height: 30px; color: var(--muted); }
.today .wx-icon { width: 36px; height: 36px; }
.wx-temp { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wx-temp .lo { color: var(--muted); font-weight: 400; }
.wx-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.wx-meta .ico { width: 13px; height: 13px; color: var(--faint); }
.wx-meta .ico:not(:first-child) { margin-left: 8px; }

.day-body { display: grid; gap: 14px; }
.today .day-body { grid-template-columns: 1fr 1fr; gap: 24px; }

.block h3 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.empty { margin: 0; color: var(--faint); font-size: 14px; }

ul { list-style: none; margin: 0; padding: 0; }

/* Afspraken */
.event {
  display: grid;
  grid-template-columns: 3px 1fr;
  gap: 12px;
  padding: 8px 10px 8px 0;
  margin-bottom: 4px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--c, var(--accent)) 7%, transparent);
}
.event-bar { border-radius: 3px; background: var(--c, var(--accent)); }
.event-title { font-weight: 500; overflow-wrap: anywhere; }
.event-meta { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.event.past { opacity: 0.5; }
.event.allday .event-title::after {
  content: "hele dag";
  display: inline-block;
  white-space: nowrap;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 6px;
}

/* To-do's */
.todo {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 5px 0;
}
.todo input[type="checkbox"] {
  appearance: none;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  border: 1.5px solid var(--faint);
  border-radius: 6px;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: var(--surface);
}
.todo input[type="checkbox"]:checked {
  background: var(--text);
  border-color: var(--text);
}
.todo input[type="checkbox"]:checked::after {
  content: "";
  width: 5px;
  height: 10px;
  border: solid var(--surface);
  border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
}
.todo-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  cursor: text;
  border-radius: 6px;
}
.todo.done .todo-text { color: var(--faint); text-decoration: line-through; }
.todo-edit {
  flex: 1;
  min-width: 0;
  border: none;
  border-bottom: 1.5px solid var(--accent);
  background: transparent;
  padding: 0;
  outline: none;
}
.todo-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; }
.todo:hover .todo-actions, .todo:focus-within .todo-actions { opacity: 1; }
@media (hover: none) { .todo-actions { opacity: 1; } }
.mini-btn {
  border: none;
  background: none;
  color: var(--faint);
  cursor: pointer;
  padding: 0 4px;
  font-size: 13px;
  line-height: 22px;
  border-radius: 6px;
}
.mini-btn:hover { color: var(--text); background: var(--surface-2); }
.mini-btn.move { color: var(--accent); }

.add {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  padding: 5px 0;
}
.add::before {
  content: "+";
  width: 20px;
  text-align: center;
  color: var(--faint);
  font-size: 18px;
  line-height: 1;
}
.add input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 2px 0;
  outline: none;
  font-size: 16px; /* voorkomt inzoomen op iPhone */
}
.add input::placeholder { color: var(--faint); }

.overdue {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--warn) 9%, transparent);
}
.overdue h3 { color: var(--warn); }
.overdue .todo-date { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Legenda */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 20px;
  padding: 0;
  font-size: 13px;
  color: var(--muted);
}
.legend li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px 4px 9px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--c) 30%, var(--line));
  background: color-mix(in srgb, var(--c) 8%, var(--surface));
  color: var(--text);
}
.swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--c);
}

.foot {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--faint);
}

/* ---------- Inloggen ---------- */
.login {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 16px;
  z-index: 10;
}
.login[hidden] { display: none; }
.login-card {
  width: min(360px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  display: grid;
  gap: 12px;
}
.login-card h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 26px; }
.login-card p { margin: 0; color: var(--muted); }
.login-card input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg);
  font-size: 16px;
}
.login-card button {
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--text);
  color: var(--surface);
  font-weight: 600;
  cursor: pointer;
}
.login-error { color: var(--warn) !important; }

/* ---------- Responsief ---------- */
@media (max-width: 960px) {
  .days { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .days { grid-template-columns: 1fr; gap: 12px; }
  .today .day-body { grid-template-columns: 1fr; gap: 16px; }
  .day.today { padding: 18px; }
  .top { margin-top: 0; }
  .now .wx-desc { display: none; }
}
