/* BLH Facility System — sober, donker accent met goud, mobile-first */
:root {
  --ink: #16181d;
  --ink-2: #3a3f4b;
  --muted: #6b7180;
  --line: #e4e6eb;
  --bg: #f5f5f3;
  --card: #ffffff;
  --gold: #b08d57;
  --gold-ink: #7a5d2e;
  --bar: #121316;
  --open: #2563eb;
  --progress: #7c3aed;
  --paused: #d97706;
  --done: #15803d;
  --urgent: #dc2626;
  --high: #ea580c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 18, 22, .06), 0 2px 8px rgba(16, 18, 22, .04);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eceef2; --ink-2: #c5c9d2; --muted: #9096a3; --line: #2a2d34;
    --bg: #0f1013; --card: #17191d; --bar: #0a0b0d; --gold: #c9a56b; --gold-ink: #e2c48f;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: inherit; }
img { max-width: 100%; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }

/* ── Topbar ── */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--bar); color: #f1f1f1;
  display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem;
  padding-top: max(.6rem, env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; font-weight: 600; white-space: nowrap; }
.brand-mark { width: 28px; height: 28px; border: 1.5px solid var(--gold); border-radius: 6px; display: grid; place-items: center;
  color: var(--gold); font-size: .72rem; font-weight: 700; letter-spacing: .04em; }
