/* ==========================================================================
   VestaSys CSS — 03 · Components
   --------------------------------------------------------------------------
   Layer 3 of 5. Multi-property, semantic building blocks: `btn`, `card`,
   `input`, `table`, `modal`, and so on.

   ORDER MATTERS. This layer is loaded BEFORE the utility layer, so a utility
   always wins over a component:

       <button class="btn btn-primary w-full text-xs">

   `w-full` and `text-xs` override whatever `.btn` sets, which is exactly how
   the existing views expect to be able to tune a component inline.

   Every component reads its colours from the theme tokens in 02-theme.css —
   there is not a single hard-coded colour below, which is what lets the same
   markup render correctly under light, dark and salmonevolution.
   ========================================================================== */


/* ==========================================================================
   Buttons
   --------------------------------------------------------------------------
   `.btn` is the neutral base; a modifier (`btn-primary`, `btn-ghost`, …) sets
   the colour, and a size modifier (`btn-xs` … `btn-lg`) sets the metrics.
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
    height: 3rem;
    min-height: 3rem;
    padding-inline: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.15;
    text-align: center;
    border-radius: var(--vs-radius-field);
    border: 1px solid var(--vs-base-300);
    background-color: var(--vs-base-200);
    color: var(--vs-base-content);
    cursor: pointer;
    user-select: none;
    text-decoration: none;
    /* Snappy but not instant — matches the old DaisyUI feel. */
    transition: background-color 0.15s ease, border-color 0.15s ease,
                color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}

/* Neutral button hover: one step darker/lighter than its resting surface. */
.btn:hover { background-color: var(--vs-base-300); }

/* A pressed button dips slightly — the tactile cue the kiosk relies on. */
.btn:active { transform: translateY(1px); }

/* Disabled buttons (attribute or class) lose all interactivity and contrast.
   This also covers the global submit-loading state, which sets `disabled`. */
.btn:disabled,
.btn[disabled],
.btn-disabled {
    pointer-events: none;
    opacity: 0.5;
    background-color: var(--vs-base-200);
    border-color: transparent;
    color: rgb(var(--vs-base-content-rgb) / 0.5);
    transform: none;
}

/* Opt out of the press animation (used where a button is inside a busy list). */
.btn-no-animation:active,
.btn.no-animation:active { transform: none; }

/* -- Colour variants ---------------------------------------------------
   Each sets surface + matching readable foreground, and darkens on hover by
   overlaying the theme's base-content at low alpha (works on any hue). */
.btn-primary   { background-color: var(--vs-primary);   border-color: var(--vs-primary);   color: var(--vs-primary-content); }
.btn-secondary { background-color: var(--vs-secondary); border-color: var(--vs-secondary); color: var(--vs-secondary-content); }
.btn-accent    { background-color: var(--vs-accent);    border-color: var(--vs-accent);    color: var(--vs-accent-content); }
.btn-neutral   { background-color: var(--vs-neutral);   border-color: var(--vs-neutral);   color: var(--vs-neutral-content); }
.btn-info      { background-color: var(--vs-info);      border-color: var(--vs-info);      color: var(--vs-info-content); }
.btn-success   { background-color: var(--vs-success);   border-color: var(--vs-success);   color: var(--vs-success-content); }
.btn-warning   { background-color: var(--vs-warning);   border-color: var(--vs-warning);   color: var(--vs-warning-content); }
.btn-error     { background-color: var(--vs-error);     border-color: var(--vs-error);     color: var(--vs-error-content); }

/* Hover for coloured buttons: darken with a translucent black overlay via
   box-shadow inset, so we don't need a second hand-picked hex per colour. */
.btn-primary:hover, .btn-secondary:hover, .btn-accent:hover, .btn-neutral:hover,
.btn-info:hover, .btn-success:hover, .btn-warning:hover, .btn-error:hover {
    box-shadow: inset 0 0 0 999px rgb(0 0 0 / 0.12);
}

/* Ghost — no surface until hovered. The most common button in the app. */
.btn-ghost {
    background-color: transparent;
    border-color: transparent;
    color: inherit;
    box-shadow: none;
}
.btn-ghost:hover { background-color: rgb(var(--vs-base-content-rgb) / 0.10); box-shadow: none; }

/* Outline — border in the current colour, filled on hover. Combined with a
   colour modifier (`btn-outline btn-error`) it inherits that hue via
   currentColor, so one rule covers every colour. */
.btn-outline {
    background-color: transparent;
    border-color: currentColor;
}
.btn-outline:hover { background-color: rgb(var(--vs-base-content-rgb) / 0.10); box-shadow: none; }
.btn-outline.btn-primary { color: var(--vs-primary); }
.btn-outline.btn-error   { color: var(--vs-error); }
.btn-outline.btn-success { color: var(--vs-success); }
.btn-outline.btn-warning { color: var(--vs-warning); }
.btn-outline.btn-info    { color: var(--vs-info); }
/* Filling an outline button on hover needs the readable foreground back. */
.btn-outline.btn-primary:hover { background-color: var(--vs-primary); color: var(--vs-primary-content); }
.btn-outline.btn-error:hover   { background-color: var(--vs-error);   color: var(--vs-error-content); }
.btn-outline.btn-success:hover { background-color: var(--vs-success); color: var(--vs-success-content); }
.btn-outline.btn-warning:hover { background-color: var(--vs-warning); color: var(--vs-warning-content); }
.btn-outline.btn-info:hover    { background-color: var(--vs-info);    color: var(--vs-info-content); }

