/* ============================================================================
   House style components in plain CSS — version 10
   This app loads it as the second <link> in Pages/Shared/_Layout.cshtml, after
   base.css (which holds the colours, the typeface and the text sizes). Only
   components here; no font-family, no colour values, no text sizes other than
   var(--text-…).

   Every value comes from syndel-menu (the source); the comment names the class or
   the file there. What is not in syndel-menu comes from syndle-audit and says so.
   Nothing here is invented: if you change something, name the source.
   ========================================================================== */

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

/* Technical: a component with display: flex must not override the hidden attribute. */
[hidden] { display: none !important; }

/* Focus: syndel-menu sets no focus ring of its own; the browser draws it. Only a
   field gets focus:ring-primary (see Form). No custom :focus-visible here or in
   an app (A1). */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
/* syndel-menu layouts/application: sr-only focus:not-sr-only focus:absolute focus:left-4
   focus:top-4 focus:z-50 focus:rounded-lg focus:bg-surface-container-lowest focus:px-4
   focus:py-2 focus:ring-1 focus:ring-outline-variant */
.skiplink { position: absolute; left: var(--space-4); top: -100px; z-index: 50;
  background: var(--surface-raised); padding: var(--space-2) var(--space-4); border-radius: var(--r-control);
  box-shadow: 0 0 0 1px var(--outline-variant); }
.skiplink:focus { top: var(--space-4); }

/* --- Shell (S) ------------------------------------------------------------- */
.shell { display: flex; height: 100vh; overflow: hidden; }
.shell__column { display: flex; flex-direction: column; flex: 1; min-width: 0; overflow-y: auto; }

/* syndel-menu Layout::SidebarComponent: w-sidebar border-r border-outline-variant bg-sidebar px-4 py-5 */
.sidebar {
  display: flex; flex-direction: column; width: var(--shell-sidebar); flex-shrink: 0; height: 100%;
  background: var(--surface-raised); border-right: 1px solid var(--outline-variant);
  padding: var(--space-5) var(--space-4);
}
/* Sidebar logo: mb-5 flex items-center gap-2.5 px-2; logo h-7; app name border-l pl-2.5 font-semibold */
.brand { display: flex; align-items: center; gap: 10px; padding: 0 var(--space-2);
  margin-bottom: var(--space-5); color: inherit; text-decoration: none; }
.brand img { height: 28px; width: auto; }
.brand__app { border-left: 1px solid var(--outline-variant); padding-left: 10px;
  font-weight: 600; color: var(--on-surface-variant); }

/* item_classes: flex items-center gap-3 rounded-navitem px-3 py-2 text-sm font-medium
   transition-colors; active bg-primary/10 text-primary; otherwise text-on-surface-variant
   hover:bg-surface-container hover:text-on-surface. nav: flex-col gap-1. */
.nav { display: flex; flex-direction: column; gap: var(--space-1); }
.nav__item {
  display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3);
  border-radius: var(--r-control); font-size: var(--text-sm); font-weight: 500;
  color: var(--on-surface-variant); text-decoration: none;
  transition: background-color var(--duration-fast), color var(--duration-fast);
}
.nav__item:hover { background: var(--surface-hover); color: var(--on-surface); }
.nav__item[aria-current="page"] { background: var(--primary-container); color: var(--on-primary-container); }

/* Layout::TopBarComponent: sticky top-0 z-40 flex h-topbar items-center gap-4 border-b
   border-outline-variant bg-surface-container-lowest/90 px-6 backdrop-blur */
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: var(--space-4);
  height: var(--shell-topbar); flex-shrink: 0; padding: 0 var(--shell-gutter);
  background: color-mix(in srgb, var(--surface-raised) 90%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--outline-variant);
}
.topbar__spacer { flex: 1; }
.topbar .nav { flex-direction: row; }
/* In the topbar the logo sits on the centre line of the bar (S11): no bottom margin. */
.topbar .brand { margin-bottom: 0; }

/* User (S4): syndel-menu SidebarComponent, the user card at the bottom:
   flex items-center gap-2.5; avatar h-9 w-9 rounded-full bg-primary text-[13px] font-bold
   text-on-primary; text min-w-0 flex-1 with name truncate text-[13.5px] font-bold and role
   text-[11px] text-on-surface-variant; log out next to it. In the sidebar with the card
   around it (mt-4 rounded-[15px] bg-usercard p-3), in the topbar without. The text sizes
   (13px, 13.5px, 11px in syndel-menu) follow the T9 scale: 12, 14, 12. Everything sits on
   one centre line: avatar, the two lines together, and the button. */
