/*
 * ImproLog design system
 * ----------------------
 * Loaded last in _Layout.cshtml, after Bootstrap 5.1, the Syncfusion bootstrap5
 * theme and sidebar.css. Every page in the portal inherits these rules, so a
 * change here is a change everywhere. Keep page-level <style> blocks for
 * genuinely page-specific layout only.
 */

/* ── 1. Tokens ─────────────────────────────────────────────────────────── */
:root {
    --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

    /* Brand */
    --brand-50: #eff6ff;
    --brand-100: #dbeafe;
    --brand-200: #bfdbfe;
    --brand-500: #3b82f6;
    --brand-600: #2563eb;
    --brand-700: #1d4ed8;
    --brand-ring: rgba(37, 99, 235, 0.18);

    /* Neutrals (slate) */
    --surface-0: #ffffff;
    --surface-50: #f8fafc;
    --surface-100: #f1f5f9;
    --surface-200: #e2e8f0;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --ink-400: #94a3b8;
    --ink-500: #64748b;
    --ink-600: #475569;
    --ink-700: #334155;
    --ink-800: #1e293b;
    --ink-900: #0f172a;

    /* Semantic */
    --success-600: #16a34a;
    --success-700: #15803d;
    --success-soft: #dcfce7;
    --success-ink: #166534;
    --warning-600: #d97706;
    --warning-soft: #fef3c7;
    --warning-line: #fde68a;
    --warning-ink: #92400e;
    --danger-600: #dc2626;
    --danger-700: #b91c1c;
    --danger-soft: #fee2e2;
    --danger-line: #fecaca;
    --danger-ink: #991b1b;
    --info-600: #0284c7;
    --info-soft: #e0f2fe;
    --info-line: #bae6fd;
    --info-ink: #075985;

    /* Shape & depth */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.07);
    --shadow-lg: 0 18px 44px rgba(15, 23, 42, 0.16);

    /* Bootstrap 5.1 hooks */
    --bs-font-sans-serif: var(--font-sans);
    --bs-body-font-family: var(--font-sans);
}

/* ── 2. Base typography ────────────────────────────────────────────────── */
html, body {
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--ink-800);
    background: var(--surface-100);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body .e-control,
body .e-btn,
body .e-css.e-btn,
body .e-grid,
body .e-dialog,
body .e-input-group,
body .e-dropdownbase,
body .e-popup {
    font-family: var(--font-sans);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--ink-900);
    font-weight: 600;
    letter-spacing: -0.01em;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1.05rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9rem; }

a {
    color: var(--brand-600);
    text-decoration: none;
}

a:hover {
    color: var(--brand-700);
    text-decoration: underline;
}

.text-muted {
    color: var(--ink-500) !important;
}

.text-primary {
    color: var(--brand-600) !important;
}

hr {
    border-color: var(--line);
    opacity: 1;
}

/* Thin, quiet scrollbars inside the content area */
.content ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.content ::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 8px;
}

.content ::-webkit-scrollbar-track {
    background: transparent;
}

/* ── 3. Cards & page headers ───────────────────────────────────────────── */
.card {
    background: var(--surface-0);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* Most pages wrap their content in <div class="card m-1">. Give those cards a
   proper vertical rhythm instead of a 4px halo. */
.content .card.m-1 {
    margin: 0 0 1rem !important;
}

.card > .card-body {
    padding: 1.25rem;
}

.card > .card-header {
    background: var(--surface-0);
    border-bottom: 1px solid var(--line);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 0.875rem 1.25rem;
    font-weight: 600;
    color: var(--ink-900);
}

.card > .card-header h1,
.card > .card-header h2,
.card > .card-header h3,
.card > .card-header h4,
.card > .card-header h5 {
    font-size: 1rem;
    margin: 0;
}

/* The portal's page header. 100+ pages use it, either as an <h3> that only
   carries a title or as a <div> that also carries filters and actions. It used
   to be a dark slate band; now it is a light header with a clear title. */
.card-header-custom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0;
    padding: 0.875rem 1.25rem;
    background: var(--surface-0);
    color: var(--ink-900);
    border-bottom: 1px solid var(--line);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.card-header-custom h1,
.card-header-custom h2,
.card-header-custom h3,
.card-header-custom h4,
.card-header-custom h5,
.card-header-custom h6 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: inherit;
}

.card-header-custom .form-check-label,
.card-header-custom label {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--ink-600);
}

.card-header-custom .btn-group .btn {
    font-weight: 500;
}

/* A header that sits directly on the page (not inside a card) still gets
   rounded corners on top; the card below should connect to it. */
.card-header-custom + .card-body {
    border-top: none;
}

/* ── 4. Buttons – Syncfusion ───────────────────────────────────────────── */
.e-btn,
.e-css.e-btn {
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.4;
    padding: 0.45rem 0.9rem;
    text-transform: none;
    box-shadow: none !important;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    background: var(--surface-0);
    border: 1px solid var(--line-strong);
    color: var(--ink-700);
}

.e-btn:hover,
.e-css.e-btn:hover {
    background: var(--surface-100);
    border-color: var(--line-strong);
    color: var(--ink-900);
}

.e-btn:focus-visible,
.e-css.e-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--brand-ring) !important;
}

.e-btn .e-btn-icon {
    font-size: 0.85rem;
}

.e-btn.e-icon-btn {
    padding: 0.45rem 0.6rem;
}

.e-btn.e-small,
.e-css.e-btn.e-small {
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
}

/* Primary: the one strong action on a screen */
.e-btn.e-primary,
.e-css.e-btn.e-primary {
    background: var(--brand-600);
    border-color: var(--brand-600);
    color: #fff;
}

.e-btn.e-primary:hover,
.e-btn.e-primary:focus,
.e-btn.e-primary:active,
.e-css.e-btn.e-primary:hover {
    background: var(--brand-700);
    border-color: var(--brand-700);
    color: #fff;
}

/* Info: used throughout for "edit / open" buttons; a soft brand tint keeps
   grids calm while still reading as clickable. */
.e-btn.e-info,
.e-css.e-btn.e-info {
    background: var(--brand-50);
    border-color: var(--brand-100);
    color: var(--brand-700);
}

.e-btn.e-info:hover,
.e-btn.e-info:focus,
.e-btn.e-info:active,
.e-css.e-btn.e-info:hover {
    background: var(--brand-100);
    border-color: var(--brand-200);
    color: var(--brand-700);
}

/* Success */
.e-btn.e-success,
.e-css.e-btn.e-success {
    background: var(--success-600);
    border-color: var(--success-600);
    color: #fff;
}