/* An explicitly "current" button (e.g. the selected filter in a join group). */
.btn-active { background-color: rgb(var(--vs-base-content-rgb) / 0.18); }

/* -- Sizes -------------------------------------------------------------- */
.btn-xs { height: 1.5rem;   min-height: 1.5rem;   padding-inline: 0.5rem;  font-size: 0.6875rem; }
.btn-sm { height: 2rem;     min-height: 2rem;     padding-inline: 0.75rem; font-size: 0.8125rem; }
.btn-md { height: 3rem;     min-height: 3rem;     padding-inline: 1rem;    font-size: 0.875rem; }
.btn-lg { height: 4rem;     min-height: 4rem;     padding-inline: 1.5rem;  font-size: 1.125rem; }

/* -- Shapes ------------------------------------------------------------- */
/* Square/circle buttons are icon-only: width tracks height, padding removed.
   The size modifiers above must still apply, hence the per-size widths. */
.btn-square { width: 3rem; padding-inline: 0; }
.btn-square.btn-xs { width: 1.5rem; }
.btn-square.btn-sm { width: 2rem; }
.btn-square.btn-lg { width: 4rem; }
.btn-circle { width: 3rem; padding-inline: 0; border-radius: 9999px; }
.btn-circle.btn-xs { width: 1.5rem; }
.btn-circle.btn-sm { width: 2rem; }
.btn-circle.btn-lg { width: 4rem; }

/* Full-width block button (forms, kiosk). */
.btn-block { display: flex; width: 100%; }


/* ==========================================================================
   Cards
   --------------------------------------------------------------------------
   The primary content container across the whole application.
   ========================================================================== */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: var(--vs-radius-box);
    /* Keeps images/tables from poking out of the rounded corners. */
    overflow: hidden;
}
.card-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.5rem;
}
.card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
}
/* Action row at the foot of a card — right-aligned button group. */
.card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem;
}
/* Compact card padding (used by dense list cards). */
.card-compact .card-body { padding: 1rem; }
/* `card-bordered` gives the hairline some cards use instead of a shadow. */
.card-bordered { border: 1px solid var(--vs-base-300); }


/* ==========================================================================
   Badges — small status pills
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    height: 1.5rem;
    padding-inline: 0.625rem;
    font-size: 0.8125rem;
    line-height: 1;
    white-space: nowrap;
    border-radius: var(--vs-radius-selector);
    border: 1px solid var(--vs-base-300);
    background-color: var(--vs-base-200);
    color: var(--vs-base-content);
}
.badge-primary   { background-color: var(--vs-primary);   border-color: var(--vs-primary);   color: var(--vs-primary-content); }
.badge-secondary { background-color: var(--vs-secondary); border-color: var(--vs-secondary); color: var(--vs-secondary-content); }
.badge-accent    { background-color: var(--vs-accent);    border-color: var(--vs-accent);    color: var(--vs-accent-content); }
.badge-neutral   { background-color: var(--vs-neutral);   border-color: var(--vs-neutral);   color: var(--vs-neutral-content); }
.badge-info      { background-color: var(--vs-info);      border-color: var(--vs-info);      color: var(--vs-info-content); }
.badge-success   { background-color: var(--vs-success);   border-color: var(--vs-success);   color: var(--vs-success-content); }
.badge-warning   { background-color: var(--vs-warning);   border-color: var(--vs-warning);   color: var(--vs-warning-content); }
.badge-error     { background-color: var(--vs-error);     border-color: var(--vs-error);     color: var(--vs-error-content); }

/* Ghost — the "no status" pill; a flat neutral chip with no border. */
.badge-ghost {
    background-color: rgb(var(--vs-base-content-rgb) / 0.10);
    border-color: transparent;
    color: var(--vs-base-content);
}
/* Outline — hollow pill in the current colour (pairs with a colour modifier). */
.badge-outline {
    background-color: transparent;
    border-color: currentColor;
    color: inherit;
}
.badge-outline.badge-primary { color: var(--vs-primary); }
.badge-outline.badge-success { color: var(--vs-success); }
.badge-outline.badge-warning { color: var(--vs-warning); }
.badge-outline.badge-error   { color: var(--vs-error); }
.badge-outline.badge-info    { color: var(--vs-info); }

.badge-xs { height: 0.875rem; padding-inline: 0.3125rem; font-size: 0.625rem; }
.badge-sm { height: 1.25rem;  padding-inline: 0.5rem;    font-size: 0.75rem; }
.badge-lg { height: 1.75rem;  padding-inline: 0.75rem;   font-size: 0.875rem; }


/* ==========================================================================
   Alerts — flash messages and inline notices
   --------------------------------------------------------------------------
   Coloured variants use a translucent tint of the status colour rather than a
   solid fill, so long alert text stays readable in both light and dark.
   ========================================================================== */
