/* ==========================================================================
   Rapportage Panel - App-Specific Styles
   Works alongside Rapportage.Themes base theme
   ========================================================================== */

/* ==========================================================================
   Responsive breakpoint ladder (canonical)

   Plain CSS: var() cannot be used inside @media conditions, so these values
   stay literal. Use ONLY these max-width breakpoints across the Panel so
   behavior stays predictable:

     480px   xs  - small phones
     640px   sm  - large phones / stacked layouts
     768px   md  - tablets; LOAD-BEARING: the app shell switches the sidebar
                   to an off-canvas drawer at <=768px (theme _sidebar.css).
                   Do not move this value.
     1024px  lg  - small laptops / narrow desktop
     1280px  xl  - desktop and up

   The --bp-* custom properties below are for JS / container-query use only;
   they are NOT valid inside @media conditions.
   ========================================================================== */
:root {
    --bp-xs: 480px;
    --bp-sm: 640px;
    --bp-md: 768px;
    --bp-lg: 1024px;
    --bp-xl: 1280px;
}

/* FluentMessageBar */
fluent-message-bar {
    margin-bottom: 1rem;
    border-radius: var(--radius-card);
}

/* --------------------------------------------------------------------------
   Base Element Color Fixes (dark mode)
   Rapportage.Themes .btn base has no explicit color; browser defaults to black.
   -------------------------------------------------------------------------- */
.btn {
    color: var(--text-primary);
}

a {
    color: var(--macos-blue);
}

/* Layout: the Panel shell (sidebar, top bar, drawer) is wwwroot/css/shell.css. */

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease-default);
}

.btn-logout:hover {
    background: var(--badge-danger-bg);
    color: var(--macos-red);
    text-decoration: none;
}

.content {
    max-width: var(--content-max-width);
    margin-inline: auto;
}

/* --------------------------------------------------------------------------
   Top Bar Search
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   Data Tables
   -------------------------------------------------------------------------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface-card);
    border: 1px solid var(--table-border);
    border-radius: var(--radius-card);
    overflow: hidden;
    box-shadow: none;
}

/* Responsive table wrapper.
   Wrap every <table class="data-table"> in <div class="table-responsive">
   so wide tables scroll horizontally at ANY width instead of crushing.
   The --wide modifier keeps every cell on one line and scrolls instead: only for
   tables whose cells must not wrap (AuditLogs, Robaws cockpit, search results).
   It does nothing on a phone (cells stay on one line there anyway) but on a laptop
   it pushes the last columns out of view, so a list people work in all day
   (Opdrachten, Klanten, Rapporten) leaves it off and lets headers wrap, with long
   text capped by cell-truncate (2026-10-08, measured at 1366px). */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive--wide > .data-table {
    min-width: 60rem;
}

.table-responsive--wide > .data-table th,
.table-responsive--wide > .data-table td {
    white-space: nowrap;
}

@media (max-width: 768px) {
    /* On phones/tablets every table gets a scroll floor so cells stop wrapping. */
    .table-responsive > .data-table {
        min-width: 44rem;
    }

    .table-responsive > .data-table th,
    .table-responsive > .data-table td {
        white-space: nowrap;
        padding: 0.625rem 0.75rem;
    }
}

/* Article name cell: primary + the kind ("Samengesteld · 3") on one line, the muted
   secondary name on its own line. Explicit classes so the layout does not depend on
   Bootstrap d-block/ms-* utilities that aren't loaded here (that gap is what made the
   two names run together). */
