/* Klussenbord Pannenkoekenrestaurant Financiën — huisstijl: stroop, boter en een snufje aardbei */
:root {
  --bg: #fff8ec;
  --surface: #ffffff;
  --surface-2: #fdf1dc;
  --ink: #3b2412;
  --ink-soft: #6b5342;
  --line: #ecd9bb;
  --syrup: #7a4a1e;
  --syrup-dark: #5a3412;
  --butter: #f4c46e;
  --butter-deep: #e8a33d;
  --strawberry: #b3263a;

  --p1: #c62828;      /* spoed */
  --p1-bg: #fdeaea;
  --p2: #b34700;      /* redelijk snel */
  --p2-bg: #fff0e0;
  --p3: #2e7d32;      /* als je tijd hebt */
  --p3-bg: #e9f6ea;

  --radius: 8px;
  --shadow: 0 1px 2px rgba(60, 36, 18, .08);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5;
  color: var(--ink); background: var(--bg);
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; color: var(--syrup-dark); }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
a { color: var(--syrup); }
img { max-width: 100%; }
[hidden] { display: none !important; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--syrup-dark); color: #fff; padding: .6rem 1rem; z-index: 100; }
.skip-link:focus { left: 0; }

:focus-visible { outline: 3px solid var(--butter-deep); outline-offset: 2px; border-radius: 6px; }

