:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --border: #e2e5e9;
    --text: #1f272e;
    --muted: #6b7682;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --sidebar: #1b2430;
    --sidebar-muted: #9aa6b2;
    --green: #16a34a;
    --amber: #d97706;
    --red: #dc2626;
    --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.4rem; margin: 0; }
h1:focus { outline: none; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 0 0 .5rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

/* ---- Layout ---- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: var(--sidebar);
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar .brand {
    padding: 1.1rem 1.25rem;
    font-weight: 700;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand small { display: block; font-weight: 400; font-size: .72rem; color: var(--sidebar-muted); margin-top: 2px; }
.nav-section { padding: .9rem 1.25rem .25rem; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sidebar-muted); }
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem 1.25rem;
    color: var(--sidebar-muted);
    font-size: .9rem;
}
.sidebar nav a:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar nav a .ico { width: 18px; text-align: center; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky; top: 0; z-index: 5;
}
.topbar .spacer { flex: 1; }
.topbar .user { color: var(--muted); font-size: .85rem; }
.content { padding: 1.5rem; }

/* ---- Page header ---- */
.page-head { display: flex; align-items: center; margin-bottom: 1.25rem; gap: 1rem; }
.page-head .spacer { flex: 1; }
.breadcrumb { color: var(--muted); font-size: .8rem; margin-bottom: .25rem; }

/* ---- Cards ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
}
.card-row { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.card-row > .card { flex: 1; min-width: 200px; }

.stat { display: flex; flex-direction: column; gap: .25rem; }
.stat .n { font-size: 1.8rem; font-weight: 700; }
.stat .l { color: var(--muted); font-size: .82rem; }

/* ---- Tables ---- */
table.grid { width: 100%; border-collapse: collapse; background: var(--surface); }
table.grid th, table.grid td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--border); }
table.grid th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbfc; }
table.grid tbody tr:hover { background: #f8fafc; }
table.grid td.num, table.grid th.num { text-align: right; }
.indent-1 { padding-left: 1.5rem !important; }
.indent-2 { padding-left: 3rem !important; }
.tree-line { color: var(--muted); }

/* ---- Badges ---- */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; background: #eef1f5; color: var(--muted); }
.badge.green { background: #dcfce7; color: var(--green); }
.badge.amber { background: #fef3c7; color: var(--amber); }
.badge.red { background: #fee2e2; color: var(--red); }
.badge.blue { background: #dbeafe; color: var(--primary-dark); }
.badge.grey { background: #e5e7eb; color: #374151; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    padding: .45rem .85rem; border-radius: 6px; font-size: .85rem; cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: #f1f3f5; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--red); border-color: #f5c2c2; }
.btn.danger:hover { background: #fef2f2; }
.btn.sm { padding: .25rem .55rem; font-size: .78rem; }
.btn-group { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem 1.25rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea {
    border: 1px solid var(--border); border-radius: 6px; padding: .5rem .6rem; font-size: .9rem; font-family: inherit; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.field .hint { font-size: .72rem; color: var(--muted); }

.toolbar { display: flex; gap: .75rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar input[type=search], .toolbar select { border: 1px solid var(--border); border-radius: 6px; padding: .45rem .6rem; font-size: .85rem; }

.empty { padding: 2.5rem; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.right { text-align: right; }
.mt { margin-top: 1rem; }
.validation-message, .text-danger { color: var(--red); font-size: .8rem; }

.alert { padding: .7rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: .88rem; }
.alert.error { background: #fee2e2; color: #991b1b; }
.alert.ok { background: #dcfce7; color: #166534; }

/* ---- Availability timeline ---- */
.timeline-row { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--border); }
.timeline-label { width: 220px; flex-shrink: 0; font-size: .85rem; }
.timeline-track { position: relative; flex: 1; height: 22px; background: #f1f3f5; border-radius: 4px; overflow: hidden; }
.timeline-block { position: absolute; top: 0; height: 100%; border-radius: 3px; font-size: .68rem; color: #fff; padding: 2px 4px; overflow: hidden; white-space: nowrap; z-index: 2; }
.timeline-block.res { background: var(--primary); }
.timeline-block.res.tentatief { background: #93b4f5; }
.timeline-block.ond { background: var(--amber); }
.timeline-block.sam { background: #7c3aed; }

/* Weekraster, week-as en vandaag-markering */
.tl-week { position: absolute; top: 0; height: 100%; z-index: 0; }
.tl-week.even { background: rgba(0,0,0,.04); }
.tl-grid { position: absolute; top: 0; height: 100%; width: 1px; background: rgba(0,0,0,.12); z-index: 1; }
.tl-today { position: absolute; top: 0; height: 100%; width: 2px; background: var(--red); z-index: 4; }
.timeline-axis { border-bottom: 2px solid var(--border); }
.timeline-axis .timeline-track { background: transparent; height: 34px; overflow: visible; }
.tl-weeklabel { position: absolute; top: 0; font-size: .62rem; line-height: 1.1; color: var(--muted); white-space: nowrap; padding-left: 3px; }

/* ---- Auth ---- */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--sidebar); padding: 1.5rem; }
.auth-card { background: var(--surface); border-radius: 12px; padding: 2rem; width: 100%; max-width: 380px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.auth-brand { font-weight: 700; font-size: 1.2rem; margin-bottom: 1.25rem; }
.auth-brand small { display: block; font-weight: 400; font-size: .72rem; color: var(--muted); }
.auth-card h1 { font-size: 1.15rem; margin-bottom: 1rem; }
.auth-input { width: 100%; border: 1px solid var(--border); border-radius: 6px; padding: .55rem .65rem; font-size: .9rem; }
.auth-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.auth-submit { width: 100%; justify-content: center; margin-top: .5rem; }
.auth-check { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); margin: .25rem 0 .5rem; }
.auth-foot { margin-top: 1rem; font-size: .85rem; color: var(--muted); }
.auth-sep { display: flex; align-items: center; text-align: center; color: var(--muted); font-size: .78rem; margin: 1rem 0 .75rem; }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.auth-sep span { padding: 0 .6rem; }
.ext-login .btn-group { flex-direction: column; }
.ext-login .btn { justify-content: center; }

#blazor-error-ui { background: #fee2e2; color:#991b1b; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.1); display: none; left: 0; padding: .6rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
    #blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: .6rem; }
.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