.article-name-line { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.article-name-count { color: var(--text-secondary); font-size: 0.78rem; }
.article-name-secondary { display: block; color: var(--text-secondary); font-size: 0.78rem; margin-top: 1px; }

.data-table th,
.data-table td {
    padding: 0.5rem 0.875rem;
    text-align: left;
    border-bottom: 1px solid var(--table-border);
}

.data-table th {
    background: var(--table-header-bg);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    letter-spacing: 0.3px;
}

.cell-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

/* On a laptop a truncated cell gives way instead of holding its full text width: with
   max-width 0 the truncating columns share the space the fixed ones (date, status, action)
   leave, never below 7rem, so the last column stays on screen (2026-10-08, measured at
   1280 and 1366px). Phones show cards and --wide tables scroll by design: both keep the
   200px cap above. */
@media (min-width: 769px) {
    .table-responsive:not(.table-responsive--wide) > .data-table td.cell-truncate {
        max-width: 0;
        width: 22%;
        min-width: 7rem;
    }
}

/* A muted second line in a truncated cell (klant over its address) ends in an ellipsis too. */
.cell-truncate > .cell-secondary {
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table tbody tr:hover {
    background: var(--table-row-hover);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* --------------------------------------------------------------------------
   Page Headers
   -------------------------------------------------------------------------- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header-left {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.page-header-left h1 {
    margin: 0;
}

h1:focus {
    outline: none;
}

.page-description {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin: 0.25rem 0 0;
}

.page-header-right {
    display: flex;
    gap: 0.5rem;
}

.back-link {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   View Tabs
   -------------------------------------------------------------------------- */
.view-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.view-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--duration-normal);
}

.view-tab:hover {
    background: var(--surface-hover);
    border-color: var(--macos-blue);
}

.view-tab.active {
    background: var(--macos-blue);
    color: white;
    border-color: var(--macos-blue);
}

.tab-count {
    background: var(--badge-default-bg);
    color: var(--badge-default-text);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 500;
}

.view-tab.active .tab-count {
    background: rgba(255,255,255,0.2);
}

/* --------------------------------------------------------------------------
   Filters
   -------------------------------------------------------------------------- */

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-group .form-control {
    min-width: 150px;
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */
.pagination-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--surface-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xs);
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--duration-normal);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: var(--macos-blue);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: var(--macos-blue);
    color: white;
    border-color: var(--macos-blue);
}

.pagination-ellipsis {
    padding: 0 0.5rem;
    color: var(--text-tertiary);
}

.pagination-size {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pagination-size select {
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xs);
    background: var(--surface-card);
    color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Status Badges
   -------------------------------------------------------------------------- */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 500;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.status-draft { background: var(--badge-default-bg); color: var(--badge-default-text); }
.status-submitted { background: var(--badge-primary-bg); color: var(--badge-primary-text); }
.status-approved { background: var(--badge-success-bg); color: var(--badge-success-text); }
.status-changesrequested { background: var(--badge-warning-bg); color: var(--badge-warning-text); }
.status-rejected { background: var(--badge-danger-bg); color: var(--badge-danger-text); }
/* Sent = pushed to Robaws ERP: distinct indigo so it no longer collides with Goedgekeurd (green) */
.status-sent { background: rgba(var(--macos-purple-rgb), 0.16); color: var(--macos-purple); }

/* Task Status Badges */
.status-task-scheduled { background: var(--badge-primary-bg); color: var(--badge-primary-text); }
.status-task-enroute { background: var(--badge-warning-bg); color: var(--badge-warning-text); }
.status-task-inprogress { background: var(--badge-warning-bg); color: var(--badge-warning-text); }
.status-task-completed { background: var(--badge-success-bg); color: var(--badge-success-text); }
.status-task-inreview { background: var(--badge-info-bg); color: var(--badge-info-text); }
.status-task-cancelled { background: var(--badge-default-bg); color: var(--badge-default-text); }

/* User Role Badges */
.status-role-technician { background: var(--badge-primary-bg); color: var(--badge-primary-text); }
.status-role-supervisor { background: var(--badge-warning-bg); color: var(--badge-warning-text); }
.status-role-seniortechnician { background: rgba(48, 209, 88, 0.14); color: var(--macos-green, #248a3d); }
.status-role-admin { background: rgba(var(--macos-purple-rgb), 0.15); color: var(--macos-purple); }

/* Active/Inactive Badges.
   "Actief" is the overwhelming default, so it's de-emphasized (unfilled, muted green)
   to reduce list noise; Inactief keeps a filled pill so the exceptions stand out. */
.status-active { background: transparent; color: var(--color-success); padding-left: 0; padding-right: 0; }
.status-inactive { background: var(--badge-default-bg); color: var(--badge-default-text); }
/* Imported-from-Robaws, not yet activated */
.status-toactivate { background: var(--badge-warning-bg); color: var(--badge-warning-text); }
/* Robaws origin tag */
.status-erp { background: var(--badge-info-bg); color: var(--badge-info-text); }

/* Group of badges shown together (e.g. status + Robaws origin) */
.badge-group {
    display: inline-flex;
    gap: 0.35rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Inline onboarding prompt for an imported user awaiting activation */
.activation-card {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    border: 1px solid var(--badge-warning-text);
    border-radius: var(--radius-md);
    background: var(--badge-warning-bg);
    color: var(--badge-warning-text);
}
.activation-card-text {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    max-width: 32rem;
}
.activation-card-text i { font-size: 1.25rem; line-height: 1.4; }
.activation-card-text p { margin: 0.15rem 0 0; font-size: 0.875rem; }
.activation-card-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

/* "X imported users awaiting activation" banner on the user list */
.pending-activation-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-md);
    background: var(--badge-warning-bg);
    color: var(--badge-warning-text);
    font-size: 0.875rem;
}
.pending-activation-banner .btn-link {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    padding: 0;
    margin-left: auto;
}

/* Template scope badges (global vs organization-owned) */
.status-global { background: var(--badge-info-bg); color: var(--badge-info-text); }
.status-org { background: var(--badge-default-bg); color: var(--badge-default-text); text-transform: none; }

/* Field Type Badges */
.field-type-badge {
    font-size: 0.75rem;
    color: var(--badge-primary-text);
    background: var(--badge-primary-bg);
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-xs);
}

/* Options Preview */

/* --------------------------------------------------------------------------
   Dashboard
   -------------------------------------------------------------------------- */
.dashboard h1 {
    margin-bottom: 1.5rem;
}

/* --------------------------------------------------------------------------
   Report Detail
   -------------------------------------------------------------------------- */
.template-detail {
    background: var(--surface-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.detail-section {
    margin-bottom: 1.5rem;
}

.detail-section h2 {
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-default);
    margin-bottom: 1rem;
}

.detail-list {
    display: grid;
    grid-template-columns: 10rem 1fr;
    gap: 0.5rem 1rem;
    margin: 0;
}

.detail-list dt {
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-list dd {
    margin: 0;
}

@media (max-width: 640px) {
    /* Stack the fixed 10rem label column on small phones. */
    .detail-list {
        grid-template-columns: 1fr;
        gap: 0.15rem 0;
    }

    .detail-list dt {
        margin-top: 0.4rem;
    }
}

/* --------------------------------------------------------------------------
   Report content cards (ReportDetail, EditProposalDetail, proposal review)
   -------------------------------------------------------------------------- */
.report-section-card {
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.report-section-card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-default);
}

.section-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.375rem;
    border-radius: 999px;
    background: var(--border-default, #dee2e6);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 600;
    margin-left: 0.375rem;
    transition: background 0.15s, color 0.15s;
}

.collapsible-toggle:hover .section-count {
    background: var(--badge-info-bg, rgba(13, 202, 240, 0.15));
    color: var(--badge-info-text, #055160);
}

.metadata-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.625rem 2rem;
}

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

.metadata-item {
    display: flex;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.metadata-item .meta-label {
    color: var(--text-secondary);
    white-space: nowrap;
    width: 9rem;
    flex-shrink: 0;
    font-size: 0.8125rem;
}

.metadata-item .meta-value {
    color: var(--text-primary);
}

.field-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.field-photo-img {
    max-width: 300px;
    max-height: 220px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--border-default);
}

.findings-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    margin: 0;
}

/* --------------------------------------------------------------------------
   Findings
   -------------------------------------------------------------------------- */
.findings-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.finding-card {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    overflow: hidden;
}

.finding-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface-hover);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-default);
    flex-wrap: wrap;
}

