/* ==========================================================================
   Monitor beheer

   Eén stylesheet voor de hele beheeromgeving. Bovenaan de tokens (kleur, type, maat), daarna de
   schil (zijbalk, bovenbalk op mobiel), de paginakop, en de bouwstenen die elke pagina gebruikt:
   tabellen, formulieren, knoppen, meldingen. Een pagina hoort geen eigen stijl te hebben; wat
   ontbreekt, komt hier bij als bouwsteen.

   Kleur: nachtblauw voor de schil, waterblauw voor acties, en pin-oranje alleen voor "waar ben ik"
   (actief menu-item) en het merkteken — nergens anders.
   ========================================================================== */

/* Instrument Sans (SIL Open Font License), zelf gehost: geen verzoek naar Google vanuit de app. */
@font-face {
    font-family: "Instrument Sans";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("fonts/instrument-sans-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Instrument Sans";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("fonts/instrument-sans-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    color-scheme: light;

    /* Schil */
    --ink: #1c2541;
    --ink-raised: #273257;
    --ink-line: #36427a;
    --ink-text: #d6dbea;
    --ink-muted: #8f98bb;

    /* Inhoud */
    --canvas: #f4f5f8;
    --surface: #ffffff;
    --surface-sunken: #f7f8fb;
    --line: #dfe2ea;
    --line-strong: #c5cad8;
    --text: #1b2033;
    --muted: #5d6478;

    /* Actie */
    --primary: #1f5fa8;
    --primary-hover: #184b86;
    --primary-soft: #e3edf8;

    /* Markering: waar ben ik, het merkteken */
    --pin: #e0702b;
    --pin-soft: #fbeadf;
    --pin-text: #7a3a0f;

    /* Status */
    --danger: #b42318;
    --danger-hover: #931c13;
    --danger-soft: #fdeceb;
    --warning: #8f5507;
    --warning-soft: #fcf2df;
    --success: #1c6f42;
    --success-soft: #e4f3ea;
    --info: #1f5fa8;
    --info-soft: #e3edf8;

    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;

    --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;

    --sidebar-width: 16rem;
    --gutter: 2.5rem;
}

/* --------------------------------------------------------------------------
   Basis
   -------------------------------------------------------------------------- */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--text);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--text);
}

h1 {
    font-size: 1.625rem;
    font-weight: 650;
    margin: 0;
}

h1:focus {
    outline: none;
}

h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem;
}

h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.5rem;
}

p {
    margin: 0 0 1rem;
}

a {
    color: var(--primary);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
}

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

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

strong {
    font-weight: 600;
}

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    padding: 0.1em 0.35em;
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
    border: 1px solid var(--line);
}

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 1.5rem 0;
}

img {
    max-width: 100%;
}

/* --------------------------------------------------------------------------
   Schil: zijbalk links, inhoud rechts. Op een smal scherm wordt de zijbalk een lade achter
   een menuknop in de bovenbalk.
   -------------------------------------------------------------------------- */

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.app-topbar {
    display: none;
}

.app-sidebar {
    grid-column: 1;
    grid-row: 1;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.25rem 0.875rem 1rem;
    background: var(--ink);
    color: var(--ink-text);
}

.app-sidebar :focus-visible {
    outline-color: var(--pin);
}

.app-main {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-body {
    flex: 1;
    width: 100%;
    max-width: 80rem;
    padding: 2rem var(--gutter) 3rem;
}

.app-footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 1rem var(--gutter);
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.8125rem;
}

.nav-backdrop {
    display: none;
}

/* Merk */

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: #fff;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-decoration: none;
}

.brand:hover {
    color: #fff;
}

.brand-mark {
    width: 1.75rem;
    height: 1.75rem;
    flex: none;
}

.brand-mark-pin {
    fill: var(--pin);
}

.brand-mark-hole {
    fill: var(--ink);
}

.brand-mark-trail {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-dasharray: 2.2 2.6;
    opacity: 0.8;
}

.sidebar-brand {
    padding: 0 0.5rem;
}

/* Menu */

.app-nav {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    margin-top: 1rem;
}

.nav-group-label {
    padding: 0 0.625rem 0.3rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--ink-muted);
}

