/* ===== Zelf-gehoste fonts (geen Google-CDN i.v.m. AVG) ===== */
@font-face {
    font-family: 'Inter';
    src: url('../fonts/Inter-Regular.ttf') format('truetype');
    font-weight: 400; font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../fonts/Inter-Medium.ttf') format('truetype');
    font-weight: 500; font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../fonts/Inter-SemiBold.ttf') format('truetype');
    font-weight: 600; font-display: swap;
}
@font-face {
    font-family: 'Fraunces';
    src: url('../fonts/Fraunces-Medium.ttf') format('truetype');
    font-weight: 500; font-display: swap;
}
@font-face {
    font-family: 'JetBrains Mono';
    src: url('../fonts/JetBrainsMono-Regular.ttf') format('truetype');
    font-weight: 400; font-display: swap;
}

/* ===== Huisstijl-tokens (exact gelijk aan de MAUI-resources) ===== */
:root {
    --bg: #FAF8F5;
    --surface: #FFFFFF;
    --ink: #1A1816;
    --ink-soft: #6B6660;
    --ink-faint: #B8B3AC;
    --line: #E8E3DA;
    --accent: #C8431F;
    --accent-soft: #FDEAE3;
    --early: #2D5A3F;
    --early-soft: #E3EDE5;
    --late: #4A3A82;
    --late-soft: #EBE6F4;
    --office: #7A5520;
    --sick: #A83232;
    --sick-bg: #FBE6E6;
    --vacation: #1F6F8B;
    --vacation-bg: #DCECF2;
    --weekend-bg: #F5F1E8;
    --radius: 12px;
}

/* ===== Reset / basis ===== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    /* iOS: respecteer de veilige zones */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
h1 { font-family: 'Fraunces', serif; font-weight: 500; font-size: 26px; margin: 0 0 8px; }
h2 { font-family: 'Fraunces', serif; font-weight: 500; font-size: 20px; margin: 0 0 6px; }
h1:focus { outline: none; }
.muted { color: var(--ink-soft); }
.mono { font-family: 'JetBrains Mono', monospace; }
a { color: var(--accent); }

/* ===== App-shell ===== */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 12px 18px;
    position: sticky; top: 0; z-index: 10;
}
.brand-sm { font-family: 'Fraunces', serif; font-size: 20px; color: var(--ink); }
.app-main { flex: 1; }
.pad { padding: 18px; max-width: 720px; margin: 0 auto; }

/* ===== Auth-schermen ===== */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 28px 24px;
    width: 100%; max-width: 380px;
    box-shadow: 0 8px 30px rgba(26,24,22,0.06);
}
.brand { font-family: 'Fraunces', serif; font-size: 34px; margin: 0 0 4px; }

/* ===== Formulieren ===== */
.field { margin: 14px 0; }
.field label {
    display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--ink-soft); margin-bottom: 6px;
}
.field input,
input.form-control {
    width: 100%; padding: 12px 14px;
    border: 1px solid var(--line); border-radius: 8px;
    background: var(--surface); color: var(--ink);
    font-family: 'Inter', sans-serif; font-size: 15px;
}
.field input:focus { outline: none; border-color: var(--accent); }

/* ===== Knoppen (tikdoel ≥ 44px voor iOS) ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 0 18px;
    border: 1px solid var(--line); border-radius: 8px;
    background: var(--surface); color: var(--ink);
    font-family: 'Inter', sans-serif; font-size: 15px; font-weight: 500;
    cursor: pointer;
}
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
/* Destructieve actie (verwijderen/deactiveren/uitloggen) — altijd in de Sick-kleur. */
.btn.danger { background: var(--sick); color: #fff; border-color: var(--sick); }
.btn.block { width: 100%; margin-top: 8px; }
.btn:disabled { opacity: 0.6; cursor: default; }

/* Toetsenbord-focus (Taak 6.10): zichtbare focusring, alleen bij toetsenbordnavigatie. */
.btn:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, .chip:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}

/* Gedeelde lege staat: één nette, gecentreerde regel. */
.empty { text-align: center; color: var(--ink-soft); font-size: 13px; padding: 24px 12px; }

.error { color: var(--sick); font-size: 13px; margin: 6px 0; }
.ok { color: var(--early); font-size: 13px; margin: 6px 0; }
.splash { padding: 40px; text-align: center; color: var(--ink-soft); }

