/* ── Design tokens ───────────────────────────────────────────── */
:root {
    --app-font: "DM Sans", system-ui, -apple-system, sans-serif;
    --app-mono: "JetBrains Mono", ui-monospace, monospace;
    --app-bg: #eef2f7;
    --app-bg-accent: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(59, 130, 246, 0.12), transparent 55%);
    --app-surface: #ffffff;
    --app-surface-muted: #f8fafc;
    --app-border: rgba(15, 23, 42, 0.1);
    --app-border-strong: rgba(15, 23, 42, 0.16);
    --app-text: #0f172a;
    --app-text-muted: #64748b;
    --app-primary: #2563eb;
    --app-primary-hover: #1d4ed8;
    --app-primary-soft: #eff6ff;
    --app-accent: #0ea5e9;
    --app-success: #059669;
    --app-success-soft: #ecfdf5;
    --app-warning: #d97706;
    --app-warning-soft: #fffbeb;
    --app-danger: #0d0501;
    --app-danger-soft: #fef2f2;
    --app-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --app-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
    --app-shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.1);
    --app-radius: 0.75rem;
    --app-radius-sm: 0.5rem;
    --app-nav-height: 4rem;

    /* Bootstrap bridge — light */
    --bs-body-bg: var(--app-bg);
    --bs-body-color: var(--app-text);
    --bs-emphasis-color: var(--app-text);
    --bs-secondary-color: var(--app-text-muted);
    --bs-tertiary-color: var(--app-text-muted);
    --bs-border-color: var(--app-border);
    --bs-secondary-bg: var(--app-surface-muted);
    --bs-tertiary-bg: var(--app-surface-muted);
    --bs-link-color: var(--app-primary);
    --bs-link-hover-color: var(--app-primary-hover);

    /* Bootstrap warning — darker amber on light backgrounds (readable) */
    --bs-warning: #92400e;
    --bs-warning-rgb: 13, 5, 1;
    --bs-warning-text-emphasis: #0d0501;
    --bs-warning-color: #0d0501;
    --app-warning-text: #0d0501;
}

/* ── Base ─────────────────────────────────────────────────────── */
body,
.app-body {
    font-family: var(--app-font);
    color: var(--app-text);
    background-color: var(--app-bg);
    background-image: var(--app-bg-accent);
    background-attachment: fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.font-monospace,
code {
    font-family: var(--app-mono) !important;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* ── Global shell (all pages / partials) ─────────────────────── */
.bg-light,
.bg-white {
    background-color: var(--app-surface-muted) !important;
    color: var(--app-text);
}

.bg-white {
    background-color: var(--app-surface) !important;
}

.text-bg-light {
    background-color: var(--app-surface-muted) !important;
    color: var(--app-text) !important;
}

.text-dark {
    color: var(--app-text) !important;
}

.border,
.border-top,
.border-bottom,
.border-start,
.border-end {
    border-color: var(--app-border) !important;
}

hr {
    border-color: var(--app-border);
    opacity: 1;
}

.app-callout {
    padding: 1rem 1.15rem;
    background: var(--app-surface-muted);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
}

.app-card-accent {
    border-color: rgba(37, 99, 235, 0.35) !important;
}

.card {
    background-color: var(--app-surface);
    border-color: var(--app-border);
    color: var(--app-text);
}

.card-header {
    background-color: var(--app-surface-muted);
    border-bottom-color: var(--app-border);
    color: var(--app-text);
}

.card-body {
    color: var(--app-text);
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--app-text);
    --bs-table-border-color: var(--app-border);
    --bs-table-striped-bg: var(--app-surface-muted);
    --bs-table-hover-bg: var(--app-primary-soft);
}

.table-light,
.table thead.table-light th,
.table > thead.table-light > tr > th {
    --bs-table-bg: var(--app-surface-muted);
    --bs-table-color: var(--app-text);
    background-color: var(--app-surface-muted);
    color: var(--app-text);
    border-color: var(--app-border);
}

.list-group-item {
    background-color: var(--app-surface);
    border-color: var(--app-border);
    color: var(--app-text);
}

.form-control:read-only,
.form-control[readonly],
.form-control:disabled,
.form-select:disabled {
    background-color: var(--app-surface-muted);
    color: var(--app-text-muted);
    border-color: var(--app-border);
}

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

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

.btn-success {
    background: linear-gradient(135deg, var(--app-success), #10b981);
    border: none;
    font-weight: 600;
}

.btn-outline-primary {
    border-color: var(--app-primary);
    color: var(--app-primary);
}

.btn-outline-primary:hover {
    background: var(--app-primary-soft);
    border-color: var(--app-primary);
    color: var(--app-primary-hover);
}

.nav-tabs {
    border-bottom-color: var(--app-border);
}

.tab-content {
    color: var(--app-text);
}

details summary {
    color: var(--app-text-muted);
}

.return-record .card,
.return-record-evidence {
    background: var(--app-surface);
    border-color: var(--app-border);
}

.return-record .app-table-wrap,
.return-record .table-responsive {
    border: none;
    box-shadow: none;
}

#buildChecklistCard .card-header {
    background: var(--app-surface-muted);
}

.checklist-progress-badge.text-bg-secondary {
    background-color: var(--app-surface-muted) !important;
    color: var(--app-text-muted) !important;
    border: 1px solid var(--app-border);
}

/* ── Header / nav ─────────────────────────────────────────────── */
.app-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    backdrop-filter: blur(12px);
}

.app-navbar {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 48%, #172554 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--app-shadow);
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.app-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.65rem;
    background: linear-gradient(135deg, var(--app-primary), var(--app-accent));
    color: #fff;
    font-size: 1.15rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.app-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.app-brand-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    letter-spacing: -0.02em;
}

.app-brand-sub {
    font-size: 0.68rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.app-nav {
    flex-wrap: nowrap;
    align-items: center;
}

.app-nav-link {
    color: rgba(255, 255, 255, 0.78) !important;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.45rem 0.85rem !important;
    border-radius: var(--app-radius-sm);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.app-nav-auth {
    flex-shrink: 0;
}

.app-nav-auth .btn {
    white-space: nowrap;
}

.app-nav-link:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.08);
}

.app-nav-link.active {
    color: #fff !important;
    background: rgba(37, 99, 235, 0.35);
}

.app-btn-accent {
    background: linear-gradient(135deg, var(--app-primary), #3b82f6);
    border: none;
    color: #fff !important;
    font-weight: 600;
    padding: 0.4rem 1rem;
    border-radius: var(--app-radius-sm);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}

.app-btn-accent:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
    color: #fff !important;
}

.app-navbar-toggler {
    border-color: rgba(255, 255, 255, 0.25);
}

.app-theme-toggle {
    color: rgba(255, 255, 255, 0.85) !important;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--app-radius-sm);
    font-weight: 500;
    padding: 0.35rem 0.75rem;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.app-theme-toggle:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.25);
}

.app-theme-toggle:active {
    transform: scale(0.97);
}

.app-main {
    padding-top: 1.75rem;
}

.app-footer {
    border-top: 1px solid var(--app-border);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
}

/* ── Alerts ───────────────────────────────────────────────────── */
.app-alert {
    border: none;
    border-radius: var(--app-radius-sm);
    box-shadow: var(--app-shadow-sm);
    font-weight: 500;
}

.app-alert-success {
    background: var(--app-success-soft);
    color: #065f46;
    border-left: 4px solid var(--app-success);
}

.app-alert-danger {
    background: var(--app-danger-soft);
    color: #991b1b;
    border-left: 4px solid var(--app-danger);
}

/* ── Page hero / headers ─────────────────────────────────────── */
.page-hero {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.page-hero h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.page-hero-lead {
    color: var(--app-text-muted);
    font-size: 0.95rem;
    margin: 0;
    max-width: 36rem;
}

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

.dashboard-hero-actions {
    gap: 0.65rem;
}

.dashboard-hero-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-width: 6.75rem;
    padding: 0.75rem 1rem;
    background: var(--hero-action-bg, var(--app-surface));
    border: 1.5px solid var(--hero-action-border, var(--app-border-strong));
    border-radius: var(--app-radius);
    color: var(--app-text);
    box-shadow: var(--app-shadow-sm), 0 0 0 1px rgba(255, 255, 255, 0.65);
    position: relative;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, background 0.15s;
}