.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-radius: var(--vs-radius-box);
    border: 1px solid var(--vs-base-300);
    background-color: var(--vs-base-200);
    color: var(--vs-base-content);
}
.alert-info    { background-color: rgb(var(--vs-info-rgb) / 0.12);    border-color: rgb(var(--vs-info-rgb) / 0.40);    color: var(--vs-base-content); }
.alert-success { background-color: rgb(var(--vs-success-rgb) / 0.12); border-color: rgb(var(--vs-success-rgb) / 0.40); color: var(--vs-base-content); }
.alert-warning { background-color: rgb(var(--vs-warning-rgb) / 0.14); border-color: rgb(var(--vs-warning-rgb) / 0.40); color: var(--vs-base-content); }
.alert-error   { background-color: rgb(var(--vs-error-rgb) / 0.12);   border-color: rgb(var(--vs-error-rgb) / 0.40);   color: var(--vs-base-content); }
/* Icons inside an alert take the status hue so the tint reads as intentional. */
.alert-info    > svg { color: var(--vs-info); }
.alert-success > svg { color: var(--vs-success); }
.alert-warning > svg { color: var(--vs-warning); }
.alert-error   > svg { color: var(--vs-error); }


/* ==========================================================================
   Form controls
   --------------------------------------------------------------------------
   `form-control` is the vertical field wrapper, `label` the row above/below it
   and `label-text` / `label-text-alt` the two text styles inside a label.
   ========================================================================== */
.form-control {
    display: flex;
    flex-direction: column;
}
.label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.25rem 0.125rem;
    /* A label wrapping a control is clickable, so show the pointer. */
    cursor: pointer;
}
.label-text {
    font-size: 0.875rem;
    color: var(--vs-base-content);
}
.label-text-alt {
    font-size: 0.75rem;
    color: rgb(var(--vs-base-content-rgb) / 0.60);
}

/* -- Text inputs, selects, textareas -----------------------------------
   Shared metrics so a row of mixed controls lines up exactly. `*-bordered`
   is what actually draws the outline (matching the old framework, where a
   bare `input` was borderless). */
.input,
.select,
.textarea,
.file-input {
    display: block;
    width: 100%;
    height: 3rem;
    padding-inline: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--vs-base-content);
    background-color: var(--vs-base-100);
    border: 1px solid transparent;
    border-radius: var(--vs-radius-field);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    /* Strip the OS look so light/dark themes stay consistent. */
    appearance: none;
    -webkit-appearance: none;
}
.input-bordered,
.select-bordered,
.textarea-bordered,
.file-input-bordered {
    border-color: rgb(var(--vs-base-content-rgb) / 0.20);
}

/* Focus: a coloured border plus a soft ring, instead of the OS outline. */
.input:focus,
.select:focus,
.textarea:focus,
.file-input:focus {
    outline: none;
    border-color: var(--vs-primary);
    box-shadow: 0 0 0 3px rgb(var(--vs-primary-rgb) / 0.20);
}

/* Laravel's validation styling hook: `input-error` on a field that failed. */
.input-error,
.select-error,
.textarea-error {
    border-color: var(--vs-error);
}

/* Disabled/readonly controls read as inert but still legible. */
.input:disabled, .select:disabled, .textarea:disabled, .file-input:disabled,
.input[readonly], .textarea[readonly] {
    background-color: var(--vs-base-200);
    color: rgb(var(--vs-base-content-rgb) / 0.60);
    cursor: not-allowed;
}

/* Textareas are multi-line, so height is a minimum and padding is symmetric. */
.textarea {
    height: auto;
    min-height: 5rem;
    padding: 0.625rem 0.75rem;
}

/* Selects get a chevron drawn as an inline SVG data URI (no icon font, no
   extra request). `currentColor` can't be used inside a data URI, so the
   arrow is a mid grey that reads acceptably on both light and dark surfaces. */
.select {
    padding-inline-end: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%238a9199' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.625rem center;
    background-size: 1rem 1rem;
}
/* A multi-select / sized select is a list box, not a dropdown — no chevron. */
.select[multiple],
.select[size]:not([size='1']) {
    height: auto;
    padding-inline-end: 0.75rem;
    background-image: none;
}

/* -- Control sizes ------------------------------------------------------ */
.input-xs, .select-xs, .file-input-xs { height: 1.5rem; padding-inline: 0.5rem;  font-size: 0.6875rem; }
.input-sm, .select-sm, .file-input-sm { height: 2rem;   padding-inline: 0.625rem; font-size: 0.8125rem; }
.input-lg, .select-lg, .file-input-lg { height: 4rem;   padding-inline: 1rem;     font-size: 1.125rem; }
.textarea-xs { min-height: 3rem;   padding: 0.375rem 0.5rem;   font-size: 0.6875rem; }
.textarea-sm { min-height: 4rem;   padding: 0.5rem 0.625rem;   font-size: 0.8125rem; }
.textarea-lg { min-height: 7rem;   padding: 0.875rem 1rem;     font-size: 1.125rem; }
.select-sm { background-position: right 0.5rem center; padding-inline-end: 1.75rem; }

/* -- File input ---------------------------------------------------------
   The native button is restyled to look like a small neutral `.btn` sitting
   flush inside the field. */
.file-input { padding-inline: 0; line-height: 3rem; }
.file-input::file-selector-button {
    height: 100%;
    margin-inline-end: 0.75rem;
    padding-inline: 1rem;
    font-size: inherit;
    font-weight: 600;
    color: var(--vs-base-content);
    background-color: var(--vs-base-200);
    border: 0;
    border-inline-end: 1px solid rgb(var(--vs-base-content-rgb) / 0.20);
    cursor: pointer;
}
.file-input-sm { line-height: 2rem; }
.file-input-sm::file-selector-button { padding-inline: 0.75rem; }