.e-btn.e-success:hover,
.e-btn.e-success:focus,
.e-btn.e-success:active,
.e-css.e-btn.e-success:hover {
    background: var(--success-700);
    border-color: var(--success-700);
    color: #fff;
}

/* Warning: cancel / history / secondary-but-notable */
.e-btn.e-warning,
.e-css.e-btn.e-warning {
    background: var(--warning-soft);
    border-color: var(--warning-line);
    color: var(--warning-ink);
}

.e-btn.e-warning:hover,
.e-btn.e-warning:focus,
.e-btn.e-warning:active,
.e-css.e-btn.e-warning:hover {
    background: #fde68a;
    border-color: #fcd34d;
    color: #78350f;
}

/* Danger: soft at rest, solid when the pointer commits */
.e-btn.e-danger,
.e-css.e-btn.e-danger {
    background: var(--danger-soft);
    border-color: var(--danger-line);
    color: var(--danger-700);
}

.e-btn.e-danger:hover,
.e-btn.e-danger:focus,
.e-btn.e-danger:active,
.e-css.e-btn.e-danger:hover {
    background: var(--danger-600);
    border-color: var(--danger-600);
    color: #fff;
}

/* Secondary / default / outline / flat / link */
.e-btn.e-secondary,
.e-css.e-btn.e-secondary {
    background: var(--surface-0);
    border-color: var(--line-strong);
    color: var(--ink-700);
}

.e-btn.e-secondary:hover,
.e-css.e-btn.e-secondary:hover {
    background: var(--surface-100);
    color: var(--ink-900);
}

.e-btn.e-outline,
.e-css.e-btn.e-outline {
    background: transparent;
    border-color: var(--brand-600);
    color: var(--brand-600);
}

.e-btn.e-outline:hover,
.e-btn.e-outline:focus,
.e-btn.e-outline:active,
.e-css.e-btn.e-outline:hover {
    background: var(--brand-50);
    border-color: var(--brand-700);
    color: var(--brand-700);
}

.e-btn.e-flat,
.e-css.e-btn.e-flat {
    background: transparent;
    border-color: transparent;
    color: var(--ink-600);
}

.e-btn.e-flat:hover,
.e-css.e-btn.e-flat:hover {
    background: var(--surface-100);
    color: var(--ink-900);
}

.e-btn.e-flat.e-primary,
.e-css.e-btn.e-flat.e-primary {
    color: var(--brand-600);
}

.e-btn.e-link,
.e-css.e-btn.e-link {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--brand-600);
    font-weight: 600;
}

.e-btn.e-link:hover,
.e-css.e-btn.e-link:hover {
    background: transparent;
    color: var(--brand-700);
    text-decoration: underline;
}

/* Icon-only buttons inside grid rows: compact, square, aligned */
.e-grid .e-rowcell .e-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 0.5rem;
    border-radius: var(--radius-sm);
    line-height: 1;
}

.e-grid .e-rowcell .e-btn + .e-btn {
    margin-left: 4px;
}

