/* Energieploeg Design System — NRGIT Portal */

:root {
    --color-primary: #103713;
    --color-primary-hover: #0b6028;
    --color-accent: #7da887;
    --color-surface: #FAFBFC;
    --color-surface-muted: #f2f5f7;
    --color-surface-raised: #ffffff;
    --color-border: #e1e1e1;
    --color-text-primary: #103713;
    --color-text-secondary: #4b5563;
    --color-error: #dc2626;
    --color-warning: #d97706;
    --color-success: #0b6028;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Base Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 10px; }

body {
    font-family: 'Manrope', system-ui, sans-serif;
    font-size: 1.6rem;
    line-height: 1.5;
    color: var(--color-text-primary);
    background-color: var(--color-surface);
}

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

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0.8rem;
}

h1 { font-size: 3.2rem; }
h2 { font-size: 2.4rem; }
h3 { font-size: 1.8rem; }

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

.sidebar {
    width: 240px;
    background: var(--color-primary);
    color: #ffffff;
    padding: 2rem 0 0;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    padding: 0 2rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 2rem;
}

.sidebar-logo h1 {
    color: var(--color-accent);
    font-size: 2rem;
    font-weight: 600;
}

.sidebar-logo span {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.2rem;
    display: block;
}

.sidebar-nav {
    padding: 0 1rem;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav a,
.sidebar-group-toggle {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.4rem;
    font-weight: 500;
    border-radius: 8px;
    transition: background 150ms ease, color 150ms ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.active,
.sidebar-group-toggle:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav a.active {
    border-left: 3px solid var(--color-accent);
}

.sidebar-group-toggle,
.sidebar-account-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.sidebar-group-toggle {
    justify-content: space-between;
}

.sidebar-caret {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.7);
    transition: transform 150ms ease;
}

[aria-expanded="true"] > .sidebar-caret {
    transform: rotate(180deg);
}

.sidebar-group-items {
    margin: 0.4rem 0 0.4rem 2rem;
    padding-left: 1rem;
    border-left: 2px solid rgba(255, 255, 255, 0.15);
}

.sidebar-group-items a {
    font-size: 1.3rem;
    padding: 0.8rem 1.5rem;
}

.sidebar-user {
    position: relative;
    padding: 1.2rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-account-toggle {
    gap: 1rem;
    padding: 0.8rem 1rem;
    border-radius: 8px;
}

.sidebar-account-toggle:hover,
.sidebar-account-toggle[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-user .user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 3.6rem;
    height: 3.6rem;
    border-radius: 50%;
    background: var(--color-accent);
    color: var(--color-primary);
    font-size: 1.3rem;
    font-weight: 600;
}

.sidebar-user .user-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.sidebar-user .user-name {
    color: #ffffff;
    font-weight: 500;
    font-size: 1.4rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user .user-role {
    color: var(--color-accent);
    font-size: 1.2rem;
}

.sidebar-user .sidebar-account-menu {
    left: 1rem;
    right: 1rem;
    min-width: 0;
    top: auto;
    bottom: calc(100% + 0.4rem);
}

.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 3rem;
    min-height: 100vh;
}

/* Cards */
.card {
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 2.4rem;
    margin-bottom: 2rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.card-title { font-size: 1.8rem; font-weight: 600; }

.planning-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 3rem 2rem;
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: none;
    border: 2px dashed var(--color-border);
    border-radius: 8px;
    transition: background 150ms ease;
}
.planning-placeholder:hover { background: var(--color-surface); }

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

.stat-card {
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.stat-value {
    font-size: 3.6rem;
    font-weight: 600;
    color: var(--color-primary);
    line-height: 1;
}

.stat-label {
    font-size: 1.3rem;
    color: var(--color-text-secondary);
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card.green .stat-value { color: var(--color-success); }
.stat-card.accent .stat-value { color: var(--color-accent); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 2rem;
    font-family: 'Manrope', system-ui, sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--color-primary);
    color: #ffffff;
}
.btn-primary:hover { background: var(--color-primary-hover); color: #ffffff; }

.btn-accent {
    background: var(--color-accent);
    color: #ffffff;
}
.btn-accent:hover { background: #6a9874; color: #ffffff; }

.btn-secondary {
    background: var(--color-surface-raised);
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}
.btn-secondary:hover { background: var(--color-surface); }

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

.plan-row-actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }

.plan-group {
    margin-top: 1.6rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
}

.plan-group .plan-row-actions {
    padding: 1.2rem 1.6rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}

.plan-group-note { font-size: 1.3rem; color: var(--color-text-secondary); }

.visit-summary-address {
    padding: 1.2rem 1.6rem;
    font-weight: 700;
    background: var(--color-surface-muted);
    border-bottom: 1px solid var(--color-border);
}

.visit-summary-assignment {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.2rem 1.6rem;
    border-bottom: 1px solid var(--color-border);
}


.visit-summary-project { font-weight: 700; }

.visit-summary-project a { text-decoration: underline; }

.visit-summary-product,
.visit-summary-total {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.visit-summary-product { font-size: 1.4rem; color: var(--color-text-secondary); }

.visit-summary-total {
    padding: 1.2rem 1.6rem;
    font-weight: 700;
    border-top: 1px solid var(--color-border);
}

.confirm-visit-title { margin: 0 0 0.8rem; font-size: 1.6rem; }

.plan-card .visit-summary { margin-bottom: 2rem; border: 1px solid var(--color-border); border-radius: 8px; }

.visit-covers {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 1.2rem 1.6rem 1.6rem;
}

.visit-covers-title { font-weight: 700; }

.visit-covers-here {
    margin-left: 0.6rem;
    padding: 0.1rem 0.8rem;
    border-radius: 999px;
    font-size: 1.2rem;
    font-weight: 500;
    color: #fff;
    background: var(--color-primary);
}

.visit-covers-note { font-size: 1.3rem; color: var(--color-text-secondary); }

/* Public pages: the registration form, the thank-you page, the scheduling step and the
   dead-link page. A branded band over a narrow reading column. */
.public-brandbar {
    background: var(--color-surface-muted);
    border-bottom: 3px solid var(--color-primary);
}

.public-brandbar-inner {
    max-width: 68rem;
    margin: 0 auto;
    padding: 2rem 1.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* `align-self` matters: the band is a column flex container, so without it the image
   stretches to the column's width and ignores its own ratio. */
.public-logo { align-self: flex-start; width: auto; height: 5.6rem; max-width: 100%; }

.public-tagline {
    font-size: 1.3rem;
    font-weight: 300;
    color: var(--color-text-secondary);
}

.public-shell {
    max-width: 68rem;
    margin: 0 auto;
    padding-block: 3.2rem 4.8rem;
    padding-left: 1.6rem;
    padding-right: 1.6rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* The customer-facing step's slot blocks, on both routes. `grid-auto-rows` is what makes
   every row match every other one, and `auto-fill` stops a partial last row stretching —
   so a block is the same size whatever its label. */
.slot-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    grid-auto-rows: 1fr;
    gap: 1.2rem;
}

.slot-grid > li { display: flex; }

.slot-button {
    width: 100%;
    min-height: 7.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 1.2rem 1rem;
    text-align: center;
}

.slot-button-date { font-size: 1.3rem; font-weight: 400; }

.slot-button-time { font-size: 1.8rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.slot-button:hover { border-color: var(--color-accent); background: var(--color-surface-muted); }

.slot-button:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* The step's own furniture: the address it is planning, the date control, and the two
   ways to leave without booking. */
.step-address { color: var(--color-text-secondary); font-weight: 500; margin-bottom: 2rem; overflow-wrap: anywhere; }

/* One card for the whole "pick a moment" decision — the date control and the slots it
   produces read as one connected surface rather than two unrelated form sections. */
.plan-card {
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    margin-bottom: 2rem;
}

.datefield .daterow { display: flex; gap: 0.8rem; }

.datefield .daterow .form-control { flex: 1; min-width: 0; }

/* Re-skins the native date input without touching its behaviour: the input itself stays
   type="date" so the platform picker (and its own calendar icon), keyboard entry and
   screen readers are untouched — only the border/background move onto this wrapper and
   the input goes borderless inside it. */
.date-input-shell {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    padding: 0 1.2rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-raised);
    transition: border-color 150ms ease;
}

.date-input-shell:focus-within { border-color: var(--color-primary); }

.date-input-shell .form-control {
    border: none;
    padding: 0.8rem 0;
    background: transparent;
}

.date-input-shell .form-control:focus { outline: none; }

/* Bleeds to the card's edges so the divider spans its full width, then reapplies the
   card's own padding on the sides — margin-top plus border-top (not just border) so the
   divider sits clear of the slots above it instead of touching them. */
.step-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    align-items: center;
    justify-content: space-between;
    margin: 2rem -2rem -2rem;
    padding: 1.6rem 2rem 2rem;
    border-top: 1px solid var(--color-border);
}

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

.step-actions .btn-ghost { border: 1px solid var(--color-border); }

/* The confirm step: same .plan-card shell as the slot grid, with its own three parts
   — the chosen moment, the applicant's details, and a caution that nothing is
   reserved yet. */
.confirm-moment {
    display: flex;
    align-items: center;
    gap: 1.4rem;
    padding: 1.4rem 1.6rem;
    background: var(--color-surface-muted);
    border-radius: 8px;
    margin-bottom: 2rem;
}

.confirm-moment-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 5.6rem;
    height: 5.6rem;
    background: var(--color-primary);
    color: #fff;
    border-radius: 8px;
}

.confirm-moment-day { font-size: 2rem; font-weight: 600; line-height: 1; }
.confirm-moment-month { font-size: 1.1rem; text-transform: uppercase; letter-spacing: 0.03em; margin-top: 0.2rem; }

.confirm-moment-text { display: flex; flex-direction: column; gap: 0.2rem; }
.confirm-moment-weekday { font-weight: 600; font-size: 1.6rem; }
.confirm-moment-time { color: var(--color-text-secondary); font-variant-numeric: tabular-nums; }

.confirm-details {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 2rem;
}

.confirm-details-row {
    display: grid;
    grid-template-columns: 11rem 1fr;
    gap: 0.8rem;
    font-size: 1.4rem;
}

.confirm-details-row dt { color: var(--color-text-secondary); }
.confirm-details-row dd { font-weight: 500; overflow-wrap: anywhere; }

.confirm-caution {
    display: flex;
    gap: 0.8rem;
    padding: 1.2rem 1.4rem;
    background: var(--color-surface-muted);
    border-left: 3px solid var(--color-warning);
    border-radius: 8px;
    font-size: 1.3rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

/* Employee plan screen: the slots fill the card as selectable badges. */
.slot-picker {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
    gap: 1rem;
}

.slot-option {
    position: relative;
    display: block;
    padding: 1.2rem 1.4rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-raised);
    cursor: pointer;
}

/* The radio keeps the tab order and the label semantics; only its box is hidden. */
.slot-option input { position: absolute; opacity: 0; pointer-events: none; }

.slot-option:hover { border-color: var(--color-accent); }

.slot-option:has(input:checked) {
    border-color: var(--color-primary);
    box-shadow: inset 0 0 0 1px var(--color-primary);
}

.slot-option:has(input:focus-visible) {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.slot-option-date { display: block; font-size: 1.3rem; color: var(--color-text-secondary); }
.slot-option-time { display: block; font-size: 1.6rem; font-weight: 600; }

.slot-option-advisor {
    display: block;
    font-size: 1.2rem;
    color: var(--color-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-danger {
    background: var(--color-error);
    color: #ffffff;
}
.btn-danger:hover { background: #b91c1c; color: #ffffff; }

.btn-sm { padding: 0.4rem 1.2rem; font-size: 1.2rem; }

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

@keyframes btn-spin { to { transform: rotate(360deg); } }

.btn:active:not(:disabled) { transform: translateY(1px); filter: brightness(0.92); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.is-loading { position: relative; opacity: 1; cursor: progress; --spinner: #ffffff; color: transparent; }
.btn-secondary.is-loading, .btn-ghost.is-loading { --spinner: var(--color-primary); }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.4rem;
    height: 1.4rem;
    margin: -0.7rem 0 0 -0.7rem;
    box-sizing: border-box;
    border: 2px solid var(--spinner);
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.7s linear infinite;
}

.btn-icon-square {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    flex-shrink: 0;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: transparent;
    color: var(--color-text-primary);
    cursor: pointer;
}
.btn-icon-square:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-icon-square.is-loading { opacity: 1; cursor: progress; }
.btn-icon-square.is-loading > * { visibility: hidden; }
.btn-icon-square.is-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.4rem;
    height: 1.4rem;
    margin: -0.7rem 0 0 -0.7rem;
    box-sizing: border-box;
    border: 2px solid var(--color-primary);
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.7s linear infinite;
}

/* Tables */
.table-container { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.4rem;
}

thead { background: var(--color-surface); }

th {
    text-align: left;
    padding: 1.2rem 1.5rem;
    font-weight: 600;
    color: var(--color-text-primary);
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--color-border);
}

td {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

tr:hover { background: var(--color-surface); }

/* Sortable table headers */
th[data-col] {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th[data-col]:hover {
    background: #e8eef0;
}

.sort-indicator {
    display: inline-block;
    margin-left: 0.4rem;
    color: var(--color-text-secondary);
    font-size: 1rem;
    font-style: normal;
}

/* Badges / Status */
.badge {
    display: inline-block;
    padding: 0.2rem 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-draft { background: #f2f5f7; color: var(--color-text-secondary); }
.badge-submitted { background: #f2f5f7; color: var(--color-text-secondary); }
.badge-approved { background: #dcfce7; color: var(--color-success); }
.badge-registered { background: #dcfce7; color: var(--color-success); }
.badge-in_assessment { background: #fef3c7; color: #92400e; }
.badge-assessed { background: #d1fae5; color: #065f46; }
.badge-in_handling { background: #ede9fe; color: #5b21b6; }
.badge-completed { background: var(--color-success); color: #ffffff; }
.badge-rejected { background: var(--color-error); color: #ffffff; }
.badge-fraud_investigation,
.badge-invitation-failed { background: #fecdd3; color: #9f1239; }
.badge-escalated { background: #fed7aa; color: #9a3412; }

.badge-neutral { background: #f2f5f7; color: var(--color-text-secondary); }

.badge-concept { background: #f2f5f7; color: var(--color-text-secondary); }
.badge-aangemeld { background: #dbeafe; color: #1e40af; }
.badge-ingepland { background: #ede9fe; color: #5b21b6; }
.badge-controle { background: #fef3c7; color: #92400e; }
.badge-uitgevoerd { background: #d1fae5; color: #065f46; }
.badge-opgeleverd { background: #a7f3d0; color: #064e3b; }
.badge-gefactureerd { background: var(--color-success); color: #ffffff; }
.badge-geannuleerd { background: var(--color-error); color: #ffffff; }

/* Planning board */
/* contain stops the table's width from inflating the flex column that holds it,
   so the board scrolls inside its own card instead of the whole page. */
.planbord-scroll { overflow-x: auto; contain: inline-size; }

.planbord th, .planbord td { text-align: center; }
.planbord th:first-child, .planbord td:first-child { text-align: left; white-space: nowrap; }

.planbord-closed { background: var(--color-surface); color: var(--color-text-secondary); }

/* One body row: each lane is a column the height of the day, with a line per grid row,
   and every entry is placed on it by its own time. */
.planbord { --planbord-row: 5.2rem; }
.planbord tbody th, .planbord tbody td {
    padding: 0;
    height: calc(var(--planbord-rows) * var(--planbord-row));
    vertical-align: top;
    background-image: repeating-linear-gradient(
        to bottom,
        var(--color-border) 0 1px,
        transparent 1px var(--planbord-row)
    );
}
.planbord-times { width: 1%; }
.planbord-time {
    height: var(--planbord-row);
    box-sizing: border-box;
    padding: 0.6rem 1.5rem 0;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--color-text-primary);
}
.planbord-lane {
    position: relative;
    min-width: 16rem;
    border-left: 1px solid var(--color-border);
}

.planbord-block {
    position: absolute;
    z-index: 1;
    box-sizing: border-box;
    border: 2px solid transparent;
    background-clip: padding-box;
    overflow: hidden;
    text-align: left;
}
.planbord-whole-day { z-index: 0; display: flex; align-items: center; justify-content: center; }

.planbord-visit {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.4rem 0.8rem;
    background-color: color-mix(in srgb, var(--color-accent) 25%, #ffffff);
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px var(--color-accent);
    color: var(--color-text-primary);
    font-size: 1.2rem;
    line-height: 1.35;
}
.planbord-visit-compact { flex-direction: row; flex-wrap: wrap; column-gap: 0.6rem; padding-block: 0.2rem; }
.planbord-visit-time { font-weight: 700; }
.planbord-visit a { color: var(--color-text-primary); font-weight: 500; }
.planbord-visit a:hover { color: var(--color-primary-hover); }

.planbord-offgrid, .planbord-outlook-failed { align-self: flex-start; }

.planbord-offgrid {
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    opacity: 0.85;
}

/* The Outlook write failed, not just a placement quirk — a warning pill, not offgrid's plain text. */
.planbord-outlook-failed {
    display: inline-block;
    padding: 0.1rem 0.6rem;
    border-radius: 20px;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
}

.planbord-leave, .planbord-busy {
    padding: 0.4rem 0.8rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 6px;
    color: var(--color-text-secondary);
}

.planbord-leave { background-color: var(--color-surface-muted); }

.schedule-window-cell { white-space: nowrap; }

/* Free/busy from Outlook: striped so it reads as time taken elsewhere, not as leave. */
.planbord-busy {
    outline: 1px dashed #b8bec4;
    outline-offset: -3px;
    background: repeating-linear-gradient(
        45deg,
        var(--color-surface),
        var(--color-surface) 6px,
        var(--color-surface-raised) 6px,
        var(--color-surface-raised) 12px
    );
    background-clip: padding-box;
    color: var(--color-text-secondary);
}

.planbord-waarschuwing {
    margin: 0 0 1.2rem;
    padding: 0.8rem 1.2rem;
    border-radius: 6px;
    border: 1px solid var(--color-warning);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 1.3rem;
}

/* Forms */
.form-group { margin-bottom: 2rem; }

.form-group label {
    display: block;
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: 0.6rem;
}

/* Hint under a field. Templates already used this class; it had no rule, so the
   text rendered at body size in the primary colour. */
.form-help {
    font-size: 1.3rem;
    color: var(--color-text-secondary);
    margin-top: 0.6rem;
}

.form-control {
    width: 100%;
    padding: 0.8rem 1.2rem;
    font-family: 'Manrope', system-ui, sans-serif;
    font-size: 1.6rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-raised);
    color: var(--color-text-primary);
    transition: border-color 150ms ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-control::placeholder { color: var(--color-text-secondary); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px 12px;
    padding-right: 3rem;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Multi-select (enum in/not_in value picker) */
.ms { position: relative; }

.ms-trigger {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    min-height: 4.2rem;
    padding: 0.6rem 3rem 0.6rem 1.2rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-raised);
    cursor: pointer;
}

.ms-placeholder { color: var(--color-text-secondary); font-size: 1.6rem; }

.ms-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.8rem;
    font-size: 1.3rem;
    font-weight: 500;
    border-radius: 20px;
    background: var(--color-accent);
    color: #ffffff;
}

.ms-chip-x {
    border: none;
    background: none;
    color: inherit;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.ms-caret {
    position: absolute;
    right: 1.2rem;
    top: 2.1rem;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
    font-size: 1.2rem;
    pointer-events: none;
}

.ms-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 220px;
    overflow-y: auto;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 0.4rem;
}

.ms-option {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 0.8rem;
    font-size: 1.5rem;
    border-radius: 6px;
    cursor: pointer;
}

.ms-option:hover { background: var(--color-surface); }
.ms-option input { cursor: pointer; }

/* Advisor picker (product form) */
.advisor-picker-field { position: relative; }

.advisor-picker-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.8rem;
}

.advisor-picker-option {
    width: 100%;
    border: none;
    background: none;
    font: inherit;
    color: inherit;
    text-align: left;
}

.advisor-picker-empty {
    padding: 0.6rem 0.8rem;
    margin: 0;
    font-size: 1.4rem;
    color: var(--color-text-secondary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* Alerts */
.alert {
    padding: 1.2rem 1.6rem;
    margin-top: 1.6rem;
    margin-bottom: 2rem;
    font-size: 1.4rem;
    font-weight: 500;
    border-radius: 8px;
}

.alert-error {
    background: #fef2f2;
    color: var(--color-error);
    border-left: 4px solid var(--color-error);
}

.alert-success {
    background: #f0fdf4;
    color: var(--color-success);
    border-left: 4px solid var(--color-success);
}

.alert-info {
    background: #eff6ff;
    color: #1d4ed8;
    border-left: 4px solid #1d4ed8;
}

/* Process Progress */
.process-progress { margin: 2rem 0; }

.progress-bar-container {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    height: 8px;
    border-radius: 4px;
    width: 100%;
    margin-bottom: 0.5rem;
}

.progress-bar {
    background: var(--color-success);
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-label {
    font-size: 1.2rem;
    color: var(--color-text-secondary);
}

/* Task list */
.task-list { list-style: none; }

.task-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    transition: background 150ms ease;
}

.task-item:hover { background: var(--color-surface); }

.task-status-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    flex-shrink: 0;
}

.task-status-icon.completed { background: var(--color-success); color: #ffffff; }
.task-status-icon.available { background: var(--color-accent); color: #ffffff; }
.task-status-icon.pending { background: #94a3b8; color: #ffffff; }
.task-status-icon.skipped { background: var(--color-surface); color: #94a3b8; }

.task-info { flex: 1; }
.task-name { font-weight: 600; font-size: 1.4rem; }
.task-role { font-size: 1.2rem; color: var(--color-text-secondary); }

/* Auth — split panel */
body.auth-split {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--color-surface-raised);
}

.auth-brand {
    width: 50%;
    background-color: var(--color-primary);
    background-image:
        linear-gradient(rgba(16, 55, 19, 0.78), rgba(16, 55, 19, 0.78)),
        url('https://energieploeg.nl/wp-content/uploads/2025/03/Loppersum-0426-small.jpg');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    padding: 48px;
    flex-shrink: 0;
}

.auth-brand-content {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    width: 100%;
}

.auth-wordmark {
    color: #ffffff;
    font-size: 2.8rem;
    font-weight: 600;
}

.auth-portal-label {
    color: var(--color-accent);
    font-size: 1.4rem;
    font-weight: 500;
    margin-top: 4px;
}

.auth-tagline {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.4rem;
    line-height: 1.6;
    max-width: 320px;
}

.auth-form-panel {
    width: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    background: var(--color-surface-raised);
    overflow-y: auto;
}

.auth-form-inner {
    width: 100%;
    max-width: 360px;
}

.auth-heading {
    font-size: 2.4rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 0.4rem;
}

.auth-subtext {
    font-size: 1.4rem;
    color: var(--color-text-secondary);
    margin-bottom: 3.2rem;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.page-title {
    font-size: 2.8rem;
    font-weight: 600;
}

.breadcrumbs {
    font-size: 1.3rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.5rem;
}

.breadcrumbs a { color: var(--color-accent); }

/* HTMX loading indicator */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-request.htmx-indicator { display: inline-block; }

/* Alpine cloak — prevent flash of un-evaluated markup before Alpine boots */
[x-cloak] { display: none !important; }

/* Modal — Alpine-driven dialog, editorial admin aesthetic */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 31, 12, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 2.4rem;
}

.modal-panel {
    background: var(--color-surface-raised);
    border-radius: 14px;
    box-shadow:
        0 32px 80px rgba(10, 31, 12, 0.32),
        0 0 0 1px rgba(16, 55, 19, 0.08);
    width: min(540px, 100%);
    max-height: calc(100vh - 4.8rem);
    /* `.modal-panel-wide` is for pickers that need columns, not a form column. */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-panel-wide { width: min(760px, 100%); }
.modal-panel-email { width: min(640px, 100%); }

/* The panel is the flex column, but every modal nests body and footer inside a form,
   so the form has to carry the column too or the body never shrinks and cannot scroll. */
.modal-panel > form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.email-field {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    min-height: 4.2rem;
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-raised);
}

.email-field:focus-within { border-color: var(--color-primary); }

.email-field input {
    flex: 1;
    min-width: 15rem;
    border: none;
    outline: none;
    padding: 0.4rem;
    font-family: inherit;
    font-size: 1.4rem;
    background: transparent;
    color: var(--color-text-primary);
}

.email-file-row {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 0.8rem 1.2rem;
    margin-bottom: 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.modal-header {
    padding: 3rem 3.2rem 2.4rem;
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    flex-shrink: 0;
}

.modal-heading-block { flex: 1; min-width: 0; }

.modal-eyebrow {
    display: block;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin-bottom: 1rem;
}

.modal-title {
    font-size: 2.4rem;
    font-weight: 600;
    line-height: 1.15;
    color: var(--color-text-primary);
    margin: 0;
    padding-left: 1.4rem;
    border-left: 3px solid var(--color-accent);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-size: 2.4rem;
    line-height: 1;
    padding: 0.4rem 0.8rem;
    margin: -0.4rem -0.8rem 0 0;
    border-radius: 8px;
    transition: background 150ms ease, color 150ms ease;
    flex-shrink: 0;
}

.modal-close:hover { background: var(--color-surface); color: var(--color-text-primary); }
.modal-close:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.modal-body { padding: 0 3.2rem 2.4rem; overflow-y: auto; min-height: 0; }

.modal-section { margin-top: 2.8rem; }
.modal-section:first-child { margin-top: 0; }

.modal-section-heading {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-text-primary);
    margin: 0 0 1rem;
}

.modal-section-hint {
    font-size: 1.3rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin: -0.4rem 0 1.4rem;
}

.modal-section .form-group { margin-bottom: 0; }
.modal-section .form-row { gap: 1.6rem; }

.field-label-micro {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    margin-bottom: 0.8rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    flex-shrink: 0;
    padding: 2rem 3.2rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}

.row-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
}

/* Modal panel entrance: subtle scale + opacity */
.modal-enter {
    transition: opacity 220ms ease-out, transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-enter-start { opacity: 0; transform: translateY(6px) scale(0.97); }
.modal-enter-end { opacity: 1; transform: translateY(0) scale(1); }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--color-text-secondary);
}

.empty-state h3 { color: var(--color-primary); margin-bottom: 1rem; }

/* List search */
.card-header .search-field { flex: 1; max-width: 36rem; margin-left: 1.6rem; }
.search-field { position: relative; }
.search-field svg {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.6rem;
    height: 1.6rem;
    color: var(--color-text-secondary);
    pointer-events: none;
}
.search-field .form-control { padding-left: 3.6rem; padding-right: 3.6rem; }
.card-header .search-field .form-control { font-size: 1.4rem; }
.list-filters { display: flex; gap: 1rem; flex: 1; justify-content: flex-end; margin-left: 1.6rem; }
.list-filters .search-field { margin-left: 0; }
.list-filters select.form-control { width: auto; min-width: 16rem; font-size: 1.4rem; }
.search-field .form-control::-webkit-search-cancel-button { display: none; }
.search-clear {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    cursor: pointer;
    color: var(--color-text-secondary);
    font-size: 1.8rem;
    line-height: 1;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
}
.search-clear:hover { background: var(--color-surface-muted); color: var(--color-text-primary); }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    body.auth-split {
        flex-direction: column;
        height: auto;
        overflow: auto;
    }

    .auth-brand {
        width: 100%;
        height: 80px;
        padding: 0 24px;
        align-items: center;
    }

    .auth-brand-content {
        flex-direction: row;
        align-items: center;
        height: auto;
    }

    .auth-tagline { display: none; }

    .auth-form-panel {
        width: 100%;
        padding: 32px 24px;
    }
}

/* Selectable choice cards — radio/checkbox rendered as bordered option cards */
.choice-group { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 0.5rem; }
.choice-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0.85rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    font-weight: normal;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.choice-card:hover { border-color: var(--color-primary); }
.choice-card:has(input:checked) {
    border-color: var(--color-primary);
    box-shadow: inset 0 0 0 1px var(--color-primary);
    background: #f2f5f7;
}
.choice-card input { margin: 0; accent-color: var(--color-primary); }

/* Two-column form row — pairs related fields side by side */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Modal overlay (Alpine-driven) */
.modal-overlay {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(0, 0, 0, 0.4);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.modal-card {
    background: var(--color-surface-raised);
    border-radius: 8px;
    box-shadow: var(--shadow);
    width: 100%; max-width: 44rem;
    max-height: 90vh; overflow-y: auto;
    padding: 1.5rem;
}
.modal-card h3 { margin: 0 0 1rem; color: var(--color-text-primary); }
.modal-actions { display: flex; gap: 1rem; margin-top: 1.5rem; }
.modal-card-wide { width: 75vw; max-width: none; padding: 2.4rem 3rem; }

/* Registration import: column mapping panel */
.import-mapping { display: flex; flex-direction: column; gap: 1.6rem; margin-top: 1.6rem; }
.import-mapping .alert { margin: 0; }
.import-mapping p,
.import-mapping h4 { margin: 0; }
.import-mapping-intro { color: var(--color-text-secondary); }
.import-mapping-columns { table-layout: fixed; }
.import-mapping-columns td { vertical-align: middle; padding-top: 0.8rem; padding-bottom: 0.8rem; }
.import-mapping-toggle { margin-top: 0.8rem; padding-left: 0; }
.import-mapping-preview { display: flex; flex-direction: column; gap: 1rem; }
.import-mapping-actions { display: flex; justify-content: flex-end; }
.mapping-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem 1rem; max-width: 60rem; }
.mapping-cell > select { flex: 0 0 20rem; width: 20rem; }
.mapping-cell label { flex: 1 0 100%; display: flex; align-items: center; gap: 1rem; font-size: 1.3rem; color: var(--color-text-secondary); }
.mapping-cell label select { width: 24rem; }
.mapping-row-error td { background: #fdeceb; }
.mapping-row-error td:first-child { box-shadow: inset 4px 0 0 var(--color-error); }
.import-mapping-errors { margin: 0.6rem 0 0; padding-left: 2rem; font-weight: 400; }
.mapping-parts { flex: 0 0 24rem; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.mapping-chip {
    display: inline-flex; align-items: center; gap: 0.6rem;
    padding: 0.4rem 0.4rem 0.4rem 1rem;
    background: #f2f5f7; color: var(--color-text-primary);
    border-radius: 6px; font-size: 1.2rem; font-weight: 600; text-transform: uppercase;
}
.mapping-chip button {
    border: 0; background: none; cursor: pointer;
    padding: 0 0.6rem; font-size: 1.6rem; line-height: 1; color: inherit;
}

/* Hide the contact-persons section when the customer type is individual.
   Reactive to the type radios without JS, so it works with the HTMX field toggle. */
form:has(input[name="customer_type"][value="particulier"]:checked) #contact-persons-section {
    display: none;
}

[x-cloak] { display: none !important; }

/* Attachment list — aligned with surrounding content, no browser bullets/indent */
.attachment-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.attachment-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
}
.btn-icon-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0.15rem;
    cursor: pointer;
    color: var(--color-text-secondary);
    line-height: 0;
}
.btn-icon-danger:hover {
    color: #c0392b;
}

/* Status dropdown — a primary button that opens its own menu (assignment detail).
   The row-actions menu shares the shell; only its trigger differs. */
.status-dropdown,
.row-actions-dropdown { position: relative; display: inline-block; }
.status-dropdown-menu,
.row-actions-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.4rem);
    min-width: 100%;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 0.4rem 0;
    z-index: 20;
    text-align: left;
}
.status-dropdown-menu button,
.row-actions-menu button,
.row-actions-menu a {
    display: block;
    width: 100%;
    padding: 0.8rem 1.6rem;
    background: none;
    border: none;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    font-family: inherit;
    font-size: 1.4rem;
    color: var(--color-text-primary);
}
.status-dropdown-menu button:hover,
.row-actions-menu button:hover,
.row-actions-menu a:hover { background: var(--color-surface); }
.status-dropdown-menu button[aria-selected="true"] { font-weight: 600; }

/* Icon-only ⋮ trigger: no chrome, so the dots sit flush in the cell. */
.row-actions-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--color-text-secondary);
}
.row-actions-trigger:hover { background: var(--color-surface); color: var(--color-text-primary); }

/* Branded 500 page */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.6rem;
    text-align: center;
}

.error-page-hero {
    position: relative;
    width: 100%;
    min-height: 32rem;
    margin-bottom: 1.6rem;
    border-radius: 14px;
    background:
        linear-gradient(170deg, var(--color-primary) 0 55%, transparent 55.2%),
        var(--color-surface-raised);
    box-shadow: 0 1px 3px rgba(16, 55, 19, 0.08);
    overflow: hidden;
}

.error-page-code {
    position: absolute;
    top: 2.4rem;
    left: 3.2rem;
    font-size: 12rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.4rem;
    color: #ffffff;
}

.error-page-art {
    position: absolute;
    right: 4rem;
    bottom: 1.6rem;
    width: 30rem;
    height: auto;
}

.error-page h1 { font-size: 2.8rem; font-weight: 700; color: var(--color-primary); }
.error-page p { max-width: 44rem; font-size: 1.6rem; color: var(--color-text-secondary); }
.error-page-btn { border-radius: 999px; padding-inline: 3.2rem; }

@media (max-width: 640px) {
    .error-page-hero { min-height: 0; display: flex; flex-direction: column; align-items: center; padding-top: 2.4rem; }
    .error-page-code { position: static; font-size: 8rem; }
    .error-page-art { position: static; width: min(26rem, 90%); margin-top: 1.6rem; }
}

#htmx-error {
    position: fixed;
    top: 1.6rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    width: min(48rem, calc(100% - 3.2rem));
}

.page-intro {
    max-width: 64rem;
    margin-top: 0.6rem;
    font-size: 1.4rem;
    color: var(--color-text-secondary);
}

/* API keys */
.api-key-page .form-error {
    margin-top: 0.6rem;
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--color-error);
}
.secret-warning {
    margin: 2rem 0 0;
    font-weight: 400;
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--color-warning);
}
.key-prefix {
    display: block;
    margin-top: 0.2rem;
    font-size: 1.2rem;
    color: var(--color-text-secondary);
}

.page-title-row { display: flex; align-items: center; gap: 1.2rem; }
.page-title-row .page-title { margin-bottom: 0; }

.key-meta { display: flex; flex-wrap: wrap; gap: 1.6rem 4rem; }
.key-meta dt {
    font-size: 1.2rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-secondary);
    margin-bottom: 0.2rem;
}
.key-meta dd { font-size: 1.4rem; }
.key-meta-note { margin-left: 0.6rem; font-size: 1.3rem; color: var(--color-text-secondary); }

/* Form with a sticky side column; the side column drops below on narrow screens. */
.form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 32rem;
    gap: 2.4rem;
    align-items: start;
}
.form-aside { position: sticky; top: 3rem; }
.form-aside .btn:disabled { opacity: 0.5; cursor: not-allowed; }
.form-group-narrow { max-width: 56rem; }

.section-title { display: flex; align-items: center; gap: 1rem; margin-bottom: 0; }
.section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    background: var(--color-primary);
    color: #ffffff;
    font-size: 1.3rem;
    font-weight: 700;
}

.option-group { border: none; margin-bottom: 2rem; }
.option-group:last-of-type { margin-bottom: 0; }
.option-group-help { margin: -0.4rem 0 1.2rem; }

.option-row {
    display: flex;
    align-items: flex-start;
    gap: 1.2rem;
    padding: 1.4rem 1.6rem;
    margin-bottom: 1rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-raised);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.option-row:hover { border-color: var(--color-primary); }
.option-row:has(input:checked) {
    border-color: var(--color-primary);
    box-shadow: inset 0 0 0 1px var(--color-primary);
    background: var(--color-surface-muted);
}
.option-row:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.option-row input { margin-top: 0.4rem; accent-color: var(--color-primary); }
.option-row-body { flex: 1; min-width: 0; }
.option-row-title { display: block; font-size: 1.5rem; font-weight: 600; }
.option-row-desc { display: block; font-size: 1.3rem; color: var(--color-text-secondary); }
.scope-code { font-size: 1.2rem; color: var(--color-text-secondary); }

.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(26rem, 1fr));
    gap: 0.8rem 2rem;
}
.check-inline { display: flex; align-items: center; gap: 0.8rem; font-size: 1.4rem; cursor: pointer; }
.check-inline input { accent-color: var(--color-primary); }

.reach-group {
    border: none;
    padding-bottom: 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--color-border);
}
.reach-group legend { font-size: 1.5rem; font-weight: 600; margin-bottom: 1rem; }

.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0.3rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-muted);
}
.segmented button {
    padding: 0.6rem 1.6rem;
    font-family: inherit;
    font-size: 1.4rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
}
.segmented button:hover { color: var(--color-text-primary); }
.segmented button[aria-pressed="true"] { background: var(--color-primary); color: #ffffff; }
.segmented button:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.record-picker { margin-top: 1.2rem; }
.record-picker .search-field { margin-bottom: 0.8rem; }
.record-picker .search-field .form-control { font-size: 1.4rem; }
.record-picker-list {
    max-height: 26rem;
    overflow-y: auto;
    padding: 0.4rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
}
.record-picker-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    font-size: 1.4rem;
    border-radius: 6px;
    cursor: pointer;
}
.record-picker-option:hover { background: var(--color-surface); }
.record-picker-option:has(input:checked) { background: var(--color-surface-muted); }
.record-picker-option input { accent-color: var(--color-primary); }
.record-picker-name { display: block; font-weight: 500; }
.record-picker-detail { display: block; font-size: 1.2rem; color: var(--color-text-secondary); }
.record-picker-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 1rem; }
.record-picker-count { margin-right: 0.4rem; font-size: 1.3rem; color: var(--color-text-secondary); }
.record-picker-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem 0.4rem 0.2rem 1rem;
    font-size: 1.3rem;
    font-weight: 500;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    background: var(--color-surface-muted);
    color: var(--color-text-primary);
}
.record-picker-chip button {
    padding: 0 0.6rem;
    font-size: 1.6rem;
    line-height: 1.4;
    border: none;
    border-radius: 50%;
    background: none;
    color: var(--color-text-secondary);
    cursor: pointer;
}
.record-picker-chip button:hover { background: var(--color-border); color: var(--color-text-primary); }
.record-picker-chip button:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.record-picker-empty {
    padding: 2.4rem 2rem;
    text-align: center;
    color: var(--color-text-secondary);
    border: 2px dashed var(--color-border);
    border-radius: 8px;
}
.record-picker-empty h3 { font-size: 1.6rem; color: var(--color-primary); }
.record-picker-empty p { max-width: 48rem; margin: 0 auto 1.2rem; font-size: 1.4rem; }

.form-note { margin: 0 0 1.2rem; font-weight: 400; }
.form-note:last-child { margin-bottom: 0; }

.expiry-options { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.expiry-options .choice-group { margin-top: 0; }
.expiry-options .form-control { width: auto; }
.expiry-options .form-control:disabled { opacity: 0.5; }

.summary-text { margin-bottom: 2rem; font-size: 1.5rem; line-height: 1.6; }
.summary-actions { display: flex; flex-direction: column; gap: 0.8rem; }
.aside-text { margin-bottom: 1.6rem; font-size: 1.4rem; color: var(--color-text-secondary); }

@media (max-width: 1100px) {
    .form-layout { grid-template-columns: minmax(0, 1fr); }
    .form-aside { position: static; }
}

.modal-subtitle { margin: 0.8rem 0 0; padding-left: 1.7rem; font-size: 1.4rem; color: var(--color-text-secondary); }
.modal-footer-hint { margin-right: auto; font-size: 1.3rem; color: var(--color-text-secondary); }

.secret-box {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 1rem 1rem 1rem 1.4rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-muted);
}
.secret-box code { flex: 1; min-width: 0; font-size: 1.4rem; word-break: break-all; }
.secret-box .btn { flex-shrink: 0; }

.code-block {
    margin: 0 0 1rem;
    padding: 1.2rem 1.4rem;
    overflow-x: auto;
    font-size: 1.3rem;
    line-height: 1.6;
    border-radius: 8px;
    background: var(--color-primary);
    color: #ffffff;
}
.secret-docs { margin: 0; }

/* Assignment request work queue */
.nav-count {
    margin-left: auto;
    min-width: 2rem;
    padding: 0.1rem 0.7rem;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    border-radius: 20px;
    background: var(--color-accent);
    color: #ffffff;
}

.request-tabs { display: flex; gap: 0.4rem; }
.request-tab,
.request-label {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1.2rem;
    font-size: 1.4rem;
    font-weight: 500;
    border-radius: 8px;
    color: var(--color-text-secondary);
}
.request-tab:hover,
.request-label:hover { background: #f2f5f7; }
.request-tab.active,
.request-label.active { background: #f2f5f7; color: var(--color-text); font-weight: 600; }
.request-tab-count { font-size: 1.2rem; color: var(--color-text-secondary); }
.request-labels { display: flex; gap: 0.4rem; padding: 0 1.6rem 1rem; flex-wrap: wrap; }

.request-meta { margin: 0.4rem 0 0; color: var(--color-text-secondary); font-size: 1.4rem; }
.request-blocks { padding: 0.4rem 1.6rem; }
.request-block { border-bottom: 1px solid var(--color-border, #e5e7eb); padding: 1.2rem 0; }
.request-block:last-child { border-bottom: 0; }
.request-block > summary { display: flex; align-items: center; gap: 1rem; cursor: pointer; font-size: 1.6rem; font-weight: 600; }
.request-fields { display: grid; grid-template-columns: 14rem 1fr; gap: 0.6rem 1.6rem; margin: 1.2rem 0 0; font-size: 1.4rem; }
.request-fields dt { color: var(--color-text-secondary); }
.request-fields dd { margin: 0; }
.request-empty { margin: 1.2rem 0 0; color: var(--color-text-secondary); }
.request-verloop { list-style: none; margin: 1.2rem 0 0; padding: 0; display: grid; gap: 0.8rem; font-size: 1.4rem; }
.request-verloop li { display: grid; grid-template-columns: 15rem 12rem 1fr; gap: 1.2rem; }
.request-verloop-time { color: var(--color-text-secondary); }
.request-verloop-who { font-weight: 500; }
.request-payload { margin: 1.2rem 0 0; padding: 1.2rem; overflow-x: auto; background: #f2f5f7; border-radius: 8px; font-size: 1.2rem; }

.page-actions { display: flex; gap: 1rem; align-items: flex-start; }
.request-edit { margin-left: auto; }
.form-static { margin: 0; font-size: 1.4rem; }

.request-group { margin: 1.6rem 0 0.4rem; font-size: 1.4rem; font-weight: 600; }
.request-project { margin: 0.8rem 0; font-size: 1.4rem; }
.request-product { display: block; margin: 0.3rem 0 0 1.6rem; }
.request-reason { color: var(--color-text-secondary); font-size: 1.2rem; }
/* Invoicing overview */
.invoicing-filters { display: flex; flex-wrap: wrap; gap: 1.6rem; align-items: flex-end; padding: 1.6rem 0; }
.invoicing-filters .form-group { margin-bottom: 0; min-width: 18rem; }
.invoicing-filters .form-group > label { font-size: 1.2rem; font-weight: 600; color: var(--color-text-secondary); }
.invoicing-filters .multi-select-toggle { height: 4rem; padding-block: 0; font-size: 1.4rem; }
.invoicing-reset { font-size: 1.4rem; color: var(--color-text-secondary); }
.invoicing-reset:hover { color: var(--color-text-primary); text-decoration: underline; }
.multi-select { position: relative; }
.multi-select-toggle { text-align: left; cursor: pointer; }
.multi-select-menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    z-index: 20;
    min-width: 100%;
    max-height: 30rem;
    overflow-y: auto;
    padding: 0.8rem;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.multi-select-menu label { display: flex; gap: 0.8rem; align-items: center; padding: 0.5rem 0.4rem; font-weight: 400; white-space: nowrap; cursor: pointer; }
.invoicing-filters .segmented { display: inline-flex; flex-wrap: nowrap; gap: 0; padding: 0; height: 4rem; background: var(--color-surface-raised); border: 1px solid var(--color-border); border-radius: 8px; overflow: hidden; }
.invoicing-filters .segmented label { display: flex; margin: 0; cursor: pointer; }
.invoicing-filters .segmented input { position: absolute; opacity: 0; pointer-events: none; }
.invoicing-filters .segmented span { display: flex; align-items: center; padding: 0 1.4rem; font-size: 1.4rem; font-weight: 500; color: var(--color-text-secondary); background: var(--color-surface-raised); white-space: nowrap; }
.invoicing-filters .segmented label + label span { border-left: 1px solid var(--color-border); }
.invoicing-filters .segmented span:hover { color: var(--color-text-primary); }
.invoicing-filters .segmented input:checked + span { background: var(--color-accent); color: #ffffff; font-weight: 600; }
.invoicing-filters .segmented input:focus-visible + span { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.invoicing-toolbar { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1.6rem; align-items: center; min-height: 6.4rem; padding: 1rem 1.6rem; background: var(--color-surface-muted); border-top: 1px solid var(--color-border); }
.invoicing-selection { white-space: nowrap; display: flex; align-items: center; gap: 1.2rem; }
.invoicing-selection input { margin: 0; }
.invoicing-total { text-align: center; color: var(--color-text-secondary); }
.invoicing-toolbar .status-dropdown { justify-self: end; }
@media (max-width: 760px) {
    .invoicing-filters .form-group, .invoicing-filters .multi-select-toggle { width: 100%; }
    .invoicing-filters .form-group:has(.segmented) { overflow-x: auto; }
    .invoicing-toolbar { grid-template-columns: 1fr auto; }
    .invoicing-total { grid-column: 1 / -1; grid-row: 2; text-align: left; }
}
.invoicing-pager { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; border-top: 1px solid var(--color-border); }

/* Invoicing terms editor */
.terms-card { max-width: 64rem; background: var(--color-surface-raised); border: 1px solid var(--color-border); border-radius: 1.2rem; padding: 1.6rem 2rem; }
.terms-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.terms-presets { display: flex; gap: 0.6rem; }
.terms-chip { font: inherit; font-size: 1.2rem; padding: 0.4rem 1rem; border-radius: 0.8rem; border: 1px solid var(--color-border); background: var(--color-surface-raised); cursor: pointer; }
.terms-chip.on { background: #e6f1fb; color: #0c447c; border-color: #85b7eb; }
.terms-hint { font-size: 1.2rem; color: var(--color-text-secondary); margin: 0 0 1.2rem; }
.terms-bar { display: flex; height: 2.8rem; border-radius: 0.8rem; overflow: hidden; margin-bottom: 1.2rem; font-size: 1.2rem; }
.terms-bar > div { display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; background: #e6f1fb; color: #0c447c; border-right: 2px solid #fff; }
.terms-bar > div.rest { background: #eaf3de; color: #27500a; }
.terms-row { display: grid; grid-template-columns: 2.8rem 1fr 1fr 3.6rem; gap: 0.8rem; align-items: center; padding: 0.8rem 0; border-bottom: 1px solid var(--color-surface-muted); }
.terms-row-head { padding-top: 0; font-size: 1.2rem; color: var(--color-text-secondary); }
.terms-nr { font-size: 1.3rem; color: var(--color-text-secondary); }
.terms-fixed { font-size: 1.4rem; padding-left: 0.4rem; }
.terms-lock { text-align: center; color: var(--color-text-secondary); }
.terms-error { font-size: 1.3rem; color: var(--color-error); margin: 0.4rem 0 0; min-height: 1.8rem; }
.terms-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 0.4rem; }