.finding-number {
    font-weight: 600;
    color: var(--text-secondary);
}

.finding-area {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    background: var(--badge-default-bg);
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-xs);
}

.finding-body {
    padding: 1rem;
}

.finding-description {
    margin: 0 0 1rem;
}

.finding-field {
    margin-top: 0.75rem;
}

.finding-field strong {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.finding-field p {
    margin: 0;
}

.finding-photos {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-default);
    background: var(--surface-hover);
    flex-wrap: wrap;
}

.photo-thumbnail {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-xs);
    overflow: hidden;
    cursor: pointer;
}

.photo-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --------------------------------------------------------------------------
   Login Page
   -------------------------------------------------------------------------- */
.login-page {
    min-height: 100vh;
    display: block;
    background: var(--surface-card);
}

/* --------------------------------------------------------------------------
   Empty States & Loading
   -------------------------------------------------------------------------- */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state .bi,
.empty-icon {
    display: block;
    font-size: 2rem;
    width: 60px;
    height: 60px;
    line-height: 60px;
    background: var(--surface-hover);
    border-radius: 50%;
    margin: 0 auto 1.25rem;
    color: var(--text-tertiary);
}

.empty-state p {
    margin: 0 0 0.25rem;
    font-size: var(--text-base);
    color: var(--text-secondary);
    font-weight: 500;
}

.empty-state small {
    display: block;
    color: var(--text-tertiary);
    font-size: var(--text-sm);
}

.empty-state .btn {
    margin-top: 1.25rem;
}

.empty-message {
    color: var(--text-secondary);
    font-style: italic;
}

.error-state {
    text-align: center;
    padding: 3rem;
}

/* --------------------------------------------------------------------------
   Forms - Extended
   -------------------------------------------------------------------------- */
.form-container {
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    padding: 1.5rem 1.75rem;
    max-width: 720px;
}

.form-section {
    margin-bottom: 2rem;
}

.form-section h2 {
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-default);
    margin-bottom: 1rem;
}

/* column-gap only: each .form-group already carries its bottom margin, so a row-gap doubled the
   space between groups once the columns stack on a phone (32px inside a row, 16px between rows). */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    column-gap: 1rem;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-default);
    margin-top: 1.5rem;
}

.form-actions-right {
    display: flex;
    gap: 0.5rem;
}

.form-text {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    margin-top: 0.25rem;
}

.text-muted {
    color: var(--text-tertiary);
}

.form-control-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
}

/* --------------------------------------------------------------------------
   Location Editor
   -------------------------------------------------------------------------- */
.location-editor {
    margin-top: 0.5rem;
}

.location-table {
    margin-bottom: 1rem;
}

.location-table .form-control {
    min-width: 100px;
}

.address-inputs {
    display: flex;
    gap: 0.5rem;
}

.address-inputs .addition-input {
    max-width: 60px;
    flex-shrink: 0;
}

.action-cell {
    white-space: nowrap;
}

.action-cell .btn {
    margin-right: 0.25rem;
}

.action-cell .btn:last-child {
    margin-right: 0;
}

.editing-row,
.adding-row {
    background: var(--badge-warning-bg);
    color: var(--text-primary);
}

.inactive-row {
    opacity: 0.6;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    cursor: pointer;
    white-space: nowrap;
}

.checkbox-inline input {
    cursor: pointer;
}

.empty-locations {
    padding: 1rem;
    text-align: center;
    color: var(--text-tertiary);
    background: var(--surface-hover);
    border-radius: var(--radius-card);
}