.user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user--card { margin-top: var(--space-4); padding: var(--space-3); border-radius: 15px;
  background: var(--surface-sunken); }
.user__avatar { display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: var(--on-primary);
  font-size: var(--text-xs); font-weight: 700; }
.user__text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.user__name { font-size: var(--text-sm); font-weight: 700; color: var(--on-surface);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user__role { font-size: var(--text-xs); color: var(--on-surface-variant); }
.user form { display: flex; margin: 0; }

.content { width: 100%; padding: var(--space-8) var(--shell-gutter); }
.content--narrow { max-width: var(--content-narrow); }

@media (max-width: 1023px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; transform: translateX(-100%);
    transition: transform var(--duration-normal); }
  .sidebar[data-open] { transform: none; }
}
@media (max-width: 767px) {
  .content { padding: var(--space-6) var(--shell-gutter-mobile); }
  .topbar { padding: 0 var(--shell-gutter-mobile); }
}

/* --- Page header (P) ------------------------------------------------------- */
/* Layout::PageHeaderComponent: back text-sm text-on-surface-variant; h1 text-2xl
   font-semibold; subtitle text-sm text-on-surface-variant. */
.page-header { display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-4); margin-bottom: var(--space-6); }
.page-header h1 { margin: 0; }
.page-header__sub { margin: 0; color: var(--on-surface-variant); }
.page-header__back { font-size: var(--text-sm); color: var(--on-surface-variant); text-decoration: none; }
.page-header__back:hover { color: var(--on-surface); }
.page-header__actions { display: flex; align-items: center; gap: var(--space-2); }

/* --- Button (K) ------------------------------------------------------------ */
/* Ui::ButtonComponent: inline-flex items-center justify-center gap-2 whitespace-nowrap
   font-medium transition-colors; rounded-xl; md px-4 py-2 text-sm, sm px-3 py-1.5 text-xs.
   No fixed height: the height follows from padding and text. */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4); border: 1px solid transparent; border-radius: var(--r-button);
  font: inherit; font-size: var(--text-sm); font-weight: 500; white-space: nowrap;
  text-decoration: none; cursor: pointer; transition: background-color var(--duration-fast), opacity var(--duration-fast);
}
/* primary: text-on-primary bg-primary shadow-sm hover:opacity-90 */
.button--primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--elevation-soft); }
.button--primary:hover { opacity: 0.9; }
/* surface: bg-surface-container-lowest border border-outline-variant text-on-surface
   hover:bg-surface-container. Also Cancel. */
.button--secondary { background: var(--surface-raised); color: var(--on-surface); border-color: var(--outline-variant); }
.button--secondary:hover { background: var(--surface-hover); }
/* danger: text-on-error bg-error shadow-sm hover:opacity-90 */
.button--danger { background: var(--error); color: var(--on-error); box-shadow: var(--elevation-soft); }
.button--danger:hover { opacity: 0.9; }
.button--small { padding: 6px var(--space-3); font-size: var(--text-xs); }
/* icon_only: h-10 w-10 (sm h-8 w-8) rounded-lg text-primary hover:bg-primary/10 */
.button--icon { width: 40px; height: 40px; padding: 0; border-radius: var(--r-control);
  background: transparent; color: var(--primary); box-shadow: none; border-color: transparent; }
