/* ==========================================================================
   Argus backend

   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: donker grachtgroen voor de schil, blauwgroen voor acties, en rietgoud alleen voor "waar
   ben ik" (actief menu-item) en "je kijkt mee" — 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: #17312e;
    --ink-raised: #21423e;
    --ink-line: #2f524d;
    --ink-text: #d3e0dc;
    --ink-muted: #8ea9a2;

    /* Inhoud */
    --canvas: #f2f5f4;
    --surface: #ffffff;
    --surface-sunken: #f7f9f8;
    --line: #dce3e1;
    --line-strong: #c2ccc9;
    --text: #1b2826;
    --muted: #5b6b67;

    /* Actie */
    --primary: #12646b;
    --primary-hover: #0c4f55;
    --primary-soft: #e2efef;

    /* Markering: waar ben ik, je kijkt mee */
    --reed: #c99a2e;
    --reed-soft: #f8f0db;
    --reed-text: #5d450c;

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

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

    --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

    --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;
}

/* --------------------------------------------------------------------------
   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(--reed);
}

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

.app-body {
    flex: 1;
    width: 100%;
    max-width: 76rem;
    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-lid {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linejoin: round;
}

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

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

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

/* Bedrijfskeuze: altijd zichtbaar bovenin, want alles eronder hoort bij dat bedrijf. */

.company-switch {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    background: var(--ink-raised);
}

.company-switch label,
.company-switch-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--ink-muted);
}

.company-switch-name {
    color: #fff;
    font-weight: 600;
}

.company-switch-row {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.company-switch select {
    width: 100%;
    min-height: 2.25rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--ink-line);
    border-radius: var(--radius-sm);
    background: var(--ink);
    color: #fff;
    font-size: 0.875rem;
}

.company-switch select:focus {
    border-color: var(--reed);
    box-shadow: none;
}

.company-switch button {
    min-height: 2.25rem;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--ink-line);
    background: transparent;
    color: #fff;
    font-size: 0.8125rem;
}

.company-switch button:hover {
    background: var(--ink-line);
}

/* 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 rietgoud in het menu. */
.app-nav a.active {
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--reed);
}

.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(--reed);
}

.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);
}

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

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

/* Een Beheerder die meekijkt bij een verhuurder ziet dat bovenaan elke pagina. */
.view-as-banner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    padding: 0.6rem var(--gutter);
    background: var(--reed-soft);
    border-bottom: 1px solid #ead8a8;
    color: var(--reed-text);
    font-size: 0.875rem;
}

.view-as-banner .link-button {
    color: var(--reed-text);
    font-weight: 600;
}

.view-as-banner .link-button:hover {
    color: var(--text);
}

/* 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-pupil {
    fill: var(--canvas);
}

.auth-body {
    width: min(25rem, 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 .page-header {
    margin-bottom: 1.25rem;
}

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

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

.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, of los boven een pagina die nog laadt (BackLink). */
.page-back {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.625rem;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
}

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

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

/* Een losse terug-link direct boven de kop: de kop sluit er dan zonder extra ruimte op aan. */
.page-back + .page-header {
    margin-top: 0;
}

.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;
}

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

.toolbar-field {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

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

.loading {
    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;
}

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

.panel,
.app-body > form,
.tab-content > form {
    max-width: 46rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}

/* Een formulier met een breed raster (het rooster) krijgt de volle breedte. */
.app-body > form:has(.table-scroll),
.tab-content > form:has(.table-scroll) {
    max-width: none;
}

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

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

form > h2:first-child,
form > input[type="hidden"] + h2 {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.confirm-subject {
    font-size: 1.0625rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* --------------------------------------------------------------------------
   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;
}

input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="file"], [type="range"]),
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;
}

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

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 groep vinkjes onder een kopje (bv. de producten per bedrijf bij een productgroep): onder elkaar,
   in een rustig kader in plaats van de kale fieldset van de browser. */
fieldset.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin: 0 0 0.75rem;
    padding: 0.5rem 0.875rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

fieldset.checkbox-group legend {
    padding: 0 0.25rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted);
}

.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;
}

/* Eén variant met zijn aantal, op het reserveringsformulier. */
/* Twee korte velden naast elkaar (begin- en eindtijd): bovenaan uitgelijnd, ook als er onder
   één ervan een hint staat. */
.field-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0 1rem;
}

.field-row input[type="time"] {
    width: 8.5rem;
}

.variant-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.variant-row label {
    flex: 1;
    min-width: 0;
}

.variant-row input {
    width: 6rem;
}

