:root {
  --bg: #f4f6f8; --surface: #ffffff; --border: #dde3ea; --text: #1b2430; --muted: #5b6b7c;
  --accent: #00704a; --accent-soft: #e1f5ea; --brand-green: #00c768; --brand-dark: #004024; --danger: #b42318; --warn: #b54708; --radius: 8px;
  --sidebar: #004024; --sidebar-text: #cfe8da;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 24px 0 8px; }
.subtitle { color: var(--muted); margin: 0 0 20px; }

.shell { display: flex; min-height: 100vh; }
.sidebar { width: 256px; background: linear-gradient(180deg, #004024 0%, #0a2e1f 100%); color: var(--sidebar-text); display: flex; flex-direction: column; padding: 16px 12px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; margin: 2px 4px 16px; }
.brand-logo { width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.brand-name { color: #fff; font-weight: 600; font-size: 15px; letter-spacing: .01em; }
.brand-mode { font-size: 11px; color: #9fd1b6; }
.brand-slogan { display: none; }
.org-picker { margin-bottom: 8px; }
.org-picker label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #7fbf9a; margin: 0 10px 6px; font-weight: 600; }
.org-picker select { width: 100%; padding: 7px 8px; border-radius: 6px; border: 1px solid #2c3d4f; background: #1d2d3d; color: #fff; }
.org-fixed { color: #fff; font-weight: 600; padding: 0 10px; }
nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item, .nav-group-toggle { display: flex; align-items: center; gap: 10px; color: var(--sidebar-text); padding: 8px 10px; border-radius: 7px; font-size: 13.5px; width: 100%; text-align: left; background: transparent; border: 0; cursor: pointer; font: inherit; }
.nav-item:hover, .nav-group-toggle:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--brand-green); color: #003018; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.nav-item.active .nav-icon { color: #003018; }
.nav-icon { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; color: #9fd1b6; flex-shrink: 0; }
.nav-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge { background: rgba(255,255,255,.18); color: #fff; border-radius: 10px; padding: 1px 7px; font-size: 11px; }
.nav-chevron { width: 16px; height: 16px; transition: transform .15s; color: #9fd1b6; }
.nav-group-toggle.open .nav-chevron { transform: rotate(180deg); }
.nav-group { display: flex; flex-direction: column; gap: 1px; margin-left: 10px; padding-left: 8px; border-left: 1px solid rgba(255,255,255,.14); }
.nav-group .nav-item { padding: 6px 10px; font-size: 13px; }
.nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #7fbf9a; margin: 16px 10px 6px; font-weight: 600; }
.nav-section-org { display: flex; flex-direction: column; gap: 2px; }
.nav-section-org strong { color: #fff; text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer { margin-top: auto; font-size: 12px; color: #8fa3b5; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 36px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; min-height: 52px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar .lang-switch { margin: 0; }
.user-menu { position: relative; }
.user-chip { display: flex; align-items: center; gap: 9px; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 4px 8px 4px 4px; cursor: pointer; font: inherit; color: var(--text); }
.user-chip:hover, .user-menu.open .user-chip { background: var(--bg); border-color: var(--border); }
.user-chip .user-avatar { width: 30px; height: 30px; font-size: 12px; }
.user-chip-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.user-chip-text .name { font-size: 13px; font-weight: 600; }
.user-chip-text .role { font-size: 11px; color: var(--muted); }
.user-chip .nav-chevron { color: var(--muted); }
.user-menu.open .nav-chevron { transform: rotate(180deg); }
.user-dropdown { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.12); min-width: 200px; padding: 6px; z-index: 30; }
.user-dropdown a, .user-dropdown button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 6px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.user-dropdown a:hover, .user-dropdown button:hover { background: var(--accent-soft); color: var(--accent); }
.user-dropdown svg { width: 15px; height: 15px; color: var(--muted); }
.content { flex: 1; padding: 24px 36px; max-width: 1300px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.card h2 { margin-top: 0; }
.toolbar { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 26px; font-weight: 600; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f9fafb; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: #f6faf8; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: #f1f3f5; padding: 1px 5px; border-radius: 4px; }
pre { background: #0f1720; color: #d7e0ea; padding: 14px; border-radius: var(--radius); overflow: auto; font-size: 12px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #eef1f4; color: var(--muted); }
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.off { background: #fdecea; color: var(--danger); }
.badge.warn { background: #fff4e5; color: var(--warn); }
.badge.type { background: #e8eefc; color: #2b4ea8; }

button, .btn { font: inherit; padding: 7px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--danger); }
button.small, .btn.small { padding: 3px 8px; font-size: 12px; text-decoration: none; display: inline-block; }
.btn { text-decoration: none; display: inline-block; }
button:disabled { opacity: .5; cursor: default; }

.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.form .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: #fff; }
.field textarea { font-family: ui-monospace, Menlo, monospace; font-size: 12px; min-height: 140px; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 4px; }
.error { color: var(--danger); margin: 8px 0; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 24px; text-align: center; }

#blazor-error-ui { background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #14212e 0%, #1f3a4d 60%, #0b6e4f 100%); padding: 20px; }
.login-card { background: var(--surface); border-radius: 12px; padding: 30px 32px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-card .brand-slogan { color: var(--muted); }
.banner { background: #fff4e5; border: 1px solid #f7d9b0; color: var(--warn); padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.user-box { margin-top: auto; font-size: 12px; color: #9fd1b6; border-top: 1px solid rgba(255,255,255,.12); padding-top: 12px; }
.user-row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-green); color: #003018; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.user-meta { min-width: 0; }
.user-box .name { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-box .role { font-size: 11px; color: #9fd1b6; }
.user-actions { display: flex; gap: 6px; }
.user-actions a, .user-actions button { display: inline-flex; align-items: center; gap: 5px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.18); color: #cfe8da; padding: 4px 9px; font-size: 12px; border-radius: 6px; cursor: pointer; font: inherit; }
.user-actions a:hover, .user-actions button:hover { background: rgba(255,255,255,.14); color: #fff; }
.user-actions svg { width: 14px; height: 14px; }
.user-box form { display: inline; }
.typeahead { position: relative; }
.typeahead input { width: 100%; padding: 8px 10px; border-radius: 7px; border: 1px solid rgba(255,255,255,.18); background: rgba(0,0,0,.25); color: #fff; }
.typeahead input::placeholder { color: #7fbf9a; }
.typeahead .results { position: absolute; left: 0; right: 0; top: 100%; z-index: 50; background: #fff; color: var(--text); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-height: 320px; overflow: auto; }
.typeahead .results div { padding: 7px 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.typeahead .results div:hover, .typeahead .results div.active { background: var(--accent-soft); }
.typeahead .results .hint { padding: 7px 10px; color: var(--muted); font-size: 12px; cursor: default; }
.typeahead .results .hint:hover { background: transparent; }

/* Taalkeuze */
.lang-switch { display: flex; gap: 4px; margin-top: 8px; }
.lang-switch a { font-size: 11px; padding: 2px 7px; border-radius: 4px; border: 1px solid rgba(255,255,255,.25); color: #9fd1b6; letter-spacing: .04em; }
.lang-switch a:hover { color: #fff; border-color: rgba(255,255,255,.5); }
.lang-switch a.current { background: var(--brand-green); border-color: var(--brand-green); color: #003018; }
.lang-switch.light a { border-color: var(--border); color: var(--muted); }
.lang-switch.light a.current { background: var(--accent); color: #fff; border-color: var(--accent); }

.report-cat { margin-bottom: 4px; }
.report-cat-head { display: flex; gap: 8px; align-items: center; background: transparent; border: 0; padding: 6px 2px; font: inherit; font-size: 13px; cursor: pointer; color: var(--text); }
.report-cat-head:hover strong { color: var(--accent); }
.pick-row:hover { background: var(--accent-soft); }

/* Signalenlijst op de machinepagina: compacte cellen, invoervelden vullen de kolom i.p.v. de browserbreedte */
table.signals th, table.signals td { padding: 6px 8px; }
table.signals input:not([type=checkbox]), table.signals select { width: 100%; min-width: 0; box-sizing: border-box; padding: 4px 6px; font-size: 12px; border: 1px solid var(--border); border-radius: 5px; font-family: inherit; }
table.signals select { min-width: 88px; }
table.signals .badge { font-size: 11px; padding: 1px 6px; white-space: nowrap; }

/* Omschrijving van een signaal: meerregelig veld dat meegroeit met de tekst (Enter = nieuwe regel), max. 1000 tekens */
textarea.desc { width: 100%; min-width: 0; box-sizing: border-box; padding: 4px 6px; font-size: 12px; line-height: 1.35; border: 1px solid var(--border); border-radius: 5px; font-family: inherit; resize: vertical; min-height: 26px; max-height: 180px; field-sizing: content; overflow: auto; }
table.signals td:has(> textarea.desc) { min-width: 220px; width: 30%; }