.dashboard-hero-action::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--hero-action-accent, var(--app-primary));
    opacity: 1;
}

.dashboard-hero-action:hover {
    transform: translateY(-2px);
    box-shadow: var(--hero-action-shadow, var(--app-shadow)), 0 0 0 1px var(--hero-action-accent, var(--app-primary));
    border-color: var(--hero-action-accent, var(--app-primary));
    background: var(--hero-action-bg-hover, var(--app-primary-soft));
    color: var(--app-text);
}

.dashboard-hero-action-new {
    --hero-action-accent: var(--app-primary);
    --hero-action-border: rgba(37, 99, 235, 0.45);
    --hero-action-bg: color-mix(in srgb, var(--app-primary-soft) 40%, var(--app-surface));
    --hero-action-bg-hover: var(--app-primary-soft);
    --hero-action-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.dashboard-hero-action-returns {
    --hero-action-accent: #0284c7;
    --hero-action-border: rgba(14, 165, 233, 0.45);
    --hero-action-bg: color-mix(in srgb, rgba(14, 165, 233, 0.12) 55%, var(--app-surface));
    --hero-action-bg-hover: rgba(14, 165, 233, 0.16);
    --hero-action-shadow: 0 4px 12px rgba(14, 165, 233, 0.09);
}

.dashboard-hero-action-repairs {
    --hero-action-accent: var(--app-warning);
    --hero-action-border: rgba(217, 119, 6, 0.45);
    --hero-action-bg: color-mix(in srgb, var(--app-warning-soft) 55%, var(--app-surface));
    --hero-action-bg-hover: var(--app-warning-soft);
    --hero-action-shadow: 0 4px 12px rgba(217, 119, 6, 0.09);
}

.dashboard-hero-action-icon {
    font-size: 1.15rem;
    line-height: 1;
    color: var(--hero-action-accent, var(--app-primary));
}

.dashboard-hero-action-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--app-text-muted);
    line-height: 1.2;
    text-align: center;
}

.dashboard-hero-action:hover .dashboard-hero-action-label {
    color: var(--app-text);
}

/* ── Cards & panels ───────────────────────────────────────────── */
.card,
.app-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-sm);
    overflow: hidden;
}

.app-card .card-header,
.card > .card-header {
    background: var(--app-surface-muted);
    border-bottom: 1px solid var(--app-border);
    font-weight: 600;
    padding: 0.85rem 1.15rem;
}

.app-card-flush .card-body {
    padding: 0;
}

.app-panel {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-sm);
    padding: 1.25rem 1.5rem;
}

.app-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--app-text-muted);
}

.app-empty {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--app-text-muted);
}

.app-empty-icon {
    font-size: 2rem;
    opacity: 0.35;
    margin-bottom: 0.5rem;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn-primary {
    background: linear-gradient(135deg, var(--app-primary), #3b82f6);
    border: none;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--app-primary-hover), var(--app-primary));
    border: none;
}

.btn-outline-secondary {
    border-color: var(--app-border-strong);
    color: var(--app-text-muted);
    font-weight: 500;
}

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

/* ── Filter chips ─────────────────────────────────────────────── */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.filter-chips .btn {
    border-radius: 2rem;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.3rem 0.85rem;
}

.filter-chips .btn-primary {
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* ── Tabs ─────────────────────────────────────────────────────── */
.app-tabs {
    border-bottom: 1px solid var(--app-border);
    gap: 0.25rem;
}

.app-tabs .nav-link {
    border: none;
    border-radius: var(--app-radius-sm) var(--app-radius-sm) 0 0;
    color: var(--app-text-muted);
    font-weight: 500;
    padding: 0.55rem 1rem;
    margin-bottom: -1px;
}

.app-tabs .nav-link:hover {
    color: var(--app-primary);
    background: var(--app-primary-soft);
}

.app-tabs .nav-link.active {
    color: var(--app-primary);
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-bottom-color: var(--app-surface);
    font-weight: 600;
}

.nav-tabs .nav-link {
    font-weight: 500;
    color: var(--app-text-muted);
    border-radius: var(--app-radius-sm) var(--app-radius-sm) 0 0;
}

.nav-tabs .nav-link.active {
    font-weight: 600;
    color: var(--app-primary);
}

/* ── Tables ───────────────────────────────────────────────────── */
.table {
    border: none;
    margin-bottom: 0;
}

.app-table-wrap {
    border-radius: var(--app-radius);
    overflow: hidden;
    border: 1px solid var(--app-border);
    box-shadow: var(--app-shadow-sm);
    background: var(--app-surface);
}

.app-table-wrap .table thead th {
    background: var(--app-surface-muted);
    border-bottom: 1px solid var(--app-border);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--app-text-muted);
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.app-table-wrap .table tbody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    border-color: var(--app-border);
}

.app-table-wrap .table tbody tr:last-child td {
    border-bottom: none;
}

.returns-table .return-row,
.repairs-table .repair-row,
.dashboard-queue-table tbody tr.dashboard-queue-row {
    transition: background 0.12s;
}

.returns-table .return-row:hover,
.repairs-table .repair-row:hover {
    background: var(--app-primary-soft) !important;
    cursor: pointer;
}

.table > :not(caption) > * > * {
    border-color: var(--app-border);
}

/* ── Forms ────────────────────────────────────────────────────── */
.form-control,
.form-select {
    border-color: var(--app-border-strong);
    border-radius: var(--app-radius-sm);
    padding: 0.5rem 0.75rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--app-text);
}

.form-text {
    color: var(--app-text-muted);
}

/* ── Badges ───────────────────────────────────────────────────── */
.badge {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.app-badge-repair-label,
.app-badge-repair-active,
.app-badge-status-wip {
    background: #fef3c7 !important;
    color: var(--app-warning-text) !important;
    border: 1px solid #e5b84a;
}

.app-badge-repair-done {
    background: var(--app-surface-muted) !important;
    color: var(--app-text-muted) !important;
    border: 1px solid var(--app-border);
}

/* Repairs list tabs + active repair rows (light) */
:root:not([data-bs-theme="dark"]) .repairs-table .table-warning,
[data-bs-theme="light"] .repairs-table .table-warning,
:root:not([data-bs-theme="dark"]) .table-warning,
[data-bs-theme="light"] .table-warning {
    --bs-table-bg: #fffbeb;
    --bs-table-color: var(--app-warning-text);
    --bs-table-hover-bg: #fef3c7;
    --bs-table-striped-bg: #fffbeb;
}

:root:not([data-bs-theme="dark"]) .alert-warning,
[data-bs-theme="light"] .alert-warning {
    background-color: #fffbeb;
    border-color: #e5b84a;
    color: var(--app-warning-text);
}

:root:not([data-bs-theme="dark"]) .app-tabs .nav-link.active,
[data-bs-theme="light"] .app-tabs .nav-link.active {
    color: #1d4ed8;
}

/* ── KPI rail (all pages: Dashboard, Reports, etc.) ───────────── */
.dashboard-stat-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    overflow: visible;
    background: var(--app-surface);
}

.dashboard-stat-strip .dashboard-stat-col {
    flex: 1 1 0;
    min-width: 0;
    border-right: 1px solid var(--app-border);
    position: relative;
}

.dashboard-stat-strip .dashboard-stat-col:last-child {
    border-right: none;
}

.dashboard-stat-strip .dashboard-stat {
    display: block;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0.65rem 0.4rem;
    text-align: center;
    color: inherit;
    transition: background 0.15s, outline 0.15s, box-shadow 0.15s, filter 0.15s;
    position: relative;
    overflow: visible;
}

.dashboard-stat-strip .dashboard-stat:not([class*="dashboard-stat-accent-"]) {
    --stat-accent: var(--app-text-muted);
    --stat-glow: rgba(100, 116, 139, 0.2);
    --stat-hover-bg: var(--app-surface-muted);
}

.dashboard-stat-strip .dashboard-stat::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stat-accent, var(--app-primary));
    opacity: 1;
}

.dashboard-stat-strip .dashboard-stat:not(:hover) {
    background: transparent !important;
    outline: none !important;
    box-shadow: none !important;
    filter: none;
}

.dashboard-stat-strip .dashboard-stat[class*="dashboard-stat-accent-"].dashboard-stat-active:not(:hover) {
    z-index: 1;
    background: var(--stat-selected-bg, var(--stat-hover-bg)) !important;
}