/* ---------- Kop en navigatie ---------- */
.topbar { background: var(--syrup); color: #fff7e6; border-bottom: 4px solid var(--butter-deep); }
.topbar-inner { max-width: 1120px; margin: 0 auto; padding: .7rem 1rem; display: flex; align-items: center; gap: 1rem; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: inherit; min-width: 0; }
.brand-logo { width: 40px; height: 40px; flex: none; border-radius: 8px; }
.brand-title { font-weight: 800; font-size: 1.05rem; line-height: 1.15; }
.brand-sub { font-size: .8rem; opacity: .85; }
.userbox { display: flex; align-items: center; gap: .5rem; flex: none; }
.userchip { text-align: right; font-size: .85rem; line-height: 1.2; }
.userchip small { display: block; opacity: .8; }

.nav { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.nav-inner { max-width: 1120px; margin: 0 auto; padding: 0 .5rem; display: flex; gap: .25rem; overflow-x: auto; }
.nav a {
  display: flex; align-items: center; gap: .45rem; padding: .85rem .9rem; text-decoration: none; color: var(--ink-soft);
  font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; min-height: 48px;
}
.nav a:hover { color: var(--syrup-dark); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--syrup-dark); border-bottom-color: var(--butter-deep); }
.nav .count { background: var(--p1); color: #fff; border-radius: 4px; font-size: .75rem; padding: 0 .5rem; min-width: 1.4rem; text-align: center; }
.nav .count.zero { background: var(--line); color: var(--ink-soft); }

main { max-width: 1120px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head p { color: var(--ink-soft); margin: 0; }
.tagline { color: var(--strawberry); font-weight: 700; }

/* ---------- Knoppen en formulieren ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; padding: .55rem 1.1rem;
  border: 2px solid var(--syrup); background: var(--syrup); color: #fff; border-radius: 6px; font: inherit; font-weight: 700;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--syrup-dark); border-color: var(--syrup-dark); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: transparent; color: var(--syrup-dark); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; border-color: rgba(255, 247, 230, .55); color: #fff7e6; min-height: 38px; padding: .3rem .8rem; font-size: .9rem; }
.btn.ghost:hover { background: rgba(255, 255, 255, .15); }
.btn.done { background: var(--p3); border-color: var(--p3); }
.btn.done:hover { background: #256528; border-color: #256528; }
.btn.danger { background: var(--p1); border-color: var(--p1); }
.btn.danger:hover { background: #a61f1f; border-color: #a61f1f; }
.btn.big { min-height: 52px; font-size: 1.05rem; padding: .7rem 1.5rem; }
.btn.small { min-height: 36px; padding: .25rem .8rem; font-size: .9rem; }

label, .label { display: block; font-weight: 700; margin-bottom: .3rem; }
.hint { color: var(--ink-soft); font-size: .88rem; font-weight: 400; }
input[type="text"], input[type="password"], input[type="search"], input[type="date"], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 2px solid var(--line); border-radius: 10px;
  padding: .6rem .75rem; min-height: 44px;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--butter-deep); outline: none; box-shadow: 0 0 0 3px rgba(232, 163, 61, .35); }
.field { margin-bottom: 1rem; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--p1); }
.error-text { color: var(--p1); font-weight: 600; font-size: .9rem; margin-top: .25rem; }
.form-error { background: var(--p1-bg); border: 1px solid #efb8b8; color: #8c1c1c; padding: .7rem .9rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 600; }
.grid-2 { display: grid; gap: 0 1rem; grid-template-columns: minmax(0, 1fr); }

/* ---------- Kaarten ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; }
.card + .card { margin-top: 1rem; }

/* Statistiek */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.stat {
  display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line);
  border-left: 8px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow);
}
.stat:hover { border-color: var(--butter-deep); }
.stat .num { font-size: 2.1rem; font-weight: 800; line-height: 1; }
.stat .lbl { font-size: .9rem; color: var(--ink-soft); font-weight: 600; margin-top: .3rem; }
.stat.p1 { border-left-color: var(--p1); } .stat.p1 .num { color: var(--p1); }
.stat.p2 { border-left-color: var(--p2); } .stat.p2 .num { color: var(--p2); }
.stat.p3 { border-left-color: var(--p3); } .stat.p3 .num { color: var(--p3); }
.stat.total { border-left-color: var(--syrup); }
.stat.done { border-left-color: var(--p3); }
.stat:last-child { grid-column: span 2; }

.two-col { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.section-title h2 { margin: 0; }

.alert { display: flex; gap: .75rem; align-items: flex-start; background: var(--p1-bg); border: 2px solid var(--p1); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1.25rem; }
.alert strong { color: #8c1c1c; }
.alert ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.alert-icon { font-size: 1.6rem; line-height: 1; }

/* ---------- Klus-kaarten ---------- */
.job-list { display: grid; gap: .75rem; }
.job {
  position: relative; display: grid; grid-template-columns: 1fr auto; gap: .5rem .9rem; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-left: 8px solid var(--line); border-radius: var(--radius);
  padding: .85rem 1rem; box-shadow: var(--shadow);
}
.job:hover { border-color: var(--butter-deep); }
.job.p1 { border-left-color: var(--p1); }
.job.p2 { border-left-color: var(--p2); }
.job.p3 { border-left-color: var(--p3); }
.job.p1 .job-title { font-size: 1.1rem; }
.job-title { font-weight: 800; color: var(--syrup-dark); margin: .2rem 0 .1rem; overflow-wrap: anywhere; }
.job-desc { color: var(--ink-soft); font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.job-meta { display: flex; flex-wrap: wrap; gap: .25rem .9rem; font-size: .85rem; color: var(--ink-soft); margin-top: .45rem; }
.job-meta span { white-space: nowrap; }
.job-thumb { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); }
.job-side { display: flex; flex-direction: column; align-items: flex-end; gap: .4rem; }
.job-top { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }

.group-title { display: flex; align-items: center; gap: .6rem; margin: 1.4rem 0 .6rem; font-size: 1rem; }
.group-title:first-child { margin-top: 0; }

.badge { display: inline-flex; align-items: center; gap: .3rem; border-radius: 4px; padding: .1rem .55rem; font-size: .75rem; font-weight: 700; letter-spacing: .03em; white-space: nowrap; }
.badge.p1 { background: var(--p1); color: #fff; }
.badge.p2 { background: var(--p2); color: #fff; }
.badge.p3 { background: var(--p3); color: #fff; }
.status { background: var(--surface-2); color: var(--syrup-dark); border: 1px solid var(--line); }
.status.nieuw { background: #e8f0fe; color: #1a3d8f; border-color: #c5d6fa; }
.status.in_behandeling { background: #fff3c4; color: #6b4e00; border-color: #f0dc8a; }
.status.afgerond { background: var(--p3-bg); color: #1d5a21; border-color: #bfe0c1; }
.badge.warn { background: #fff; color: var(--p1); border: 2px solid var(--p1); }

.empty { text-align: center; padding: 2rem 1rem; color: var(--ink-soft); background: var(--surface); border: 2px dashed var(--line); border-radius: var(--radius); }
.empty .big { font-size: 2.4rem; display: block; }
.empty strong { display: block; color: var(--syrup-dark); font-size: 1.1rem; }

/* ---------- Filters ---------- */
.filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .6rem; margin-bottom: 1rem; padding: .9rem; }
.filters .search { grid-column: span 2; }
.filters label { font-size: .8rem; margin-bottom: .15rem; color: var(--ink-soft); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; grid-column: span 2; }
.chip { border: 2px solid var(--line); background: #fff; border-radius: 6px; padding: .25rem .8rem; font: inherit; font-weight: 700; font-size: .85rem; cursor: pointer; color: var(--ink-soft); min-height: 36px; }
.chip[aria-pressed="true"] { background: var(--syrup); border-color: var(--syrup); color: #fff; }
.result-count { color: var(--ink-soft); font-size: .9rem; margin: 0 0 .75rem; }

/* ---------- Nieuwe klus ---------- */
.prio-options { display: grid; gap: .6rem; }
.prio-option { position: relative; }
.prio-option input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.prio-option .box { display: flex; gap: .7rem; align-items: flex-start; border: 2px solid var(--line); border-left-width: 8px; border-radius: 12px; padding: .7rem .9rem; background: #fff; }
.prio-option.p1 .box { border-left-color: var(--p1); }
.prio-option.p2 .box { border-left-color: var(--p2); }
.prio-option.p3 .box { border-left-color: var(--p3); }
.prio-option input:checked + .box { box-shadow: 0 0 0 3px var(--butter-deep); background: var(--surface-2); }
.prio-option input:focus-visible + .box { outline: 3px solid var(--syrup); outline-offset: 2px; }
.prio-option .dot { font-size: 1.3rem; line-height: 1.2; }
.prio-option .t { font-weight: 800; }
.field.invalid .prio-option .box { border-color: var(--p1); }

.photo-pick { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; }
.photo-pick input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.photo-preview { position: relative; display: inline-block; }
.photo-preview img { max-height: 150px; border-radius: 10px; border: 1px solid var(--line); display: block; }
.photo-preview button { position: absolute; top: -8px; right: -8px; width: 32px; height: 32px; border-radius: 50%; border: 2px solid #fff; background: var(--p1); color: #fff; font-size: 1rem; cursor: pointer; }
.readonly-box { background: var(--surface-2); border: 2px solid var(--line); border-radius: 10px; padding: .6rem .75rem; min-height: 44px; }

.success { text-align: center; padding: 2rem 1rem; }
.success .big { font-size: 3.2rem; }
.success h1 { margin-top: .5rem; }
.success .actions { display: flex; justify-content: center; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }

/* ---------- Detail ---------- */
.detail-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.detail-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 0; }
.facts dt { color: var(--ink-soft); font-weight: 600; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.desc { white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-photo { display: block; max-width: 100%; max-height: 420px; border-radius: 12px; border: 1px solid var(--line); margin-top: .75rem; }
.actions-panel { display: grid; gap: .6rem; }
.actions-panel .row { display: flex; flex-wrap: wrap; gap: .5rem; }
.done-box { background: var(--p3-bg); border: 1px solid #bfe0c1; border-radius: 12px; padding: .75rem .9rem; margin-top: .75rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.6rem; border-left: 2px solid var(--line); margin-left: .5rem; }
.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: .25rem; width: 12px; height: 12px; border-radius: 50%; background: var(--butter-deep); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.timeline li.afgerond::before { background: var(--p3); }
.timeline li.heropend::before { background: var(--p1); }
.timeline li.opmerking::before { background: var(--syrup); }
.timeline .when { font-size: .8rem; color: var(--ink-soft); }
.timeline .what { font-weight: 700; }
.timeline .text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Dashboard-grafiek ---------- */
.bars { display: flex; align-items: flex-end; gap: .5rem; height: 130px; padding-top: 1.2rem; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar .fill { width: 100%; max-width: 44px; background: var(--butter-deep); border-radius: 6px 6px 0 0; min-height: 3px; }
.bar .val { font-size: .8rem; font-weight: 800; }
.bar .name { font-size: .72rem; color: var(--ink-soft); margin-top: .25rem; white-space: nowrap; }

/* ---------- Beheer ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
.inactive { opacity: .55; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.inline-form .field { margin: 0; flex: 1 1 180px; }

/* ---------- Inloggen ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: var(--bg); }
.login-card { width: 100%; max-width: 400px; }
.login-card .brand-logo { width: 72px; height: 72px; display: block; margin: 0 auto .5rem; }
.login-card h1 { text-align: center; font-size: 1.4rem; }
.login-card .tagline { text-align: center; margin-bottom: 1.2rem; }

/* ---------- Dialoog en meldingen ---------- */
dialog { border: none; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 1.5rem)); max-height: calc(100vh - 2rem); box-shadow: 0 20px 60px rgba(40, 20, 5, .35); color: var(--ink); }
dialog::backdrop { background: rgba(40, 20, 5, .55); }
.dialog-body { padding: 1.25rem; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }

.toasts { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); bottom: 5rem; display: grid; gap: .5rem; width: min(480px, calc(100vw - 1.5rem)); pointer-events: none; }
.toast { pointer-events: auto; background: var(--syrup-dark); color: #fff; padding: .8rem 1rem; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; display: flex; gap: .6rem; align-items: center; justify-content: space-between; border-left: 6px solid var(--butter-deep); }
.toast.error { background: #8c1c1c; border-left-color: #fff; }
.toast.spoed { background: var(--p1); border-left-color: #fff; }
.toast a { color: #fff; text-decoration: underline; white-space: nowrap; }

.loading { text-align: center; padding: 3rem 1rem; color: var(--ink-soft); }
.muted { color: var(--ink-soft); }

/* ---------- Groter scherm ---------- */
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stat:last-child { grid-column: auto; }
  .filters { grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr)); align-items: end; }
  .filters .search { grid-column: span 1; }
  .chips { grid-column: 1 / -1; }
  .job-thumb { width: 96px; height: 96px; }
}
@media (min-width: 900px) {
  .two-col { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .detail-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .toasts { bottom: 1.5rem; }
}
@media (max-width: 899px) {
  .brand-sub { display: none; }
  .userchip small { display: none; }
}
@media (max-width: 520px) {
  .job { grid-template-columns: 1fr; }
  .job-side { flex-direction: row; align-items: center; justify-content: space-between; }
  .job-thumb { width: 64px; height: 64px; }
  h1 { font-size: 1.4rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Foto-knop met toetsenbordfocus */
.photo-pick input:focus-visible + .btn { outline: 3px solid var(--butter-deep); outline-offset: 2px; }

.filters > *, .grid-2 > * { min-width: 0; }
input[type="date"] { min-width: 0; max-width: 100%; }

/* Telefoon: kop in twee regels, compacter menu */
@media (max-width: 520px) {
  .topbar-inner { flex-wrap: wrap; gap: .5rem; padding: .6rem .8rem; }
  .brand { flex: 1 1 100%; }
  .brand-title { font-size: .98rem; }
  .brand-logo { width: 38px; height: 38px; }
  .userbox { width: 100%; justify-content: flex-end; }
  .userchip { margin-right: auto; text-align: left; }
  .userchip small { display: block; }
  .nav a { padding: .8rem .65rem; font-size: .9rem; }
}

/* Rustiger uiterlijk: geen pictogrammen als decoratie */
.empty .big:empty, .success .big:empty { display: none; }
.alert-icon { width: 1.6rem; height: 1.6rem; flex: none; border-radius: 50%; background: var(--p1); color: #fff; font-weight: 800; text-align: center; line-height: 1.6rem; font-size: 1rem; }
.prio-option .dot { width: .9rem; height: .9rem; border-radius: 50%; margin-top: .3rem; flex: none; }
.prio-option .dot.p1 { background: var(--p1); } .prio-option .dot.p2 { background: var(--p2); } .prio-option .dot.p3 { background: var(--p3); }
.tabs .btn { border-radius: 6px; }