/* -- Checkbox / radio / toggle ------------------------------------------
   All three are the native control restyled with `appearance: none`, so they
   stay keyboard-accessible and form-serialisable. */
.checkbox {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid rgb(var(--vs-base-content-rgb) / 0.35);
    border-radius: var(--vs-radius-selector);
    background-color: transparent;
    cursor: pointer;
    transition: background-color 0.12s ease, border-color 0.12s ease;
}
/* Checked state: fill with the accent colour and stamp a tick, again as an
   inline SVG background so no icon font is needed. */
.checkbox:checked,
.checkbox[aria-checked='true'] {
    background-color: var(--vs-base-content);
    border-color: var(--vs-base-content);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
    background-size: 80% 80%;
    background-position: center;
    background-repeat: no-repeat;
}
.checkbox-primary:checked { background-color: var(--vs-primary); border-color: var(--vs-primary); }
.checkbox-success:checked { background-color: var(--vs-success); border-color: var(--vs-success); }
.checkbox-warning:checked { background-color: var(--vs-warning); border-color: var(--vs-warning); }
.checkbox-error:checked   { background-color: var(--vs-error);   border-color: var(--vs-error); }
.checkbox:disabled { opacity: 0.4; cursor: not-allowed; }
.checkbox-xs { width: 1rem;     height: 1rem; }
.checkbox-sm { width: 1.25rem;  height: 1.25rem; }
.checkbox-lg { width: 2rem;     height: 2rem; }

.radio {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid rgb(var(--vs-base-content-rgb) / 0.35);
    border-radius: 9999px;
    background-color: transparent;
    cursor: pointer;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
/* The dot is drawn with an inset box-shadow so it scales with the control. */
.radio:checked {
    border-color: var(--vs-base-content);
    box-shadow: inset 0 0 0 0.25rem var(--vs-base-100), inset 0 0 0 1rem var(--vs-base-content);
}
.radio-primary:checked { border-color: var(--vs-primary); box-shadow: inset 0 0 0 0.25rem var(--vs-base-100), inset 0 0 0 1rem var(--vs-primary); }
.radio:disabled { opacity: 0.4; cursor: not-allowed; }
.radio-xs { width: 1rem; height: 1rem; }
.radio-sm { width: 1.25rem; height: 1.25rem; }

/* Toggle — a pill track with a knob moved by an inset box-shadow trick, so the
   whole control is one element with no pseudo-element positioning to maintain. */
.toggle {
    flex-shrink: 0;
    width: 3rem;
    height: 1.5rem;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid rgb(var(--vs-base-content-rgb) / 0.30);
    border-radius: 9999px;
    background-color: rgb(var(--vs-base-content-rgb) / 0.20);
    cursor: pointer;
    position: relative;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.toggle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0.1875rem;
    width: 1.0625rem;
    height: 1.0625rem;
    border-radius: 9999px;
    background-color: var(--vs-base-100);
    transform: translateY(-50%);
    transition: left 0.15s ease;
}
.toggle:checked { background-color: var(--vs-base-content); border-color: var(--vs-base-content); }
.toggle:checked::after { left: calc(100% - 1.25rem); }
.toggle-primary:checked { background-color: var(--vs-primary); border-color: var(--vs-primary); }
.toggle-success:checked { background-color: var(--vs-success); border-color: var(--vs-success); }
.toggle-warning:checked { background-color: var(--vs-warning); border-color: var(--vs-warning); }
.toggle-error:checked   { background-color: var(--vs-error);   border-color: var(--vs-error); }
.toggle:disabled { opacity: 0.4; cursor: not-allowed; }
.toggle-sm { width: 2.25rem; height: 1.125rem; }
.toggle-sm::after { width: 0.75rem; height: 0.75rem; }
.toggle-sm:checked::after { left: calc(100% - 0.9375rem); }


/* ==========================================================================
   Tables
   ========================================================================== */
.table {
    width: 100%;
    font-size: 0.875rem;
    text-align: left;
    border-collapse: separate;
    border-spacing: 0;
}
.table th,
.table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}
/* Header row: small, muted, uppercase-ish label styling. */
.table thead th {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgb(var(--vs-base-content-rgb) / 0.60);
    white-space: nowrap;
}
/* Hairline between rows only (not above the first or below the last). */
.table tbody tr td,
.table thead tr th {
    border-bottom: 1px solid rgb(var(--vs-base-content-rgb) / 0.10);
}
.table tbody tr:last-child td { border-bottom: 0; }
/* `class="hover"` on a <tr> highlights it on mouse-over. */
.table tbody tr.hover:hover,
.table tbody tr:hover.hover {
    background-color: rgb(var(--vs-base-content-rgb) / 0.04);
}
/* Zebra striping, if a view opts in. */
.table-zebra tbody tr:nth-child(even) { background-color: rgb(var(--vs-base-content-rgb) / 0.03); }
/* Density modifiers. */
.table-xs th, .table-xs td { padding: 0.25rem 0.5rem;  font-size: 0.75rem; }
.table-sm th, .table-sm td { padding: 0.5rem 0.75rem;  font-size: 0.8125rem; }
.table-lg th, .table-lg td { padding: 1rem 1.25rem;    font-size: 1rem; }


/* ==========================================================================
   Breadcrumbs
   --------------------------------------------------------------------------
   A horizontal, scrollable trail. The "/" separator is generated, so the
   markup stays a plain <ul><li>…</li></ul>.
   ========================================================================== */