.dashboard-stat-strip .dashboard-stat:hover {
    z-index: 2;
    background: var(--stat-hover-bg, var(--app-surface-muted)) !important;
    outline: 1px solid color-mix(in srgb, var(--stat-accent, var(--app-border-strong)) 40%, transparent);
    outline-offset: -1px;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--stat-accent, var(--app-border-strong)) 20%, transparent) !important;
    filter: drop-shadow(0 0 10px var(--stat-glow, rgba(100, 116, 139, 0.2)));
}

.dashboard-stat-strip .dashboard-stat[class*="dashboard-stat-accent-"]:hover::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stat-accent);
    opacity: 0.75;
}

.dashboard-stat-strip .dashboard-stat-value {
    display: block;
    font-size: 1.35rem;
    font-family: var(--app-mono);
    font-weight: 600;
    line-height: 1.1;
    color: var(--app-text);
}

.dashboard-stat-strip .dashboard-stat-label {
    display: block;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--app-text-muted);
    margin-top: 0.35rem;
    font-weight: 600;
}

.dashboard-stat-danger {
    --stat-accent: var(--app-danger);
}

.dashboard-stat-accent-active {
    --stat-accent: var(--app-primary);
    --stat-glow: rgba(37, 99, 235, 0.2);
    --stat-hover-bg: color-mix(in srgb, var(--app-primary-soft) 60%, var(--app-surface));
    --stat-selected-bg: var(--app-primary-soft);
}

.dashboard-stat-accent-overdue {
    --stat-accent: var(--app-danger);
    --stat-glow: rgba(220, 38, 38, 0.16);
    --stat-hover-bg: var(--app-danger-soft);
    --stat-selected-bg: var(--app-danger-soft);
}

.dashboard-stat-accent-ship {
    --stat-accent: var(--app-warning);
    --stat-glow: rgba(217, 119, 6, 0.16);
    --stat-hover-bg: var(--app-warning-soft);
    --stat-selected-bg: var(--app-warning-soft);
}

.dashboard-stat-accent-contact {
    --stat-accent: #8b5cf6;
    --stat-glow: rgba(139, 92, 246, 0.2);
    --stat-hover-bg: color-mix(in srgb, rgba(139, 92, 246, 0.14) 65%, var(--app-surface));
    --stat-selected-bg: rgba(139, 92, 246, 0.14);
}

.dashboard-stat-accent-awaiting {
    --stat-accent: #0284c7;
    --stat-glow: rgba(14, 165, 233, 0.16);
    --stat-hover-bg: rgba(14, 165, 233, 0.14);
    --stat-selected-bg: rgba(14, 165, 233, 0.14);
}

.dashboard-stat-accent-rebuild {
    --stat-accent: #6366f1;
    --stat-glow: rgba(99, 102, 241, 0.2);
    --stat-hover-bg: color-mix(in srgb, rgba(99, 102, 241, 0.14) 65%, var(--app-surface));
    --stat-selected-bg: rgba(99, 102, 241, 0.14);
}

.dashboard-stat-accent-ready {
    --stat-accent: var(--app-success);
    --stat-glow: rgba(5, 150, 105, 0.16);
    --stat-hover-bg: var(--app-success-soft);
    --stat-selected-bg: var(--app-success-soft);
}

.dashboard-stat-value {
    display: block;
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--app-text);
}

.dashboard-stat-label {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--app-text-muted);
    margin-top: 0.35rem;
    font-weight: 600;
}

.dashboard-focus-card {
    border-left: 4px solid var(--app-danger);
    box-shadow: var(--app-shadow);
}

.dashboard-focus-card > .card-header {
    background: linear-gradient(90deg, var(--app-danger-soft), var(--app-surface));
}

.dashboard-focus-split .border-end-lg {
    border-right: 1px solid var(--app-border) !important;
}

.dashboard-focus-split .bg-light {
    background: var(--app-surface-muted) !important;
}

@media (max-width: 991.98px) {
    .dashboard-focus-split .border-end-lg {
        border-right: 0 !important;
        border-bottom: 1px solid var(--app-border);
    }
}

.dashboard-focus-list .dashboard-focus-item {
    border-color: var(--app-border);
    transition: background 0.12s;
}

.dashboard-focus-list .dashboard-focus-item:hover {
    background: var(--app-primary-soft);
}

.dashboard-cmdb-badge {
    font-size: 0.65rem;
    vertical-align: middle;
}

.dashboard-lwd-date {
    font-size: 0.6875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
    padding: 0.12rem 0.4rem;
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-muted);
    border: 1px solid var(--app-border);
}

/* Readable warning text on light UI (Due column, hints) */
:root:not([data-bs-theme="dark"]) .text-warning,
[data-bs-theme="light"] .text-warning,
:root:not([data-bs-theme="dark"]) .text-app-warning,
[data-bs-theme="light"] .text-app-warning {
    color: var(--app-warning-text) !important;
}

html:not([data-bs-theme="dark"]) .dashboard-lwd-date.text-app-warning {
    background: #fef3c7 !important;
    border-color: #e5b84a !important;
    color: var(--app-warning-text) !important;
}

:root:not([data-bs-theme="dark"]) .text-warning-emphasis,
[data-bs-theme="light"] .text-warning-emphasis {
    color: var(--app-warning-text) !important;
}

:root:not([data-bs-theme="dark"]) .badge.bg-warning,
:root:not([data-bs-theme="dark"]) .badge.text-bg-warning,
:root:not([data-bs-theme="dark"]) .badge.text-bg-warning.text-dark,
[data-bs-theme="light"] .badge.bg-warning,
[data-bs-theme="light"] .badge.text-bg-warning,
[data-bs-theme="light"] .badge.text-bg-warning.text-dark {
    background-color: #fef3c7 !important;
    color: var(--app-warning-text) !important;
    border: 1px solid #e5b84a;
}

:root:not([data-bs-theme="dark"]) .form-text.text-warning,
[data-bs-theme="light"] .form-text.text-warning {
    color: var(--app-warning-text) !important;
}

[data-bs-theme="dark"] .text-app-warning,
[data-bs-theme="dark"] .text-warning,
[data-bs-theme="dark"] .text-warning-emphasis {
    color: var(--app-warning-text) !important;
}

[data-bs-theme="dark"] .dashboard-lwd-date.text-app-warning {
    background: rgba(245, 158, 11, 0.18) !important;
    border-color: rgba(201, 162, 39, 0.45) !important;
    color: var(--app-warning-text) !important;
}

[data-bs-theme="dark"] .dashboard-lwd-date.text-danger {
    background: rgba(239, 68, 68, 0.14) !important;
    border-color: rgba(248, 113, 113, 0.35) !important;
    color: #f0b4b4 !important;
}

.dashboard-next-action-label {
    font-weight: 600;
    color: var(--app-primary);
}

.dashboard-quick-action {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    vertical-align: middle;
}

.dashboard-queue-card .card-header {
    border-bottom: 1px solid var(--app-border);
    background: var(--app-surface-muted);
}

.dashboard-return-glance .dashboard-person {
    line-height: 1.2;
    font-weight: 600;
}

.dashboard-return-glance .dashboard-subline {
    line-height: 1.25;
    margin-top: 0.15rem;
}

.dashboard-ps-col {
    width: 4.5rem;
    font-variant-numeric: tabular-nums;
}

.dashboard-return-glance .dashboard-hint {
    line-height: 1.2;
    margin-top: 0.1rem;
}

.dashboard-return-col {
    min-width: 12rem;
    max-width: 22rem;
}

.dashboard-focus-link {
    color: inherit;
}

.dashboard-focus-link:hover .dashboard-person,
.dashboard-focus-link:hover strong {
    color: var(--app-primary);
}

.dashboard-queue-table tbody tr.dashboard-queue-row:hover {
    background-color: var(--app-primary-soft);
}

/* ── Page title home link (return arrow → dashboard) ──────────── */
.page-title-with-home {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
}

.page-title-home-gap {
    display: inline-block;
    width: 0.5rem;
}

.page-title-home-link {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    text-decoration: none;
    border-radius: 0.25rem;
    cursor: pointer;
}

.page-title-home-link:hover,
.page-title-home-link:focus {
    text-decoration: none;
    opacity: 0.85;
}