.location-actions {
    margin-top: 1rem;
}

/* --------------------------------------------------------------------------
   Section Headers
   -------------------------------------------------------------------------- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-default);
    margin-bottom: 1rem;
}

.section-header h2 {
    margin: 0;
    padding: 0;
    border: none;
}

.empty-state-inline {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-tertiary);
    background: var(--surface-hover);
    border-radius: var(--radius-card);
}

.empty-state-inline p {
    margin: 0 0 1rem;
}

/* --------------------------------------------------------------------------
   Page Actions
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   Linked Report Card
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   Action Buttons
   -------------------------------------------------------------------------- */

/* Icon-only action buttons for table rows */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--surface-card);
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease-default);
    font-size: 0.875rem;
}

.action-btn:hover {
    background: var(--macos-blue);
    border-color: var(--macos-blue);
    color: white;
    text-decoration: none;
}

.action-btn + .action-btn {
    margin-left: 0.25rem;
}

/* --------------------------------------------------------------------------
   Blazor Error UI
   -------------------------------------------------------------------------- */
#blazor-error-ui {
    background: var(--badge-warning-bg);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: var(--z-toast);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: var(--color-danger, #d32f2f);
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* --------------------------------------------------------------------------
   Error Boundary Full-Page Fallback
   -------------------------------------------------------------------------- */
.error-boundary-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    min-height: 50vh;
    gap: 1rem;
}

.error-boundary-page h1 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 0;
}

.error-boundary-page p {
    color: var(--text-muted);
    max-width: 480px;
    margin: 0;
}

/* --------------------------------------------------------------------------
   Dutch Error Page
   -------------------------------------------------------------------------- */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 2rem;
}

.error-page-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
    max-width: 480px;
}

.error-page-icon {
    font-size: 3rem;
    color: var(--color-warning);
}

.error-page h1 {
    font-size: 1.75rem;
    margin: 0;
}

.error-page p {
    color: var(--text-muted);
    margin: 0;
}

.error-trace {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.error-page-actions {
    margin-top: 0.5rem;
}

/* --------------------------------------------------------------------------
   Breadcrumb Navigation
   -------------------------------------------------------------------------- */
.breadcrumb {
    margin-bottom: 1rem;
}

.breadcrumb-list {
    display: flex;
    align-items: center;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.875rem;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item a {
    color: var(--macos-blue);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

.breadcrumb-item.active span {
    color: var(--text-secondary);
}

.breadcrumb-separator {
    margin: 0 0.5rem;
    color: var(--text-tertiary);
}

.breadcrumb-item + .breadcrumb-item::before {
    content: none;
}

/* --------------------------------------------------------------------------
   Skeleton Loaders
   -------------------------------------------------------------------------- */
.skeleton-table {
    opacity: 0.7;
}

.skeleton-row td {
    padding: 1rem 0.75rem;
}

.skeleton-text {
    display: inline-block;
    background: linear-gradient(90deg, var(--surface-hover) 25%, var(--border-default) 50%, var(--surface-hover) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius-xs);
    height: 1em;
}

.skeleton-id { width: 30px; }
.skeleton-date { width: 80px; }
.skeleton-name { width: 120px; }
.skeleton-address { width: 180px; }
.skeleton-badge { width: 70px; }
.skeleton-btn { width: 50px; }

@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* --------------------------------------------------------------------------
   Modal Animations
   -------------------------------------------------------------------------- */
@keyframes modal-fade-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: var(--blur-sm);
    z-index: var(--z-modal-backdrop);
    animation: fade-in var(--duration-normal) var(--ease-default);
}

.modal.show {
    z-index: var(--z-modal);
    animation: modal-fade-in var(--duration-normal) var(--ease-out);
}

/* --------------------------------------------------------------------------
   Toast Styling & Animation
   -------------------------------------------------------------------------- */
@keyframes toast-slide-in {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-fade-out {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-8px); }
}

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-popover);
    border-left: 4px solid;
    animation: toast-slide-in var(--duration-normal) var(--ease-out);
}

.toast-success { border-left-color: var(--macos-green); }
.toast-error { border-left-color: var(--macos-red); }
.toast-warning { border-left-color: var(--macos-orange); }
.toast-info { border-left-color: var(--macos-blue); }

.toast-icon { font-size: 1.125rem; flex-shrink: 0; }
.toast-success .toast-icon { color: var(--macos-green); }
.toast-error .toast-icon { color: var(--macos-red); }
.toast-warning .toast-icon { color: var(--macos-orange); }
.toast-info .toast-icon { color: var(--macos-blue); }

.toast-message { flex: 1; font-size: 0.875rem; color: var(--text-primary); }

.toast-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
    transition: color var(--duration-fast) var(--ease-default);
}
.toast-close:hover { color: var(--text-primary); }

/* --------------------------------------------------------------------------
   Alert Animation
   -------------------------------------------------------------------------- */
@keyframes alert-slide-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert { animation: alert-slide-in var(--duration-normal) var(--ease-out); }

/* --------------------------------------------------------------------------
   Table Striping
   -------------------------------------------------------------------------- */