.app-nav a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 2.375rem;
    padding: 0.4rem 0.625rem;
    border-radius: var(--radius-sm);
    color: var(--ink-text);
    text-decoration: none;
    font-weight: 500;
}

.app-nav a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

/* Waar ben ik: het enige pin-oranje in het menu. */
.app-nav a.active {
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--pin);
}

.nav-icon {
    flex: none;
    width: 1.15rem;
    height: 1.15rem;
    color: var(--muted);
}

.app-nav .nav-icon {
    color: var(--ink-muted);
}

.app-nav a:hover .nav-icon,
.app-nav a.active .nav-icon {
    color: var(--pin);
}

.sidebar-user {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 0.625rem 0;
    border-top: 1px solid var(--ink-line);
    font-size: 0.8125rem;
}

.sidebar-user-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink-muted);
}

a.sidebar-user-name {
    text-decoration: none;
}

a.sidebar-user-name:hover {
    color: var(--ink-text);
    text-decoration: underline;
}

.sidebar-user .link-button {
    color: var(--ink-text);
}

.sidebar-user .link-button:hover {
    color: #fff;
}

/* Inlogscherm: geen menu, alleen het merk boven één paneel. */

.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12vh 1rem 2rem;
}

.brand-auth {
    color: var(--ink);
    font-size: 1.375rem;
    margin-bottom: 1.5rem;
}

.brand-auth:hover {
    color: var(--ink);
}

.brand-auth .brand-mark {
    width: 2.25rem;
    height: 2.25rem;
}

.brand-auth .brand-mark-hole {
    fill: var(--canvas);
}

.auth-body {
    width: min(26rem, 100%);
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}

.auth-body h1 {
    font-size: 1.375rem;
    margin-bottom: 1.25rem;
}

.auth-body h2 {
    font-size: 1rem;
    margin: 1.5rem 0 0.75rem;
}

.auth-body .page-header {
    margin-bottom: 1.25rem;
}

.auth-body .field,
.auth-body .form-floating {
    max-width: none;
}

.auth-body button[type="submit"] {
    width: 100%;
    margin-top: 0.5rem;
}

.auth-links {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
    font-size: 0.875rem;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0 0.75rem;
    color: var(--muted);
    font-size: 0.8125rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--line);
}

.auth-footer {
    margin-top: auto;
    padding-top: 2rem;
    color: var(--muted);
    font-size: 0.8125rem;
}

/* --------------------------------------------------------------------------
   Paginakop (PageHeader): terug-link, titel met acties rechts, korte uitleg.
   -------------------------------------------------------------------------- */

.page-header {
    margin-bottom: 1.75rem;
}

.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.page-intro {
    max-width: 68ch;
    margin-top: 0.5rem;
    color: var(--muted);
}

.page-intro p {
    margin: 0 0 0.5rem;
}

.page-intro p:last-child {
    margin-bottom: 0;
}

/* Terug-link: in de kop, als link of (bij een pagina die in-place wisselt) als knop. */
.page-back {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 0;
    margin-bottom: 0.625rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.page-back:hover {
    background: none;
    color: var(--primary);
}

.page-back svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin: 2.25rem 0 0.75rem;
}

.section-header h2 {
    margin: 0;
}

.section-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* Filters en zoeken boven een overzicht. */
.toolbar {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin: 0 0 1rem;
}

.toolbar-search {
    flex: 1 1 18rem;
    max-width: 26rem;
}

.toolbar-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.toolbar-field label {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--muted);
}

.toolbar-field select {
    width: auto;
    min-width: 9rem;
}

.toolbar-count {
    margin-left: auto;
    align-self: center;
    color: var(--muted);
    font-size: 0.8125rem;
    white-space: nowrap;
}

.loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
}

.empty {
    padding: 2rem 1.25rem;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-lg);
    color: var(--muted);
    text-align: center;
}

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

.small {
    font-size: 0.8125rem;
}

/* --------------------------------------------------------------------------
   Overzichtstegels op de startpagina.
   -------------------------------------------------------------------------- */

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.tile {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem 1.125rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    color: var(--text);
    text-decoration: none;
}

.tile:hover {
    border-color: var(--primary);
    color: var(--text);
}

.tile .nav-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--primary);
}