/* ── 5. Buttons – Bootstrap ────────────────────────────────────────────── */
.btn {
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.45rem 0.9rem;
    box-shadow: none !important;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-primary {
    background-color: var(--brand-600);
    border-color: var(--brand-600);
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active {
    background-color: var(--brand-700);
    border-color: var(--brand-700);
    color: #fff;
}

.btn-outline-primary {
    color: var(--brand-600);
    border-color: var(--brand-200);
    background-color: var(--surface-0);
}

.btn-outline-primary:hover {
    color: var(--brand-700);
    background-color: var(--brand-50);
    border-color: var(--brand-500);
}

.btn-check:checked + .btn-outline-primary,
.btn-check:active + .btn-outline-primary,
.btn-outline-primary:active,
.btn-outline-primary.active {
    color: #fff;
    background-color: var(--brand-600);
    border-color: var(--brand-600);
}

.btn-check:focus + .btn-outline-primary,
.btn-outline-primary:focus {
    box-shadow: 0 0 0 3px var(--brand-ring) !important;
}

.btn-secondary,
.btn-outline-secondary {
    color: var(--ink-700);
    background-color: var(--surface-0);
    border-color: var(--line-strong);
}

.btn-secondary:hover,
.btn-outline-secondary:hover,
.btn-secondary:focus,
.btn-outline-secondary:focus {
    color: var(--ink-900);
    background-color: var(--surface-100);
    border-color: var(--line-strong);
}

.btn-success {
    background-color: var(--success-600);
    border-color: var(--success-600);
}

.btn-success:hover,
.btn-success:focus {
    background-color: var(--success-700);
    border-color: var(--success-700);
}

.btn-danger {
    background-color: var(--danger-600);
    border-color: var(--danger-600);
}

.btn-danger:hover,
.btn-danger:focus {
    background-color: var(--danger-700);
    border-color: var(--danger-700);
}

.btn-warning,
.btn-outline-warning:hover {
    background-color: var(--warning-soft);
    border-color: var(--warning-line);
    color: var(--warning-ink);
}

.btn-outline-warning {
    color: var(--warning-ink);
    border-color: var(--warning-line);
}

.btn-link {
    color: var(--brand-600);
    font-weight: 500;
}

.btn-close:focus {
    box-shadow: none;
}

/* ── 6. Forms ──────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 0.875rem;
}

.col-form-label,
.form-label,
.crm-input-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ink-600);
    padding: 0 0 0.3rem;
    margin-bottom: 0;
    line-height: 1.3;
}

.form-control,
.form-select {
    border-radius: var(--radius-md);
    border: 1px solid var(--line-strong);
    font-size: 0.875rem;
    padding: 0.45rem 0.75rem;
    color: var(--ink-800);
    background-color: var(--surface-0);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px var(--brand-ring);
    color: var(--ink-900);
}

.form-control::placeholder {
    color: var(--ink-400);
}

.form-control:disabled,
.form-control[readonly],
.form-select:disabled {
    background-color: var(--surface-50);
    color: var(--ink-500);
}

.form-check-input {
    border-color: var(--line-strong);
    width: 1.05em;
    height: 1.05em;
    margin-top: 0.2em;
}

.form-check-input:checked {
    background-color: var(--brand-600);
    border-color: var(--brand-600);
}

.form-check-input:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.form-check-label {
    font-size: 0.875rem;
    color: var(--ink-700);
}

.input-group-text {
    border-radius: var(--radius-md);
    border-color: var(--line-strong);
    background: var(--surface-50);
    color: var(--ink-600);
    font-size: 0.875rem;
}

/* Syncfusion inputs (text boxes, dropdowns, date pickers, numeric) */
.e-input-group,
.e-input-group.e-control-wrapper,
.e-float-input,
.e-float-input.e-control-wrapper {
    border-radius: var(--radius-md) !important;
    border-color: var(--line-strong) !important;
    background: var(--surface-0);
    font-size: 0.875rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.e-input-group:not(.e-disabled).e-input-focus,
.e-input-group.e-control-wrapper:not(.e-disabled).e-input-focus,
.e-float-input:not(.e-disabled).e-input-focus,
.e-float-input.e-control-wrapper:not(.e-disabled).e-input-focus {
    border-color: var(--brand-500) !important;
    box-shadow: 0 0 0 3px var(--brand-ring) !important;
}

.e-input-group .e-input,
.e-input-group.e-control-wrapper .e-input,
.e-input-group input.e-input,
.e-float-input input {
    font-size: 0.875rem;
    color: var(--ink-800);
}

.e-input-group .e-input::placeholder,
.e-input-group input::placeholder {
    color: var(--ink-400);
}

.e-input-group .e-input-group-icon,
.e-input-group.e-control-wrapper .e-input-group-icon {
    color: var(--ink-500);
    border-color: transparent;
    background: transparent;
}

.e-input-group .e-input-group-icon:hover {
    color: var(--ink-800);
    background: var(--surface-100);
}

.e-input-group.e-disabled,
.e-input-group.e-control-wrapper.e-disabled,
.e-input-group.e-disabled .e-input {
    background: var(--surface-50) !important;
    color: var(--ink-500);
}

textarea.form-control,
.e-input-group textarea.e-input {
    line-height: 1.5;
}

.validation-message,
.text-danger.validation-message {
    font-size: 0.8rem;
    margin-top: 0.25rem;
    color: var(--danger-600);
}

.valid.modified:not([type=checkbox]) {
    outline: none;
    border-color: var(--success-600);
}

.invalid {
    outline: none;
    border-color: var(--danger-600);
}

/* ── 7. Data grid (Syncfusion) ─────────────────────────────────────────── */
.e-grid {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--ink-800);
}

.e-grid .e-toolbar {
    background: var(--surface-0);
    border-bottom: 1px solid var(--line);
    border-top: none;
}

.e-grid .e-toolbar .e-toolbar-items {
    background: var(--surface-0);
}

.e-grid .e-toolbar .e-tbar-btn,
.e-grid .e-toolbar .e-tbar-btn:hover {
    border-radius: var(--radius-sm);
    color: var(--ink-700);
    background: transparent;
}

.e-grid .e-toolbar .e-tbar-btn:hover {
    background: var(--surface-100);
}

.e-grid .e-toolbar .e-tbar-btn-text {
    font-size: 0.85rem;
    font-weight: 500;
}

.e-grid .e-toolbar .e-search .e-input-group,
.e-grid .e-toolbar .e-search.e-input-group {
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--line-strong) !important;
    background: var(--surface-0);
    min-width: 220px;
}

.e-grid .e-groupdroparea {
    background: var(--surface-50);
    border-bottom: 1px dashed var(--line-strong);
    border-top: none;
    color: var(--ink-400);
    font-size: 0.8rem;
    font-style: normal;
    padding: 0.55rem 1rem;
    min-height: 0;
}

.e-grid .e-groupdroparea.e-grouped {
    background: var(--brand-50);
    color: var(--ink-700);
}

.e-grid .e-gridheader {
    background: var(--surface-50);
    border-top: none;
    border-bottom: 1px solid var(--line);
}

.e-grid .e-headercell,
.e-grid .e-detailheadercell,
.e-grid .e-gridheader .e-headercontent {
    background: var(--surface-50);
    color: var(--ink-600);
    font-size: 0.8rem;
    font-weight: 600;
    border-color: var(--line);
}

.e-grid .e-headercelldiv,
.e-grid .e-headertext {
    color: var(--ink-600);
    font-size: 0.8rem;
    font-weight: 600;
}

.e-grid .e-headercell .e-sortfilterdiv,
.e-grid .e-headercell .e-icons {
    color: var(--ink-400);
}

.e-grid .e-filterbarcell,
.e-grid .e-filterbarcelldisabled {
    background: var(--surface-0);
    border-color: var(--line);
    padding: 0.35rem 0.5rem;
}

.e-grid .e-filterbarcell .e-input-group {
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--line) !important;
    background: var(--surface-50);
}

.e-grid .e-filterbarcell .e-input-group.e-input-focus {
    background: var(--surface-0);
}

.e-grid .e-rowcell,
.e-grid .e-detailrowcollapse,
.e-grid .e-detailrowexpand {
    border-color: var(--line);
    color: var(--ink-800);
    font-size: 0.875rem;
    padding: 0.55rem 0.75rem;
    line-height: 1.4;
}

.e-grid .e-altrow .e-rowcell,
.e-grid .e-altrow {
    background: var(--surface-0);
}

.e-grid .e-row:hover .e-rowcell,
.e-grid .e-row:hover .e-detailrowcollapse,
.e-grid .e-row:hover .e-detailrowexpand {
    background: var(--surface-50) !important;
}

.e-grid .e-rowcell.e-selectionbackground,
.e-grid .e-row.e-active .e-rowcell,
.e-grid td.e-active {
    background: var(--brand-50) !important;
    color: var(--ink-900);
}

.e-grid .e-emptyrow td {
    color: var(--ink-500);
    padding: 1.5rem 0.75rem;
    text-align: center;
    font-size: 0.875rem;
}

.e-grid .e-gridcontent {
    background: var(--surface-0);
}

.e-grid .e-summaryrow .e-summarycell,
.e-grid .e-summarycell {
    background: var(--surface-50);
    color: var(--ink-800);
    font-weight: 600;
    border-color: var(--line);
}

.e-grid .e-groupcaption,
.e-grid .e-recordplusexpand,
.e-grid .e-recordpluscollapse,
.e-grid .e-indentcell {
    background: var(--surface-50);
    border-color: var(--line);
}

.e-grid .e-gridpager,
.e-pager {
    background: var(--surface-0);
    border-top: 1px solid var(--line);
    color: var(--ink-600);
    font-size: 0.8rem;
    padding: 0.4rem 0.5rem;
}

.e-pager .e-numericitem,
.e-pager .e-icons {
    color: var(--ink-600);
    border-radius: var(--radius-sm);
}