.data-table tbody tr:nth-child(even) {
    background: var(--table-row-stripe);
}
.data-table tbody tr:nth-child(even):hover {
    background: var(--table-row-hover);
}

/* --------------------------------------------------------------------------
   Utility Classes
   -------------------------------------------------------------------------- */
.mt-3 {
    margin-top: 1rem;
}

/* ==========================================================================
   RESPONSIVE UTILITIES & MOBILE ENHANCEMENTS
   ========================================================================== */

/* Touch-friendly minimum sizes for interactive elements */
@media (max-width: 768px) {
    /* Ensure buttons are tappable */
    .btn {
        min-height: 44px;
    }

    .btn-sm {
        min-height: 40px;
    }

    /* Form controls touch-friendly size */
    .form-control,
    select.form-control {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    /* Page header stacks on mobile */
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .page-header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .page-header-left h1 {
        font-size: 1.25rem;
    }

    .page-header-right {
        flex-direction: column;
    }

    .page-header-right .btn {
        width: 100%;
        justify-content: center;
    }

    /* Filters stack vertically */

    .filter-group {
        width: 100%;
    }

    .filter-group .form-control {
        width: 100%;
        min-width: unset;
    }

    /* Data tables scroll horizontally via the .table-responsive wrapper now
       (see the .table-responsive rules near .data-table). */

    /* Detail grids stack */
    .detail-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Form actions stack */
    .form-actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }

    .form-actions .btn,
    .form-actions-right .btn {
        width: 100%;
        justify-content: center;
    }

    .form-actions-right {
        flex-direction: column;
        width: 100%;
    }

    /* Stats grid adjusts */

    /* Breadcrumb wraps */
    .breadcrumb-list {
        flex-wrap: wrap;
    }

    /* Action buttons wrap */
}

/* Very small mobile screens */
@media (max-width: 640px) {
    .page-header-left h1 {
        font-size: 1.125rem;
    }

    /* Stats grid single column */

    /* Section headers stack */
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .section-header .btn {
        width: 100%;
    }

    /* Reduce padding */
    .form-container,
    .template-detail {
        padding: 1rem;
    }

    .finding-card {
        margin: 0 -0.5rem;
        border-radius: 0;
    }

    .finding-header {
        padding: 0.5rem 0.75rem;
    }

    .finding-body {
        padding: 0.75rem;
    }

    /* Linked report card stacks */
}

/* --------------------------------------------------------------------------
   Customer Browser
   -------------------------------------------------------------------------- */
.customer-browser {
    max-width: 1000px;
}

.browser-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--surface-card);
    border-radius: var(--radius-card);
    border: 1px solid var(--border-default);
}

.browser-toolbar .search-box {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    position: relative;
}

.browser-toolbar .search-box i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

.browser-toolbar .search-box input {
    width: 100%;
    padding: 0.5rem 2rem 0.5rem 2.25rem;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    font-size: 0.875rem;
}

.browser-toolbar .search-box input:focus {
    outline: none;
    border-color: var(--macos-blue);
    box-shadow: var(--input-shadow-focus);
}

.browser-toolbar .clear-search {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0.25rem;
}

.browser-toolbar .clear-search:hover {
    color: var(--text-primary);
}

.filter-toggle {
    display: flex;
    align-items: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.toggle-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
}

.browser-stats {
    margin-left: auto;
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

.browser-more {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.customer-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.customer-row {
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    overflow: hidden;
}

.customer-row.inactive {
    opacity: 0.7;
}

.customer-row.expanded {
    border-color: var(--macos-blue);
}

.customer-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color var(--duration-fast);
}

.customer-header:hover {
    background: var(--surface-hover);
}

.expand-toggle {
    background: none;
    border: none;
    color: var(--text-tertiary);
    padding: 0.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--duration-fast);
}

.customer-row.expanded .expand-toggle {
    color: var(--macos-blue);
}

.customer-name {
    flex: 1;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.customer-name:hover {
    color: var(--macos-blue);
}

.customer-stats {
    display: flex;
    gap: 1rem;
}

.customer-stats .stat,
.location-stats .stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

.btn-view-reports {
    background: none;
    border: none;
    color: var(--text-tertiary);
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-card);
    transition: all var(--duration-fast);
}

.btn-view-reports:hover {
    background: var(--macos-blue);
    color: white;
}

.location-list {
    border-top: 1px solid var(--border-default);
    background: var(--surface-hover);
    color: var(--text-primary);
}

.location-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-default);
}

.location-row:last-child {
    border-bottom: none;
}

.location-row.inactive {
    opacity: 0.6;
}

.location-indent {
    width: 1.5rem;
    flex-shrink: 0;
    position: relative;
}

.location-indent::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: -0.5rem;
    bottom: 50%;
    width: 1px;
    background: var(--border-default);
}

.location-indent::after {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 50%;
    width: 0.75rem;
    height: 1px;
    background: var(--border-default);
}