.tile-count {
    font-size: 1.375rem;
    font-weight: 650;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.tile-label {
    color: var(--muted);
    font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   Panelen: een formulier staat op een wit vlak, los van het canvas.
   -------------------------------------------------------------------------- */

.panel {
    max-width: 48rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}

/* Een formulier met een kaart of breed raster krijgt de volle breedte. */
.panel-wide {
    max-width: none;
}

.panel > :last-child {
    margin-bottom: 0;
}

/* Secties binnen één formulier. */
.panel h2 {
    font-size: 1rem;
    margin: 1.75rem 0 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
}

.panel > h2:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.panel .section-header {
    margin: 1.75rem 0 0.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
}

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

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}

/* De gevaarlijke knop (Verwijderen) staat los van opslaan en annuleren, helemaal rechts. */
.form-actions-far {
    margin-left: auto;
}

/* --------------------------------------------------------------------------
   Formuliervelden
   -------------------------------------------------------------------------- */

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-width: 30rem;
    margin-bottom: 1.125rem;
}

.field > label {
    font-weight: 600;
    font-size: 0.875rem;
}

.field .field {
    margin-bottom: 0.5rem;
}

/* Velden naast elkaar; op een telefoon onder elkaar. Een veld in een raster is zo breed als zijn kolom. */
.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0 1.25rem;
}

.field-grid > .field {
    max-width: none;
}

.field-grid-narrow {
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    max-width: 30rem;
}

input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="file"], [type="range"], [type="color"]),
select,
textarea {
    width: 100%;
    min-height: 2.5rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.9375rem;
}

textarea {
    resize: vertical;
}

input[type="file"] {
    font: inherit;
    font-size: 0.875rem;
    max-width: 100%;
}

input[type="color"] {
    width: 3.5rem;
    min-width: 3.5rem;
    height: 2.5rem;
    padding: 0.15rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
}

input:not([type="checkbox"], [type="radio"]):focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: var(--surface-sunken);
    color: var(--muted);
}

input[type="checkbox"],
input[type="radio"] {
    width: 1.05rem;
    height: 1.05rem;
    margin: 0;
    accent-color: var(--primary);
    flex: none;
}

.field-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.8125rem;
}

label.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    font-size: 0.9375rem;
    cursor: pointer;
}

/* Een rij vinkjes naast elkaar (Ingeschakeld, Publiek, …). */
.checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin-bottom: 1.125rem;
}

/* Keuzelijst met een knop ernaast ("Toevoegen"): de lijst vult de ruimte, de knop blijft smal. */
.add-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.add-row > :first-child {
    flex: 1;
    min-width: 0;
}

.add-row button,
.add-row .btn {
    flex: none;
}

.valid.modified:not([type="checkbox"]) {
    border-color: var(--success);
}

.invalid {
    border-color: var(--danger) !important;
}

.validation-message,
.error-message,
.text-danger {
    color: var(--danger);
    font-size: 0.875rem;
}

/* De samenvatting van Blazor boven een formulier met fouten. */
.validation-errors {
    margin: 0 0 1.25rem;
    padding: 0.75rem 1rem 0.75rem 2rem;
    border: 1px solid #f3c5c1;
    border-radius: var(--radius);
    background: var(--danger-soft);
    color: #7f1a12;
    font-size: 0.875rem;
}

.validation-errors:empty {
    display: none;
}

/* --------------------------------------------------------------------------
   Knoppen. De basis staat in :where() zodat elke variant hem zonder specificiteitsgevecht
   overschrijft. Elke knop zonder eigen klasse is een hoofdknop: er verschijnt nooit een
   onopgemaakte browserknop.
   -------------------------------------------------------------------------- */

:where(button, .btn) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

:where(button, .btn):hover {
    background: var(--primary-hover);
    color: #fff;
}

/* Een <a class="btn"> krijgt anders de linkkleur, want a wint van :where(). */
.btn,
.btn:hover {
    color: #fff;
}

:where(button, .btn):disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--line-strong);
}

.btn-secondary:hover {
    background: var(--surface-sunken);
    color: var(--text);
    border-color: var(--muted);
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-small {
    min-height: 2rem;
    padding: 0.25rem 0.65rem;
    font-size: 0.8125rem;
}

.btn .nav-icon,
button .nav-icon {
    width: 1rem;
    height: 1rem;
    color: inherit;
}

/* Knoppen rechtsboven in een paneel (vorige/volgende POI). */
.panel-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

/* Knoppen die eruitzien als een link. */
.link-button,
.link-button-inline {
    display: inline;
    min-height: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--primary);
    font: inherit;
    font-weight: 500;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
    cursor: pointer;
}