.e-pager .e-numericitem:hover,
.e-pager .e-icons:not(.e-disable):hover {
    background: var(--surface-100);
    color: var(--ink-900);
}

.e-pager .e-currentitem,
.e-pager .e-currentitem:hover {
    background: var(--brand-600);
    color: #fff;
    border-radius: var(--radius-sm);
}

.e-pager .e-pagerdropdown {
    margin: 0 0.5rem;
}

.e-pager .e-pagerconstant,
.e-pager .e-pagercountmsg {
    color: var(--ink-500);
}

/* Column menu / filter popups */
.e-grid-menu,
.e-filter-popup,
.e-excelfilter {
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg) !important;
    border: 1px solid var(--line) !important;
}

/* ── 8. Dialogs, popups, tooltips ──────────────────────────────────────── */
.e-dialog {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.e-dialog .e-dlg-header-content {
    background: var(--surface-0);
    border-bottom: 1px solid var(--line);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 1rem 1.25rem;
}

.e-dialog .e-dlg-header,
.e-dialog .e-dlg-header * {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink-900);
}

.e-dialog .e-dlg-content {
    padding: 1.25rem;
    color: var(--ink-800);
    font-size: 0.875rem;
}

.e-dialog .e-footer-content {
    background: var(--surface-50);
    border-top: 1px solid var(--line);
    padding: 0.75rem 1.25rem;
}

.e-dialog .e-dlg-closeicon-btn {
    border-radius: var(--radius-sm);
}

.e-dlg-overlay {
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}

.e-popup.e-ddl,
.e-dropdownbase,
.e-popup.e-popup-open.e-dropdown-popup {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.e-dropdownbase .e-list-item {
    font-size: 0.875rem;
    color: var(--ink-800);
}

.e-dropdownbase .e-list-item.e-active,
.e-dropdownbase .e-list-item.e-active.e-hover {
    background: var(--brand-50);
    color: var(--brand-700);
}

.e-dropdownbase .e-list-item.e-hover {
    background: var(--surface-100);
}

.e-tooltip-wrap {
    border-radius: var(--radius-sm);
    background: var(--ink-900);
    border: none;
}

.e-tooltip-wrap .e-tip-content {
    color: #fff;
    font-size: 0.8rem;
}

.e-toast {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

/* ── 9. Messages, alerts, badges ───────────────────────────────────────── */
.e-message {
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
}

.e-message .e-msg-content {
    font-size: 0.875rem;
    line-height: 1.5;
}

.e-message.e-error,
.e-message.e-filled.e-error,
.e-message.e-outlined.e-error {
    background: #fef2f2;
    border-color: var(--danger-line);
    color: var(--danger-ink);
}

.e-message.e-error .e-msg-icon,
.e-message.e-error .e-msg-close-icon {
    color: var(--danger-600);
}

.e-message.e-warning,
.e-message.e-filled.e-warning,
.e-message.e-outlined.e-warning {
    background: #fffbeb;
    border-color: var(--warning-line);
    color: var(--warning-ink);
}

.e-message.e-warning .e-msg-icon,
.e-message.e-warning .e-msg-close-icon {
    color: var(--warning-600);
}

.e-message.e-success,
.e-message.e-filled.e-success,
.e-message.e-outlined.e-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: var(--success-ink);
}

.e-message.e-success .e-msg-icon,
.e-message.e-success .e-msg-close-icon {
    color: var(--success-600);
}

.e-message.e-info,
.e-message.e-filled.e-info,
.e-message.e-outlined.e-info {
    background: #f0f9ff;
    border-color: var(--info-line);
    color: var(--info-ink);
}

.e-message.e-info .e-msg-icon,
.e-message.e-info .e-msg-close-icon {
    color: var(--info-600);
}

.e-message .e-btn.e-link {
    color: inherit;
    text-decoration: underline;
}

.alert {
    border-radius: var(--radius-md);
    border-width: 1px;
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
}

.alert-danger {
    background: #fef2f2;
    border-color: var(--danger-line);
    color: var(--danger-ink);
}

.alert-warning {
    background: #fffbeb;
    border-color: var(--warning-line);
    color: var(--warning-ink);
}

.alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: var(--success-ink);
}

.alert-info {
    background: #f0f9ff;
    border-color: var(--info-line);
    color: var(--info-ink);
}

.badge {
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.01em;
    padding: 0.3em 0.65em;
    border-radius: 999px;
    border: 1px solid transparent;
}

/* Bootstrap's solid status badges, toned down to the same soft look as .pill.
   Many pages pick the bg-* class in code, so the restyle is done here rather
   than in each page. !important is needed to beat Bootstrap's own utilities. */
.badge.bg-primary { background-color: var(--brand-50) !important; border-color: var(--brand-100); color: var(--brand-700) !important; }
.badge.bg-success { background-color: var(--success-soft) !important; border-color: #bbf7d0; color: var(--success-ink) !important; }
.badge.bg-warning { background-color: var(--warning-soft) !important; border-color: var(--warning-line); color: var(--warning-ink) !important; }
.badge.bg-danger { background-color: var(--danger-soft) !important; border-color: var(--danger-line); color: var(--danger-ink) !important; }
.badge.bg-info { background-color: var(--info-soft) !important; border-color: var(--info-line); color: var(--info-ink) !important; }
.badge.bg-secondary,
.badge.bg-light { background-color: var(--surface-100) !important; border-color: var(--line); color: var(--ink-700) !important; }
.badge.bg-dark { background-color: var(--ink-800) !important; color: #fff !important; }

.e-badge {
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.72rem;
    padding: 0.3em 0.65em;
}

/* ── 10. Plain tables, lists, misc ─────────────────────────────────────── */
.table {
    font-size: 0.875rem;
    color: var(--ink-800);
    border-color: var(--line);
}

.table > thead th,
.table > thead td {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink-600);
    background: var(--surface-50);
    border-bottom: 1px solid var(--line);
}

.table > :not(:first-child) {
    border-top: none;
}

.table-hover > tbody > tr:hover > * {
    background-color: var(--surface-50);
}

.spinner-border {
    color: var(--brand-600);
}

.nav-tabs {
    border-bottom: 1px solid var(--line);
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--ink-500);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.6rem 0.9rem;
}

.nav-tabs .nav-link:hover {
    color: var(--ink-900);
    border-color: var(--line-strong);
}

.nav-tabs .nav-link.active {
    color: var(--brand-700);
    border-color: var(--brand-600);
    background: transparent;
}