.breadcrumbs {
    max-width: 100%;
    overflow-x: auto;
    padding-block: 0.5rem;
}
.breadcrumbs > ul {
    display: flex;
    align-items: center;
    white-space: nowrap;
    min-height: 1.5rem;
}
.breadcrumbs > ul > li { display: flex; align-items: center; }
.breadcrumbs > ul > li + li::before {
    content: '/';
    margin-inline: 0.5rem;
    opacity: 0.4;
}
.breadcrumbs > ul > li > a { text-decoration: none; }
.breadcrumbs > ul > li > a:hover { text-decoration: underline; }


/* ==========================================================================
   Menu — the sidebar nav and dropdown lists
   ========================================================================== */
.menu {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    padding: 0.5rem;
    font-size: 0.875rem;
}
.menu :where(li) { position: relative; display: flex; flex-direction: column; flex-shrink: 0; }
/* Every interactive child of a menu item gets the same row treatment, so a
   <a>, a <button> and a <form><button> all look identical in the sidebar. */
.menu :where(li) > :where(a, button, .menu-item) {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--vs-radius-field);
    text-align: left;
    text-decoration: none;
    transition: background-color 0.12s ease, color 0.12s ease;
}
.menu :where(li) > :where(a, button, .menu-item):hover {
    background-color: rgb(var(--vs-base-content-rgb) / 0.08);
}
/* Current page — used by the sidebar via @class([... 'menu-active' => …]). */
.menu :where(li) > .menu-active,
.menu :where(li) > .active,
.menu .menu-active {
    background-color: var(--vs-primary);
    color: var(--vs-primary-content);
}
.menu :where(li) > .menu-active:hover { background-color: var(--vs-primary); }
/* Section headings inside a menu. */
.menu :where(li) > .menu-title,
.menu .menu-title {
    padding: 0.5rem 0.75rem 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgb(var(--vs-base-content-rgb) / 0.50);
}
/* Collapsible group — <li><details><summary>…</summary><ul>…</ul></details></li>,
   the sidebar's expandable sections.

   The summary needs the SAME row treatment as an <a>, and for a non-obvious
   reason: the preflight in 01-base.css makes every <svg> `display: block` so
   icons cannot blow out a flex row. A <summary> left at its UA default
   (`display: list-item`) is not a flex container, so that block-level icon
   forces a line break — the disclosure marker, the icon and the label each end
   up on their own line. Making the summary a flex row is what puts them back
   on one line, exactly as it does for the <a> rows above. */
.menu :where(li) > details > summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--vs-radius-field);
    text-align: left;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
    /* Drop the native triangle — the chevron below replaces it, so the arrow
       sits at the end of the row instead of in front of the icon. */
    list-style: none;
}
.menu :where(li) > details > summary::-webkit-details-marker { display: none; }
.menu :where(li) > details > summary:hover {
    background-color: rgb(var(--vs-base-content-rgb) / 0.08);
}

/* The chevron: pushed to the trailing edge by the auto margin, pointing down
   when the group is closed and up when it is open. */
.menu :where(li) > details > summary::after {
    content: '';
    width: 0.45rem;
    height: 0.45rem;
    margin-inline-start: auto;
    flex-shrink: 0;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    /* Nudged up so the rotated square reads as centred against the label. */
    transform: translateY(-2px) rotate(45deg);
    transition: transform 0.15s ease;
    opacity: 0.6;
}
.menu :where(li) > details[open] > summary::after {
    transform: translateY(1px) rotate(-135deg);
}

/* The submenu: indented under its heading with a guide rule, so a child row is
   visibly subordinate to the group it belongs to. */
.menu :where(li) > details > ul {
    margin-inline-start: 1rem;
    padding-inline-start: 0.5rem;
    border-inline-start: 1px solid var(--vs-base-300);
}

.menu-xs { font-size: 0.6875rem; }
.menu-xs :where(li) > :where(a, button, .menu-item) { padding: 0.25rem 0.5rem; }
.menu-xs :where(li) > details > summary { padding: 0.25rem 0.5rem; }
.menu-sm { font-size: 0.8125rem; }
.menu-sm :where(li) > :where(a, button, .menu-item) { padding: 0.375rem 0.625rem; }
.menu-sm :where(li) > details > summary { padding: 0.375rem 0.625rem; }


/* ==========================================================================
   Dropdown
   --------------------------------------------------------------------------
   CSS-only: the panel opens while focus is anywhere inside the wrapper. The
   trigger therefore needs `tabindex="0"` (the existing markup already has it).
   ========================================================================== */
.dropdown { position: relative; display: inline-block; }
.dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    /* Hidden but still focusable-in-order — visibility toggles, not display,
       so the open/close can be transitioned. */
    visibility: hidden;
    opacity: 0;
    transform: translateY(-0.25rem);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    z-index: 50;
}
.dropdown:focus-within > .dropdown-content,
.dropdown.dropdown-open > .dropdown-content {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}
/* Alignment modifiers. */
.dropdown-end > .dropdown-content    { left: auto; right: 0; }
.dropdown-top > .dropdown-content    { top: auto; bottom: 100%; }
.dropdown-left > .dropdown-content   { top: 0; left: auto; right: 100%; }
.dropdown-right > .dropdown-content  { top: 0; left: 100%; }