.link-button:hover,
.link-button-inline:hover {
    background: none;
    color: var(--primary-hover);
}

.icon-button {
    min-height: 0;
    padding: 0.35rem;
    border: 1px solid transparent;
    background: none;
    color: var(--muted);
    line-height: 0;
}

.icon-button:hover {
    background: var(--surface-sunken);
    border-color: var(--line);
    color: var(--text);
}

.icon-button .nav-icon {
    width: 1.1rem;
    height: 1.1rem;
    color: inherit;
}

/* Twee knoppen tegen elkaar (vorige/volgende). */
.button-pair {
    display: inline-flex;
}

.button-pair > * {
    border-radius: 0;
}

.button-pair > :first-child {
    border-top-left-radius: var(--radius);
    border-bottom-left-radius: var(--radius);
}

.button-pair > :last-child {
    border-top-right-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
    margin-left: -1px;
}

/* --------------------------------------------------------------------------
   Meldingen en statuslabels
   -------------------------------------------------------------------------- */

.alert {
    padding: 0.75rem 1rem;
    margin: 0 0 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    max-width: 52rem;
}

.alert a {
    color: inherit;
    font-weight: 600;
}

.alert code {
    overflow-wrap: anywhere;
    word-break: break-all;
    background: rgba(255, 255, 255, 0.5);
    border-color: transparent;
}

.alert-danger {
    background: var(--danger-soft);
    border-color: #f3c5c1;
    color: #7f1a12;
}

.alert-warning {
    background: var(--warning-soft);
    border-color: #efd6a6;
    color: #6b4006;
}

.alert-success {
    background: var(--success-soft);
    border-color: #b9dfc8;
    color: #155232;
}

.alert-info {
    background: var(--info-soft);
    border-color: #c4d8ee;
    color: #163f6e;
}

.alert-small {
    padding: 0.45rem 0.75rem;
    font-size: 0.875rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge + .badge {
    margin-left: 0.35rem;
}

.badge-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge-success {
    background: var(--success-soft);
    color: var(--success);
}

.badge-info {
    background: var(--info-soft);
    color: var(--info);
}

.badge-neutral {
    background: var(--surface-sunken);
    color: var(--muted);
    border: 1px solid var(--line);
}

/* Een rijtje labels in een tabelcel (playlists, tags) mag over meerdere regels. */
.badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.badge-list .badge + .badge {
    margin-left: 0;
}

/* Gekoppelde items onder een keuzelijst: een label met een kruisje om het weer los te halen. */
.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 0 1.125rem;
    padding: 0;
    list-style: none;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.3rem 0.2rem 0.7rem;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-hover);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.3;
}

.chip-remove {
    width: 1.35rem;
    height: 1.35rem;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    line-height: 0;
}

.chip-remove:hover {
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
}

.chip-remove svg {
    width: 0.8rem;
    height: 0.8rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

/* Een kleurstip (de kleur van een route op de kaart). */
.color-dot {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.15);
    vertical-align: middle;
}

/* --------------------------------------------------------------------------
   Tabellen
   -------------------------------------------------------------------------- */

table {
    width: 100%;
    margin: 0 0 1.5rem;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    font-variant-numeric: tabular-nums;
}

th, td {
    padding: 0.7rem 0.9rem;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--line);
}