.e-tab .e-tab-header .e-toolbar-item .e-tab-wrap {
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.e-tab .e-tab-header .e-toolbar-item .e-tab-text {
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: none;
}

.e-tab .e-tab-header .e-indicator {
    background: var(--brand-600);
}

.e-accordion {
    border-radius: var(--radius-md);
    border-color: var(--line);
}

.e-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

/* Legacy AdminLTE boxes used on a couple of reports */
.small-box,
.info-box {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* Blazor reconnect / error bar */
#blazor-error-ui {
    background: var(--ink-900);
    color: #fff;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
}

#blazor-error-ui a {
    color: #93c5fd;
}

#components-reconnect-modal {
    font-family: var(--font-sans);
}

/* ── 11. Responsive ────────────────────────────────────────────────────── */
@media (max-width: 767.98px) {
    html, body {
        font-size: 14px;
    }

    .card > .card-body {
        padding: 1rem;
    }

    .card-header-custom {
        padding: 0.75rem 1rem;
        align-items: flex-start;
    }

    .e-grid .e-rowcell,
    .e-grid .e-headercell {
        padding: 0.5rem;
    }
}

/* ── 12. Shared page building blocks ───────────────────────────────────── */

/* Page header (Shared/PageHeader.razor): icon chip, title, optional subtitle,
   actions to the right. Sits where .card-header-custom used to be typed by
   hand, so it also carries that class. */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    flex-wrap: wrap;
}

.page-header-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.page-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    background: var(--brand-50);
    color: var(--brand-600);
    font-size: 0.95rem;
}

.card-header-custom .page-header-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink-900);
    line-height: 1.25;
}

/* Blazor moves focus to the h1 after navigation; no ring around the title */
.page-header-title:focus {
    outline: none;
}

.page-header-subtitle {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--ink-500);
    margin-top: 1px;
}

.page-header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-left: auto;
}

/* Font Awesome icons inside Syncfusion buttons */
.e-btn .e-btn-icon[class*="fa-"] {
    font-size: 0.8rem;
    line-height: 1;
    width: auto;
    margin-top: 0;
}

.e-btn .e-btn-icon.e-icon-left[class*="fa-"] {
    margin-right: 0.45rem;
    padding: 0;
}

.e-btn.e-icon-btn .e-btn-icon[class*="fa-"] {
    margin: 0;
}

/* Pills: one shape for every status / type / flag label */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    background: var(--surface-100);
    color: var(--ink-700);
}

.pill i {
    font-size: 0.7rem;
}

.pill-brand { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); }
.pill-success { background: var(--success-soft); border-color: #bbf7d0; color: var(--success-ink); }
.pill-warning { background: var(--warning-soft); border-color: var(--warning-line); color: var(--warning-ink); }
.pill-danger { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-ink); }
.pill-info { background: var(--info-soft); border-color: var(--info-line); color: var(--info-ink); }
.pill-violet { background: #f3e8ff; border-color: #e9d5ff; color: #6b21a8; }

/* A pill tinted by a colour that comes from data (department colour):
   set --pill-color inline. */
.pill-tinted {
    background: color-mix(in srgb, var(--pill-color) 12%, #fff);
    border-color: color-mix(in srgb, var(--pill-color) 30%, #fff);
    color: color-mix(in srgb, var(--pill-color) 75%, #000);
}

.pill-tinted::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--pill-color);
}

/* Catering order progress: one dot per step, each one not started /
   in progress / done. Shared/CatStatusDots.razor. */
.status-dots {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.status-dots-track {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

.kule {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--surface-200);
}

/* Not started is an empty ring, so a list of new orders is not a wall of red */
.kule-0 { background: transparent; box-shadow: inset 0 0 0 2px var(--line-strong); }
.kule-1 { background: #f59e0b; }
.kule-2 { background: var(--success-600); }
.kule-3 { background: var(--brand-600); }
.kule-9 { background: var(--ink-800); }

.status-dots-done {
    color: var(--success-600);
    font-size: 0.85rem;
}

.status-dots-name {
    font-weight: 500;
    color: var(--ink-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Small flag icons in a grid row (paid, invoice sent, …) */
.flag-icons {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--ink-500);
    font-size: 0.85rem;
}

.flag-icons .flag-ok { color: var(--success-600); }
.flag-icons .flag-money { color: var(--warning-600); }

/* Grid rows for orders that are finished: quiet instead of dark grey */
.e-grid .e-row.grey-background .e-rowcell:not(.e-selectionbackground) {
    background-color: var(--surface-100) !important;
    color: var(--ink-500);
}

.e-grid .e-row.grey-background .status-dots-name {
    color: var(--ink-500);
}

/* Row actions: one visible action plus a "more" menu */
.row-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.e-grid .e-rowcell .row-actions .e-btn.row-more {
    background: transparent;
    border-color: transparent;
    color: var(--ink-500);
}

.e-grid .e-rowcell .row-actions .e-btn.row-more:hover {
    background: var(--surface-200);
    color: var(--ink-900);
}

.e-contextmenu-container ul.e-contextmenu {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 4px;
    min-width: 200px;
    font-family: var(--font-sans);
}

.e-contextmenu-container ul.e-contextmenu .e-menu-item {
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--ink-800);
}

.e-contextmenu-container ul.e-contextmenu .e-menu-item .e-menu-icon[class*="fa-"] {
    font-size: 0.8rem;
    line-height: inherit;
    color: var(--ink-500);
    width: 1.1rem;
    text-align: center;
    margin-right: 0.6rem;
}

.e-contextmenu-container ul.e-contextmenu .e-menu-item.e-focused,
.e-contextmenu-container ul.e-contextmenu .e-menu-item:hover {
    background: var(--surface-100);
    color: var(--ink-900);
}

.e-dropdown-popup {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.e-dropdown-popup ul {
    padding: 4px;
    min-width: 190px;
}

.e-dropdown-popup ul .e-item {
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--ink-800);
    font-family: var(--font-sans);
}

.e-dropdown-popup ul .e-item .e-menu-icon {
    font-size: 0.8rem;
    color: var(--ink-500);
    width: 1.1rem;
    text-align: center;
    margin-right: 0.6rem;
    line-height: inherit;
}

.e-dropdown-popup ul .e-item:hover,
.e-dropdown-popup ul .e-item.e-focused {
    background: var(--surface-100);
    color: var(--ink-900);
}

/* Filter bar in a page header: a short segmented control plus "more" */
.filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-bar .btn-group .btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
}

.filter-bar .e-dropdown-btn.e-btn.filter-active {
    background: var(--brand-600);
    border-color: var(--brand-600);
    color: #fff;
}

.filter-bar .e-input-group {
    width: 140px;
}

/* Form sections: an icon heading over a group of fields */
.form-section + .form-section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0 0 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-500);
}

/* A section heading that also draws the rule above it, for forms that are one
   long grid of rows rather than nested <section> elements. */
.form-section-title.is-divider {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}

.form-section-title i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    background: var(--brand-50);
    color: var(--brand-600);
    font-size: 0.75rem;
}

