/* Duimstok inspecteur-portaal — legacy MVP layout port
 *
 * Legacy variabelen wijzen naar design-system tokens (assets/styles/design-system.css).
 * Hierdoor cascadet de hele app automatisch naar de ProRail rode huisstijl
 * zonder dat we elke CSS-regel hoeven te herschrijven.
 *
 * Nieuwe code: gebruik bij voorkeur direct de --color-*, --space-*, --type-*
 * tokens of de .ds-* component classes uit design-system.css. */

:root {
    /* Legacy alias → design-system primair palet */
    --prorail-blue:   var(--color-brand-primary);
    --prorail-light:  var(--color-brand-light);
    --header-bg:      var(--color-neutral-200);
    --section-header: var(--color-neutral-100);

    /* Legacy alias → semantisch palet */
    --status-open:    var(--color-status-open);
    --status-done:    var(--color-status-positive);
    --status-ready:   var(--color-status-positive);
    --color-danger:   var(--color-status-negative);

    /* Legacy alias → neutraal palet */
    --color-text:    var(--color-neutral-900);
    --color-muted:   var(--color-neutral-700);
    --color-border:  var(--color-neutral-200);
    --color-bg:      var(--color-neutral-100);
    --color-card:    var(--color-neutral-000);

    /* Legacy alias → typografie + radius */
    --font:   var(--font-family-base);
    --radius: var(--radius-4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    font-size: 11px;
    background: var(--color-bg);
    color: var(--color-text);
}

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

button { font-family: var(--font); cursor: pointer; }

/* ─── Sticky ProRail-blauwe toolbar ────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--prorail-blue);
    color: #fff;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
/* Inline form wrapper so submit-button sits flush in the toolbar row. */
.toolbar .inline-form {
    display: inline;
}
.toolbar h1 {
    flex: 1;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.toolbar a,
.toolbar button,
.toolbar label {
    background: #fff;
    color: var(--prorail-blue);
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    transition: background 0.15s;
}
.toolbar a:hover,
.toolbar button:hover,
.toolbar label:hover {
    background: var(--prorail-light);
    text-decoration: none;
}
.toolbar input[type="file"] { display: none; }

.toolbar .user-info {
    background: transparent;
    color: #fff;
    font-size: 11px;
    padding: 0 4px;
    opacity: 0.85;
}
.toolbar .user-info:hover { background: transparent; }

/* ─── Body container ───────────────────────────────────────────── */
.body { max-width: 1100px; margin: 0 auto; padding: 16px; }

/* ─── Application chrome ────────────────────────────────────────────
   Shared framing so the homepage and order list match the inspection
   form's chrome (the look the team standardised on). These rules mirror
   inspection.css's .inspection-form / .brand-bar / .form-header so the
   form stays the single visual reference; keep them in sync. Scoped under
   .page-chrome so they never touch the form (which is not .page-chrome). */
.page-chrome {
    border: 2px solid var(--color-brand-primary);
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    margin-bottom: 16px;
}
.page-chrome .brand-bar {
    display: flex;
    align-items: center;
    gap: 6px 16px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #d8d8d8;
}
.page-chrome .brand-logo { height: 32px; width: auto; display: block; }
.page-chrome .brand-meta { margin-left: auto; font-size: 12px; color: #6b6b6b; text-align: right; }
.page-chrome .brand-meta span { color: #1f1f1f; font-weight: 600; }

.page-chrome .form-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 56px;
    background: var(--color-brand-primary);
    color: #fff;
}
.page-chrome .form-header h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0;
}
.page-chrome .btn-back { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); }
.page-chrome .header-actions {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
}
.page-chrome .btn-header {
    background: #fff;
    color: var(--color-brand-primary);
    border: 1px solid #fff;
    border-radius: 4px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.page-chrome .btn-header:hover { background: var(--color-brand-light); text-decoration: none; }
.page-chrome .btn-header--ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .6); }
.page-chrome .btn-header--ghost:hover { background: rgba(255, 255, 255, .12); text-decoration: none; }