thead th {
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
    background: var(--surface-sunken);
    color: var(--muted);
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

thead th:first-child {
    border-top-left-radius: var(--radius-lg);
}

thead th:last-child {
    border-top-right-radius: var(--radius-lg);
}

tbody tr:last-child > * {
    border-bottom: 0;
}

tbody tr:hover > td {
    background: #fafbfd;
}

/* Sorteren op een kolom: de kop is een knop die eruitziet als tekst. */
.sort-button {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-weight: inherit;
}

.sort-button:hover {
    background: none;
    color: var(--text);
}

.sort-button svg {
    width: 0.8rem;
    height: 0.8rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.45;
}

.sort-button.sorted svg {
    opacity: 1;
    color: var(--primary);
}

/* Een tabel zonder kop is een lijst van eigenschappen: label links, waarde rechts. */
table:not(:has(thead)) th {
    width: 13rem;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Actiekolom (lege kop): rechts uitgelijnd, links naast elkaar. */
table:has(thead th:last-child:empty) td:last-child {
    text-align: right;
    white-space: nowrap;
}

td > a,
td > .link-button-inline {
    font-weight: 500;
    text-decoration: none;
}

td > a:hover,
td > .link-button-inline:hover {
    text-decoration: underline;
}

td > a + a,
td > a + button,
td > button + a,
td > button + button,
td > a + span,
td > span + a {
    margin-left: 0.6rem;
}

/* Korte waarden (datum, tijd, bedrag, aantal) breken niet af; app.js markeert ze met data-short. */
td[data-short] {
    white-space: nowrap;
}

/* Een rij die niet meer meetelt, zoals een verlopen ticket. */
.row-muted > td {
    color: var(--muted);
}

.row-danger > td:first-child {
    box-shadow: inset 3px 0 0 var(--danger);
}

/* Een tabel binnen een paneel (vertalingen, gekoppelde POI's): invoer in de cellen, compacter. */
.table-form {
    margin-bottom: 1rem;
}

.table-form th,
.table-form td {
    padding: 0.45rem 0.6rem;
    vertical-align: top;
}

.table-form td:first-child {
    padding-top: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
}

.table-form input:not([type="checkbox"]),
.table-form textarea {
    min-height: 2.25rem;
    padding: 0.35rem 0.55rem;
    font-size: 0.875rem;
}

.table-form .col-narrow {
    width: 9rem;
}

.table-form .col-lang {
    width: 6rem;
}

.table-scroll {
    overflow-x: auto;
    margin-bottom: 1.5rem;
    -webkit-overflow-scrolling: touch;
}

.table-scroll > table {
    margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Kaart en afbeeldingen
   -------------------------------------------------------------------------- */

.map-frame {
    height: 32rem;
    width: 100%;
    margin-bottom: 0.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface-sunken);
}

.map-frame > div {
    height: 100%;
    width: 100%;
}

/* De kaart in de routekiezer (modal) is even hoog als de routelijst ernaast. */
.modal-split .map-frame {
    height: 36rem;
    margin-bottom: 0;
}

.image-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.image-card {
    position: relative;
    width: 10rem;
}

.image-card-large {
    width: 100%;
    max-width: 20rem;
}

.image-card img {
    display: block;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.image-card .btn-danger {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    min-height: 0;
    padding: 0.3rem;
    line-height: 0;
}

.qr-preview {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.25rem;
}

.qr-preview img {
    width: 12rem;
    height: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

/* --------------------------------------------------------------------------
   Modaal (routekiezer op de kaart)
   -------------------------------------------------------------------------- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(20, 26, 45, 0.55);
}

.modal {
    display: flex;
    flex-direction: column;
    width: min(72rem, 100%);
    max-height: calc(100vh - 2rem);
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--line);
}

.modal-header h2 {
    margin: 0;
}

.modal-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 1.25rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--line);
}

.modal-split {
    display: grid;
    grid-template-columns: minmax(16rem, 1fr) 2fr;
    gap: 1.25rem;
}

.modal-split-list {
    max-height: 36rem;
    overflow-y: auto;
}

.pick-list-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.pick-list {
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.pick-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--line);
}

.pick-list li:last-child {
    border-bottom: 0;
}

.pick-list .checkbox-label {
    min-width: 0;
}

/* Blazor-foutmelding binnen een component. */
.blazor-error-boundary {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    background: var(--danger-soft);
    color: #7f1a12;
}

.blazor-error-boundary::after {
    content: "Er ging iets mis bij het tonen van dit onderdeel.";
}

/* Laadindicator. */
.spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: button-spin 0.7s linear infinite;
    vertical-align: -0.15em;
}

/* --------------------------------------------------------------------------
   Accountpagina's van Identity (scaffold): tabbladen en een compatlaag voor de markup die daar
   nog in Bootstrap-termen staat (form-floating, row/col). Die pagina's zijn bewust niet
   herschreven; dit maakt ze netjes zonder Bootstrap.
   -------------------------------------------------------------------------- */

.tab-list {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
}

.tab-list::-webkit-scrollbar {
    display: none;
}

.tab-list a {
    flex: none;
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.55rem 0.85rem;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-weight: 500;
    text-decoration: none;
}

.tab-list a:hover {
    color: var(--text);
}

.tab-list a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.form-floating {
    display: flex;
    flex-direction: column-reverse;
    gap: 0.35rem;
    max-width: 30rem;
}

.form-floating > label {
    font-weight: 600;
    font-size: 0.875rem;
}

.form-floating > .validation-message {
    order: -1;
}

.mb-3 {
    margin-bottom: 1.125rem;
}

.w-100 {
    width: 100%;
}

.row {
    display: block;
}

.row > [class*="col-"] {
    max-width: 36rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.form-check label,
.checkbox label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    cursor: pointer;
}

.btn-lg {
    min-height: 2.75rem;
}

.btn-link {
    display: inline;
    min-height: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--primary);
    font-weight: 500;
    text-decoration: underline;
}

.btn-link:hover {
    background: none;
    color: var(--primary-hover);
}

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

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

/* --------------------------------------------------------------------------
   Smal scherm (tablet staand, telefoon): het menu wordt een lade.
   -------------------------------------------------------------------------- */

@media (max-width: 960px) {
    :root {
        --gutter: 1rem;
    }

    .app-shell {
        display: block;
    }

    .app-topbar {
        position: sticky;
        top: 0;
        z-index: 30;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        height: 3.5rem;
        padding: 0 0.75rem 0 0.25rem;
        padding-left: max(0.25rem, env(safe-area-inset-left));
        background: var(--ink);
        color: #fff;
    }

    .app-topbar .brand-mark {
        width: 1.5rem;
        height: 1.5rem;
    }

    .nav-toggle {
        width: 2.75rem;
        height: 2.75rem;
        min-height: 0;
        padding: 0;
        border: 0;
        background: none;
        color: #fff;
    }

    .nav-toggle:hover {
        background: var(--ink-raised);
    }

    .nav-toggle svg {
        width: 1.5rem;
        height: 1.5rem;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
    }

    .nav-toggle-close,
    .nav-open .nav-toggle-open {
        display: none;
    }

    .nav-open .nav-toggle-close {
        display: block;
    }

    .app-sidebar {
        position: fixed;
        top: 3.5rem;
        bottom: 0;
        left: 0;
        z-index: 40;
        width: min(20rem, 86vw);
        height: auto;
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform 0.22s ease, visibility 0s linear 0.22s;
    }

    .nav-open .app-sidebar {
        transform: none;
        visibility: visible;
        transition: transform 0.22s ease;
    }

    .sidebar-brand {
        display: none;
    }

    .nav-open .nav-backdrop {
        display: block;
        position: fixed;
        inset: 3.5rem 0 0 0;
        z-index: 35;
        background: rgba(20, 26, 45, 0.45);
    }

    .app-nav a {
        min-height: 2.75rem;
    }

    .app-body {
        padding: 1.25rem var(--gutter) 2.5rem;
    }

    h1 {
        font-size: 1.375rem;
    }

    .modal-split {
        grid-template-columns: 1fr;
    }

    .modal-split-list {
        max-height: 14rem;
    }
}

@media (max-width: 960px) and (prefers-reduced-motion: reduce) {
    .app-sidebar,
    .nav-open .app-sidebar {
        transition: none;
    }
}

/* --------------------------------------------------------------------------
   Telefoon
   -------------------------------------------------------------------------- */

@media (max-width: 700px) {
    /* 16px voorkomt dat iOS inzoomt zodra je een veld aantikt. */
    input:not([type="checkbox"], [type="radio"], [type="hidden"]),
    select,
    textarea {
        font-size: 1rem;
    }

    .field,
    .field-grid-narrow {
        max-width: none;
    }

    .panel {
        padding: 1rem;
    }

    .auth-body {
        padding: 1.5rem 1.25rem;
    }

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

    .toolbar-count {
        margin-left: 0;
    }

    /* De hoofdknop onderaan een formulier over de hele breedte: makkelijk te raken met een duim. */
    .form-actions > * {
        width: 100%;
    }

    .form-actions-far {
        margin-left: 0;
    }

    .page-actions,
    .page-actions > .btn,
    .page-actions > button {
        width: 100%;
    }

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

    .app-footer {
        flex-direction: column;
    }

    .map-frame,
    .modal-split .map-frame {
        height: 22rem;
    }

    /* Tabellen op een telefoon: een overzicht stapelt per rij tot een kaartje. De eerste kolom
       wordt de titel, elke volgende cel krijgt zijn kolomkop ervoor (data-label, gezet door
       app.js), en de acties komen onderaan de kaart. Formuliertabellen (.table-form) schuiven. */
    table:not(.table-form):has(thead) {
        border: 0;
        background: none;
    }

    table:not(.table-form):has(thead) thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    table:not(.table-form):has(thead) tbody,
    table:not(.table-form):has(thead) tr {
        display: block;
    }

    table:not(.table-form):has(thead) tr {
        margin-bottom: 0.75rem;
        padding: 0.35rem 1rem;
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: var(--radius-lg);
    }

    table:not(.table-form):has(thead) tbody tr:hover > td {
        background: none;
    }

    table:not(.table-form):has(thead) td {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: baseline;
        gap: 1rem;
        padding: 0.4rem 0;
        border: 0;
        text-align: right;
        white-space: normal;
    }

    table:not(.table-form):has(thead) td::before {
        content: attr(data-label);
        flex: none;
        max-width: 45%;
        color: var(--muted);
        font-size: 0.8125rem;
        text-align: left;
    }

    table:not(.table-form):has(thead) td[data-label=""]::before,
    table:not(.table-form):has(thead) td:not([data-label])::before {
        display: none;
    }

    table:not(.table-form):has(thead) td:first-child {
        display: block;
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--line);
        margin-bottom: 0.25rem;
        font-size: 1rem;
        font-weight: 600;
        text-align: left;
    }

    table:not(.table-form):has(thead) td:first-child::before {
        display: none;
    }

    table:not(.table-form):has(thead) .badge-list {
        justify-content: flex-end;
    }

    /* Actiecel onderaan de kaart, met knoppen die groot genoeg zijn om te raken. */
    table:not(.table-form):has(thead th:last-child:empty) td:last-child {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.25rem 0.75rem;
        margin-top: 0.25rem;
        padding: 0.6rem 0 0.4rem;
        border-top: 1px solid var(--line);
        text-align: left;
    }

    table:not(.table-form):has(thead th:last-child:empty) td:last-child > a,
    table:not(.table-form):has(thead th:last-child:empty) td:last-child > button {
        margin-left: 0;
    }

    table:not(.table-form):has(thead th:last-child:empty) td:last-child:empty {
        display: none;
    }

    .row-danger > td:first-child {
        box-shadow: none;
        color: var(--danger);
    }

    .table-form {
        display: block;
        overflow-x: auto;
    }

    /* Eigenschappenlijst: label boven de waarde. */
    table:not(:has(thead)) th,
    table:not(:has(thead)) td {
        display: block;
        width: auto;
        border: 0;
    }

    table:not(:has(thead)) th {
        padding: 0.7rem 1rem 0;
        font-size: 0.8125rem;
    }

    table:not(:has(thead)) td {
        padding: 0.1rem 1rem 0.7rem;
        border-bottom: 1px solid var(--line);
    }

    table:not(:has(thead)) tr:last-child td {
        border-bottom: 0;
    }

    table:not(:has(thead)) tr,
    table:not(:has(thead)) tbody {
        display: block;
    }
}

/* Feedback na een klik (zie app.js): bezig = gedimd met een draaiend rondje, klaar = kort een vinkje. */
button.is-busy {
    opacity: 0.75;
    cursor: progress;
    pointer-events: none;
}

button.is-busy::before {
    content: "";
    width: 0.8em;
    height: 0.8em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: button-spin 0.7s linear infinite;
}

button.is-done {
    position: relative;
    color: transparent;
}

button.is-done::after {
    content: "✓  " attr(data-done-label);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--surface);
    white-space: nowrap;
}

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

@media (prefers-reduced-motion: reduce) {
    button.is-busy::before,
    .spinner {
        animation: none;
        border-right-color: currentColor;
        opacity: 0.6;
    }
}