.form-checks {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.5rem;
    margin-bottom: 0.875rem;
}

/* Save / cancel bar that stays in view at the bottom of a long form */
.sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1.25rem -1.25rem -1.25rem;
    padding: 0.75rem 1.25rem;
    background: color-mix(in srgb, var(--surface-0) 92%, transparent);
    backdrop-filter: blur(6px);
    border-top: 1px solid var(--line);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Summary strip at the top of a detail page */
.summary-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    margin-bottom: 1rem;
    background: var(--surface-0);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1 1 180px;
    min-width: 0;
    padding: 0.875rem 1.25rem;
    border-right: 1px solid var(--line);
}

.summary-item:last-child {
    border-right: none;
}

.summary-item > i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    background: var(--surface-100);
    color: var(--ink-600);
    font-size: 0.9rem;
}

.summary-item > div {
    min-width: 0;
}

.summary-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-500);
}

.summary-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* KPI tile on a report: label, big number, one line of context.
   Set --kpi-color inline for the accent. */
.kpi-tile {
    height: 100%;
    padding: 0.875rem 1.1rem;
    background: var(--surface-0);
    border: 1px solid var(--line);
    border-left: 4px solid var(--kpi-color, var(--brand-600));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.kpi-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-500);
}

.kpi-value {
    margin-top: 0.15rem;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--ink-900);
    font-variant-numeric: tabular-nums;
}

.kpi-sub {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--ink-500);
}

/* Compact list of orders, one clickable row each (catering start page) */
.order-rows {
    display: flex;
    flex-direction: column;
}

.order-row,
.order-row:hover {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink-800);
    text-decoration: none;
}

.order-row:last-child {
    border-bottom: none;
}

/* A card that is only a page header (filters and actions, no body) */
.card > .page-header:last-child {
    border-bottom: none;
    border-radius: var(--radius-lg);
}

/* Departure cards (kitchen departure): the accent colour says how soon the
   car leaves. Set by one of the departure-* classes. */
.departure-card {
    --dep-color: var(--success-600);
    border-left: 4px solid var(--dep-color);
}

.departure-card.departure-near { --dep-color: var(--warning-600); }
.departure-card.departure-soon { --dep-color: var(--danger-600); }
.departure-card.departure-gone { --dep-color: var(--ink-400); }
.departure-card.departure-pickup { --dep-color: #7c3aed; }

.departure-card.departure-gone .card-body {
    opacity: 0.6;
}

.departure-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
}

.departure-time {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--dep-color) 12%, #fff);
    color: color-mix(in srgb, var(--dep-color) 80%, #000);
    font-size: 1.1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.departure-time i {
    font-size: 0.85rem;
}

.departure-driver {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink-900);
}

.departure-countdown {
    font-size: 0.85rem;
    font-weight: 600;
    color: color-mix(in srgb, var(--dep-color) 80%, #000);
}

.order-row:hover {
    background: var(--surface-50);
}

.order-row-time {
    flex-shrink: 0;
    width: 3.2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--ink-900);
}

.order-row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.order-row-name {
    font-weight: 600;
    color: var(--ink-900);
}

.order-row-detail {
    font-size: 0.8rem;
    color: var(--ink-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.order-row .status-dots {
    flex-shrink: 0;
    width: 11.5rem;
}

@media (max-width: 767.98px) {
    .order-row .status-dots-name {
        display: none;
    }

    .order-row .status-dots {
        width: auto;
    }
}

/* Loading and empty states (Shared/LoadingState.razor, Shared/EmptyState.razor) */
.state {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-500);
    font-size: 0.875rem;
}

.state-loading {
    gap: 0.6rem;
    padding: 2rem 1rem;
}

.state-loading i {
    color: var(--brand-600);
    font-size: 1rem;
}

.state-empty {
    flex-direction: column;
    gap: 0.25rem;
    padding: 2.25rem 1rem;
    text-align: center;
}

.state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-bottom: 0.5rem;
    border-radius: 50%;
    background: var(--surface-100);
    color: var(--ink-400);
    font-size: 1.1rem;
}

.state-title {
    font-weight: 600;
    color: var(--ink-800);
}

.state-text {
    max-width: 36rem;
}

.state-actions {
    margin-top: 0.75rem;
}

/* Alert rows: a compact list of things that need attention (admin dashboard) */
.alert-rows {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alert-row {
    --row-color: var(--ink-400);
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.6rem 0.875rem;
    border: 1px solid var(--line);
    border-left: 3px solid var(--row-color);
    border-radius: var(--radius-md);
    background: var(--surface-0);
}

.alert-row > i {
    flex-shrink: 0;
    width: 1.1rem;
    text-align: center;
    color: var(--row-color);
}

.alert-row-danger { --row-color: var(--danger-600); }
.alert-row-warning { --row-color: var(--warning-600); }
.alert-row-ok { --row-color: var(--success-600); }

.alert-row-main {
    flex: 1;
    min-width: 0;
}

.alert-row-title {
    font-weight: 600;
    color: var(--ink-900);
}

.alert-row-text {
    font-size: 0.8125rem;
    color: var(--ink-600);
}

/* Totals under an order's lines */
.totals-table td {
    padding: 0.4rem 0.25rem;
    border-color: var(--line);
    font-variant-numeric: tabular-nums;
}

.totals-table .totals-grand td {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink-900);
    border-top: 2px solid var(--line-strong);
    border-bottom: none;
}

/* Scan pages: what a QR code on an order sheet opens. Read on a phone at arm's
   length, so the order number is the largest thing on the page and the button is
   tall enough to hit with a thumb. */
.scan-page {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 0.5rem;
}

.scan-card {
    overflow: hidden;
}

.scan-head {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface-50);
}

.scan-kind {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--brand-600);
}

.scan-card.is-done .scan-kind {
    color: var(--success-ink);
}

.scan-order-no {
    margin-top: 0.25rem;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--ink-900);
    font-variant-numeric: tabular-nums;
}

.scan-customer {
    margin-top: 0.25rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--ink-700);
    overflow-wrap: anywhere;
}

.scan-facts {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    padding: 1rem 1.25rem;
}

