/* KBK-huisstijl voor portaal en beheer: navy #1A3360, rood #E63422, antraciet #373A41, grijs #C5C9C7 */
/* "hidden" moet altijd winnen van display-regels (anders blijft bv. het inlogscherm staan) */
[hidden] { display: none !important; }
:root {
  --kbk-navy: #1A3360; --kbk-red: #E63422; --kbk-dark: #373A41; --kbk-grey: #C5C9C7;
  --bg: #eef1f5; --panel: #ffffff; --panel-alt: #f4f6f9; --line: #d6dbe1; --text: #373A41; --muted: #6b7380;
  --accent: #1A3360; --accent-soft: #e2e8f2; --primary: #E63422; --primary-hover: #c92b1b;
  --btn: #f2f4f7; --btn-hover: #e4e8ee; --header-bg: #1A3360;
  --ok: #2e8b3a; --ok-soft: #e5f4e6; --warn: #b26b00; --warn-soft: #fdf1dc; --err: #c62828; --err-soft: #fde8e6;
  --shadow: 0 6px 24px rgba(26, 51, 96, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220; --panel: #121c30; --panel-alt: #18243c; --line: #26344f; --text: #e6eaf1; --muted: #93a0b5;
    --accent: #4fb3e8; --accent-soft: #16304a; --primary: #E63422; --primary-hover: #f04a38;
    --btn: #1a2740; --btn-hover: #22314f; --header-bg: #002240;
    --ok: #6cc070; --ok-soft: #173322; --warn: #f2c94c; --warn-soft: #33290f; --err: #ff6b5a; --err-soft: #3a1a17;
    --shadow: 0 6px 24px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1220; --panel: #121c30; --panel-alt: #18243c; --line: #26344f; --text: #e6eaf1; --muted: #93a0b5;
  --accent: #4fb3e8; --accent-soft: #16304a; --primary: #E63422; --primary-hover: #f04a38;
  --btn: #1a2740; --btn-hover: #22314f; --header-bg: #002240;
  --ok: #6cc070; --ok-soft: #173322; --warn: #f2c94c; --warn-soft: #33290f; --err: #ff6b5a; --err-soft: #3a1a17;
  --shadow: 0 6px 24px rgba(0, 0, 0, .4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
a { color: var(--accent); }
h1, h2, h3 { color: var(--text); line-height: 1.25; }

/* kopbalk */
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 20px; background: var(--header-bg); color: #fff;
  border-bottom: 3px solid var(--kbk-red); flex-wrap: wrap; position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
/* logo: alleen hoogte vast, breedte volgt de verhouding (nooit vervormen) */
.brand img { height: 34px; width: auto; max-width: none; display: block; object-fit: contain; }
.brand .logo-mark { display: none; }
.topbar .app { font-weight: 600; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.3); }
.topbar .app small { display: block; font-weight: 400; font-size: 11px; opacity: .75; }
.topbar .spacer { flex: 1; }
.hbtn { font: inherit; font-size: 13px; color: #fff; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
  border-radius: 6px; padding: 5px 12px; cursor: pointer; text-decoration: none; }
.hbtn:hover { background: rgba(255,255,255,.22); }
.user { display: inline-flex; align-items: center; gap: 8px; margin-right: 4px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--kbk-red); color: #fff; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.uname { font-size: 13px; }
#userSlot { display: inline-flex; align-items: center; gap: 8px; }

/* inhoud */
main.wrap { max-width: 1200px; margin: 0 auto; padding: 24px 20px 48px; }
.pagehead { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.pagehead h1 { margin: 0; font-size: 24px; }
.pagehead p { margin: 2px 0 0; color: var(--muted); }
.pagehead .spacer { flex: 1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.card.pad { padding: 18px 20px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 28px; text-align: center; }

/* knoppen en velden */
button, .btn, input, select, textarea { font: inherit; color: var(--text); }
button, .btn { background: var(--btn); border: 1px solid var(--line); border-radius: 6px; padding: 7px 14px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover:not(:disabled), .btn:hover { background: var(--btn-hover); }
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.primary:hover:not(:disabled) { background: var(--primary-hover); }
.danger { color: var(--err); }
.small { padding: 3px 10px; font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=checkbox] { accent-color: var(--kbk-red); }
label.field { display: block; margin: 10px 0; }
label.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* badges */
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge.red { background: var(--err-soft); color: var(--err); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.grey { background: var(--btn); color: var(--muted); }

/* tabellen */
table.grid { width: 100%; border-collapse: collapse; }
table.grid th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel-alt); position: sticky; top: 0; }
table.grid td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tr:hover td { background: var(--panel-alt); }
table.grid select { width: auto; padding: 4px 8px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { border: 0; border-radius: 0; background: transparent; padding: 10px 16px; color: var(--muted); }
.tabs button.active { color: var(--text); font-weight: 600; box-shadow: inset 0 -3px 0 var(--kbk-red); }
.tabs button:hover { background: transparent; color: var(--text); }

/* dialoog */
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); padding: 0;
  width: min(480px, calc(100% - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(10, 18, 32, .55); }
dialog form { padding: 20px 22px; }
dialog h2 { margin: 0 0 6px; font-size: 18px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* meldingen */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 8px;
  padding: 10px 14px; box-shadow: var(--shadow); max-width: 380px; transition: opacity .3s, transform .3s; }
.toast.err { border-left-color: var(--err); }
.toast.out { opacity: 0; transform: translateY(8px); }

@media (max-width: 640px) {
  .topbar { padding: 8px 12px; }
  .uname { display: none; }
  .brand .logo-full { display: none; }
  .brand .logo-mark { display: block; height: 36px; }
  main.wrap { padding: 16px; }
  table.grid th:nth-child(n+4), table.grid td:nth-child(n+4) { display: none; }
}