/* ==========================================================================
   Modal
   --------------------------------------------------------------------------
   Driven by Alpine toggling `modal-open` (`:class="{ 'modal-open': open }"`).
   Closed modals are `visibility: hidden` + `opacity: 0` so they can animate,
   and `pointer-events: none` so they never block clicks while closed.
   ========================================================================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 1rem;
    background-color: rgb(0 0 0 / 0.45);
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    overscroll-behavior: contain;
    transition: opacity 0.2s ease, visibility 0.2s;
}
.modal.modal-open,
.modal[open] {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}
.modal-box {
    position: relative;
    z-index: 1;               /* above .modal-backdrop */
    width: 100%;
    max-width: 32rem;
    max-height: calc(100vh - 5rem);
    overflow-y: auto;
    padding: 1.5rem;
    border-radius: var(--vs-radius-box);
    background-color: var(--vs-base-100);
    color: var(--vs-base-content);
    box-shadow: var(--vs-shadow-xl);
    transform: translateY(0.5rem) scale(0.98);
    transition: transform 0.2s ease;
}
.modal.modal-open .modal-box { transform: translateY(0) scale(1); }
/* Right-aligned button row at the foot of the box. */
.modal-action {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}
/* A click-catcher filling the modal behind the box — closes on click. */
.modal-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    cursor: pointer;
}


/* ==========================================================================
   Tabs
   ========================================================================== */
.tabs { display: flex; flex-wrap: wrap; align-items: center; }
.tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2rem;
    padding-inline: 1rem;
    font-size: 0.875rem;
    line-height: 2;
    color: rgb(var(--vs-base-content-rgb) / 0.60);
    cursor: pointer;
    text-decoration: none;
    border-radius: var(--vs-radius-field);
    transition: background-color 0.12s ease, color 0.12s ease;
}
.tab:hover { color: var(--vs-base-content); }
.tab-active { color: var(--vs-base-content); font-weight: 600; }
/* Boxed style — a padded track with the active tab as a raised chip. */
.tabs-boxed {
    gap: 0.25rem;
    padding: 0.25rem;
    background-color: rgb(var(--vs-base-content-rgb) / 0.08);
    border-radius: var(--vs-radius-field);
}
.tabs-boxed .tab-active {
    background-color: var(--vs-primary);
    color: var(--vs-primary-content);
}
.tabs-sm .tab { height: 1.75rem; font-size: 0.8125rem; padding-inline: 0.75rem; }
.tabs-lg .tab { height: 3rem;    font-size: 1.125rem;  padding-inline: 1.25rem; }


/* ==========================================================================
   Stats — the dashboard tiles
   ========================================================================== */
.stats {
    display: grid;
    grid-auto-flow: column;
    overflow-x: auto;
    border-radius: var(--vs-radius-box);
    background-color: var(--vs-base-100);
    color: var(--vs-base-content);
}
/* Stacked (mobile) orientation; `sm:stats-horizontal` flips it back at ≥640px
   — that responsive variant lives in 05-variants.css. */