.page-title-home-link:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.page-title-home-link .bi {
    font-size: 1em;
    vertical-align: -0.125em;
}

/* ── Return workflow ──────────────────────────────────────────── */
.table-reminder td {
    vertical-align: middle;
}

.badge-status {
    font-size: 0.85rem;
}

.card-reminder {
    border-left: 4px solid var(--app-danger);
}

.card-reminder-warning {
    border-left-color: var(--app-warning);
}

.card-reminder-info {
    border-left-color: var(--app-primary);
}

label.required-field::after,
.form-label.required-field::after {
    content: " *";
    color: var(--app-danger);
    font-weight: 700;
}

label.label-field-optional::after,
.form-label.label-field-optional::after {
    content: "";
}

.validation-summary-valid {
    display: none !important;
}

.alert-danger:empty {
    display: none !important;
}

.return-stepper-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
    list-style: none;
    padding: 0.85rem 1.15rem;
    margin: 0 0 0.75rem;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-sm);
}

.return-step {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--app-text-muted);
}

.return-step-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #cbd5e1;
    flex-shrink: 0;
}

.return-step.done .return-step-dot {
    background: var(--app-success);
}

.return-step.done {
    color: var(--app-success);
}

.return-step.current .return-step-dot {
    background: var(--app-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.return-step.current {
    color: var(--app-primary);
    font-weight: 600;
}

.return-step.locked {
    color: #94a3b8;
    opacity: 0.7;
}

.return-step.locked .return-step-dot {
    background: #e2e8f0;
}

.return-step.upcoming .return-step-dot {
    background: #e2e8f0;
}

.return-step-label {
    line-height: 1.2;
    white-space: nowrap;
}

.checklist-task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 0.5rem;
}

.checklist-task-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--app-border-strong);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface);
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.checklist-task-btn:hover {
    border-color: var(--app-primary);
    background: var(--app-primary-soft);
    box-shadow: var(--app-shadow-sm);
}

.checklist-task-btn:has(.checklist-task-input:checked) {
    background: var(--app-success-soft);
    border-color: var(--app-success);
}

.checklist-task-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.checklist-task-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #cbd5e1;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: transparent;
    flex-shrink: 0;
}

.checklist-task-btn:has(.checklist-task-input:checked) .checklist-task-mark {
    border-color: var(--app-success);
    background: var(--app-success);
    color: #fff;
}

.checklist-task-text {
    font-size: 0.875rem;
    line-height: 1.25;
}

.checklist-tech-select .checklist-tech-btn {
    flex: 1 1 50%;
    font-weight: 600;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.return-timeline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    padding: 0.65rem 1rem;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    box-shadow: var(--app-shadow-sm);
    font-size: 0.875rem;
}

.return-timeline-sep {
    color: #cbd5e1;
}

.return-timeline-carrier {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.5rem 1rem;
    background: var(--app-primary-soft);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: var(--app-radius-sm);
    color: #1e40af;
}

.return-timeline-carrier-item {
    font-weight: 500;
}

.shipping-leg {
    padding: 1rem 1.15rem;
    background: var(--app-surface-muted);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
}

.shipping-leg .h6 {
    color: var(--app-text);
    font-weight: 600;
}

.shipping-carrier-status {
    font-weight: 500;
    background-color: var(--app-surface);
}

.return-edit-form {
    padding-bottom: 0.5rem;
}

.return-edit-header {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    padding: 1.15rem 1.35rem;
    margin-bottom: 1rem;
    box-shadow: var(--app-shadow-sm);
}

.return-edit-header h1 {
    font-size: 1.35rem;
    margin: 0;
}

.return-edit-form .tab-content {
    background: var(--app-surface);
    border: 1px solid var(--app-border) !important;
    border-radius: 0 0 var(--app-radius) var(--app-radius);
    box-shadow: var(--app-shadow-sm);
    padding: 1.35rem !important;
}

.return-edit-form .nav-tabs {
    border-bottom: none;
    gap: 0.15rem;
    flex-wrap: wrap;
}

.return-edit-form .nav-tabs .nav-link {
    border: 1px solid transparent;
    margin-bottom: 0;
    font-size: 0.875rem;
    padding: 0.4rem 0.65rem;
}

.return-edit-form .nav-tabs .nav-link.active {
    border-color: var(--app-border);
    border-bottom-color: var(--app-surface);
    background: var(--app-surface);
}

.return-edit-footer {
    margin-top: 1rem;
    padding: 0 0 0.5rem;
}

.return-edit-footer-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem 1.25rem;
    margin-bottom: 0.5rem;
    padding: 0 0.15rem;
}

.return-edit-notes {
    flex: 1 1 12rem;
    min-width: 10rem;
    max-width: 28rem;
}

.return-edit-notes-summary {
    font-size: 0.8125rem;
    color: var(--app-text-muted);
    cursor: pointer;
    user-select: none;
}

.return-edit-notes-summary::-webkit-details-marker {
    margin-right: 0.35rem;
}

.return-edit-manual-toggle {
    font-size: 0.8125rem;
    text-decoration: none;
    color: var(--app-text-muted);
}

.return-edit-manual-toggle:hover {
    color: var(--app-text);
    text-decoration: underline;
}

.return-edit-manual-panel {
    flex: 1 1 100%;
    padding: 0.35rem 0 0.15rem;
}

.return-edit-footer-hint {
    padding: 0 0.15rem;
}

.return-edit-footer-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 0.85rem 1.15rem;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-lg);
}

.return-edit-footer-actions .btn {
    min-width: 7.5rem;
}

.return-edit-footer-back {
    font-size: 0.8125rem;
    color: var(--app-text-muted);
    text-decoration: none;
    white-space: nowrap;
}

.return-edit-footer-back:hover {
    color: var(--app-text);
    text-decoration: underline;
}

.return-manual-status {
    max-width: 100%;
}

.return-manual-status summary {
    cursor: pointer;
    user-select: none;
}

.return-overview-columns {
    --bs-gutter-y: 1.5rem;
}

.return-overview-panel {
    min-height: 5.5rem;
    background: var(--app-primary-soft) !important;
    border-color: rgba(37, 99, 235, 0.15) !important;
    border-radius: var(--app-radius-sm) !important;
}

/* ── IT case file ─────────────────────────────────────────────── */
.return-record-dl dt {
    font-weight: 500;
    color: var(--app-text-muted);
}

.return-record-notes {
    white-space: pre-wrap;
    font-family: inherit;
    font-size: inherit;
    background: transparent;
    border: none;
    padding: 0;
}

.return-record-history-compact .return-record-history-item {
    border-bottom: 1px solid var(--app-border);
}

.return-record-history-compact .return-record-history-item:last-child {
    border-bottom: none;
}

.return-record-history-details > summary {
    list-style: none;
    cursor: pointer;
}

.return-record-history-details > summary::-webkit-details-marker {
    display: none;
}

.return-record-history-summary {
    display: grid;
    grid-template-columns: 1.25rem 5.5rem minmax(0, 1fr) 1.25rem;
    align-items: center;
    gap: 0.5rem 0.65rem;
    padding: 0.45rem 0.15rem;
    border-radius: var(--app-radius-sm);
    transition: background 0.12s;
}

.return-record-history-summary:hover {
    background: var(--app-primary-soft);
}

.return-record-history-date {
    font-weight: 600;
    font-size: 0.8125rem;
}

.return-record-history-step {
    font-weight: 500;
    color: var(--app-text);
    min-width: 0;
}

.return-record-history-item.is-pending .return-record-history-step {
    color: var(--app-text-muted);
}

.return-record-history-chevron {
    justify-self: end;
    font-size: 0.75rem;
    transition: transform 0.15s;
}

.return-record-history-details[open] .return-record-history-chevron {
    transform: rotate(180deg);
}

.return-record-history-body {
    margin: 0 0 0.5rem 2.9rem;
    padding: 0 0 0.5rem 0.65rem;
    border-left: 2px solid var(--app-border);
}

.return-record-history-item.is-complete .return-record-history-body {
    border-left-color: var(--app-success);
}

.return-record-history-evidence {
    color: var(--app-text);
    line-height: 1.45;
}

.return-record-history-summary-day .return-record-history-step {
    display: block;
    min-width: 0;
}

.return-record-history-activity-count {
    font-weight: 600;
    color: var(--app-text-muted);
}