/* --------------------------------------------------------------------------
   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;
}

/* 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);
}

.action-icon {
    width: 1.1rem;
    height: 1.1rem;
}

/* --------------------------------------------------------------------------
   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;
}

/* Een lange, ononderbroken code (bv. de eenmalig getoonde balie-API-sleutel) breekt af in plaats van
   het paneel op een telefoon horizontaal te laten scrollen. */
.alert code {
    overflow-wrap: anywhere;
    word-break: break-all;
}

.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;
}

.badge {
    display: inline-flex;
    align-items: center;
    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-neutral {
    background: var(--surface-sunken);
    color: var(--muted);
    border: 1px solid var(--line);
}

/* --------------------------------------------------------------------------
   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: #fafcfb;
}

/* 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. De ruimte komt uit CSS en niet
   uit de markup, want Razor slikt de spatie rond een @if-blok op. */
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.9rem;
}

/* 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 geannuleerde reservering. */
.row-muted > td {
    color: var(--muted);
}

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

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

.media-thumb {
    display: block;
    max-width: 120px;
    max-height: 80px;
    border-radius: var(--radius-sm);
}

/* Rasters: het rooster (editor) en het bezettingsrooster. Die lees je als raster en schuiven op een smal scherm
   horizontaal, in plaats van te stapelen zoals een overzicht. */

.table-grid th,
.table-grid td {
    border-right: 1px solid var(--line);
}

.table-grid th:last-child,
.table-grid td:last-child {
    border-right: 0;
}

.schedule-grid {
    width: auto;
    font-size: 0.8125rem;
}

.schedule-grid th,
.schedule-grid td {
    padding: 0.35rem 0.45rem;
    text-align: center;
    white-space: nowrap;
}

.schedule-grid td > input + input {
    margin-left: 0.3rem;
}

.schedule-grid input:not([type="checkbox"]) {
    min-height: 2rem;
    padding: 0.25rem 0.35rem;
    font-size: 0.8125rem;
}

.schedule-grid input[type="number"] {
    width: 4.5rem;
}

.schedule-grid input[type="time"] {
    width: 6.5rem;
}

/* Prijsraster per product: elke cel is een knop met de prijs die echt geldt. */
.price-grid .price-cell {
    min-width: 5.5rem;
    padding: 0.3rem 0.4rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
}

.price-grid .price-cell-uitzondering { border-color: var(--primary); font-weight: 600; }
.price-grid .price-cell-niet { text-decoration: line-through; color: var(--ink-muted); }
.price-grid .price-cell-uit { background: var(--surface-sunken); color: var(--ink-muted); cursor: default; }
.price-grid .price-cell-selected { outline: 2px solid var(--primary); outline-offset: 1px; }
.price-cell-panel { margin-top: 1rem; }
.schedule-grid .bulk-cell {
    background: var(--surface-sunken);
    border-right: 2px solid var(--line-strong);
}

.schedule-grid .bulk-cell > * + * {
    margin-left: 0.3rem;
}

.rooster-nav {
    margin-bottom: 1.25rem;
}

.rooster-week {
    font-variant-numeric: tabular-nums;
}

.rooster-table {
    min-width: 56rem;
    font-size: 0.8125rem;
    /* Zeven gelijke dagkolommen; anders maakt één drukke dag de rest heel smal. */
    table-layout: fixed;
}

.rooster-table th:first-child {
    width: 9rem;
}

.rooster-table th,
.rooster-table td {
    vertical-align: top;
}

.rooster-table td {
    padding: 0.5rem;
}

.rooster-table td:first-child {
    overflow-wrap: anywhere;
    font-weight: 600;
}

.rooster-block {
    margin-bottom: 0.3rem;
}

.rooster-block:last-child {
    margin-bottom: 0;
}

.rooster-block a {
    display: block;
    padding: 0.3rem 0.45rem;
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
    color: var(--primary-hover);
    text-decoration: none;
    line-height: 1.35;
}

.rooster-block a:hover {
    background: #cfe4e4;
}

/* --------------------------------------------------------------------------
   Tabbladen
   -------------------------------------------------------------------------- */

.tab-control {
    margin-top: 0.5rem;
}

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

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

.tab-button {
    flex: none;
    min-height: 2.75rem;
    gap: 0.45rem;
    padding: 0.55rem 0.85rem;
    margin-bottom: -1px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: none;
    color: var(--muted);
    font-weight: 500;
}

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

.tab-button .nav-icon {
    color: inherit;
}

.tab-button-active,
.tab-button-active:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-content {
    padding-top: 1.5rem;
}