.stats-vertical { grid-auto-flow: row; }
.stats-horizontal { grid-auto-flow: column; }
.stat {
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    /* A divider between tiles, drawn on the leading edge of each tile. */
    border-inline-start: 1px solid rgb(var(--vs-base-content-rgb) / 0.10);
    padding: 1rem 1.5rem;
    column-gap: 1rem;
}
.stats-vertical > .stat {
    border-inline-start: 0;
    border-top: 1px solid rgb(var(--vs-base-content-rgb) / 0.10);
}
/* Never draw the divider before the first tile. */
.stats > .stat:first-child { border-inline-start: 0; border-top: 0; }
.stat-title {
    grid-column-start: 1;
    font-size: 0.75rem;
    color: rgb(var(--vs-base-content-rgb) / 0.60);
    white-space: nowrap;
}
.stat-value {
    grid-column-start: 1;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.stat-desc {
    grid-column-start: 1;
    font-size: 0.75rem;
    color: rgb(var(--vs-base-content-rgb) / 0.60);
}
/* The icon slot, pinned to the right of the tile across all three text rows. */
.stat-figure {
    grid-column-start: 2;
    grid-row: span 3 / span 3;
    place-self: center end;
}


/* ==========================================================================
   Progress bar
   --------------------------------------------------------------------------
   Styles the native <progress>, which needs vendor-specific pseudo-elements
   for the filled portion (they cannot be combined into one selector list —
   an unknown pseudo-element invalidates the whole rule).
   ========================================================================== */
.progress {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 0.5rem;
    border-radius: 9999px;
    overflow: hidden;
    background-color: rgb(var(--vs-base-content-rgb) / 0.15);
    color: var(--vs-base-content);
}
.progress::-webkit-progress-bar   { background-color: transparent; }
.progress::-webkit-progress-value { background-color: currentColor; border-radius: 9999px; }
.progress::-moz-progress-bar      { background-color: currentColor; border-radius: 9999px; }
/* An indeterminate <progress> (no `value`) shouldn't paint a full bar. */
.progress:not([value])::-webkit-progress-value { background-color: transparent; }

.progress-primary { color: var(--vs-primary); }
.progress-secondary { color: var(--vs-secondary); }
.progress-accent  { color: var(--vs-accent); }
.progress-info    { color: var(--vs-info); }
.progress-success { color: var(--vs-success); }
.progress-warning { color: var(--vs-warning); }
.progress-error   { color: var(--vs-error); }


/* ==========================================================================
   Join — welds adjacent controls into one segmented group
   ========================================================================== */
.join { display: inline-flex; align-items: stretch; }
.join > .join-item {
    border-radius: 0;
    /* Collapse the doubled border between neighbours. */
    margin-inline-start: -1px;
}
.join > .join-item:first-child { margin-inline-start: 0; border-start-start-radius: var(--vs-radius-field); border-end-start-radius: var(--vs-radius-field); }
.join > .join-item:last-child  { border-start-end-radius: var(--vs-radius-field);  border-end-end-radius: var(--vs-radius-field); }
/* The focused/active segment must paint above its neighbours' borders. */
.join > .join-item:focus,
.join > .join-item:hover,
.join > .join-item.btn-active { position: relative; z-index: 1; }
.join-vertical { flex-direction: column; }
.join-vertical > .join-item { margin-inline-start: 0; margin-top: -1px; }
.join-vertical > .join-item:first-child { margin-top: 0; border-start-start-radius: var(--vs-radius-field); border-start-end-radius: var(--vs-radius-field); border-end-start-radius: 0; }
.join-vertical > .join-item:last-child  { border-end-start-radius: var(--vs-radius-field); border-end-end-radius: var(--vs-radius-field); border-start-end-radius: 0; }


/* ==========================================================================
   Avatar
   --------------------------------------------------------------------------
   `.avatar` is the wrapper; the sizing/rounding lives on its inner <div>
   (`<div class="avatar"><div class="w-9 rounded-full">…`), which is why the
   inner element only needs overflow/aspect handling here.
   ========================================================================== */
.avatar { position: relative; display: inline-flex; }
.avatar > div {
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
/* Placeholder — centres the initials when there is no photo. */
.avatar-placeholder > div,
.avatar.placeholder > div {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    user-select: none;
}


/* ==========================================================================
   Divider — a labelled or bare horizontal rule
   ========================================================================== */
.divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-block: 1rem;
    height: 1rem;
    white-space: nowrap;
    font-size: 0.875rem;
    color: rgb(var(--vs-base-content-rgb) / 0.50);
}
/* Rules either side of the (optional) label. */
.divider::before,
.divider::after {
    content: '';
    flex: 1 1 0;
    height: 1px;
    background-color: rgb(var(--vs-base-content-rgb) / 0.15);
}
/* With no text content the two rules simply meet in the middle. */
.divider:empty { gap: 0; }


/* ==========================================================================
   Timeline
   --------------------------------------------------------------------------
   Vertical only (the single view using it is `timeline-vertical`). Each <li>
   is a 3-column grid: start | middle (the dot) | end.
   ========================================================================== */
.timeline { display: flex; }
.timeline-vertical { flex-direction: column; }
.timeline-vertical > li {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    column-gap: 0.75rem;
    position: relative;
}
/* Compact drops the leading column so everything hangs off the left rail. */
.timeline-compact > li { grid-template-columns: 0 auto 1fr; }
.timeline-start  { grid-column-start: 1; text-align: end; padding-block: 0.5rem; }
.timeline-middle { grid-column-start: 2; display: flex; align-items: center; justify-content: center; }
.timeline-end    { grid-column-start: 3; padding-block: 0.5rem; }
.timeline-compact .timeline-start { display: none; }
/* The connecting rail between consecutive dots. */
.timeline-vertical > li:not(:last-child) .timeline-middle::after {
    content: '';
    position: absolute;
    top: 50%;
    bottom: -50%;
    width: 2px;
    background-color: rgb(var(--vs-base-content-rgb) / 0.15);
}


/* ==========================================================================
   Tooltip
   --------------------------------------------------------------------------
   Pure CSS: the text comes from `data-tip` and is rendered in an ::after
   bubble that appears on hover or keyboard focus.
   ========================================================================== */
.tooltip { position: relative; display: inline-block; }
.tooltip::after {
    content: attr(data-tip);
    position: absolute;
    z-index: 60;
    /* Wide enough to be useful, capped so it never spans the viewport. */
    max-width: 18rem;
    width: max-content;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1.35;
    white-space: normal;
    text-align: center;
    border-radius: var(--vs-radius-field);
    background-color: var(--vs-neutral);
    color: var(--vs-neutral-content);
    box-shadow: var(--vs-shadow-md);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.12s ease, visibility 0.12s;
    /* Default placement: above, horizontally centred. */
    bottom: calc(100% + 0.375rem);
    left: 50%;
    transform: translateX(-50%);
}
.tooltip:hover::after,
.tooltip:focus-visible::after,
.tooltip:focus-within::after { opacity: 1; visibility: visible; }

/* Placement modifiers (the help-tip component passes these dynamically). */
.tooltip-top::after    { bottom: calc(100% + 0.375rem); top: auto;  left: 50%; right: auto; transform: translateX(-50%); }
.tooltip-bottom::after { top: calc(100% + 0.375rem);    bottom: auto; left: 50%; right: auto; transform: translateX(-50%); }
.tooltip-left::after   { right: calc(100% + 0.375rem);  left: auto; top: 50%;  bottom: auto; transform: translateY(-50%); }
.tooltip-right::after  { left: calc(100% + 0.375rem);   right: auto; top: 50%; bottom: auto; transform: translateY(-50%); }


/* ==========================================================================
   Loading spinner
   --------------------------------------------------------------------------
   Used by the global submit-loading behaviour in /js/app.js, which injects
   `<span class="loading loading-spinner loading-sm">` into the clicked button.
   ========================================================================== */
.loading {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    /* Border trick: three sides transparent, one visible, spun forever. */
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 9999px;
    animation: vs-spin 0.7s linear infinite;
}
/* Shape modifier. `.loading` is already a spinner, so this is explicit intent
   rather than new styling — it exists so the markup reads unambiguously and so
   other shapes (bars, dots) can be added here later without touching views. */
.loading-spinner { border-style: solid; }
.loading-xs { width: 1rem;    height: 1rem;    border-width: 1.5px; }
.loading-sm { width: 1.25rem; height: 1.25rem; border-width: 2px; }
.loading-lg { width: 2.5rem;  height: 2.5rem;  border-width: 3px; }
@keyframes vs-spin { to { transform: rotate(360deg); } }
/* Users who ask for less motion get a static ring rather than a spin. */
@media (prefers-reduced-motion: reduce) {
    .loading { animation-duration: 2.5s; }
}


/* ==========================================================================
   Links
   ========================================================================== */
.link { text-decoration: underline; cursor: pointer; }
/* `link-hover` shows the underline only on hover — the app's default style. */
.link-hover { text-decoration: none; }
.link-hover:hover { text-decoration: underline; }
.link-primary   { color: var(--vs-primary); }
.link-secondary { color: var(--vs-secondary); }
.link-accent    { color: var(--vs-accent); }
.link-success   { color: var(--vs-success); }
.link-warning   { color: var(--vs-warning); }
.link-error     { color: var(--vs-error); }
.link-neutral   { color: var(--vs-neutral); }


/* ==========================================================================
   Printed quote document (.quote-doc)
   --------------------------------------------------------------------------
   The customer's copy of a price quote from /system/pricing, rendered only when
   printing (the block is `hidden print:block` in the markup — see the print
   utilities in 04-utilities.css).

   It deliberately does NOT reuse `card` / `table`: those are tuned for a screen
   at arm's length, and a document that will be read on paper, forwarded as a
   PDF and possibly filed against a purchase order needs heavier structure and
   quieter colour.

   This is also the one place in the framework that hard-codes colour rather
   than reading the theme tokens, and does so on purpose: the sheet is always
   black on white whatever theme the employee happens to be using, because the
   customer's copy must not depend on a preference of ours.
   ========================================================================== */
.quote-doc {
    color: #111111;
    font-size: 10.5pt;
    line-height: 1.45;
}

/* Masthead: who is quoting, what this is, and when — the three things a reader
   checks before anything else. */
.quote-doc-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
    border-bottom: 2px solid #111111;
    padding-bottom: 0.75rem;
    margin-bottom: 1.25rem;
}
.quote-doc-brand {
    font-size: 17pt;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.1;
}
.quote-doc-kicker {
    font-size: 8.5pt;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #555555;
}
.quote-doc-meta {
    text-align: right;
    font-size: 9pt;
    color: #333333;
    white-space: nowrap;
}

