:root {
  --bg: #10141a;
  --surface: #1a212b;
  --surface-2: #232c39;
  --border: #2e3a4a;
  --text: #e8edf3;
  --text-dim: #93a1b3;
  --accent: #fbbf24;
  --accent-press: #d9a51f;
  --accent-text: #181203;
  --danger: #f87171;
  --ok: #4ade80;
  --radius: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-size: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
}

.hidden { display: none !important; }

/* ---------- login ---------- */
.login {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card { width: 100%; max-width: 340px; text-align: center; }
.logo {
  width: 72px; height: 72px; margin: 0 auto 20px;
  background: var(--accent); color: var(--accent-text);
  border-radius: 20px; font-size: 30px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: -1px;
}
.login-card h1 { font-size: 1.35rem; margin-bottom: 4px; }
.login-card p { color: var(--text-dim); margin-bottom: 24px; }
#pin-input {
  width: 100%; padding: 14px; font-size: 1.4rem; text-align: center;
  letter-spacing: 8px; margin-bottom: 12px;
}

/* ---------- layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: rgba(16,20,26,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.logo-sm {
  background: var(--accent); color: var(--accent-text);
  border-radius: 8px; padding: 3px 8px; font-weight: 800; font-size: .9rem;
}
#topbar-title { font-weight: 650; font-size: 1.1rem; flex: 1; }
.add-btn {
  width: 40px; height: 40px; border-radius: 12px; border: none;
  background: var(--accent); color: var(--accent-text);
  font-size: 26px; line-height: 1; font-weight: 600; cursor: pointer;
}
.add-btn:active { background: var(--accent-press); }

main { padding: 16px 16px calc(84px + var(--safe-bottom)); max-width: 680px; margin: 0 auto; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex;
  background: rgba(16,20,26,.95); backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
}
.tab {
  flex: 1; padding: 10px 0 12px; border: none; background: none;
  color: var(--text-dim); font-size: .78rem; font-weight: 600; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tab.active { color: var(--accent); }
.tab-ico { font-size: 1.3rem; }

/* ---------- inputs ---------- */
input, textarea, select {
  width: 100%;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 12px; font-size: 1rem; font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
textarea { resize: vertical; min-height: 72px; }
label { display: block; font-size: .82rem; color: var(--text-dim); font-weight: 600; margin: 14px 0 5px; }
label:first-child { margin-top: 0; }

.search { margin-bottom: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 12px; padding: 13px 18px;
  font-size: 1rem; font-weight: 700; cursor: pointer; width: 100%;
}
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:active { background: var(--accent-press); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: none; color: var(--danger); border: 1px solid var(--danger); }
.icon-btn {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
  width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: .95rem;
}
.error { color: var(--danger); margin-top: 10px; font-size: .9rem; }

/* ---------- list & cards ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; cursor: pointer;
  display: flex; gap: 12px; align-items: center;
}
.card:active { background: var(--surface-2); }
.avatar {
  width: 52px; height: 52px; border-radius: 12px; flex-shrink: 0;
  background: var(--surface-2); object-fit: cover;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.2rem; color: var(--accent);
  border: 1px solid var(--border);
}
.card-main { flex: 1; min-width: 0; }
.card-title { font-weight: 650; }
.card-sub { color: var(--text-dim); font-size: .85rem; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--accent); border-radius: 999px;
  font-size: .7rem; font-weight: 700; padding: 2px 9px;
}

/* taken */
.task-card { align-items: flex-start; }
.task-check {
  width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0; margin-top: 1px;
  border: 2px solid var(--border); background: none; cursor: pointer;
  color: var(--accent-text); font-weight: 800; font-size: .95rem;
}
.task-check.done { background: var(--ok); border-color: var(--ok); }
.task-done .card-title { text-decoration: line-through; color: var(--text-dim); }
.due { font-size: .75rem; font-weight: 700; color: var(--text-dim); }
.due.today { color: var(--accent); }
.due.late { color: var(--danger); }
.prio-high { border-left: 3px solid var(--danger); }

/* agenda */
.day-head {
  margin: 18px 4px 2px; font-size: .8rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim);
}
.day-head.today { color: var(--accent); }
.day-head:first-child { margin-top: 0; }
.time-pill {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 8px; font-size: .8rem; font-weight: 700;
  color: var(--accent); flex-shrink: 0;
}

.empty { text-align: center; color: var(--text-dim); padding: 48px 16px; line-height: 1.6; }
.empty b { color: var(--text); }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.6);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px 20px 0 0; width: 100%; max-width: 680px;
  max-height: 92dvh; display: flex; flex-direction: column;
}
@media (min-width: 700px) {
  .modal { align-items: center; }
  .modal-card { border-radius: 20px; }
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 10px;
}
.modal-head h2 { font-size: 1.15rem; }
.modal-body { padding: 8px 18px calc(24px + var(--safe-bottom)); overflow-y: auto; }
.modal-body .btn { margin-top: 18px; }
.modal-body .btn-danger { margin-top: 10px; }

/* foto-invoer */
.photo-row { display: flex; gap: 10px; }
.photo-slot {
  flex: 1; aspect-ratio: 4/3; border-radius: 12px; overflow: hidden;
  border: 2px dashed var(--border); background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; color: var(--text-dim); font-size: .8rem; font-weight: 600;
  cursor: pointer; position: relative;
}
.photo-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-slot .ico { font-size: 1.6rem; }
.photo-clear {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  background: rgba(0,0,0,.65); color: #fff; border: none;
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: .85rem;
}
.row-2 { display: flex; gap: 10px; }
.row-2 > div { flex: 1; }

.detail-photo { width: 100%; border-radius: 12px; margin-bottom: 4px; border: 1px solid var(--border); }
.detail-line { padding: 10px 2px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; }
.detail-line b { color: var(--text-dim); font-weight: 600; min-width: 92px; font-size: .85rem; }
.detail-line a { color: var(--accent); text-decoration: none; word-break: break-all; }
.detail-line span { white-space: pre-wrap; }