.button--icon:hover { background: var(--primary-container); opacity: 1; }
.button--small.button--icon { width: 32px; height: 32px; }
.button:disabled, .button[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
/* syndle-audit (iPad): at least 44px high on touch devices. */
@media (pointer: coarse) {
  .button { min-height: 44px; }
  .button--icon, .button--small.button--icon { width: 44px; height: 44px; }
}

/* --- Card, badge, chip ----------------------------------------------------- */
/* Ui::CardComponent: rounded-card bg-surface-container-lowest p-5 shadow-soft
   ring-1 ring-outline-variant/60; padding "p-0" for a table. */
.card { background: var(--surface-raised); border-radius: var(--r-card); padding: var(--space-5);
  box-shadow: var(--elevation-soft), 0 0 0 1px color-mix(in srgb, var(--outline-variant) 60%, transparent); }
.card--flat { padding: 0; overflow: hidden; }
/* Card as a link: syndel-menu hover:shadow-raise. */
.card--clickable { color: inherit; text-decoration: none; cursor: pointer; transition: box-shadow var(--duration-fast); }
.card--clickable:hover { box-shadow: var(--elevation-raise), 0 0 0 1px color-mix(in srgb, var(--outline-variant) 60%, transparent); }
/* Floating panel: syndel-menu dropdown rounded-xl shadow-xl ring-1 ring-outline-variant. */
.card--pop { box-shadow: var(--elevation-pop), 0 0 0 1px var(--outline-variant); }

/* Ui::BadgeComponent: inline-flex items-center rounded px-1.5 py-0.5 text-xs font-medium;
   neutral bg-surface-container-high text-on-surface-variant; primary bg-primary/10
   text-primary; success/warning/error bg-…-container text-on-…-container. */
.badge { display: inline-flex; align-items: center; gap: var(--space-1); padding: 2px 6px;
  border-radius: var(--r-badge); font-size: var(--text-xs); font-weight: 500;
  background: var(--surface-selected); color: var(--on-surface-variant); }
.badge--primary { background: var(--primary-container); color: var(--on-primary-container); }
.badge--success { background: var(--success-container); color: var(--on-success-container); }
.badge--warning { background: var(--warning-container); color: var(--on-warning-container); }
.badge--error { background: var(--error-container); color: var(--on-error-container); }
/* pill: true: rounded-full px-2 py-px. Allergens: contains with a border, traces quiet. */
.badge--pill { border-radius: 9999px; padding: 1px var(--space-2); }
.badge--contains { border-radius: 9999px; padding: 1px var(--space-2); background: var(--warning-container);
  color: var(--on-warning-container); box-shadow: inset 0 0 0 1px var(--warning); }
.badge--traces { border-radius: 9999px; padding: 1px var(--space-2); background: var(--surface-sunken);
  color: var(--on-surface-variant); box-shadow: inset 0 0 0 1px var(--outline-variant); }

/* Chip (filter chip and tab), rule Z7 and Ui::ChipComponent: rounded-control px-3 py-1.5 text-sm
   ring-1 ring-outline-variant; active bg-primary-container text-on-primary-container ring-primary;
   muted: italic text-on-surface-variant. */
.chip { display: inline-flex; align-items: center; padding: 6px var(--space-3); border-radius: var(--r-control);
  font-size: var(--text-sm); color: var(--on-surface); text-decoration: none;
  box-shadow: inset 0 0 0 1px var(--outline-variant); }
button.chip { border: 0; background: transparent; font: inherit; cursor: pointer; }
.chip:disabled { cursor: default; }
.chip:hover { background: var(--surface-hover); }
.chip[aria-pressed="true"], .chip[aria-current] { background: var(--primary-container); color: var(--on-primary-container);
  box-shadow: inset 0 0 0 1px var(--primary); }
.chip--quiet { font-style: italic; color: var(--on-surface-variant); }

/* --- Form (F, M3) ---------------------------------------------------------- */
/* Label: block text-sm font-medium mb-1. Hint: block text-xs text-on-surface-variant. */
.field { display: flex; flex-direction: column; gap: var(--space-1); margin-bottom: var(--space-4); }
.field label { font-weight: 500; }
.field__hint { font-size: var(--text-xs); color: var(--on-surface-variant); }
.field__error { color: var(--error); font-weight: 500; }
/* Field: w-full rounded border-outline-variant ring-1 ring-outline-variant px-3 py-2;
   focus:ring-primary. */
.input, .field input:not([type="checkbox"], [type="radio"]), .field select, .field textarea {
  width: 100%; padding: var(--space-2) var(--space-3); border: 1px solid var(--outline-variant);
  border-radius: var(--r-badge); background: var(--surface-raised); color: var(--on-surface); font: inherit;
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary);
}
/* Small field: w-20 rounded-md ring-1 ring-outline-variant px-2 py-1 text-sm. */
.input--small { padding: var(--space-1) var(--space-2); border-radius: var(--r-alert); }
/* syndle-audit (iPad): fields at least 44px on touch devices; iOS zooms in below 16px. */
@media (pointer: coarse) {
  .input, .field input:not([type="checkbox"], [type="radio"]), .field select { min-height: 44px; }
}
@media (max-width: 767px) {
  .input, .field input, .field select, .field textarea { font-size: 16px; }
}
[aria-invalid="true"] { border-color: var(--error) !important; }
.form__actions { display: flex; gap: var(--space-2); margin-top: var(--space-6); }