.return-record-history-step-names {
    font-weight: 500;
    color: var(--app-text);
}

.return-record-history-activity + .return-record-history-activity {
    padding-top: 0.65rem;
    margin-top: 0.65rem;
    border-top: 1px dashed var(--app-border);
}

.return-record-history-audit-item {
    line-height: 1.4;
    padding: 0.2rem 0;
}

.return-record .return-record-card-header {
    background: var(--app-surface-muted);
    color: var(--app-text);
    border-bottom: 2px solid rgba(37, 99, 235, 0.2);
}

.return-record .return-record-card-header strong {
    color: var(--app-primary);
    font-weight: 600;
}

.return-record-checklist td,
.return-record-checklist th {
    vertical-align: middle;
}

.return-record-validation {
    font-size: 0.875rem;
    white-space: nowrap;
}

.return-record-validation-link {
    color: var(--app-primary);
    text-decoration: none;
    font-weight: 500;
}

.return-record-validation-link:hover {
    text-decoration: underline;
}

.return-record-validation-pending {
    color: var(--app-text-muted);
    font-weight: 400;
}

.return-record-checklist-badge-done {
    background-color: var(--app-primary-soft);
    color: var(--app-primary);
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.return-record-toolbar {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--app-shadow-sm);
}

/* ── Repair forms ─────────────────────────────────────────────── */
.repair-form-intro {
    color: var(--app-text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
    padding: 0.85rem 1rem;
    background: var(--app-primary-soft);
    border-radius: var(--app-radius-sm);
    border-left: 3px solid var(--app-primary);
}

.repair-detail-header {
    background: linear-gradient(135deg, var(--app-surface) 0%, var(--app-primary-soft) 100%);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--app-shadow-sm);
}

.repair-detail-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.35rem;
}

/* Date fields — visible text, calendar icon, and Today button (repairs + returns) */
input[type="date"].form-control,
input[type="datetime-local"].form-control,
input[type="time"].form-control {
    background-color: #fff;
    color: var(--app-text);
    border-color: var(--app-border-strong);
    min-height: calc(1.5em + 0.5rem + 2px);
    color-scheme: light;
}

input[type="date"].form-control::-webkit-calendar-picker-indicator,
input[type="datetime-local"].form-control::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.72;
}

.input-group-sm .btn-today {
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

[data-bs-theme="dark"] input[type="date"].form-control,
[data-bs-theme="dark"] input[type="datetime-local"].form-control,
[data-bs-theme="dark"] input[type="time"].form-control {
    color-scheme: dark;
    background-color: var(--app-surface-muted);
    color: var(--app-text);
    border-color: var(--app-border-strong);
}

[data-bs-theme="dark"] input[type="date"]::-webkit-datetime-edit,
[data-bs-theme="dark"] input[type="date"]::-webkit-datetime-edit-fields-wrapper,
[data-bs-theme="dark"] input[type="date"]::-webkit-datetime-edit-text,
[data-bs-theme="dark"] input[type="date"]::-webkit-datetime-edit-month-field,
[data-bs-theme="dark"] input[type="date"]::-webkit-datetime-edit-day-field,
[data-bs-theme="dark"] input[type="date"]::-webkit-datetime-edit-year-field,
[data-bs-theme="dark"] input[type="datetime-local"]::-webkit-datetime-edit,
[data-bs-theme="dark"] input[type="datetime-local"]::-webkit-datetime-edit-fields-wrapper {
    color: var(--app-text);
}

[data-bs-theme="dark"] input[type="date"].form-control::-webkit-calendar-picker-indicator,
[data-bs-theme="dark"] input[type="datetime-local"].form-control::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.15);
    opacity: 0.92;
}

[data-app-tier="enterprise"]:not([data-bs-theme="dark"]) .app-panel .form-control,
[data-app-tier="enterprise"]:not([data-bs-theme="dark"]) .app-panel .form-select {
    background-color: #fff;
    color: #212529;
    border-color: var(--app-border-strong);
}

[data-app-tier="enterprise"]:not([data-bs-theme="dark"]) .app-panel .form-label {
    color: #212529;
    font-weight: 600;
}

[data-app-tier="enterprise"]:not([data-bs-theme="dark"]) .app-panel .form-text {
    color: #495057;
}

[data-app-tier="enterprise"] input[type="date"].form-control::-webkit-calendar-picker-indicator,
[data-app-tier="enterprise"] input[type="datetime-local"].form-control::-webkit-calendar-picker-indicator {
    opacity: 0.8;
    filter: contrast(1.25);
}

[data-app-tier="enterprise"] .input-group-sm .btn-today {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    color: #212529;
}

[data-app-tier="enterprise"] .input-group-sm .btn-today:hover {
    background-color: var(--app-primary-soft);
    border-color: var(--app-primary);
    color: var(--app-primary);
}

[data-app-tier="enterprise"][data-bs-theme="dark"] .app-panel .form-control,
[data-app-tier="enterprise"][data-bs-theme="dark"] .app-panel .form-select {
    background-color: #343a40;
    color: #f8f9fa;
    border-color: #6c757d;
}

[data-app-tier="enterprise"][data-bs-theme="dark"] .app-panel .form-label {
    color: #f8f9fa;
}

[data-app-tier="enterprise"][data-bs-theme="dark"] .app-panel .form-text {
    color: #ced4da;
}

[data-app-tier="enterprise"][data-bs-theme="dark"] input[type="date"].form-control,
[data-app-tier="enterprise"][data-bs-theme="dark"] input[type="datetime-local"].form-control {
    background-color: #343a40;
    color: #f8f9fa;
    border-color: #6c757d;
    color-scheme: dark;
}

[data-app-tier="enterprise"][data-bs-theme="dark"] input[type="date"]::-webkit-datetime-edit,
[data-app-tier="enterprise"][data-bs-theme="dark"] input[type="date"]::-webkit-datetime-edit-fields-wrapper,
[data-app-tier="enterprise"][data-bs-theme="dark"] input[type="date"]::-webkit-datetime-edit-text,
[data-app-tier="enterprise"][data-bs-theme="dark"] input[type="date"]::-webkit-datetime-edit-month-field,
[data-app-tier="enterprise"][data-bs-theme="dark"] input[type="date"]::-webkit-datetime-edit-day-field,
[data-app-tier="enterprise"][data-bs-theme="dark"] input[type="date"]::-webkit-datetime-edit-year-field {
    color: #f8f9fa;
}

[data-app-tier="enterprise"][data-bs-theme="dark"] input[type="date"].form-control::-webkit-calendar-picker-indicator,
[data-app-tier="enterprise"][data-bs-theme="dark"] input[type="datetime-local"].form-control::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.2);
    opacity: 0.95;
}

[data-app-tier="enterprise"][data-bs-theme="dark"] .input-group-sm .btn-today {
    background-color: #495057;
    border-color: #adb5bd;
    color: #f8f9fa;
}

[data-app-tier="enterprise"][data-bs-theme="dark"] .input-group-sm .btn-today:hover {
    background-color: rgba(13, 110, 253, 0.25);
    border-color: var(--app-primary);
    color: #fff;
}

[data-app-tier="enterprise"] .repair-form-intro {
    background: #e7f1ff;
    color: #212529;
    border-left-color: var(--app-primary);
}

[data-app-tier="enterprise"][data-bs-theme="dark"] .repair-form-intro {
    background: rgba(13, 110, 253, 0.15);
    color: #e9ecef;
    border-left-color: #6ea8fe;
}

/* ── CMDB strip ───────────────────────────────────────────────── */
.cmdb-strip {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-sm);
}