.scan-facts:empty {
    display: none;
}

.scan-fact {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
}

.scan-fact > i {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    background: var(--brand-50);
    color: var(--brand-600);
    font-size: 0.875rem;
}

.scan-fact-main {
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--ink-900);
    overflow-wrap: anywhere;
}

/* A lone main line sits level with its icon */
.scan-fact-main:only-child {
    padding-top: 0.3rem;
}

.scan-fact-sub {
    font-size: 0.875rem;
    color: var(--ink-600);
    overflow-wrap: anywhere;
}

.scan-fact-note > i {
    background: var(--warning-soft);
    color: var(--warning-ink);
}

.scan-fact-note .scan-fact-sub {
    padding-top: 0.4rem;
    color: var(--ink-800);
    white-space: pre-line;
}

.scan-lines {
    padding: 0.875rem 1.25rem 1rem;
    border-top: 1px solid var(--line);
}

.scan-lines-title {
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-500);
}

.scan-line {
    display: flex;
    gap: 0.75rem;
    padding: 0.3rem 0;
    font-size: 0.9375rem;
    color: var(--ink-800);
}

.scan-line-qty {
    flex-shrink: 0;
    min-width: 3rem;
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--ink-900);
}

.scan-line-name {
    overflow-wrap: anywhere;
}

.scan-action {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid var(--line);
}

.scan-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    min-height: 4.5rem;
    padding: 1rem;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--brand-600);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    transition: background-color 0.15s ease, transform 0.05s ease;
    touch-action: manipulation;
}

.scan-button:hover {
    background: var(--brand-700);
}

.scan-button:active {
    transform: scale(0.985);
}

.scan-button:focus-visible {
    outline: 3px solid var(--brand-200);
    outline-offset: 2px;
}

.scan-button:disabled {
    background: var(--ink-400);
    box-shadow: none;
}

.scan-receipt {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-height: 4.5rem;
    padding: 1rem 1.25rem;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-lg);
    background: var(--success-soft);
    color: var(--success-ink);
}

.scan-receipt > i {
    font-size: 2rem;
    color: var(--success-600);
}

/* The scan no longer applies to this order: same box, neutral instead of green */
.scan-receipt.scan-blocked {
    border-color: var(--line-strong);
    background: var(--surface-100);
    color: var(--ink-700);
}

.scan-receipt.scan-blocked > i {
    font-size: 1.5rem;
    color: var(--ink-500);
}

.scan-receipt-title {
    font-size: 1.125rem;
    font-weight: 700;
}

.scan-receipt-sub {
    font-size: 0.875rem;
}

.scan-error {
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--danger-line);
    border-radius: var(--radius-md);
    background: var(--danger-soft);
    color: var(--danger-ink);
    font-size: 0.9375rem;
}

/* Customer survey: one question per section, answers as large choices */
.survey-page {
    max-width: 760px;
}

.survey-question-text {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink-900);
}

.survey-question-no {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    background: var(--brand-50);
    color: var(--brand-600);
    font-size: 0.8rem;
    font-weight: 700;
}

.survey-rating,
.survey-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.survey-options {
    flex-direction: column;
    align-items: stretch;
    max-width: 420px;
}

/* The radio itself is hidden; its label is the visible choice */
.survey-choice-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.survey-rating-label,
.survey-option-label {
    margin: 0;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: var(--surface-0);
    color: var(--ink-700);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.survey-rating-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    font-size: 1.0625rem;
    font-variant-numeric: tabular-nums;
}

.survey-option-label {
    padding: 0.6rem 0.875rem;
    font-weight: 500;
}

.survey-rating-label:hover,
.survey-option-label:hover {
    border-color: var(--brand-500);
    background: var(--brand-50);
}

.survey-choice-input:checked + label {
    border-color: var(--brand-600);
    background: var(--brand-600);
    color: #fff;
}

.survey-choice-input:focus-visible + label {
    outline: 3px solid var(--brand-200);
    outline-offset: 2px;
}

.survey-choice-input:disabled + label {
    cursor: default;
    pointer-events: none;
}

.survey-choice-input:disabled:not(:checked) + label {
    opacity: 0.55;
}

@media (max-width: 767.98px) {
    .summary-item {
        flex-basis: 50%;
        border-right: none;
        border-bottom: 1px solid var(--line);
    }

    .sticky-actions {
        margin: 1rem -1rem -1rem;
        padding: 0.75rem 1rem;
    }

    .page-header-actions {
        margin-left: 0;
        width: 100%;
    }
}

/* List with a detail panel on the right: selecting a row opens the panel next to
   the list, so an order can be read without leaving the list. */
.split-view {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.split-main {
    flex: 1 1 0;
    min-width: 0;
}

.detail-panel {
    position: sticky;
    top: 0.5rem;
    flex: 0 0 400px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 1rem);
    margin: 0.25rem 0.25rem 0 0;
    background: var(--surface-0);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    font-size: 0.875rem;
}

.detail-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--line);
}

.detail-panel-title {
    margin-bottom: 0.25rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink-900);
}

.detail-panel-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0 1rem 1rem;
}

.detail-panel-section {
    padding-top: 0.875rem;
}

.detail-panel-label {
    margin-bottom: 0.25rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-500);
}

.detail-panel-pre {
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.detail-panel-alert {
    padding: 0.5rem 0.625rem;
    background: var(--danger-soft);
    border: 1px solid var(--danger-line);
    border-radius: var(--radius-md);
    color: var(--danger-ink);
}

.detail-panel-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--line);
}

/* On narrow screens there is no room beside the list, so the panel lies over it. */
@media (max-width: 1199.98px) {
    .detail-panel {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 1040;
        width: min(400px, 100vw);
        max-height: none;
        margin: 0;
        border-radius: 0;
        box-shadow: var(--shadow-lg);
    }
}

/* Theme switch in the top bar (Shared/ThemeSwitch.razor) */
.theme-switch {
    display: inline-flex;
    gap: 2px;
    padding: 2px;
    background: var(--surface-100);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}

.theme-switch-btn {
    width: 28px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink-500);
    font-size: 0.8rem;
    cursor: pointer;
}

.theme-switch-btn:hover {
    color: var(--ink-900);
}

.theme-switch-btn.active {
    background: var(--surface-0);
    color: var(--brand-600);
    box-shadow: var(--shadow-sm);
}

.theme-switch-btn:focus-visible {
    outline: 2px solid var(--brand-500);
    outline-offset: 1px;
}