/* ===== Topbar-bel + badge ===== */
.topbar-row { display: flex; align-items: center; justify-content: space-between; }
.bell { position: relative; text-decoration: none; font-size: 20px; line-height: 1; padding: 4px; }
.bell .badge {
    position: absolute; top: -4px; right: -6px; min-width: 16px; height: 16px;
    background: var(--accent); color: #fff; border-radius: 8px; font-size: 10px;
    display: flex; align-items: center; justify-content: center; padding: 0 4px; font-family: 'Inter';
}

/* ===== Onderste tabbalk ===== */
.app-main { padding-bottom: 68px; }
.tabbar {
    position: fixed; bottom: 0; left: 0; right: 0;
    display: flex; background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 20;
}
.tabbar a {
    flex: 1; text-align: center; padding: 9px 0 8px; text-decoration: none;
    color: var(--ink-soft); font-size: 11px;
}
.tabbar a .ico { display: block; font-size: 19px; line-height: 1.1; }
.tabbar a.active { color: var(--accent); }

/* ===== Kaarten / lijsten ===== */
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 14px 16px; margin: 12px 0;
}
.card h2 { margin-top: 0; }
.overline { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.big { font-family: 'Fraunces', serif; font-size: 22px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: var(--bg); color: var(--ink-soft); }
.chip.early { background: var(--early-soft); color: var(--early); }
.chip.late  { background: var(--late-soft); color: var(--late); }
.chip.sick  { background: var(--sick-bg); color: var(--sick); }
.chip.vac   { background: var(--vacation-bg); color: var(--vacation); }
.list-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: none; }
.spacer { height: 8px; }

/* ===== Rooster-grid (read-only) ===== */
.grid-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.roster { border-collapse: collapse; width: 100%; font-size: 13px; }
table.roster th, table.roster td { border: 1px solid var(--line); padding: 6px 8px; text-align: center; white-space: nowrap; }
/* Kolomkoppen: ondoorzichtig en sticky bovenaan bij scrollen. */
table.roster thead th { background: var(--surface); font-weight: 600; position: sticky; top: 0; z-index: 2; height: 40px; }
/* Dag-kolom links: ondoorzichtig en sticky links. */
table.roster tbody th { background: var(--surface); font-weight: 600; position: sticky; left: 0; z-index: 1; }
table.roster thead th:first-child { left: 0; z-index: 3; }
table.roster td.weekend { background: var(--weekend-bg); }
table.roster td.gap { background: var(--accent-soft); color: var(--accent); }
table.roster td.draft { font-style: italic; color: var(--ink-soft); }
.pool-switch { display: flex; gap: 6px; margin: 8px 0; }
.pool-switch button { flex: 1; }
.pool-switch button.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ===== Modal (V4 Taak 3: viewport-gefixeerd; smal = bottom-sheet, breed = gecentreerd) ===== */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(26,24,22,0.5);
    display: flex; align-items: flex-end; justify-content: center; z-index: 100;
}
.modal-card {
    background: var(--surface); width: 100%; max-width: 480px;
    border-radius: 16px 16px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
    max-height: 90vh; overflow-y: auto;
}
@media (min-width: 640px) {
    .modal-backdrop { align-items: center; padding: 24px; }
    .modal-card { border-radius: 16px; max-height: 85vh; }
}
/* Scroll-lock op de achtergrond zolang er een modal open staat. */
body:has(.modal-backdrop) { overflow: hidden; }
.field select {
    width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px;
    background: var(--surface); color: var(--ink); font-family: 'Inter'; font-size: 15px;
}
.banner {
    background: var(--late-soft); border: 1px solid var(--late); color: var(--late);
    border-radius: var(--radius); padding: 12px 14px; margin: 10px 0;
}
td.clickable { cursor: pointer; }
/* "Mijn diensten"-filter: andermans cellen gedempt (V4 Taak 5). */
table.roster td.dim { opacity: .35; }

/* ===== Dashboard-tellers ===== */
.counters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.counter {
    background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
    padding: 12px 10px; text-align: center; cursor: pointer;
}
.counter .num { font-family: 'Fraunces', serif; font-size: 24px; color: var(--ink); }
.counter .lbl { font-size: 10.5px; color: var(--ink-soft); }