/* ── Print ────────────────────────────────────────────────────── */
@media print {
    .app-header,
    .app-footer,
    .return-record-toolbar,
    .return-record-evidence .form-text,
    .return-record-evidence .btn,
    .alert {
        display: none !important;
    }

    .return-record-evidence textarea {
        border: none;
        resize: none;
    }

    main.container,
    main.container-xl {
        max-width: 100%;
        padding: 0;
    }

    .return-record .card {
        break-inside: avoid;
        border: 1px solid var(--app-border) !important;
    }

    .return-record .return-record-card-header {
        background-color: #fff !important;
        color: #212529 !important;
        border-bottom: 2px solid rgba(37, 99, 235, 0.2) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .return-record-history-details .return-record-history-body {
        display: block !important;
    }

    .return-record-history-chevron {
        display: none !important;
    }

    .return-record-history-item.is-complete .return-record-history-summary {
        background: var(--app-success-soft) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .return-record-validation-link {
        color: var(--app-primary) !important;
        text-decoration: none !important;
    }
}

@media (max-width: 575.98px) {
    .page-hero h1 {
        font-size: 1.45rem;
    }

    .dashboard-stat-strip .dashboard-stat-value {
        font-size: 1.15rem;
    }
}

/* ── Dark mode ────────────────────────────────────────────────── */
[data-bs-theme="dark"] {
    color-scheme: dark;

    --app-bg: #0a0f1a;
    --app-bg-accent: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(59, 130, 246, 0.22), transparent 55%);
    --app-surface: #131c2e;
    --app-surface-muted: #1a2438;
    --app-border: rgba(255, 255, 255, 0.08);
    --app-border-strong: rgba(255, 255, 255, 0.14);
    --app-text: #e2e8f0;
    --app-text-muted: #94a3b8;
    --app-primary: #60a5fa;
    --app-primary-hover: #93c5fd;
    --app-primary-soft: rgba(59, 130, 246, 0.18);
    --app-accent: #38bdf8;
    --app-success: #34d399;
    --app-success-soft: rgba(16, 185, 129, 0.16);
    --app-warning: #d4a017;
    --app-warning-soft: rgba(245, 158, 11, 0.16);
    --app-warning-text: #c9a227;
    --app-danger: #f87171;
    --app-danger-soft: rgba(239, 68, 68, 0.16);
    --app-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --app-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --app-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);

    --bs-body-bg: var(--app-bg);
    --bs-body-color: var(--app-text);
    --bs-emphasis-color: var(--app-text);
    --bs-secondary-color: var(--app-text-muted);
    --bs-tertiary-color: var(--app-text-muted);
    --bs-border-color: var(--app-border);
    --bs-secondary-bg: var(--app-surface-muted);
    --bs-tertiary-bg: var(--app-surface-muted);
    --bs-link-color: var(--app-primary);
    --bs-link-hover-color: var(--app-primary-hover);
}

[data-bs-theme="dark"] .text-bg-light,
[data-bs-theme="dark"] .text-dark {
    color: var(--app-text) !important;
}

[data-bs-theme="dark"] .badge.text-bg-light,
[data-bs-theme="dark"] .badge.text-bg-light.text-dark {
    background-color: var(--app-surface-muted) !important;
    color: var(--app-text) !important;
    border: 1px solid var(--app-border);
}

[data-bs-theme="dark"] .btn-secondary {
    background-color: var(--app-surface-muted);
    border-color: var(--app-border-strong);
    color: var(--app-text);
}

[data-bs-theme="dark"] .btn-secondary:hover {
    background-color: #243044;
    color: var(--app-text);
}

[data-bs-theme="dark"] .navbar-toggler-icon {
    filter: invert(1);
}

[data-bs-theme="dark"] .app-footer {
    background: rgba(10, 15, 26, 0.85);
    border-top-color: var(--app-border);
}

[data-bs-theme="dark"] .app-alert-success {
    background: var(--app-success-soft);
    color: #6ee7b7;
    border-left-color: var(--app-success);
}

[data-bs-theme="dark"] .app-alert-danger {
    background: var(--app-danger-soft);
    color: #fca5a5;
    border-left-color: var(--app-danger);
}

[data-bs-theme="dark"] .app-alert .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

[data-bs-theme="dark"] .dashboard-focus-card > .card-header {
    background: linear-gradient(90deg, var(--app-danger-soft), var(--app-surface)) !important;
}

[data-bs-theme="dark"] .return-timeline-carrier {
    background: var(--app-primary-soft);
    border-color: rgba(96, 165, 250, 0.25);
    color: #93c5fd;
}

[data-bs-theme="dark"] .return-step-dot {
    background: #475569;
}

[data-bs-theme="dark"] .return-step.locked .return-step-dot,
[data-bs-theme="dark"] .return-step.upcoming .return-step-dot {
    background: #334155;
}

[data-bs-theme="dark"] .checklist-task-mark {
    border-color: #475569;
}

[data-bs-theme="dark"] .checklist-task-btn {
    background: var(--app-surface);
    border-color: var(--app-border-strong);
}

[data-bs-theme="dark"] .checklist-task-btn:hover {
    background: var(--app-primary-soft);
    border-color: var(--app-primary);
}

[data-bs-theme="dark"] .checklist-task-btn:has(.checklist-task-input:checked) {
    background: var(--app-success-soft);
    border-color: var(--app-success);
}

[data-bs-theme="dark"] .app-badge-repair-label,
[data-bs-theme="dark"] .app-badge-repair-active,
[data-bs-theme="dark"] .app-badge-status-wip {
    background: rgba(251, 191, 36, 0.2) !important;
    color: #fde68a !important;
    border-color: rgba(251, 191, 36, 0.4);
}

[data-bs-theme="dark"] .app-badge-repair-done {
    background: var(--app-surface-muted) !important;
    color: var(--app-text-muted) !important;
}

[data-bs-theme="dark"] .repair-detail-header {
    background: linear-gradient(135deg, var(--app-surface) 0%, rgba(59, 130, 246, 0.12) 100%);
}

[data-bs-theme="dark"] .repair-form-intro {
    background: var(--app-primary-soft);
    border-left-color: var(--app-primary);
}

[data-bs-theme="dark"] .return-overview-panel {
    background: var(--app-primary-soft) !important;
    border-color: rgba(96, 165, 250, 0.2) !important;
}

[data-bs-theme="dark"] .return-record .return-record-card-header {
    background: var(--app-surface-muted);
}

[data-bs-theme="dark"] .return-record .return-record-card-header strong {
    color: var(--app-primary);
}

[data-bs-theme="dark"] .return-record-history-item.is-complete .return-record-history-summary {
    background: color-mix(in srgb, var(--app-success-soft) 55%, transparent);
}

[data-bs-theme="dark"] .return-record-checklist-badge-done {
    background-color: var(--app-primary-soft);
    color: var(--app-primary);
    border-color: rgba(96, 165, 250, 0.25);
}

[data-bs-theme="dark"] .returns-table .return-row:hover,
[data-bs-theme="dark"] .repairs-table .repair-row:hover,
[data-bs-theme="dark"] .dashboard-queue-table tbody tr.dashboard-queue-row:hover,
[data-bs-theme="dark"] .dashboard-focus-list .dashboard-focus-item:hover {
    background: var(--app-primary-soft) !important;
}

[data-bs-theme="dark"] .filter-chips .btn-outline-secondary {
    background: var(--app-surface);
    border-color: var(--app-border-strong);
    color: var(--app-text-muted);
}

[data-bs-theme="dark"] .filter-chips .btn-outline-secondary:hover {
    background: var(--app-surface-muted);
    color: var(--app-text);
}

[data-bs-theme="dark"] .app-tabs .nav-link.active {
    background: var(--app-surface);
    border-color: var(--app-border);
    border-bottom-color: var(--app-surface);
}

[data-bs-theme="dark"] .nav-tabs .nav-link.active {
    background: var(--app-surface);
    border-color: var(--app-border);
    color: var(--app-primary);
}

[data-bs-theme="dark"] .return-edit-form .nav-tabs .nav-link.active {
    background: var(--app-surface);
    border-bottom-color: var(--app-surface);
}

[data-bs-theme="dark"] .text-danger {
    color: #e57373 !important;
}

[data-bs-theme="dark"] .badge.text-bg-danger,
[data-bs-theme="dark"] .badge.text-bg-danger.text-white {
    color: #f3e8e8 !important;
}

[data-bs-theme="dark"] .table-warning {
    --bs-table-bg: rgba(251, 191, 36, 0.12);
    --bs-table-color: #d4b85c;
    --bs-table-hover-bg: rgba(251, 191, 36, 0.18);
}

[data-bs-theme="dark"] .table-warning > :is(td, th, a, strong),
[data-bs-theme="dark"] .repairs-table .table-warning > :is(td, th, a, strong) {
    color: #d4b85c !important;
}

[data-bs-theme="dark"] .alert-warning {
    color: var(--app-warning-text);
    border-color: rgba(201, 162, 39, 0.35);
}