/* --- Alerts (M) ------------------------------------------------------------ */
/* Layout::FlashComponent: mb-4 rounded-md px-4 py-3 text-sm ring-1;
   notice bg-success-container text-on-success-container ring-success/20;
   alert bg-error-container text-on-error-container ring-error/20.
   Warning: the same structure with the warning tokens of syndel-menu. */
.alert { display: block; margin-bottom: var(--space-4); padding: var(--space-3) var(--space-4);
  border-radius: var(--r-alert); font-size: var(--text-sm); }
.alert--success { background: var(--success-container); color: var(--on-success-container);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--success) 20%, transparent); }
.alert--error { background: var(--error-container); color: var(--on-error-container);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--error) 20%, transparent); }
.alert--warning { background: var(--warning-container); color: var(--on-warning-container);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warning) 20%, transparent); }

/* --- Table (TB) ------------------------------------------------------------ */
/* syndel-menu views: table min-w-full divide-y divide-outline-variant/40 text-sm;
   thead bg-surface-container-low text-left text-on-surface-variant; th px-4 py-2
   font-medium; td px-4 py-2; tr hover:bg-surface-container-low. The table sits in a
   CardComponent with padding p-0; .data-table takes over that card. */
.data-table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-sm);
  background: var(--surface-raised); border-radius: var(--r-card); overflow: hidden;
  box-shadow: var(--elevation-soft), 0 0 0 1px color-mix(in srgb, var(--outline-variant) 60%, transparent); }
.data-table th { background: var(--surface-sunken); color: var(--on-surface-variant); font-weight: 500; text-align: left; }
.data-table th, .data-table td { padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid color-mix(in srgb, var(--outline-variant) 40%, transparent); }
.data-table tbody tr:hover { background: var(--surface-sunken); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table td { vertical-align: middle; }
.data-table .number { text-align: right; font-variant-numeric: tabular-nums; }
/* syndle-audit: compact = without frame and header background, for a table in a card;
   the columns keep their spacing, the outer edges do not. */
.data-table--compact { border-radius: 0; background: transparent; box-shadow: none; }
.data-table--compact th { background: transparent; }
.data-table--compact th, .data-table--compact td { padding: var(--space-2) var(--space-4) var(--space-2) 0; }
.data-table--compact th:last-child, .data-table--compact td:last-child { padding-right: 0; }
.data-table--compact tbody tr:hover { background: transparent; }
/* syndle-audit: on a narrow screen the table scrolls in its own frame, with a
   shadow on the side where there is more. */
@media (max-width: 767px) {
  .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch;
    background-color: var(--surface-raised);
    background-image:
      linear-gradient(to right, var(--surface-raised), transparent),
      linear-gradient(to left, var(--surface-raised), transparent),
      radial-gradient(farthest-side at 0 50%, rgb(0 0 0 / .12), transparent),
      radial-gradient(farthest-side at 100% 50%, rgb(0 0 0 / .12), transparent);
    background-position: left center, right center, left center, right center;
    background-size: 28px 100%, 28px 100%, 12px 100%, 12px 100%;
    background-repeat: no-repeat;
    background-attachment: local, local, scroll, scroll; }
  .data-table th, .data-table td { white-space: nowrap; }
}

/* Empty state: syndle-audit .empty-state (text in the empty table cell). */
.empty-state { color: var(--on-surface-variant); }
/* EmptyState: the text above the button in a card. */
.card > .empty-state:not(:last-child) { margin-bottom: var(--space-4); }

/* --- Loading (L) ----------------------------------------------------------- */
.htmx-request.dims-while-loading, .htmx-request .dims-while-loading, turbo-frame[aria-busy="true"] { opacity: 0.6; }

/* --- Modal (A3) ------------------------------------------------------------ */
/* Layout::ModalComponent: rounded-2xl bg-surface p-0 shadow-xl backdrop:bg-black/40;
   header border-b border-outline-variant px-5 py-4, title text-lg font-semibold;
   content max-h-[80vh] overflow-y-auto p-5. */