.quote-doc-section {
    /* A section that lands half on one page and half on the next reads as two
       different quotes, so keep each one whole. */
    break-inside: avoid;
    margin-bottom: 1.1rem;
}
.quote-doc-section-title {
    font-size: 8.5pt;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #555555;
    border-bottom: 1px solid #d4d4d4;
    padding-bottom: 0.2rem;
    margin-bottom: 0.5rem;
}

/* Two-column facts (Prepared for, employees, server, …). */
.quote-doc-facts {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.2rem 1.25rem;
    font-size: 9.5pt;
}
.quote-doc-facts dt { color: #555555; }
.quote-doc-facts dd { font-weight: 600; }

/* Line items. */
.quote-doc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9.5pt;
}
.quote-doc-table th {
    text-align: left;
    font-size: 8.5pt;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #555555;
    border-bottom: 1px solid #111111;
    padding: 0.3rem 0;
}
.quote-doc-table td {
    border-bottom: 1px solid #e5e5e5;
    padding: 0.38rem 0;
    vertical-align: top;
}
.quote-doc-table .quote-doc-amount {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.quote-doc-table .quote-doc-detail {
    display: block;
    font-size: 8.5pt;
    color: #666666;
}

/* The three figures the reader is actually looking for. The per-employee cost
   is given the emphasis because it is the one that survives being repeated in
   a meeting. */
.quote-doc-totals {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 0.4rem;
    break-inside: avoid;
}
.quote-doc-total {
    border: 1px solid #d4d4d4;
    padding: 0.6rem 0.7rem;
}
.quote-doc-total-lead {
    border: 2px solid #111111;
}
.quote-doc-total-label {
    font-size: 8pt;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #555555;
}
.quote-doc-total-value {
    font-size: 15pt;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.quote-doc-total-sub {
    font-size: 8.5pt;
    color: #555555;
    font-variant-numeric: tabular-nums;
}

.quote-doc-terms {
    margin-top: 1.25rem;
    padding-top: 0.6rem;
    border-top: 1px solid #d4d4d4;
    font-size: 8.5pt;
    color: #555555;
    break-inside: avoid;
}
.quote-doc-signature {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    margin-top: 1.5rem;
    break-inside: avoid;
}
.quote-doc-signature div {
    border-top: 1px solid #111111;
    padding-top: 0.3rem;
    font-size: 8.5pt;
    color: #555555;
}