.location-name {
    flex: 1;
    cursor: pointer;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.location-name:hover {
    color: var(--macos-blue);
}

.location-alt {
    color: var(--text-tertiary);
}

.location-stats {
    display: flex;
    gap: 1rem;
}

.no-locations {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.badge-inactive {
    font-size: 0.7rem;
    padding: 0.125rem 0.375rem;
    background: var(--text-tertiary);
    color: white;
    border-radius: 0.25rem;
    font-weight: 500;
}

/* Customer Browser responsive */
@media (max-width: 768px) {
    .browser-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .browser-toolbar .search-box {
        max-width: none;
    }

    .browser-stats {
        margin-left: 0;
    }

    .customer-header {
        flex-wrap: wrap;
    }

    .customer-stats {
        order: 3;
        width: 100%;
        margin-left: 2rem;
        margin-top: 0.5rem;
    }
}

/* --------------------------------------------------------------------------
   Dashboard Enhancements
   -------------------------------------------------------------------------- */

/* Stats Cards Row */
.stats-cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stats-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    position: relative;
    transition: box-shadow var(--duration-fast) var(--ease-default),
                border-color var(--duration-fast) var(--ease-default);
}

.stats-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.stats-card-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-hover);
    border-radius: 50%;
    font-size: 1.375rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.stats-card-content {
    flex: 1;
}

.stats-card-value {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
}

.stats-card-label {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-top: 0.25rem;
}

/* Card color variants */

/* Dashboard Columns */

/* Report List in Dashboard */

/* Empty state */

/* Skeleton loading */

.skeleton-date {
    width: 60px;
    height: 1rem;
}

.skeleton-name {
    flex: 1;
    height: 1rem;
    max-width: 200px;
}

.skeleton-badge {
    width: 80px;
    height: 1.25rem;
}

/* Status Breakdown */
.status-breakdown {
    max-width: 600px;
}

.status-bars {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.status-bar-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-bar-row .status-label {
    min-width: 100px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.status-bar {
    flex: 1;
    height: 12px;
    background: var(--surface-hover);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.status-bar-fill {
    height: 100%;
    border-radius: var(--radius-sm);
    transition: width 0.3s ease;
}

/* Scoped to dashboard bar fills only — avoids overriding .status-badge text */
.status-bar-fill.status-draft { background: var(--status-draft-fill); }
.status-bar-fill.status-submitted { background: var(--status-submitted-fill); }
.status-bar-fill.status-approved { background: var(--status-approved-fill); }
.status-bar-fill.status-changesrequested { background: var(--status-changes-requested-fill); }
.status-bar-fill.status-rejected { background: var(--status-rejected-fill); }
.status-bar-fill.status-sent { background: var(--status-sent-fill); }

.status-bar-row .status-count {
    min-width: 50px;
    text-align: right;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Dashboard responsive */

@media (max-width: 768px) {
    .stats-cards-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-card {
        padding: 1rem;
    }

    .stats-card-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .stats-card-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stats-cards-row {
        grid-template-columns: 1fr;
    }
}

/* --------------------------------------------------------------------------
   Filter Components
   -------------------------------------------------------------------------- */

/* Filter Bar */
.filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.25rem 0;
    margin-bottom: 0.5rem;
}

.filter-bar-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-clear-all {
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
}

.filter-clear-all:hover {
    color: var(--macos-red);
}

/* Filter Chip */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--badge-primary-bg);
    color: var(--badge-primary-text);
    border-radius: var(--radius-pill);
    font-size: 0.8125rem;
}

.filter-chip-label {
    font-weight: 500;
}

.filter-chip-value {
    opacity: 0.9;
}

.filter-chip-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    margin-left: 0.25rem;
    background: rgba(var(--macos-blue-rgb), 0.15);
    border: none;
    border-radius: 50%;
    color: inherit;
    cursor: pointer;
    transition: background var(--duration-fast);
}

.filter-chip-remove:hover {
    background: rgba(var(--macos-blue-rgb), 0.25);
}

.filter-chip-remove i {
    font-size: 0.75rem;
}

/* Filter Add Button */
.filter-add-btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

.filter-add-btn i {
    margin-right: 0.25rem;
}

/* Filter Dropdown Container */
.filter-dropdown-container {
    position: relative;
}

.filter-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: var(--z-floating);
    min-width: 200px;
    margin-top: 0.25rem;
    padding: 0.5rem 0;
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-lg);
}

.filter-dropdown-empty {
    padding: 0.75rem 1rem;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    text-align: center;
}

.filter-dropdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background var(--duration-fast);
}

.filter-dropdown-item:hover {
    background: var(--surface-hover);
}

.filter-dropdown-label {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.filter-dropdown-type {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* Filter Input Popup */
.filter-input-popup {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: var(--z-floating);
    min-width: 280px;
    margin-top: 0.25rem;
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-lg);
}

.filter-input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-default);
    font-weight: 500;
    font-size: 0.875rem;
}

.filter-input-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-xs);
}

.filter-input-close:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.filter-input-body {
    padding: 1rem;
}

.filter-input-body .form-control {
    font-size: 0.875rem;
}

/* Boolean Options */
.boolean-options {
    display: flex;
    gap: 0.5rem;
}

.boolean-options .btn {
    flex: 1;
}