/* Padded content well inside the frame; the form's own sections manage
   their padding, so this only wraps the homepage / order-list content. */
.page-chrome .chrome-content { padding: 16px; }
.page-chrome .form-footer {
    background: var(--color-brand-light);
    color: #6b6b6b;
    font-size: 11.5px;
    padding: 8px 16px;
}

/* ─── Summary cards ────────────────────────────────────────────── */
.summary-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.summary-card {
    background: var(--color-card);
    border-radius: 10px;
    padding: 16px 20px;
    border-left: 5px solid var(--prorail-blue);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 14px;
}
.summary-card.wissel { border-left-color: #7b1fa2; }
.summary-card.overweg { border-left-color: #0288d1; }
.summary-card.spoor { border-left-color: #e65100; }
.summary-card.totaal { border-left-color: var(--prorail-blue); }

.summary-card .card-icon {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
}
.summary-card.wissel .card-icon { background: #f3e5f5; color: #7b1fa2; }
.summary-card.overweg .card-icon { background: #e1f5fe; color: #0288d1; }
.summary-card.spoor .card-icon { background: #fff3e0; color: #e65100; }
.summary-card.totaal .card-icon { background: var(--prorail-light); color: var(--prorail-blue); }

.summary-card .card-info { flex: 1; }
.summary-card .card-value { font-size: 26px; font-weight: 800; color: var(--color-text); line-height: 1; }
.summary-card .card-label { font-size: 11px; color: var(--color-muted); margin-top: 2px; }

/* ─── Progress bar ─────────────────────────────────────────────── */
.progress-section { margin-bottom: 16px; }
.progress-bar-bg { height: 8px; background: #e0e0e0; border-radius: 4px; overflow: hidden; }
.progress-bar-fill {
    height: 100%;
    background: var(--status-done);
    border-radius: 4px;
    transition: width 0.4s ease;
}
.progress-text { font-size: 11px; color: #666; margin-top: 4px; text-align: right; }

/* ─── Order table ──────────────────────────────────────────────── */
/* ─── Order list — styled to the mockup (crimson tabs, column panel,
       resizable fixed-layout table, styled pager). Colours use the brand
       tokens: --color-brand-primary = crimson #B20A2F, --color-brand-light
       = pink #F2DEE3. ─────────────────────────────────────────────────── */
.order-table-wrap {
    background: var(--color-card);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.order-table-header {
    display: flex;
    align-items: flex-end;
    padding: 12px 16px 0;
    gap: 10px 14px;
    border-bottom: 2px solid var(--color-brand-primary);
    flex-wrap: wrap;
}
.order-table-header h2 {
    margin: 0 6px 8px 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
}

/* Object-type filter buttons rendered as tabs. */
.filter-btns { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.filter-btn {
    background: var(--color-neutral-200, #e5e5e5);
    border: 1px solid var(--color-border);
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    color: var(--color-text);
    text-decoration: none;
    transition: background 0.15s;
}
.filter-btn:hover:not(.active) { background: var(--color-brand-light); text-decoration: none; }
.filter-btn.active {
    background: var(--color-brand-primary);
    color: #fff;
    border-color: var(--color-brand-primary);
}

/* "Kolommen" button + dropdown panel. */
.column-config { position: relative; margin-bottom: 8px; }
.column-config-toggle {
    border: 1px solid #9a9a9a;
    background: #fff;
    border-radius: 4px;
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
}
.column-config-toggle:hover { background: var(--color-brand-light); }
.column-config-panel {
    /* Fixed (not absolute) so the panel escapes the .page-chrome wrapper's
       `overflow: hidden`, which would otherwise clip everything below the chrome's
       bottom edge. Its top/right/max-height are set in JS from the toggle button's
       position (the panel is hidden until JS opens it, so JS always runs first). */
    position: fixed;
    z-index: 30;
    width: min(580px, 92vw);
    /* border-box so the JS-set max-height (viewport gap) is the true visible
       height — incl. padding+border — and the panel never spills off-screen. */
    box-sizing: border-box;
    max-height: 72vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #faf0f3;
    border: 1px solid var(--color-brand-light);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    padding: 14px 16px;
}
.column-config-panel[hidden] { display: none; }
/* The whole panel scrolls (max-height fitted to the viewport in JS), so the
   column checkboxes stay reachable even when many saved layouts grow it. */
.column-config-groups {
    margin-top: 4px;
}
.column-config-group { margin-top: 12px; }
.column-config-group-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--color-brand-primary);
    font-weight: 700;
    margin-bottom: 6px;
}
.column-config-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: calc(50% - 6px);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 5px 8px;
    margin: 0 4px 6px 0;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    vertical-align: top;
}
.column-config-item input[type="checkbox"] { accent-color: var(--color-brand-primary); flex: 0 0 auto; }

/* Saved-layout controls (inside the panel). */
.layout-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-bottom: 1px solid var(--color-brand-light);
    padding-bottom: 12px;
    margin-bottom: 4px;
}
.layout-select-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 12px;
}
.layout-select-label select,
.layout-name {
    border: 1px solid #9a9a9a;
    border-radius: 3px;
    padding: 5px 7px;
    font: inherit;
    font-size: 12px;
    background: #fff;
}
.layout-select-label select { min-width: 180px; }
.layout-save { display: flex; gap: 6px; align-items: center; }
.layout-name { flex: 1; }
.layout-save-btn {
    border: 1px solid var(--color-brand-primary);
    background: var(--color-brand-primary);
    color: #fff;
    border-radius: 3px;
    padding: 5px 12px;
    font: inherit;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}
.layout-save-btn:hover { background: #8f0826; }
.layout-list { list-style: none; margin: 0; padding: 0; }
.layout-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 1px solid var(--color-brand-light);
    font-size: 12px;
}
.layout-list-name { flex: 1; font-weight: 600; }
.layout-apply, .layout-update, .layout-delete {
    background: none;
    border: none;
    color: var(--color-brand-primary);
    font: inherit;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}
.layout-apply:hover, .layout-update:hover, .layout-delete:hover { text-decoration: underline; }
.layout-delete { color: #8f0826; }
.layout-update:disabled {
    opacity: 0.45;
    cursor: default;
    text-decoration: none;
}

/* Resizable, fixed-layout table. */
.order-table-scroll { overflow-x: auto; }
.order-table { width: 100%; border-collapse: collapse; }
.order-table-fixed { table-layout: fixed; width: auto; }
.order-table th {
    background: var(--color-brand-light);
    font-size: 12px;
    font-weight: 700;
    padding: 7px 10px;
    text-align: left;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* The order number is an <a> (so iOS Data Detectors don't linkify it as a phone
   number); keep it looking like the old bold black text, with a hover affordance. */
.order-table .order-key-link {
    color: inherit;
    text-decoration: none;
    -webkit-touch-callout: none;
}
.order-table .order-key-link:hover { text-decoration: underline; }
.order-table-fixed thead .label-row th {
    position: relative;
    vertical-align: top;
    cursor: grab;
    user-select: none;
    /* iPad/Safari: allow touch drag-reorder and suppress the native long-press
       selection + callout menu that otherwise hijacks the gesture. */
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
}
.order-table-fixed thead .label-row th:active { cursor: grabbing; }
.th-label { display: flex; align-items: center; gap: 6px; overflow: hidden; }
.sort-header {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sort-header:hover { color: var(--color-brand-primary); text-decoration: none; }
.sort-header.active { color: var(--color-brand-primary); }
.col-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 9px;
    height: 100%;
    cursor: col-resize;
    touch-action: none;
}
.col-resizer:hover, .col-resizer.active { background: rgba(178, 10, 47, 0.35); }
/* Drag-to-reorder feedback: the dragged header dims, the drop target shows a
   crimson edge on the side the column will land. */
.order-table-fixed thead .label-row th.dragging { opacity: .45; }
.order-table-fixed thead .label-row th.drag-over-before { box-shadow: inset 3px 0 0 var(--color-brand-primary); }
.order-table-fixed thead .label-row th.drag-over-after { box-shadow: inset -3px 0 0 var(--color-brand-primary); }

.order-table td {
    padding: 8px 10px;
    font-size: 12.5px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.order-table td.num { text-align: right; }
.order-table tbody tr { cursor: pointer; transition: background 0.1s; }
.order-table tbody tr:hover { background: #faf0f3; }
.order-table tbody tr:active { background: var(--color-brand-light); }
.order-table tbody td strong { color: var(--color-brand-primary); }
.order-table .hoevh-cell { text-align: right; font-weight: 600; white-space: nowrap; }

/* Per-column filter row. */
.order-table thead .filter-row th {
    background: #fff;
    padding: 4px 6px;
    border-bottom: 2px solid var(--color-border);
    font-weight: 400;
}
.col-filter {
    width: 100%;
    border: 1px solid #9a9a9a;
    border-radius: 3px;
    padding: 3px 6px;
    font: inherit;
    font-size: 11.5px;
    background: #fff;
    outline: none;
}
.col-filter:focus {
    border-color: var(--color-brand-primary);
    box-shadow: 0 0 0 2px rgba(178, 10, 47, 0.15);
}
.col-filter::placeholder { color: #aaa; }
select.col-filter { cursor: pointer; }

.type-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}
.type-badge.wissel, .type-badge.engelsman, .type-badge.kruising {
    background: #f3e5f5; color: #7b1fa2;
}
.type-badge.overweg { background: #e1f5fe; color: #0288d1; }
.type-badge.spoor { background: #fff3e0; color: #e65100; }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
}
.status-badge .status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-badge.open { background: #fbe3c6; color: #8a4b00; }
.status-badge.open .status-dot { background: var(--status-open); }
.status-badge.ready { background: #d3e9ef; color: #1d5b69; }
.status-badge.ready .status-dot { background: var(--status-ready); }
.status-badge.done { background: #d6ecd8; color: #1f5d23; }
.status-badge.done .status-dot { background: var(--status-done); }

/* Pagination bar. */
.order-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--color-border);
}
.pager-size { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.pager-size select {
    border: 1px solid #9a9a9a;
    border-radius: 3px;
    padding: 5px 7px;
    font: inherit;
    background: #fff;
}
.pager-info, .pager-current { font-size: 12.5px; color: var(--color-muted); }
.pager-nav { display: flex; align-items: center; gap: 10px; }
.pager-prev, .pager-next {
    border: 1px solid #9a9a9a;
    background: #fff;
    border-radius: 3px;
    padding: 6px 14px;
    font-weight: 600;
    font-size: 12px;
    text-decoration: none;
    color: var(--color-text);
    cursor: pointer;
}
.pager-prev:hover, .pager-next:hover { background: var(--color-brand-light); text-decoration: none; }
.pager-prev.disabled, .pager-next.disabled { opacity: .45; cursor: default; pointer-events: none; }

.empty-state {
    text-align: center;
    color: var(--color-muted);
    padding: 2rem;
    font-size: 13px;
}

/* ─── Form panels (order detail + inspection edit) ─────────────── */
.panel {
    background: var(--color-card);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 16px 20px;
    margin-bottom: 16px;
}
.panel h2 {
    font-size: 13px;
    color: var(--prorail-blue);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid #eee;
    padding-bottom: 6px;
}
.panel p.hint { color: var(--color-muted); font-size: 11px; margin: 4px 0 10px; }

dl.meta-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 14px;
    font-size: 12px;
}
dl.meta-list dt { color: var(--color-muted); font-weight: 600; }
dl.meta-list dd { color: var(--color-text); }

/* ─── Forms ────────────────────────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px 14px;
}
.form-grid label,
.form-row label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    color: #555;
}
.form-row { display: flex; flex-direction: column; gap: 10px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="file"],
select, textarea {
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: var(--font);
    font-size: 12px;
    background: #fff;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--prorail-blue);
    background: #fff;
}

/* ─── Buttons ──────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: #fff;
    color: var(--prorail-blue);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--prorail-light); text-decoration: none; }

.btn-primary {
    background: var(--prorail-blue);
    color: #fff;
}
.btn-primary:hover { background: #001e5a; }

.btn-success {
    background: var(--status-done);
    color: #fff;
}
.btn-success:hover { background: #388e3c; }

.btn-danger {
    background: var(--color-danger);
    color: #fff;
}
.btn-danger:hover { background: #ad1f1f; }

.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-lg { padding: 10px 18px; font-size: 13px; }

/* ─── Flash messages ──────────────────────────────────────────── */
.flash {
    padding: 8px 14px;
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 12px;
}
.flash-success { background: #d1fae5; color: #065f46; border-left: 3px solid #10b981; }
.flash-info    { background: #dbeafe; color: #1e40af; border-left: 3px solid #3b82f6; }
.flash-error   { background: #fee2e2; color: #991b1b; border-left: 3px solid #ef4444; }

/* ─── Scores table (in inspection form) ───────────────────────── */
.scores-table { width: 100%; border-collapse: collapse; }
.scores-table th, .scores-table td {
    padding: 6px;
    border-bottom: 1px solid #eee;
    text-align: left;
    font-size: 11px;
}
.scores-table thead th { background: var(--prorail-light); color: #555; font-weight: 700; }
.scores-table select, .scores-table input { width: 100%; padding: 4px 6px; font-size: 11px; }
.scores-table .section-row th {
    background: var(--section-header);
    color: var(--prorail-blue);
    font-weight: 700;
    padding: 6px 10px;
    text-align: left;
}
.scores-table .foto-cell { text-align: center; font-weight: 600; color: var(--prorail-blue); }

.assessment-table { margin: 12px; width: calc(100% - 24px); }
/* Fixed column widths for the score tables (moved out of inline style attrs). */
.assessment-table .col-nr { width: 50px; }
.assessment-table .col-nr-narrow { width: 40px; }
.assessment-table .col-dwl,
.assessment-table .col-bal { width: 80px; }
.assessment-table .col-score { width: 100px; }
.assessment-table .col-foto { width: 60px; }
.scores-actions { padding: 8px 12px 14px; }
.save-status { margin-left: 10px; color: var(--color-muted); font-size: 11px; }

/* ─── Score colours (ported from mockup js/inspectie.js) ──────── */
/* 1 = green (good), 2 = yellow (fair), 4 = red (bad); class 3 unused. */
.score--1 { background: #d1fae5; color: #065f46; border-color: #10b981; }
.score--2 { background: #fef3c7; color: #92400e; border-color: #f59e0b; }
.score--4 { background: #fee2e2; color: #991b1b; border-color: #ef4444; }
/* The read-only totaalscore is a <strong>, not a control — colour it as a chip. */
strong[data-total-score].score--1,
strong[data-total-score].score--2,
strong[data-total-score].score--4 {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 4px;
    border: 1px solid transparent;
}

/* ─── Visual section (flattened inspection form) ──────────────── */
.visual-section { margin-top: 18px; }

/* ─── Photo grid ──────────────────────────────────────────────── */
.photo-grid {
    list-style: none;
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}
.photo-tile {
    background: var(--color-bg);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--color-border);
}
.photo-tile img { width: 100%; height: 130px; object-fit: cover; display: block; }
.photo-meta {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 6px 8px;
    font-size: 10px;
    color: var(--color-muted);
}
.photo-tile form { padding: 0 8px 8px; }

.photo-upload-form {
    display: grid;
    grid-template-columns: 120px 180px 1fr auto;
    gap: 8px;
    align-items: end;
}

/* ─── Auth pages (login, register, reset password) ────────────── */
.page-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--prorail-light);
}
.auth-card {
    background: var(--color-card);
    border-radius: 10px;
    padding: 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-top: 4px solid var(--prorail-blue);
}
.auth-card h1 {
    margin-bottom: 18px;
    color: var(--prorail-blue);
    font-size: 20px;
    font-weight: 700;
}
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: #555; }
.checkbox-row {
    flex-direction: row !important;
    align-items: center;
    gap: 8px !important;
    font-weight: 400 !important;
    color: #555 !important;
}
.checkbox-row input { width: auto !important; }

/* ─── Duimstokformulier ────────────────────────────────────────── */
.form-container {
    background: #fff;
    border: 2px solid var(--prorail-blue);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 16px;
}
.form-title {
    background: var(--prorail-blue);
    color: #fff;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.5px;
}

.header-grid {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.header-grid .cell {
    padding: 4px 8px;
    border: 1px solid var(--color-border);
    font-size: 11px;
    vertical-align: middle;
    background: #fff;
}
.header-grid .cell.label {
    background: var(--header-bg);
    font-weight: 600;
    color: #333;
    width: 22%;
}
.header-grid .cell.readonly { background: var(--header-bg); color: #555; }
.header-grid .cell input,
.header-grid .cell textarea,
.header-grid .cell select {
    border: none;
    padding: 2px 4px;
    background: transparent;
    font-size: 11px;
    width: 100%;
}
.header-grid .cell input:focus,
.header-grid .cell textarea:focus { background: #fffde7; outline: none; }
.header-grid .cell input:disabled,
.header-grid .cell textarea:disabled {
    background: var(--header-bg);
    color: #555;
    cursor: not-allowed;
}
/* Grey the whole value-cell of a disabled (SAP) field so the non-editable
   columns read as one solid grey block, not a faint inset control. The input
   rule above keeps the field grey as a fallback where :has() is unsupported. */
.header-grid .cell:has(input:disabled),
.header-grid .cell:has(textarea:disabled) {
    background: var(--header-bg);
}
.sap-note {
    margin: 8px 12px 0;
    font-size: 11px;
    color: #777;
    font-style: italic;
}
.bulk-score-bar {
    margin: 8px 0;
}
.bulk-score-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #333;
}
.bulk-score-control select {
    font-size: 12px;
    padding: 2px 4px;
}

.opmerkingen-block {
    margin: 12px;
    border: 1px solid var(--color-border);
    background: #fafafa;
}
.opmerkingen-label {
    background: var(--header-bg);
    padding: 6px 10px;
    font-weight: 600;
    font-size: 11px;
    border-bottom: 1px solid var(--color-border);
}
.opmerkingen-block textarea {
    border: none;
    background: transparent;
    padding: 8px 10px;
    font-size: 12px;
    width: 100%;
    resize: vertical;
    min-height: 70px;
}

.form-actions {
    padding: 12px;
    border-top: 1px solid #eee;
    text-align: right;
}
.form-footer {
    background: var(--prorail-light);
    padding: 6px 12px;
    font-size: 10px;
    color: var(--color-muted);
    border-top: 1px solid var(--color-border);
}

.captured-photos {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 12px 16px;
    margin-top: 16px;
}
.captured-photos h3 {
    font-size: 12px;
    color: var(--prorail-blue);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ─── Diagram (Overzicht-tab) ─────────────────────────────────── */
.diagram {
    background: #fff;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 16px;
}
.diagram-title {
    text-align: center;
    color: var(--prorail-blue);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
}
.diagram-instruction {
    background: #fffde7;
    border: 1px solid #ffd54f;
    border-radius: 6px;
    padding: 10px 14px;
    margin: 0 auto 20px;
    max-width: 600px;
    font-size: 11px;
    line-height: 1.5;
    color: #555;
}

/* Camera-buttons (photo-slots) */
.cap-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    text-align: center;
    color: var(--prorail-blue);
}
.cap-label input[type="file"] { display: none; }
.cap-icon {
    position: relative;
    background: var(--prorail-blue);
    color: #fff;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.15s;
}
.cap-label:hover .cap-icon { background: #001e5a; transform: scale(1.05); }
.cap-label.uploading .cap-icon { opacity: 0.6; animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.cap-icon .cap-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--status-done);
    color: #fff;
    border-radius: 999px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.cap-icon .cap-badge.hidden { display: none; }
.cap-text {
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
}
.cap-arrow { font-size: 16px; color: var(--prorail-blue); }
.cap-arrow.lg { font-size: 20px; }

/* SVG-canvas layout (used by wissel/engelsman/kruising/overweg) */
.diagram-svg-wrap {
    position: relative;
    max-width: 720px;
    margin: 0 auto;
    background: #fff;
    margin: 60px auto;
}
.diagram-svg {
    display: block;
    width: 100%;
    height: 100%;
}
.cap-overlay {
    position: absolute;
    transform: translate(-50%, -50%);
}

/* Spoor-diagram specifiek */
.spoor-info {
    background: var(--prorail-light);
    padding: 8px 14px;
    border-radius: 4px;
    margin: 0 auto 20px;
    max-width: 400px;
    text-align: center;
}
.spoor-info-label { font-size: 10px; color: var(--color-muted); }
.spoor-info-value { font-size: 14px; font-weight: 700; color: var(--prorail-blue); }
.spoor-overzicht {
    display: grid;
    grid-template-columns: 140px 1fr 140px;
    align-items: center;
    gap: 16px;
    max-width: 600px;
    margin: 0 auto;
}
.spoor-position { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.spoor-km { font-size: 10px; color: var(--color-muted); }
.spoor-track svg { width: 100%; height: 60px; }

.hidden { display: none !important; }

/* ─── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .summary-row { grid-template-columns: 1fr 1fr; }
    /* Keep the landscape font sizes (th 12px / td 12.5px) in portrait too;
       only tighten the horizontal padding so the columns still fit. */
    .order-table th, .order-table td { padding: 8px 6px; }
    .photo-upload-form { grid-template-columns: 1fr; }
}

/* ─── Homepage dashboard (Phase 2) ─────────────────────────────── */
.home-import {
    background: var(--color-surface, #f7f8fa);
    border: 1px solid var(--color-border, #e0e0e0);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 18px;
    font-size: 12.5px;
}
.home-import-title {
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--color-muted, #666);
    margin-bottom: 6px;
}
.import-list { list-style: none; margin: 0; padding: 0; }
.import-list li { display: flex; align-items: baseline; gap: 8px; padding: 2px 0; }
.import-name { display: inline-block; min-width: 140px; font-weight: 600; }
.home-import-form { margin-top: 10px; }
.home-import-upload {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--color-primary, #B20A2F);
    border-radius: 6px;
    color: var(--color-primary, #B20A2F);
    font-weight: 600;
    font-size: 12.5px;
    cursor: pointer;
}
.home-import-upload:hover { background: var(--color-primary, #B20A2F); color: #fff; }
.home-import-upload input[type="file"] { display: none; }

.home-start { margin-bottom: 22px; }
.home-start-title { margin: 0 0 2px; font-size: 19px; font-weight: 700; }
.home-start-sub { margin: 0 0 16px; color: var(--color-muted, #666); }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.choice-card {
    border: 2px solid var(--color-border, #e0e0e0);
    border-radius: 8px;
    padding: 16px 16px 18px;
    background: #fff;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.choice-card:hover {
    border-color: var(--prorail-blue, #00529b);
    box-shadow: 0 0 0 3px rgba(0, 82, 155, .08);
}
/* The card is an <a>, so the global `a:hover { text-decoration: underline }`
   would underline every line of its text on hover. Keep it undecorated. */
.choice-card:hover { text-decoration: none; }
.choice-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 2px solid var(--prorail-blue, #00529b);
    padding-bottom: 8px;
    margin-bottom: 10px;
}
.choice-head h3 { margin: 0; font-size: 17px; font-weight: 700; color: var(--prorail-blue, #00529b); }
.choice-badge {
    background: var(--prorail-light, #e6eef5);
    color: var(--prorail-blue, #00529b);
    border-radius: 999px;
    padding: 3px 12px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}
.choice-desc { margin: 0 0 14px; color: var(--color-muted, #666); font-size: 13px; flex: 1; }
.choice-go {
    align-self: flex-start;
    background: var(--prorail-blue, #00529b);
    color: #fff;
    border-radius: 4px;
    padding: 9px 16px;
    font-weight: 700;
    font-size: 14px;
}

.home-panel { margin-bottom: 14px; }

.stats-block { margin-bottom: 18px; }
.stats-block:last-child { margin-bottom: 0; }
.stats-title {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--prorail-blue, #00529b);
    text-transform: uppercase;
    letter-spacing: .4px;
}
table.stats-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.stats-table thead th {
    background: var(--color-surface, #f7f8fa);
    text-align: right;
    padding: 6px 10px;
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: var(--color-muted, #666);
    border-bottom: 1px solid var(--color-border, #e0e0e0);
    white-space: nowrap;
}
.stats-table thead th:first-child { text-align: left; }
.stats-table thead th[data-status="open"]  { color: var(--status-open, #f57f17); }
.stats-table thead th[data-status="busy"]  { color: var(--status-ready, #558b2f); }
.stats-table thead th[data-status="done"]  { color: var(--status-done, #2e7d32); }
.stats-table thead th[data-status="total"] { color: var(--prorail-blue, #00529b); }
.stats-table tbody th {
    background: #fff;
    text-align: left;
    padding: 7px 10px;
    font-weight: 600;
    border-bottom: 1px solid #eee;
}
.stats-table tbody td {
    padding: 7px 10px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}
.stats-table .cell-total { font-weight: 700; color: var(--prorail-blue, #00529b); }
.stats-table .row-meters th, .stats-table .row-meters td {
    font-size: 11.5px;
    color: var(--color-muted, #666);
    padding: 4px 10px 6px;
}
.stats-table .row-meters .cat-meters { font-weight: 500; font-style: italic; padding-left: 24px; }
.stats-table .row-total th, .stats-table .row-total td {
    background: var(--prorail-light, #e6eef5);
    font-weight: 700;
    border-top: 2px solid var(--prorail-blue, #00529b);
}
.stats-empty { padding: 12px 4px; color: var(--color-muted, #666); font-style: italic; }

.home-filter-hint { margin: 0 0 10px; color: var(--color-muted, #666); font-size: 12px; }
.home-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 0 0 14px;
}
.home-filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 180px;
    flex: 1 1 180px;
}
.home-filter-label { font-weight: 700; font-size: 12px; color: var(--color-text); }
.home-filter-field select {
    border: 1px solid var(--color-border, #e0e0e0);
    border-radius: 6px;
    padding: 8px 10px;
    background: #fff;
    font-size: 13px;
    color: var(--color-text);
}
.home-filter-field select:focus {
    outline: none;
    border-color: var(--color-brand-primary, #B20A2F);
    box-shadow: 0 0 0 2px var(--color-brand-light, #f6dade);
}
.home-filter-apply {
    background: var(--color-brand-primary, #B20A2F);
    color: #fff;
    border: 0;
    border-radius: 4px;
    padding: 8px 16px;
    font-weight: 700;
    cursor: pointer;
}
.home-filter-apply:hover { background: var(--color-brand-primary-dark, #8c0825); }

@media (max-width: 760px) {
    .choice-grid { grid-template-columns: 1fr; }
}