[data-bs-theme="dark"] .alert-primary {
    background: var(--app-primary-soft);
    border-color: rgba(96, 165, 250, 0.3);
    color: var(--app-text);
}

[data-bs-theme="dark"] .card.border-primary {
    border-color: rgba(96, 165, 250, 0.4) !important;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: var(--app-surface-muted);
    border-color: var(--app-border-strong);
    color: var(--app-text);
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: var(--app-surface-muted);
    border-color: var(--app-primary);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
    color: var(--app-text);
}

[data-bs-theme="dark"] .form-control::placeholder {
    color: #64748b;
}

[data-bs-theme="dark"] .input-group-text {
    background: var(--app-surface-muted);
    border-color: var(--app-border-strong);
    color: var(--app-text-muted);
}

[data-bs-theme="dark"] .btn-outline-secondary {
    border-color: var(--app-border-strong);
    color: var(--app-text-muted);
}

[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background: var(--app-surface-muted);
    border-color: var(--app-border-strong);
    color: var(--app-text);
}

[data-bs-theme="dark"] .btn-link {
    color: var(--app-primary);
}

[data-bs-theme="dark"] .page-hero h1 .text-primary {
    color: var(--app-primary) !important;
}

[data-bs-theme="dark"] .shipping-carrier-status {
    background-color: var(--app-surface-muted);
    color: var(--app-text);
}

[data-bs-theme="dark"] .shipping-leg {
    background: var(--app-surface-muted);
}

[data-bs-theme="dark"] .return-edit-footer-bar {
    box-shadow: var(--app-shadow-lg);
}

[data-bs-theme="dark"] .dashboard-focus-link:hover strong,
[data-bs-theme="dark"] .dashboard-focus-link:hover .dashboard-person {
    color: var(--app-primary);
}

.app-section-bar {
    background: var(--app-surface-muted);
}

.app-table-wrap.border-0 {
    border: none !important;
    box-shadow: none !important;
    border-radius: 0;
}

[data-bs-theme="dark"] .alert-warning {
    background: rgba(251, 191, 36, 0.14);
    border-color: rgba(251, 191, 36, 0.35);
    color: #fde68a;
}

[data-bs-theme="dark"] .badge.text-bg-dark {
    background-color: #334155 !important;
    color: var(--app-text) !important;
}

[data-bs-theme="dark"] .text-primary {
    color: var(--app-primary) !important;
}

[data-bs-theme="dark"] .text-success {
    color: var(--app-success) !important;
}

[data-bs-theme="dark"] .dashboard-focus-split .bg-light,
[data-bs-theme="dark"] .app-section-bar {
    background: var(--app-surface-muted) !important;
}

/* ── Enterprise tier (5151 sandbox) — light only ─────────────── */
[data-app-tier="enterprise"]:not([data-bs-theme="dark"]) {
    --app-font: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
    --app-bg: #e9ecef;
    --app-bg-accent: none;
    --app-surface: #ffffff;
    --app-surface-muted: #f8f9fa;
    --app-border: #dee2e6;
    --app-border-strong: #ced4da;
    --app-text: #212529;
    --app-text-muted: #6c757d;
    --app-primary: #0d6efd;
    --app-primary-hover: #0b5ed7;
    --app-primary-soft: #e7f1ff;
    --app-accent: #495057;
    --app-success: #198754;
    --app-success-soft: #d1e7dd;
    --app-warning: #d97706;
    --app-warning-soft: #fef3c7;
    --app-warning-text: #0d0501;
    --app-danger: #dc3545;
    --app-danger-soft: #f8d7da;
    --app-shadow-sm: none;
    --app-shadow: none;
    --app-shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.08);
    --app-radius: 0.25rem;
    --app-radius-sm: 0.2rem;
    --app-nav-height: 3.25rem;
}

[data-app-tier="enterprise"] body,
[data-app-tier="enterprise"].app-body,
.app-body-enterprise {
    background-color: var(--app-bg) !important;
    background-image: none !important;
    font-size: 0.9375rem;
}

/* Top instance banner (5151 enterprise / 5152 demo) */
.app-env-banner {
    color: #fff;
    text-align: center;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

.app-env-banner-enterprise {
    background: #0a58ca;
}

.app-env-banner-demo {
    background: #0f766e;
}

.app-env-banner-label {
    font-weight: 700;
}

.app-env-banner-sep {
    opacity: 0.55;
    margin: 0 0.35rem;
}

/* Flat command-bar nav (not the colorful gradient) */
[data-app-tier="enterprise"] .app-navbar {
    background: #25282c !important;
    border-bottom: 2px solid var(--app-primary) !important;
    box-shadow: none !important;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

[data-app-tier="enterprise"] .app-brand-mark {
    background: var(--app-primary) !important;
    color: #fff !important;
    box-shadow: none !important;
    border-radius: 0.25rem;
    width: 2.15rem;
    height: 2.15rem;
    font-size: 1rem;
}

[data-app-tier="enterprise"] .app-brand-title {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

[data-app-tier="enterprise"] .app-brand-sub {
    text-transform: none;
    letter-spacing: 0.02em;
    font-size: 0.65rem;
}

[data-app-tier="enterprise"] .app-nav-link {
    font-size: 0.8125rem;
    padding: 0.4rem 0.55rem !important;
}

[data-app-tier="enterprise"] .app-nav-link.active {
    background: rgba(13, 110, 253, 0.45) !important;
    border-radius: 0.2rem;
}

@media (max-width: 1499.98px) {
    [data-app-tier="enterprise"] .app-brand-sub {
        display: none;
    }
}

[data-app-tier="enterprise"] .app-btn-accent {
    background: var(--app-primary) !important;
    border: 1px solid var(--app-primary) !important;
    box-shadow: none !important;
    border-radius: 0.2rem;
    font-size: 0.8125rem;
}

[data-app-tier="enterprise"] .app-btn-accent:hover {
    transform: none;
    box-shadow: none !important;
    background: var(--app-primary-hover) !important;
}

[data-app-tier="enterprise"] .app-nav-search .input-group-text,
[data-app-tier="enterprise"] .app-nav-search .form-control {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: #fff;
}

[data-app-tier="enterprise"] .app-nav-search .form-control::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

[data-app-tier="enterprise"] .app-main {
    padding-top: 1.25rem;
}

[data-app-tier="enterprise"] .app-footer {
    background: var(--app-surface);
    backdrop-filter: none;
    border-top: 1px solid var(--app-border);
}

/* Flat buttons — no gradients */
[data-app-tier="enterprise"] .btn-primary {
    background: var(--app-primary);
    border-color: var(--app-primary);
    box-shadow: none;
    font-weight: 600;
    font-size: 0.8125rem;
    border-radius: var(--app-radius-sm);
}

[data-app-tier="enterprise"] .btn-primary:hover {
    background: var(--app-primary-hover);
    border-color: var(--app-primary-hover);
}

[data-app-tier="enterprise"] .btn-outline-secondary {
    font-size: 0.8125rem;
    border-radius: var(--app-radius-sm);
}

[data-app-tier="enterprise"] .filter-chips .btn {
    border-radius: var(--app-radius-sm);
    font-size: 0.75rem;
}

[data-app-tier="enterprise"] .filter-chips .btn-primary {
    box-shadow: none;
}

/* Page headers — compact, no playful icons */
[data-app-tier="enterprise"] .page-hero {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--app-border);
}

[data-app-tier="enterprise"] .page-hero h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0;
}

[data-app-tier="enterprise"] .page-hero h1 .text-primary {
    color: var(--app-text-muted) !important;
}

[data-app-tier="enterprise"] .page-hero-lead {
    font-size: 0.8125rem;
}

[data-app-tier="enterprise"] .dashboard-hero-action {
    border-radius: var(--app-radius-sm);
    border-width: 1.5px;
    box-shadow: none;
    min-width: 6.25rem;
    padding: 0.6rem 0.85rem;
}

[data-app-tier="enterprise"] .dashboard-hero-action:hover {
    transform: translateY(-1px);
    box-shadow: var(--hero-action-shadow, var(--app-shadow-sm));
}

[data-bs-theme="dark"] .dashboard-hero-action {
    box-shadow: var(--app-shadow-sm), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

[data-bs-theme="dark"] .dashboard-hero-action-new {
    --hero-action-border: rgba(96, 165, 250, 0.5);
    --hero-action-bg: color-mix(in srgb, var(--app-primary-soft) 55%, var(--app-surface));
}

[data-bs-theme="dark"] .dashboard-hero-action-returns {
    --hero-action-border: rgba(56, 189, 248, 0.45);
    --hero-action-bg: color-mix(in srgb, rgba(56, 189, 248, 0.14) 60%, var(--app-surface));
    --hero-action-bg-hover: rgba(56, 189, 248, 0.22);
}

[data-bs-theme="dark"] .dashboard-hero-action-repairs {
    --hero-action-border: rgba(251, 191, 36, 0.5);
    --hero-action-bg: color-mix(in srgb, var(--app-warning-soft) 60%, var(--app-surface));
}

/* Focus / queue panels */
[data-app-tier="enterprise"] .dashboard-focus-card {
    border-left: 3px solid var(--app-border-strong);
    box-shadow: none;
    border-radius: var(--app-radius-sm);
}

[data-app-tier="enterprise"] .dashboard-focus-card > .card-header {
    background: var(--app-surface-muted) !important;
    font-size: 0.8125rem;
    padding: 0.65rem 1rem;
}

[data-app-tier="enterprise"] .card,
[data-app-tier="enterprise"] .app-card,
[data-app-tier="enterprise"] .app-panel {
    box-shadow: none;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
}

[data-app-tier="enterprise"] .app-table-wrap {
    box-shadow: none;
    border-radius: var(--app-radius-sm);
}

[data-app-tier="enterprise"] .app-table-wrap .table {
    font-size: 0.8125rem;
}

[data-app-tier="enterprise"] .app-table-wrap .table thead th {
    font-size: 0.65rem;
    padding: 0.5rem 0.65rem;
    background: #f1f3f5;
}

[data-app-tier="enterprise"] .app-table-wrap .table tbody td {
    padding: 0.45rem 0.65rem;
}

[data-app-tier="enterprise"] .app-table-wrap .table > :not(caption) > * > * {
    padding: 0.45rem 0.65rem;
}

[data-app-tier="enterprise"] .returns-table .return-row:hover,
[data-app-tier="enterprise"] .repairs-table .repair-row:hover {
    background: var(--app-surface-muted) !important;
}

[data-app-tier="enterprise"] .app-tabs .nav-link {
    font-size: 0.8125rem;
    padding: 0.45rem 0.85rem;
}

[data-app-tier="enterprise"] .app-nav-search {
    min-width: 9rem;
    max-width: 14rem;
    flex: 0 1 14rem;
}

[data-app-tier="enterprise"] .app-nav-search .form-control {
    min-width: 0;
}

[data-app-tier="enterprise"] .lifecycle-timeline {
    padding: 0.75rem 0;
}

[data-app-tier="enterprise"] .lifecycle-timeline-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--app-border);
}