/* Date Range Filter */
.date-range-filter {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.date-range-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.date-input-group {
    flex: 1;
}

.date-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.date-separator {
    color: var(--text-tertiary);
    padding-top: 1.25rem;
}

.date-range-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Typeahead Input */
.typeahead-container {
    position: relative;
    width: 100%;
}

.typeahead-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.typeahead-input-wrapper.open .typeahead-input {
    border-color: var(--macos-blue);
    box-shadow: var(--input-shadow-focus);
}

.typeahead-input {
    width: 100%;
    padding-right: 2rem;
}

.typeahead-spinner {
    position: absolute;
    right: 0.5rem;
    display: flex;
    align-items: center;
}

.typeahead-clear {
    position: absolute;
    right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
}

.typeahead-clear:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.typeahead-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: var(--z-floating);
    max-height: 250px;
    overflow-y: auto;
    margin-top: 0.25rem;
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-lg);
}

.typeahead-option {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background var(--duration-fast);
}

.typeahead-option:hover,
.typeahead-option.highlighted {
    background: var(--surface-hover);
}

.typeahead-option-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.typeahead-option-secondary {
    display: block;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.125rem;
}

.typeahead-no-results,
.typeahead-hint {
    padding: 0.75rem;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

/* Filter Components - Responsive */
@media (max-width: 768px) {
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar-chips {
        width: 100%;
    }

    .filter-dropdown-container {
        width: 100%;
    }

    .filter-add-btn {
        width: 100%;
        justify-content: center;
    }

    .filter-dropdown-menu,
    .filter-input-popup {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        border-radius: var(--radius-card) var(--radius-card) 0 0;
        max-height: 60vh;
    }

    .date-range-inputs {
        flex-direction: column;
    }

    .date-separator {
        display: none;
    }

    .date-input-group {
        width: 100%;
    }

    .search-box-container .search-box {
        max-width: none;
    }
}

/* Search Box Container (Reports page) */
.search-box-container {
    margin-bottom: 1rem;
}

.search-box-container .search-box {
    position: relative;
    max-width: 480px;
    width: 100%;
}

.search-box-container .search-box i.bi-search {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-box-container .search-box input {
    width: 100%;
    padding: 0.5rem 2.5rem 0.5rem 2.25rem;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-input);
    font-size: 0.875rem;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.search-box-container .search-box input:focus {
    outline: none;
    border-color: var(--macos-blue);
    box-shadow: var(--input-shadow-focus);
}

.search-box-container .search-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-box-container .search-clear:hover {
    color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Dark Mode — Native Select Dropdown
   color-scheme: dark makes the browser render the native dropdown popup
   with a dark background instead of the default white OS popup.
   -------------------------------------------------------------------------- */
[data-theme="dark"] select,
[data-theme="dark"] .form-select {
    color-scheme: dark;
}

/* --------------------------------------------------------------------------
   Dark Mode Card Borders
   -------------------------------------------------------------------------- */
[data-theme="dark"] .stats-card,
[data-theme="dark"] .template-detail,
[data-theme="dark"] .form-container,
[data-theme="dark"] .pagination-container,
[data-theme="dark"] .empty-state,
[data-theme="dark"] .data-table {
    border: 1px solid var(--border-default);
}

/* --------------------------------------------------------------------------
   Hub Architecture — Shared Layout Primitives
   -------------------------------------------------------------------------- */

/* HubCard row — wrapping flex row of clickable entity/stat cards */
.hub-cards-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin-bottom: 1rem;
}

/* Tab content area */
.tab-content {
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: 0 var(--radius-card) var(--radius-card) var(--radius-card);
    padding: 1.25rem;
}

/* Timeline section separator */
.timeline-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-default);
}

/* Proposal list rows in hub tab */

.proposal-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    background: var(--surface-base);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
}

.proposal-info {
    flex: 1;
    min-width: 0;
}

.proposal-title {
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
}

.proposal-title:hover {
    text-decoration: underline;
    color: var(--macos-blue);
}

.proposal-meta {
    font-size: 0.8125rem;
}

.proposal-stats {
    font-size: 0.8125rem;
    white-space: nowrap;
}

/* Linked report card (task hub) */

/* Dark mode hub cards */
[data-theme="dark"] .hub-card,
[data-theme="dark"] .tab-content,
[data-theme="dark"] .proposal-row {
    border-color: var(--border-default);
}

/* Responsive hub cards */
@media (max-width: 640px) {
    .hub-cards-row {
        gap: 0.5rem;
    }
}


/* Next-step CTA card (post-approval) */
.next-step-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--color-success-bg, #f0faf0);
    border: 1px solid var(--color-success, #28a745);
    border-radius: var(--radius-badge);
    padding: 0.875rem 1rem;
    margin-bottom: 1rem;
}

.next-step-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.875rem;
}