.brand small { display: block; color: #9a9fab; font-weight: 400; font-size: .72rem; line-height: 1; }
.topnav { display: flex; gap: .15rem; margin-left: .5rem; }
.topnav a { text-decoration: none; color: #c8ccd4; padding: .4rem .65rem; border-radius: 6px; font-size: .9rem; }
.topnav a:hover, .topnav a.on { color: #fff; background: rgba(255,255,255,.08); }
.topbar .spacer { flex: 1; }
.loc-switch select {
  background: #1f2126; color: #fff; border: 1px solid #33363d; border-radius: 6px; padding: .35rem .5rem; max-width: 220px; font: inherit; font-size: .88rem;
}
.icon-btn { position: relative; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; color: #e4e6ea; text-decoration: none; }
.icon-btn:hover { background: rgba(255,255,255,.08); }
.badge-dot { position: absolute; top: 3px; right: 2px; background: var(--urgent); color: #fff; font-size: .65rem; min-width: 16px; height: 16px;
  border-radius: 8px; display: grid; place-items: center; padding: 0 4px; font-weight: 600; }
.user-chip { color: #c8ccd4; font-size: .85rem; text-decoration: none; }

/* ── Layout ── */
main { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 6rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: 2fr 1fr; }
@media (max-width: 860px) { .grid-3 { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.stack > * + * { margin-top: 1rem; }

/* ── Stat-tegels ── */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: .75rem; margin-bottom: 1rem; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, 1fr); } .stats .stat:last-child { grid-column: span 2; } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .95rem; text-decoration: none; display: block;
  border-top: 3px solid var(--c, var(--line)); box-shadow: var(--shadow); }
.stat .n { font-size: 1.8rem; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: .82rem; }
.stat:hover { border-color: var(--c); }

/* ── Weer ── */
.wx-now { display: flex; align-items: center; gap: .9rem; }
.wx-icon { font-size: 2.4rem; line-height: 1; }
.wx-temp { font-size: 1.9rem; font-weight: 650; }
.wx-days { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: .9rem; text-align: center; }
.wx-days div { background: var(--bg); border-radius: 8px; padding: .45rem .25rem; font-size: .82rem; }

/* ── Takenlijst ── */
.task-list { list-style: none; margin: 0; padding: 0; }
.task-list li + li { border-top: 1px solid var(--line); }
.task-row { display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .75rem; padding: .7rem .1rem; text-decoration: none; align-items: center; }
.task-row:hover .task-title { text-decoration: underline; }
.task-title { font-weight: 550; }
.task-meta { grid-column: 2 / 4; color: var(--muted); font-size: .82rem; display: flex; gap: .6rem; flex-wrap: wrap; }
.prio-bar { width: 4px; align-self: stretch; border-radius: 2px; background: var(--line); grid-row: span 2; }
.prio-urgent .prio-bar { background: var(--urgent); }
.prio-high .prio-bar { background: var(--high); }
.prio-normal .prio-bar { background: #9ca3af; }
.empty { color: var(--muted); padding: .75rem 0; }

/* ── Pills ── */
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: color-mix(in srgb, var(--c) 12%, transparent); color: var(--c); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.s-open { --c: var(--open); } .s-in_progress { --c: var(--progress); } .s-paused { --c: var(--paused); } .s-done { --c: var(--done); }
.p-urgent { --c: var(--urgent); } .p-high { --c: var(--high); } .p-normal { --c: #6b7280; } .p-low { --c: #94a3b8; }
.tag { display: inline-block; border: 1px solid var(--line); border-radius: 6px; padding: .05rem .45rem; font-size: .75rem; color: var(--ink-2); }

/* ── Formulieren ── */
label { display: block; font-weight: 550; font-size: .88rem; margin-bottom: .3rem; }
.field { margin-bottom: .95rem; }
.help { color: var(--muted); font-size: .8rem; margin-top: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: .6rem .7rem; min-height: 44px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--gold) 55%, transparent); border-color: var(--gold); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .35rem .9rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; font-size: .9rem;
  border-radius: 8px; padding: .55rem 1rem; min-height: 42px; cursor: pointer; text-decoration: none;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn:hover { border-color: var(--ink-2); }
.btn-primary { background: var(--ink); color: var(--card); border-color: var(--ink); }
.btn-primary:hover { opacity: .9; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #1b1408; }
.btn-danger { color: var(--urgent); border-color: color-mix(in srgb, var(--urgent) 35%, transparent); }
.btn-block { width: 100%; }
.btn-sm { min-height: 32px; padding: .3rem .7rem; font-size: .82rem; }
.btn-group { display: flex; gap: .5rem; flex-wrap: wrap; }

.alert { border-radius: 8px; padding: .65rem .85rem; margin-bottom: 1rem; font-size: .9rem; }
.alert-ok { background: color-mix(in srgb, var(--done) 12%, var(--card)); color: var(--done); border: 1px solid color-mix(in srgb, var(--done) 30%, transparent); }
.alert-err { background: color-mix(in srgb, var(--urgent) 10%, var(--card)); color: var(--urgent); border: 1px solid color-mix(in srgb, var(--urgent) 30%, transparent); }
.alert-info { background: color-mix(in srgb, var(--gold) 12%, var(--card)); color: var(--gold-ink); border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent); }

/* ── Filters ── */
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters select, .filters input { width: auto; min-height: 38px; padding: .35rem .6rem; font-size: .88rem; }
.filters input[type=search] { flex: 1; min-width: 160px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
.seg a { padding: .4rem .75rem; text-decoration: none; font-size: .85rem; color: var(--ink-2); }
.seg a.on { background: var(--ink); color: var(--card); }

/* ── Taakdetail ── */
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .4rem .9rem; font-size: .9rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; }
.photos a { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--bg); }
.photos img { width: 100%; height: 100%; object-fit: cover; }
.description { white-space: pre-wrap; }
.translated-note { font-size: .78rem; color: var(--muted); display: flex; gap: .4rem; align-items: center; margin-top: .3rem; }
.translated-note button { background: none; border: 0; padding: 0; color: var(--gold-ink); font: inherit; cursor: pointer; text-decoration: underline; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: .55rem 0 .55rem 1.1rem; border-left: 2px solid var(--line); position: relative; font-size: .9rem; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: .95rem; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.timeline li.ev-comment::before { background: var(--gold); }
.timeline li.ev-status::before { background: var(--progress); }
.timeline .when { color: var(--muted); font-size: .78rem; }
.timeline .bubble { background: var(--bg); border-radius: 8px; padding: .5rem .7rem; margin-top: .3rem; }
.pre { white-space: pre-wrap; }
.actions-card .btn { width: 100%; margin-bottom: .5rem; }
details.inline > summary { cursor: pointer; list-style: none; }
details.inline > summary::-webkit-details-marker { display: none; }

/* ── Tabellen ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
th, td { padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.dim td { opacity: .5; }
.bar { height: 8px; border-radius: 4px; background: var(--gold); }

/* ── Auth-pagina's ── */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: var(--bar); }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 14px; padding: 1.75rem 1.5rem; }
.auth-brand { text-align: center; margin-bottom: 1.25rem; }
.auth-brand .brand-mark { margin: 0 auto .6rem; width: 44px; height: 44px; font-size: .95rem; }
.divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .8rem; margin: 1rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.lang-links { text-align: center; margin-top: 1rem; font-size: .8rem; }
.lang-links a { color: var(--muted); margin: 0 .3rem; }
.lang-links a.on { color: var(--ink); font-weight: 600; }

/* ── Openbare meldpagina ── */
.public-head { background: var(--bar); color: #fff; padding: 1rem; padding-top: max(1rem, env(safe-area-inset-top)); }
.public-head .inner { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: .7rem; }
.public-main { max-width: 640px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.hp { position: absolute; left: -9999px; }
.photo-input { border: 1.5px dashed var(--line); border-radius: 10px; padding: 1rem; text-align: center; color: var(--muted); cursor: pointer; display: block; }
.photo-input input { display: none; }
.photo-preview { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .5rem; }
.photo-preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }

/* ── Mobiele tabbalk ── */
.tabbar { display: none; }
@media (max-width: 760px) {
  .topnav, .user-chip, .desk-only { display: none !important; }
  .loc-switch select { max-width: 150px; }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { text-decoration: none; text-align: center; padding: .45rem 0 .5rem; font-size: .7rem; color: var(--muted); }
  .tabbar a .ico { display: block; font-size: 1.25rem; line-height: 1.3; }
  .tabbar a.on { color: var(--ink); font-weight: 600; }
  .tabbar a.new .ico { color: var(--gold); }
}

/* ── Poster ── */
.poster { max-width: 720px; margin: 0 auto; text-align: center; padding: 2rem; background: #fff; color: #111; }
.poster h1 { font-size: 2.6rem; margin-bottom: .5rem; }
.poster .langs { font-size: 1.1rem; color: #555; margin-bottom: 1.5rem; }
.poster img { width: 70%; max-width: 460px; }
@media print { .no-print { display: none !important; } body { background: #fff; } }

/* ── Arbeidsmiddelen / keuringsstatus ── */
.eq-overdue { --c: var(--urgent); } .eq-rejected { --c: var(--high); } .eq-due_soon { --c: var(--paused); }
.eq-unknown { --c: #6b7280; } .eq-ok { --c: var(--done); } .eq-na { --c: #94a3b8; }
.eq-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; text-align: center; margin-bottom: .75rem; }
.eq-mini a { text-decoration: none; background: var(--bg); border-radius: 8px; padding: .5rem .25rem; }
.eq-mini .n { font-size: 1.35rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.eq-mini .l { font-size: .75rem; color: var(--muted); }
@media (max-width: 560px) { .hide-sm { display: none; } }
@media (max-width: 560px) {
  .filters select { flex: 1 1 calc(50% - .25rem); min-width: 0; }
  .filters input[type=search] { flex: 1 1 100%; }
}

/* ── Mobiel app-frame ──
   iOS (vooral als web-app op het beginscherm) verschuift position:fixed/sticky-balken na het
   gebruik van het toetsenbord. Daarom op mobiel: vaste boven- en onderbalk in een flex-kolom,
   en alleen <main> scrolt. */
@media (max-width: 760px) {
  body.app-shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
  body.app-shell .topbar { position: relative; flex: none; }
  body.app-shell main {
    flex: 1 1 auto; min-height: 0; width: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain; padding-bottom: 1.5rem;
  }
  body.app-shell .tabbar { position: static; flex: none; }
}