[data-app-tier="enterprise"] .lifecycle-timeline-marker {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    margin-top: 0.35rem;
    background: var(--app-text-muted);
    flex-shrink: 0;
}

[data-app-tier="enterprise"] .lifecycle-kind-return-open .lifecycle-timeline-marker { background: var(--app-warning); }
[data-app-tier="enterprise"] .lifecycle-kind-return-closed .lifecycle-timeline-marker { background: var(--app-success); }
[data-app-tier="enterprise"] .lifecycle-kind-repair-open .lifecycle-timeline-marker { background: var(--app-primary); }
[data-app-tier="enterprise"] .lifecycle-kind-repair-closed .lifecycle-timeline-marker { background: var(--app-text-muted); }
[data-app-tier="enterprise"] .lifecycle-kind-audit .lifecycle-timeline-marker { background: #6f42c1; }
[data-app-tier="enterprise"] .lifecycle-kind-cmdb .lifecycle-timeline-marker { background: var(--app-accent); }

[data-app-tier="enterprise"] .lifecycle-dl dt {
    color: var(--app-text-muted);
    font-weight: 500;
    font-size: 0.75rem;
}

[data-app-tier="enterprise"] .app-badge-status-open {
    background: var(--app-warning-soft);
    color: var(--app-warning-text);
    border: 1px solid #fcd34d;
}

[data-app-tier="enterprise"] .app-badge-status-closed {
    background: var(--app-success-soft);
    color: #0a3622;
    border: 1px solid #a3cfbb;
}

[data-app-tier="enterprise"] .search-kind-asset { background: var(--app-primary-soft); color: var(--app-primary); }
[data-app-tier="enterprise"] .search-kind-return { background: var(--app-warning-soft); color: var(--app-warning-text); }
[data-app-tier="enterprise"] .search-kind-repair { background: #e9ecef; color: #495057; }

[data-app-tier="enterprise"][data-bs-theme="dark"] {
    color-scheme: dark;

    --app-bg: #141619;
    --app-bg-accent: none;
    --app-surface: #1c1f23;
    --app-surface-muted: #25282c;
    --app-border: #343a40;
    --app-border-strong: #495057;
    --app-text: #e9ecef;
    --app-text-muted: #adb5bd;
    --app-primary: #6ea8fe;
    --app-primary-hover: #9ec5fe;
    --app-primary-soft: rgba(13, 110, 253, 0.22);
    --app-accent: #adb5bd;
    --app-success: #75b798;
    --app-success-soft: rgba(25, 135, 84, 0.22);
    --app-warning: #ffda6a;
    --app-warning-soft: rgba(253, 126, 20, 0.18);
    --app-danger: #ea868f;
    --app-danger-soft: rgba(220, 53, 69, 0.2);
    --app-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --app-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    --app-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

    --bs-body-bg: var(--app-bg);
    --bs-body-color: var(--app-text);
    --bs-emphasis-color: var(--app-text);
    --bs-secondary-color: var(--app-text-muted);
    --bs-tertiary-color: var(--app-text-muted);
    --bs-border-color: var(--app-border);
    --bs-secondary-bg: var(--app-surface-muted);
    --bs-tertiary-bg: var(--app-surface-muted);
    --bs-link-color: var(--app-primary);
    --bs-link-hover-color: var(--app-primary-hover);
}

[data-app-tier="enterprise"][data-bs-theme="dark"] .app-navbar {
    background: #1c1f23 !important;
    border-bottom-color: var(--app-primary) !important;
}

[data-app-tier="enterprise"][data-bs-theme="dark"] .app-table-wrap .table thead th {
    background: #25282c;
}

[data-app-tier="enterprise"][data-bs-theme="dark"] .search-kind-repair {
    background: rgba(73, 80, 87, 0.5);
    color: #ced4da;
}

/* Warning text on light UI — override Bootstrap yellow text (must stay last) */
html:not([data-bs-theme="dark"]),
html[data-bs-theme="light"] {
    --bs-warning-rgb: 13, 5, 1;
    --bs-warning-text-emphasis: #0d0501;
    --bs-warning-color: #0d0501;
    --app-warning-text: #0d0501;
}

html:not([data-bs-theme="dark"]) .text-warning,
html:not([data-bs-theme="dark"]) .text-app-warning,
html:not([data-bs-theme="dark"]) .form-text.text-warning,
html:not([data-bs-theme="dark"]) .badge.text-bg-warning,
html:not([data-bs-theme="dark"]) .badge.text-bg-warning.text-dark,
html:not([data-bs-theme="dark"]) .badge.bg-warning,
html:not([data-bs-theme="dark"]) .app-badge-status-wip,
html:not([data-bs-theme="dark"]) .app-badge-repair-active,
html:not([data-bs-theme="dark"]) .app-badge-repair-label,
html:not([data-bs-theme="dark"]) .alert-warning,
html:not([data-bs-theme="dark"]) .table-warning,
html:not([data-bs-theme="dark"]) .table-warning > :is(td, th, a, strong),
html:not([data-bs-theme="dark"]) .repairs-table .table-warning > :is(td, th, a, strong),
html:not([data-bs-theme="dark"]) [data-app-tier="enterprise"] .app-badge-status-open,
html:not([data-bs-theme="dark"]) [data-app-tier="enterprise"] .search-kind-return,
html:not([data-bs-theme="dark"]) .dashboard-lwd-date.text-app-warning {
    color: #0d0501 !important;
}

html:not([data-bs-theme="dark"]) .dashboard-lwd-date.text-app-warning {
    background: #fef3c7 !important;
    border-color: #e5b84a !important;
}