/* ── Dark theme ──────────────────────────────────────────────────────────
   Chosen with the switch in the top bar; _Layout.cshtml sets data-theme on
   <html> and loads Syncfusion's bootstrap5-dark theme. Almost everything above
   is drawn from the tokens, so the dark theme is mainly a second set of token
   values. The ramps are flipped: --surface-* go dark, --ink-* go light. The
   rules after the tokens cover the places that use a fixed colour. */
:root[data-theme="dark"] {
    color-scheme: dark;

    /* Brand */
    --brand-50: #14213d;
    --brand-100: #1b2d55;
    --brand-200: #274178;
    --brand-500: #60a5fa;
    --brand-600: #4f8ff7;
    --brand-700: #8ab6fb;
    --brand-ring: rgba(96, 165, 250, 0.3);

    /* Neutrals: page, card, raised, lines */
    --surface-0: #151e2e;
    --surface-50: #1a2436;
    --surface-100: #0b1120;
    --surface-200: #26334a;
    --line: #243047;
    --line-strong: #364560;
    --ink-400: #64748b;
    --ink-500: #8a99b0;
    --ink-600: #a8b5c8;
    --ink-700: #cbd5e1;
    --ink-800: #e2e8f0;
    --ink-900: #f1f5f9;

    /* Semantic */
    --success-600: #22c55e;
    --success-700: #16a34a;
    --success-soft: #0f2e1f;
    --success-ink: #86efac;
    --warning-600: #f59e0b;
    --warning-soft: #33260a;
    --warning-line: #5c4310;
    --warning-ink: #fcd34d;
    --danger-600: #ef4444;
    --danger-700: #dc2626;
    --danger-soft: #3b1518;
    --danger-line: #6b2226;
    --danger-ink: #fca5a5;
    --info-600: #38bdf8;
    --info-soft: #0c2a3d;
    --info-line: #164863;
    --info-ink: #7dd3fc;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.6);
}

/* Bootstrap 5.1 has no dark mode of its own; these are the pieces the rules
   above do not already draw from the tokens. */
[data-theme="dark"] .table {
    --bs-table-striped-color: var(--ink-800);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
    --bs-table-hover-color: var(--ink-900);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.05);
    color: var(--ink-800);
    border-color: var(--line);
}

[data-theme="dark"] .modal-content,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .list-group-item,
[data-theme="dark"] .accordion-item,
[data-theme="dark"] .accordion-button,
[data-theme="dark"] .page-link,
[data-theme="dark"] .info-box {
    background-color: var(--surface-0);
    border-color: var(--line);
    color: var(--ink-800);
}

[data-theme="dark"] .dropdown-item {
    color: var(--ink-800);
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: var(--surface-200);
    color: var(--ink-900);
}

[data-theme="dark"] .bg-white { background-color: var(--surface-0) !important; }
[data-theme="dark"] .bg-light { background-color: var(--surface-50) !important; }
[data-theme="dark"] .text-dark,
[data-theme="dark"] .text-body { color: var(--ink-800) !important; }
[data-theme="dark"] .text-secondary { color: var(--ink-500) !important; }
[data-theme="dark"] .text-success { color: var(--success-600) !important; }
[data-theme="dark"] .text-danger { color: var(--danger-ink) !important; }
[data-theme="dark"] .text-warning { color: var(--warning-600) !important; }
[data-theme="dark"] .text-info { color: var(--info-600) !important; }

[data-theme="dark"] .border,
[data-theme="dark"] .border-top,
[data-theme="dark"] .border-bottom,
[data-theme="dark"] .border-start,
[data-theme="dark"] .border-end {
    border-color: var(--line) !important;
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(1) brightness(2);
}

[data-theme="dark"] .main .top-row {
    background-color: var(--surface-0);
    border-bottom-color: var(--line);
}

/* Fixed colours in the rules above */
[data-theme="dark"] .alert-danger,
[data-theme="dark"] .e-message.e-error,
[data-theme="dark"] .e-message.e-filled.e-error,
[data-theme="dark"] .e-message.e-outlined.e-error {
    background: var(--danger-soft);
}

[data-theme="dark"] .alert-warning,
[data-theme="dark"] .e-message.e-warning,
[data-theme="dark"] .e-message.e-filled.e-warning,
[data-theme="dark"] .e-message.e-outlined.e-warning {
    background: var(--warning-soft);
}

[data-theme="dark"] .alert-success,
[data-theme="dark"] .e-message.e-success,
[data-theme="dark"] .e-message.e-filled.e-success,
[data-theme="dark"] .e-message.e-outlined.e-success {
    background: var(--success-soft);
    border-color: #1c5136;
}

[data-theme="dark"] .alert-info,
[data-theme="dark"] .e-message.e-info,
[data-theme="dark"] .e-message.e-filled.e-info,
[data-theme="dark"] .e-message.e-outlined.e-info {
    background: var(--info-soft);
}

[data-theme="dark"] .pill-success,
[data-theme="dark"] .badge.bg-success,
[data-theme="dark"] .scan-receipt {
    border-color: #1c5136;
}

[data-theme="dark"] .pill-violet {
    background: #2a1a47;
    border-color: #44297a;
    color: #d8b4fe;
}

[data-theme="dark"] .pill-tinted {
    background: color-mix(in srgb, var(--pill-color) 22%, var(--surface-0));
    border-color: color-mix(in srgb, var(--pill-color) 45%, var(--surface-0));
    color: color-mix(in srgb, var(--pill-color) 45%, #fff);
}

[data-theme="dark"] .departure-time {
    background: color-mix(in srgb, var(--dep-color) 22%, var(--surface-0));
}

[data-theme="dark"] .departure-time,
[data-theme="dark"] .departure-countdown {
    color: color-mix(in srgb, var(--dep-color) 55%, #fff);
}

[data-theme="dark"] .e-btn.e-warning:hover,
[data-theme="dark"] .e-btn.e-warning:focus,
[data-theme="dark"] .e-btn.e-warning:active,
[data-theme="dark"] .e-css.e-btn.e-warning:hover {
    background: var(--warning-line);
    border-color: #7a5914;
    color: var(--warning-ink);
}

/* These use the darkest ink as a background with white text; ink is light here. */
[data-theme="dark"] .e-tooltip-wrap,
[data-theme="dark"] #blazor-error-ui {
    background: #020617;
    border: 1px solid var(--line-strong);
}

[data-theme="dark"] .badge.bg-dark {
    background-color: #020617 !important;
    border-color: var(--line-strong);
}

[data-theme="dark"] .kule-9 {
    background: #020617;
    box-shadow: inset 0 0 0 1px var(--line-strong);
}