.next-step-info strong {
    color: var(--color-success, #28a745);
}

.next-step-info span {
    color: var(--text-secondary);
}

/* Filter + Search Combined Toolbar */
.filter-search-toolbar {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.filter-search-toolbar .filter-bar {
    flex: 1;
    margin-bottom: 0;
    min-width: 0;
}

.filter-search-toolbar .search-box-container {
    flex: 0 0 280px;
    margin-bottom: 0;
}

.filter-search-toolbar .search-box-container .search-box {
    max-width: none;
}

@media (max-width: 640px) {
    .filter-search-toolbar {
        flex-direction: column;
        gap: 0.5rem;
    }

    .filter-search-toolbar .search-box-container {
        flex: 1 1 auto;
        width: 100%;
    }
}

/* Filter clear row */
.filter-clear-row {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 0.5rem;
}

.btn-ghost {
    background: none;
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background var(--duration-fast);
}

.btn-ghost:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   PDF Preview Panel
   -------------------------------------------------------------------------- */
.pdf-preview-panel {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.pdf-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--surface-hover);
    border-bottom: 1px solid var(--border-default);
}

.pdf-preview-embed {
    width: 100%;
    height: 70vh;
    min-height: 500px;
    border: none;
    display: block;
}

/* --------------------------------------------------------------------------
   Bulk Action Bar (ReportList bulk approve)
   -------------------------------------------------------------------------- */

.bulk-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    margin-bottom: 0.75rem;
    background: var(--surface-selected);
    border: 1px solid var(--accent-blue);
    border-radius: var(--radius-card);
    gap: 1rem;
}

.bulk-action-info {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.bulk-action-buttons {
    display: flex;
    gap: 0.5rem;
}

.col-checkbox {
    width: 2.5rem;
    text-align: center;
    padding-left: 0.75rem !important;
}

tr.row-selected td {
    background: var(--surface-selected);
}

.clickable-row {
    cursor: pointer;
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.data-table th.sortable:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.data-table th.sorted {
    color: var(--macos-blue);
}

.sort-icon {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

.data-table th.sorted .sort-icon {
    color: var(--macos-blue);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: var(--z-modal-backdrop);
}

/* --------------------------------------------------------------------------
   Review (proposal) view: badges and changed-field highlights
   -------------------------------------------------------------------------- */
.review-badge {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-xs);
    margin-left: 0.5rem;
    vertical-align: middle;
}

.review-badge-modified {
    background: var(--badge-warning-bg);
    color: var(--badge-warning-text);
}

.review-badge-added {
    background: var(--badge-success-bg);
    color: var(--badge-success-text);
}

.review-badge-removed {
    background: var(--badge-danger-bg);
    color: var(--badge-danger-text);
}

.changed-field-value {
    display: inline-block;
}

.changed-field-modified {
    background: var(--badge-warning-bg);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-xs);
}

.changed-field-was {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    background: transparent;
}

.changed-field-was::before {
    content: "was: ";
    font-weight: 500;
}

.review-finding-card-modified {
    border-color: var(--badge-warning-text);
    box-shadow: 0 0 0 1px var(--badge-warning-text) inset;
}

.review-finding-card-added {
    border-color: var(--badge-success-text);
    box-shadow: 0 0 0 1px var(--badge-success-text) inset;
}

.review-finding-card-removed {
    opacity: 0.6;
    border-color: var(--badge-danger-text);
    box-shadow: 0 0 0 1px var(--badge-danger-text) inset;
}

.review-finding-card-removed .finding-body,
.review-finding-card-removed .finding-description {
    text-decoration: line-through;
    text-decoration-color: var(--badge-danger-text);
}

.review-photo-thumbnail {
    position: relative;
}

.review-photo-thumbnail.added::after,
.review-photo-thumbnail.removed::after {
    content: attr(data-marker);
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.75rem;
}

.review-photo-thumbnail.added::after {
    background: var(--badge-success-text);
    color: white;
}

.review-photo-thumbnail.removed::after {
    background: var(--badge-danger-text);
    color: white;
}

.review-photo-thumbnail.removed img {
    opacity: 0.5;
    filter: grayscale(0.6);
}

/* "Nieuw" / "Verwijderd" written on a proposal's photo, not just a + or - (#233). */
.photo-change-label {
    position: absolute;
    left: 4px;
    bottom: 4px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.4;
    color: white;
    pointer-events: none;
}

.review-photo-thumbnail.added .photo-change-label {
    background: var(--badge-success-text);
}

.review-photo-thumbnail.removed .photo-change-label {
    background: var(--badge-danger-text);
}

/* A photo the report keeps, with a new drawing from the proposal (#203). */
.review-photo-thumbnail.redrawn {
    outline: 2px solid var(--badge-info-text);
    outline-offset: -2px;
}

.review-photo-thumbnail.redrawn .photo-change-label {
    background: var(--badge-info-text);
}

/* Photo-question grids (Algemene vragen / Afronding): each photo opens in the lightbox. */
.field-photo-button {
    position: relative;
    display: inline-block;
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
}

.review-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface-hover);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.review-legend-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-right: 0.25rem;
}

/* Client-version notices (#64). Full-width strips above the app chrome — the Panel has no
   offline queue to strand, so even the blocking case is a bar rather than an overlay.
   Moved here from wwwroot/css/app.css, which no page ever linked (#147). */
.version-block-bar,
.version-update-bar {
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    text-align: center;
}

.version-block-bar {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border-bottom: 1px solid var(--color-danger);
}

.version-update-bar {
    background: var(--color-info-bg);
    color: var(--color-info);
    border-bottom: 1px solid var(--color-info);
}
