:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #6b7686;
  --line: #e2e6ec;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --ok-bg: #e7f6ec; --ok: #17663a;
  --err-bg: #fdecec; --err: #a12626;
  --danger: #c23030;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151b; --card: #1a2029; --text: #e6eaf0; --muted: #94a0b2; --line: #2b3340;
    --accent: #4c8dff; --ok-bg: #143322; --ok: #7fd8a1; --err-bg: #3a1a1a; --err: #ff9b9b; --danger: #ff6b6b;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 16px; padding-bottom: 40px; }
h1 { font-size: 1.35rem; margin: 0 0 12px; }
h2 { font-size: 1.05rem; margin: 0 0 8px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.mt { margin-top: 12px; }

/* Header */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 52px; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  padding: 10px 9px; text-decoration: none; color: var(--muted); white-space: nowrap; font-size: .95rem;
  border-bottom: 2px solid transparent; font-weight: 500;
}
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }

/* Cards & forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card.narrow { max-width: 420px; margin-left: auto; margin-right: auto; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 8px; }
input, select {
  font: inherit; font-size: 16px; /* voorkomt inzoomen op iOS */
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); width: 100%; min-height: 46px;
}
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
input[type=date], input[type=time] { min-width: 0; -webkit-appearance: none; appearance: none; }
.entry-form { display: flex; flex-direction: column; gap: 12px; }
.code-input { font-size: 1.6rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent); color: var(--accent-text); border: 0; border-radius: 10px;
  padding: 11px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 44px;
}
.btn.big { padding: 14px; font-size: 1.05rem; }
.btn.secondary { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 6px 0; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }
.actions-row form { margin: 0; }
form.inline { display: flex; gap: 8px; }
form.inline input { flex: 1; min-width: 0; }
form.inline .btn { white-space: nowrap; }

.flash { padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-size: .95rem; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--err-bg); color: var(--err); }

/* Filter */
.filter { display: flex; flex-direction: column; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 2px; }
.chip {
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; white-space: nowrap;
  text-decoration: none; color: var(--text); font-size: .875rem;
}
.chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* Totaal */
.total-bar {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 12px 16px; margin-bottom: 16px; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-text);
}
.total-bar strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.total-bar .muted { color: inherit; opacity: .8; font-weight: 400; font-size: .9rem; }

/* Dagen & registraties */
.day { margin-bottom: 16px; }
.day h2 {
  display: flex; justify-content: space-between; font-size: .85rem; text-transform: uppercase;
  letter-spacing: .03em; color: var(--muted); margin: 0 4px 6px;
}
.entries { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.entries li + li { border-top: 1px solid var(--line); }
.entries a, .entries li > div {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 12px 16px; color: var(--text); text-decoration: none;
}
.entries a:active { background: var(--bg); }
.time, .dur { font-variant-numeric: tabular-nums; }
.time { font-weight: 600; }
.desc { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desc strong { color: var(--text); font-weight: 500; }

/* Tabel */
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl tfoot th { border-bottom: 0; }
.tbl .r { text-align: right; }

/* Gebruikers */
details.card > summary { list-style: none; cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
details.user > summary { display: flex; justify-content: space-between; align-items: center; }
details.user > summary::after { content: "›"; font-size: 1.4rem; color: var(--muted); transition: transform .15s; }
details.user[open] > summary::after { transform: rotate(90deg); }
details.user.inactive { opacity: .6; }
.badge { display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); margin-left: 4px; color: var(--muted); }
.badge.off { color: var(--danger); }

/* MFA */
.qr { display: flex; justify-content: center; padding: 12px; background: #fff; border-radius: 10px; margin: 8px 0; min-height: 60px; color: #333; }
.secret { display: inline-block; margin-top: 4px; padding: 6px 8px; background: var(--bg); border-radius: 6px; font-size: .95rem; word-break: break-all; }

@media (min-width: 640px) {
  h1 { font-size: 1.6rem; }
}

/* Accountmenu rechtsboven */
details.acct { position: relative; }
details.acct > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
  padding: 6px 2px; color: var(--text); font-size: .95rem; max-width: 55vw;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: none;
}
details.acct > summary::-webkit-details-marker { display: none; }
details.acct > summary::after {
  content: ""; flex: none; width: 7px; height: 7px; margin: -4px 4px 0 0;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .15s;
}
details.acct[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.acct-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; z-index: 20;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 6px; display: flex; flex-direction: column;
}
.acct-menu .acct-mail { padding: 8px 10px; font-size: .85rem; border-bottom: 1px solid var(--line); margin-bottom: 4px; word-break: break-all; }
.acct-menu a, .acct-menu button {
  display: block; width: 100%; text-align: left; padding: 10px; border-radius: 8px;
  color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer;
}
.acct-menu a:hover, .acct-menu button:hover { background: var(--bg); }
.acct-menu button { color: var(--danger); }