/* ===== Tabel (rapport/logboek) ===== */
table.data { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.data th, table.data td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: right; white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { color: var(--ink-soft); font-weight: 600; }

.chk { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 14px; }
.chk input { width: auto; }
.daychips { display: flex; gap: 4px; flex-wrap: wrap; }
.daychip {
    border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; font-size: 12px;
    cursor: pointer; background: var(--surface); color: var(--ink-soft);
}
.daychip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.colordot { display: inline-block; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; vertical-align: middle; }
.colordot.sel { border-color: var(--ink); }

/* Blazor laad-/foutbalk */
.loading-progress { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); text-align: center; color: var(--ink-soft); }
.loading-progress-text { color: var(--ink-soft); }
#blazor-error-ui {
    background: var(--sick-bg); color: var(--sick);
    bottom: 0; display: none; left: 0; padding: 0.8rem 1.2rem; position: fixed; width: 100%;
    box-shadow: 0 -1px 2px rgba(0,0,0,0.1); z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* ---------- Plannen (basisweek) ---------- */
.badge {
    display: inline-block; padding: 1px 8px; border-radius: 999px;
    font-size: 11px; font-weight: 600; background: var(--line); color: var(--ink-soft);
    text-transform: uppercase; letter-spacing: .04em; vertical-align: middle;
}
.badge.ok { background: var(--early-soft); color: var(--early); }
.badge.warn { background: #FBEFD6; color: #7A5520; }
.badge.err { background: var(--accent-soft); color: var(--accent); }

.stepper { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.stepper .step {
    display: flex; align-items: center; gap: 6px; padding: 5px 10px;
    border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--ink-faint);
}
.stepper .step .num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 50%; background: var(--line);
    color: var(--surface); font-weight: 700; font-size: 11px;
}
.stepper .step.on { border-color: var(--accent); color: var(--ink); }
.stepper .step.on .num { background: var(--accent); }
.stepper .step.done { color: var(--early); border-color: var(--early-soft); }
.stepper .step.done .num { background: var(--early); }

.weekgrid { border-collapse: collapse; width: 100%; font-size: 13px; }
.weekgrid th, .weekgrid td { border: 1px solid var(--line); padding: 4px; text-align: center; }
.weekgrid thead th { background: var(--bg); font-size: 12px; }
.weekgrid td.typecell { text-align: left; white-space: nowrap; font-size: 12px; }
.weekgrid select { min-width: 84px; font-size: 12px; padding: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Meldingen instellen ---------- */
.prefhead { display: grid; grid-template-columns: 1fr 52px 52px; align-items: end; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.prefhead .col { text-align: center; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
.prefrow { display: grid; grid-template-columns: 1fr 52px 52px; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.prefrow:last-child { border-bottom: none; }
.prefinfo { display: flex; flex-direction: column; gap: 2px; }
.prefinfo .muted { font-size: 12.5px; }
.switch { display: flex; justify-content: center; }
.switch input { width: 20px; height: 20px; accent-color: var(--early); }
.btn.block { width: 100%; margin-top: 12px; }

/* ---------- App gebruik ---------- */
.statgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.statnum { font-family: Fraunces, serif; font-size: 24px; color: var(--ink); }
.statlbl { font-size: 11.5px; color: var(--ink-soft); }
.spark { width: 100%; height: 80px; display: block; }
.usagetbl { border-collapse: collapse; width: 100%; font-size: 12.5px; white-space: nowrap; }
.usagetbl th, .usagetbl td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.usagetbl thead th { color: var(--ink-soft); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }

.card.inactive { opacity: .6; }

/* ===== Rondleiding (tour) + Help (VERBETERINGEN-3 Taak 5) ===== */
.tour-backdrop {
    position: fixed; inset: 0; background: rgba(26,24,22,.55);
    display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.tour-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
    padding: 22px; max-width: 380px; width: 100%; box-shadow: 0 16px 48px rgba(0,0,0,.25);
}
.tour-card h3 { font-family: Georgia, serif; font-size: 19px; margin: 6px 0 8px; color: var(--ink); }
.tour-card p { color: var(--ink); font-size: 14.5px; line-height: 1.5; margin: 0 0 16px; }
.tour-progress { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.tour-actions { display: flex; align-items: center; gap: 8px; }

.help-section { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-bottom: 8px; overflow: hidden; }
.help-head { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
    background: none; border: none; padding: 14px 16px; font-size: 15px; font-weight: 600; color: var(--ink); cursor: pointer; }
.help-head .chev { margin-left: auto; color: var(--soft); transition: transform .15s; }
.help-head.open .chev { transform: rotate(90deg); }
.help-body { padding: 0 16px 16px; color: var(--ink); font-size: 14px; line-height: 1.55; white-space: pre-line; }
.help-body .btn { margin-top: 12px; }