/* 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.";
}

/* --------------------------------------------------------------------------
   Wizard: stappenbalk en sjabloonkaarten
   -------------------------------------------------------------------------- */

.wizard-steps {
    display: flex;
    gap: 0.5rem;
    margin: 0 0 1.25rem;
    padding: 0;
    list-style: none;
}

.wizard-steps li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 0;
    min-width: 0;
    padding: 0.5rem 0.75rem;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.wizard-steps li.current {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-soft);
    font-weight: 600;
}

.wizard-steps li.done {
    color: var(--text);
}

.wizard-step-number {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 1px solid currentColor;
    font-size: 0.75rem;
}

.wizard-step-title {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.wizard-steps-compact {
    display: none;
    margin: 0 0 1rem;
    font-weight: 600;
    color: var(--primary);
}

.panel.wizard-panel {
    max-width: none;
}

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

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 0.75rem;
}

/* Een knop (klikbaar met toetsenbord), maar zonder de hoofdknop-stijl van :where(button). */
.template-card,
.template-card:hover {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.375rem;
    padding: 1rem;
    text-align: left;
    white-space: normal;
    font-weight: 400;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}

.template-card:hover,
.template-card:focus-visible {
    border-color: var(--primary);
}

.template-card.selected {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.template-card-title {
    font-weight: 600;
}

.template-card-text {
    color: var(--muted);
    font-size: 0.9375rem;
}

.template-card-example {
    margin-top: auto;
    font-size: 0.875rem;
    color: var(--primary);
}

.wizard-summary {
    margin: 0 0 1rem;
    padding-left: 1.25rem;
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   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;
    }

    .app-topbar-context {
        margin-left: auto;
        max-width: 45vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: var(--ink-muted);
        font-size: 0.8125rem;
    }

    .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(15, 30, 28, 0.45);
    }

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

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

    h1 {
        font-size: 1.375rem;
    }
}

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

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

@media (max-width: 700px) {
    .wizard-steps {
        display: none;
    }

    .wizard-steps-compact {
        display: block;
    }

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

    .field {
        max-width: none;
    }

    .panel,
    .app-body > form,
    .tab-content > form {
        padding: 1rem;
    }

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

    /* De hoofdknop onderaan een formulier over de hele breedte: makkelijk te raken met een duim. */
    .app-body form button[type="submit"]:not(.link-button, .link-button-inline, .icon-button),
    .form-actions > * {
        width: 100%;
    }

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

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

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

    /* 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. Rasters (.table-grid) schuiven horizontaal. */
    table:not(.table-grid):has(thead) {
        border: 0;
        background: none;
    }

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

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

    table:not(.table-grid):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-grid):has(thead) tbody tr:hover > td {
        background: none;
    }

    table:not(.table-grid):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-grid):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-grid):has(thead) td[data-label=""]::before,
    table:not(.table-grid):has(thead) td:not([data-label])::before {
        display: none;
    }

    table:not(.table-grid):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-grid):has(thead) td:first-child::before {
        display: none;
    }

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

    table:not(.table-grid):has(thead th:last-child:empty) td:last-child > a,
    table:not(.table-grid):has(thead th:last-child:empty) td:last-child > button {
        display: inline-flex;
        align-items: center;
        min-height: 2.25rem;
        margin-left: 0;
    }

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

    /* 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 {
        display: block;
    }

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

/* HTML-editor (HtmlEditor.razor): de knop "Uitgebreid" boven TinyMCE, alleen voor de Beheerder. */
.html-editor-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.35rem;
}

.html-editor-bar [aria-pressed="true"] {
    background: var(--primary);
    color: #fff;
}

.html-editor-host {
    min-height: 2rem;
}

/* Een lange tekst met opmaak schrijft niet prettig in 30rem: het veld mag zo breed als het formulier. */
.field:has(> .html-editor) {
    max-width: none;
}

/* Vertaling bewerken: Nederlands links, vertaling rechts; op een telefoon onder elkaar. */
.translation-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
}

.translation-source {
    padding: 0.55rem 0.75rem;
    background: var(--surface-sunken);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

@media (max-width: 700px) {
    .translation-pair {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* De roostereditor is breder dan de pagina; de laatste kolom (Verwijder) blijft rechts in beeld
   staan terwijl de rest scrollt. */
.schedule-editor th:last-child,
.schedule-editor td:last-child {
    position: sticky;
    right: 0;
    background: var(--surface);
    box-shadow: -1px 0 0 var(--line);
}

/* 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 {
        animation: none;
        border-right-color: currentColor;
        opacity: 0.6;
    }
}