dialog.modal { width: 100%; max-width: 32rem; padding: 0; border: 0; border-radius: var(--r-card);
  background: var(--surface); color: var(--on-surface); box-shadow: var(--elevation-pop); }
dialog.modal--wide { max-width: 56rem; }
dialog.modal::backdrop { background: var(--scrim); }
.modal__header { display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--outline-variant); }
.modal__header h2 { margin: 0; }
.modal__body { padding: var(--space-5); max-height: 80vh; overflow-y: auto; }

/* --- Icon (I) -------------------------------------------------------------- */
/* application.tailwind.css .material-symbols-outlined */
.icon { font-family: "Material Symbols Outlined"; font-weight: normal; font-style: normal;
  line-height: 1; vertical-align: middle; font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24; }
.icon--filled { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }

/* --- Spinner (L5) ---------------------------------------------------------- */
/* Ui::SpinnerComponent: flex min-h-9 items-center gap-2 text-sm text-on-surface-variant,
   role="status", circle 18px animate-spin text-primary. */
.spinner { display: flex; align-items: center; gap: var(--space-2); min-height: 36px;
  font-size: var(--text-sm); color: var(--on-surface-variant); }
.spinner::before { content: ""; width: 18px; height: 18px; flex: none; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--primary) 25%, transparent); border-top-color: var(--primary);
  animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================================
   Added in contract version 13 (24-11-2026), source: ias
   ========================================================================== */
/* MultiSelect (componenten.md): chosen options as chips above the search field, the results in a list below it. */
.multi-select__chosen { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; margin: 0; padding: 0; }
.multi-select__chosen:not(:has(li)) { display: none; }
.multi-select__chip {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 4px var(--space-1) 4px var(--space-3); border-radius: var(--r-control);
  background: var(--primary-container); color: var(--on-primary-container);
}
/* At least 24×24px (house style K3, WCAG 2.5.8), 44px on touch like .field input. */
.multi-select__remove {
  display: inline-flex; align-items: center; justify-content: center; min-width: 24px; min-height: 24px;
  border: 0; background: transparent; color: inherit; font: inherit; font-size: var(--text-lg); line-height: 1;
  padding: 0 var(--space-1); border-radius: var(--r-control); cursor: pointer;
}
@media (pointer: coarse) { .multi-select__remove { min-width: 44px; min-height: 44px; } }
.multi-select__remove .icon { font-size: 18px; }
.multi-select__remove:hover { background: var(--surface-hover); }
/* The results hang under the search field as one box: same border, no gap, the field loses its lower corners.
   In the flow, not floating: .modal__body scrolls and would cut off a floating list. */
.multi-select__options {
  list-style: none; margin: calc(-1 * var(--space-1) - 1px) 0 0; padding: var(--space-1); max-height: 15rem; overflow: auto;
  border: 1px solid var(--primary); border-top-color: var(--outline-variant);
  border-radius: 0 0 var(--r-badge) var(--r-badge); background: var(--surface-raised); box-shadow: var(--elevation-raise);
}
.multi-select:has(.multi-select__options) input[type="search"] {
  border-color: var(--primary); border-bottom-left-radius: 0; border-bottom-right-radius: 0;
}
/* The browser's own clear button looks like the remove button of a chip; Escape clears the field. */
.multi-select input[type="search"]::-webkit-search-cancel-button { display: none; }
.multi-select__option {
  display: flex; width: 100%; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--r-control);
  background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.multi-select__detail { color: var(--on-surface-variant); }
.multi-select__option:hover, .multi-select__option:focus-visible { background: var(--surface-hover); }

/* ActionMenu (componenten.md): the actions of a table row in a popover under its ⋮ button. */
.action-menu {
  position: fixed; inset: auto; margin: 0; min-width: 12rem; padding: var(--space-1);
  border: 1px solid var(--outline-variant); border-radius: var(--r-control);
  background: var(--surface-raised); color: var(--on-surface); box-shadow: var(--elevation-raise);
}
.action-menu__toggle .icon { font-size: 20px; }   /* I2: 18–20px in a button */
.action-menu ul { list-style: none; margin: 0; padding: 0; }
.action-menu .button {
  width: 100%; justify-content: flex-start; border: 0; border-radius: var(--r-control);
  background: transparent; box-shadow: none; font-weight: 400;
}
.action-menu .button:hover, .action-menu .button:focus-visible { background: var(--surface-hover); }
