/* Core Reset & Variables */
:root {
    /* Colors — slate/blue base */
    --primary: #0f172a;
    --primary-light: #1e293b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --bg-main: #f1f5f9;
    --bg-white: #ffffff;
    --bg-subtle: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --bg-form-gray: #e9e9e9;

    /* Status colors */
    --ok: #16a34a;
    --ok-bg: #dcfce7;
    --ok-fg: #166534;
    --warn: #f59e0b;
    --warn-bg: #fef3c7;
    --warn-fg: #92400e;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-bg: #fee2e2;
    --danger-fg: #991b1b;
    --info: #3b82f6;
    --info-bg: #dbeafe;
    --info-fg: #1e40af;

    /* Type scale (px-based, applied via var) */
    --fs-2xs: 10px;
    --fs-xs: 11px;
    --fs-sm: 12px;
    --fs-base: 13px;
    --fs-md: 14px;
    --fs-lg: 16px;
    --fs-xl: 20px;
    --fs-2xl: 24px;

    /* Spacing scale (4px base) */
    --sp-0: 0;
    --sp-1: 2px;
    --sp-2: 4px;
    --sp-3: 6px;
    --sp-4: 8px;
    --sp-5: 12px;
    --sp-6: 16px;
    --sp-8: 24px;

    /* Radii */
    --r-sm: 4px;
    --r-md: 6px;
    --r-lg: 10px;
    --r-xl: 14px;
    --r-pill: 9999px;

    /* Shadows */
    --sh-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --sh-md: 0 2px 6px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    --sh-lg: 0 10px 20px -6px rgba(15, 23, 42, 0.12), 0 4px 8px -4px rgba(15, 23, 42, 0.06);

    /* Z-index scale */
    --z-sidebar: 50;
    --z-modal: 1000;
    --z-toast: 1100;
    --z-tooltip: 1200;

    /* Layout */
    --sidebar-width: 256px;
    --h-topbar: 52px;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

.icon {
    width: 1.25rem;
    height: 1.25rem;
    vertical-align: middle;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: inline-block;
    margin: 0;
    padding: 0;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-main);
    font-size: var(--fs-base);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

/* Layout Utilities */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-1 {
    flex: 1 1 0%;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.justify-around {
    justify-content: space-around;
}

.justify-end {
    justify-content: flex-end !important;
}

.h-screen {
    height: 100vh;
}

.h-full {
    height: 100%;
}

.h-20 {
    height: var(--h-topbar);
}

.h-16 {
    height: 4rem;
}

.h-10 {
    height: 2.5rem;
}

.h-8 {
    height: 2rem;
}

.w-full {
    width: 100%;
}

.w-10 {
    width: 2.5rem;
}

.w-12 {
    width: 3rem;
}

.w-8 {
    width: 2rem;
}

.w-px {
    width: 1px;
}

.overflow-hidden {
    overflow: hidden;
}

.overflow-y-auto {
    overflow-y: auto;
}

.overflow-x-auto {
    overflow-x: auto;
}

.max-h-400 {
    max-height: 400px;
}

.max-h-500 {
    max-height: 500px;
}

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.fixed {
    position: fixed;
}

.inset-0 {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.inset-y-0 {
    top: 0;
    bottom: 0;
}

.left-0 {
    left: 0;
}

.right-0 {
    right: 0;
}

.bottom-0 {
    bottom: 0;
}

.top-0 {
    top: 0;
}

.z-50 {
    z-index: 50;
}

.z-10 {
    z-index: 10;
}

/* Spacing */
.p-1 {
    padding: 0.25rem;
}

.p-2 {
    padding: 0.5rem;
}

.p-2\.5 {
    padding: 0.625rem;
}

.p-3 {
    padding: 0.75rem;
}

.p-4 {
    padding: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

.p-8 {
    padding: 2rem;
}

.p-10 {
    padding: 2.5rem;
}

.pl-4 {
    padding-left: 1rem !important;
}

.pl-10 {
    padding-left: 2.5rem;
}

.px-2 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.px-6 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.px-8 {
    padding-left: 2rem;
    padding-right: 2rem;
}

.py-1 {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.pl-3 {
    padding-left: 0.75rem;
}

.pb-0 {
    padding-bottom: 0 !important;
}

.pb-10 {
    padding-bottom: 2.5rem !important;
}

.pb-20 {
    padding-bottom: 5rem !important;
}

.pb-24 {
    padding-bottom: 6rem !important;
}

.pb-32 {
    padding-bottom: 8rem !important;
}

.m-0 {
    margin: 0;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.max-w-md {
    max-width: 28rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-10 {
    margin-bottom: 2.5rem;
}

.mb-12 {
    margin-bottom: 3rem;
}

.mr-2 {
    margin-right: 0.5rem;
}

.mr-2\.5 {
    margin-right: 0.625rem;
}

.mr-3 {
    margin-right: 0.75rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-8 {
    margin-top: 2rem;
}

.ml-4 {
    margin-left: 1rem;
}

.space-x-3>*+* {
    margin-left: 0.75rem;
}

.space-x-4>*+* {
    margin-left: 1rem;
}

.space-x-6>*+* {
    margin-left: 1.5rem;
}

.space-y-1>*+* {
    margin-top: 0.25rem !important;
}

.space-y-2>*+* {
    margin-top: 0.5rem !important;
}

.space-y-3>*+* {
    margin-top: 0.75rem !important;
}

.space-y-4>*+* {
    margin-top: 1rem !important;
}

.space-y-6>*+* {
    margin-top: 1.5rem !important;
}

.gap-4 {
    gap: 1rem;
}

.gap-6 {
    gap: 1.5rem;
}

.gap-8 {
    gap: 2rem;
}

.gap-10 {
    gap: 2.5rem;
}

.gap-x-8 {
    column-gap: 2rem;
}

.gap-y-4 {
    row-gap: 1rem;
}

/* Grid */
.grid {
    display: grid;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .lg\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Colors */
.bg-gray-50 {
    background-color: var(--bg-main) !important;
}

.bg-white {
    background-color: var(--bg-white) !important;
}

.bg-form-gray {
    background-color: var(--bg-form-gray) !important;
}

.bg-white\/90 {
    background-color: rgba(255, 255, 255, 0.9);
}

.bg-red-50 {
    background-color: #fef2f2;
}

.bg-red-500 {
    background-color: #ef4444;
}

.bg-slate-900 {
    background-color: var(--primary);
}

.bg-slate-900\/50 {
    background-color: rgba(15, 23, 42, 0.5);
}

.bg-slate-800 {
    background-color: var(--primary-light);
}

.bg-slate-700 {
    background-color: #334155;
}

.bg-gray-200 {
    background-color: var(--border);
}

.bg-blue-50 {
    background-color: #eff6ff;
}

.bg-blue-600 {
    background-color: #2563eb !important;
}

.bg-indigo-600 {
    background-color: #4f46e5 !important;
}

.bg-violet-600 {
    background-color: #7c3aed !important;
}

.bg-emerald-600 {
    background-color: #059669 !important;
}

.bg-green-50 {
    background-color: #f0fdf4;
}

.bg-green-900 {
    background-color: #14532d !important;
}

.text-white {
    color: white !important;
}

.text-slate-400 {
    color: #94a3b8;
}

.text-slate-500 {
    color: var(--text-muted);
}

.text-slate-900 {
    color: var(--primary);
}

.text-gray-400 {
    color: #9ca3af;
}

.text-gray-500 {
    color: #6b7280;
}

.text-gray-600 {
    color: #4b5563;
}

.text-gray-700 {
    color: #374151;
}

.text-gray-900 {
    color: var(--text-main);
}

.text-red-500 {
    color: #ef4444;
}

.text-red-600 {
    color: #dc2626;
}

.text-blue-600 {
    color: #2563eb;
}

/* Typography */
.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-base {
    font-size: 1rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-xl {
    font-size: 1.25rem;
}

.text-2xl {
    font-size: 1.5rem;
}

.text-3xl {
    font-size: 1.875rem;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

.tracking-tight {
    letter-spacing: -0.025em;
}

.tracking-wider {
    letter-spacing: 0.05em;
}

.uppercase {
    text-transform: uppercase;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-center {
    text-align: center;
}

/* Components */
.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-5);
    font-size: var(--fs-base);
    font-weight: 600;
    line-height: 1.2;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: background-color 0.15s, box-shadow 0.15s, transform 0.15s;
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--accent);
    color: white;
}

.btn-primary:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3);
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.3);
}

.btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background-color: #e5e7eb;
    transform: translateY(-1px);
}

.rounded-lg {
    border-radius: 0.5rem;
}

.rounded-xl {
    border-radius: 0.75rem;
}

.rounded-2xl {
    border-radius: 1rem;
}

.rounded-3xl {
    border-radius: 1.5rem;
}

.max-w-sm {
    max-width: 24rem;
}

.pb-2 {
    padding-bottom: 0.5rem;
}

.pt-0 {
    padding-top: 0;
}

.gap-3 {
    gap: 0.75rem;
}

.leading-relaxed {
    line-height: 1.625;
}

.rounded-full {
    border-radius: 9999px;
}

.shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.shadow-xl {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.shadow-inner {
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
}

/* Form Styles */
input, select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    font-family: inherit;
    font-size: 0.875rem;
    transition: all 0.2s;
    background-color: white;
    appearance: none;
}

input[type="checkbox"], input[type="radio"] {
    width: auto;
    padding: 0;
    margin: 0;
    appearance: auto;
    -webkit-appearance: auto;
    border: none;
    border-radius: 0;
    background-color: transparent;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.required {
    color: #ef4444;
    margin-left: 0.125rem;
}

.optional {
    font-size: 0.75rem;
    font-weight: normal;
    color: #94a3b8;
}

/* Sidebar & Navigation */
#sidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#sidebar.collapsed {
    width: 0;
    transform: translateX(-100%);
}

@media (min-width: 768px) {
    #sidebar {
        position: static;
        transform: none !important;
    }
}

.backdrop-blur-md {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Sidebar flat navigation */
.sidebar-section-label {
    padding: var(--sp-5) var(--sp-5) var(--sp-2);
    font-size: var(--fs-2xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    border-top: 1px solid rgba(100, 116, 139, 0.2);
    margin-top: var(--sp-2);
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: var(--sp-5);
    padding: var(--sp-3) var(--sp-5);
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    font-weight: 500;
    color: #94a3b8;
    text-decoration: none !important;
    transition: background-color 0.15s, color 0.15s;
    cursor: pointer;
}

.sidebar-item:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
}

.sidebar-item-active {
    background-color: #3b82f6 !important;
    color: #ffffff !important;
    font-weight: 600;
}

.sidebar-item .icon {
    flex-shrink: 0;
}

nav a, nav button {
    text-decoration: none !important;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.opacity-100 {
    opacity: 1 !important;
}

.opacity-0 {
    opacity: 0 !important;
}

@media (min-width: 768px) {
    .md\:block {
        display: block;
    }

    .md\:hidden {
        display: none;
    }

    .md\:static {
        position: static;
    }

    .md\:translate-x-0 {
        transform: translateX(0) !important;
    }

    .md\:-translate-x-full {
        transform: translateX(-100%) !important;
    }

    .md\:pb-10 {
        padding-bottom: 2.5rem;
    }
}

/* Specific Sidebar Hiding Utilities */
.-translate-x-full {
    transform: translateX(-100%) !important;
}

.translate-x-0 {
    transform: translateX(0) !important;
}

@media (min-width: 1024px) {
    .lg\:p-10 {
        padding: 2.5rem;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover\:bg-gray-50:hover {
    background-color: #f9fafb;
}

.hover\:bg-red-50:hover {
    background-color: #fef2f2;
}

.hover\:text-gray-600:hover {
    color: #4b5563;
}

.hover\:text-red-600:hover {
    color: #dc2626;
}

.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.transition-colors {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.transition-transform {
    transition-property: transform;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.group:hover .group-hover\:translate-x-0\.5 {
    transform: translateX(0.125rem);
}

/* Bottom Nav Scroll & Modal */
#bottom-nav {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
}

#bottom-nav::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.bottom-nav-item {
    flex: 0 0 auto;
    min-width: 90px;
    padding: 0 1rem;
}

/* Mobile Sub-menu Modal (Bottom Sheet) */
#mobile-submenu-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: white;
    border-top-left-radius: 1.5rem;
    border-top-right-radius: 1.5rem;
    z-index: 100;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    padding-bottom: 2.5rem;
}

#mobile-submenu-modal.show {
    transform: translateY(0);
}

.mobile-submenu-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-submenu-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mobile-submenu-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    text-decoration: none !important;
    background-color: #f8fafc;
    color: var(--text-main);
    font-weight: 600;
    transition: all 0.2s;
}

.mobile-submenu-item:active {
    background-color: #f1f5f9;
    transform: scale(0.98);
}

.mobile-submenu-item .icon {
    margin-right: 1.25rem;
    color: var(--accent);
}

#mobile-modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

#mobile-modal-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

/* Data Tables */
.table-container {
    background: white;
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th {
    background-color: var(--bg-subtle);
    padding: var(--sp-3) var(--sp-5);
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s;
}

.data-table th:hover {
    background-color: #f1f5f9;
}

.data-table th .sort-icon {
    margin-left: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.3;
}

.data-table th.sort-asc .sort-icon,
.data-table th.sort-desc .sort-icon {
    opacity: 1;
    color: var(--accent);
}

.data-table td {
    padding: var(--sp-3) var(--sp-5);
    font-size: var(--fs-sm);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

/* Roomier variant for forms-in-tables where extra breathing room is wanted */
.data-table--roomy th,
.data-table--roomy td {
    padding: var(--sp-5) var(--sp-6);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background-color: #f9fafb;
}

/* Dense table variant — spreadsheet-like density matching the Bulk Dispensing
   grid. Apply via class="data-table data-table-dense". Layers list pages use this. */
.data-table-dense {
    table-layout: fixed;
}
.data-table-dense th {
    background: #f8fafc;
    padding: 0.5rem 0.375rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    border: 1px solid #e2e8f0;
    text-align: center;
    white-space: nowrap;
    user-select: none;
}
.data-table-dense td {
    padding: 0.25rem 0.5rem;
    border: 1px solid #e2e8f0;
    font-size: 0.8125rem;
    height: 32px;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.data-table-dense tr:hover td {
    background: #f8fafc;
}
.data-table-dense .action-btn {
    width: 1.5rem;
    height: 1.5rem;
}
.data-table-dense .action-btn .icon {
    width: 0.85rem;
    height: 0.85rem;
}
.data-table-dense .edit-actions {
    gap: 0.25rem;
}

/* Compact parts table inside modals - spreadsheet-like */
.modal .data-table th {
    padding: 0.25rem 0.35rem;
    font-size: 0.7rem;
}

.modal .data-table td {
    padding: 0.15rem 0.35rem;
    border-bottom: none;
}

.modal .data-table tr:hover td {
    background-color: transparent;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background-color: #dcfce7;
    color: #166534;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Table Actions */
.table-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    border: none;
    background-color: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background-color: #f1f5f9;
    color: var(--accent);
}

.action-btn.delete {
    color: #dc2626 !important;
    background-color: #fef2f2 !important;
    border: none !important;
}

.action-btn.delete:hover {
    background-color: #fee2e2 !important;
    color: #b91c1c !important;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background-color: white;
    border-top: 1px solid var(--border);
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.pagination-controls {
    display: flex;
    gap: 0.25rem;
}

.page-btn {
    min-width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background-color: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

.page-btn.active {
    background-color: var(--accent);
    color: white;
    border-color: var(--accent);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-ellipsis {
    min-width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.page-size-select {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: white;
    cursor: pointer;
    width: 4rem;
}

/* ActionBar */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.search-container {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.search-container .icon.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    width: 1.1rem;
    height: 1.1rem;
}

.search-container input {
    padding-left: 2.75rem;
    padding-right: 2.75rem;
}

.search-container .clear-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.25rem;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    /* Controlled by JS */
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    transition: all 0.2s;
}

.search-container .clear-btn:hover {
    background-color: #f1f5f9;
    color: var(--text-main);
}

.search-container .clear-btn .icon {
    width: 1rem;
    height: 1rem;
}

/* Form Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background-color: white;
    border-radius: var(--r-lg);
    width: 100%;
    max-width: 40rem;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--sh-lg);
    transform: scale(0.97);
    transition: transform 0.2s;
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.modal--sm { max-width: 28rem; }
.modal--md { max-width: 40rem; }
.modal--lg { max-width: 56rem; }

.lg-modal {
    max-width: 60rem;
}

.modal-header {
    padding: var(--sp-5) var(--sp-6);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: var(--fs-md);
    font-weight: 700;
    color: var(--primary);
}

.modal-close {
    font-size: var(--fs-xl);
    color: var(--text-muted);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
}

.modal-body {
    padding: var(--sp-6);
    overflow-y: auto;
}

.modal-footer {
    padding: var(--sp-5) var(--sp-6);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-5);
}

/* Diesel Data-Capture Modal Overlay */
.tx-details-portal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9000 !important;
    display: none;
    background: rgba(15, 23, 42, 0.7) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 1.5rem !important;
}

.tx-details-portal-overlay.show {
    display: flex !important;
}

.tx-details-modal-box {
    width: 95%;
    max-width: 850px;
    max-height: 90vh;
    background: white;
    border-radius: 2rem;
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Grid Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .form-grid.cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-grid.cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.form-group label {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-main);
}

.form-group label span.required {
    color: #ef4444;
    margin-left: 0.25rem;
}

/* Toggle Switch - Reduced Size */
.switch {
    position: relative;
    display: inline-block;
    width: 2.5rem;
    height: 1.25rem;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 1.25rem;
}

.slider:before {
    position: absolute;
    content: "";
    height: 0.85rem;
    width: 0.85rem;
    left: 0.2rem;
    bottom: 0.2rem;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background-color: var(--accent);
}

input:checked+.slider:before {
    transform: translateX(1.25rem);
}

/* Field Helpers */
.read-only {
    background-color: #f8fafc;
    cursor: not-allowed;
}

.input-error {
    border-color: #ef4444 !important;
}

.error-message {
    font-size: 0.75rem;
    color: #ef4444;
}

/* Autocomplete/Search-as-you-type Styles */
.autocomplete-container {
    position: relative;
}

.autocomplete-item.selected {
    background: #f1f5f9;
}

/* Import Modal Steps */
.step-item {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.step-item.active {
    color: white;
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.step-line {
    height: 2px;
    flex-grow: 1;
    max-width: 50px;
    background: var(--border);
}

.import-step {
    min-height: 300px;
}

.db-field-slot {
    background: white;
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.db-field-slot.mapped {
    border-color: #22c55e;
    background: #f0fdf4;
}

.file-col-tag {
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
}

.file-col-tag:active {
    cursor: grabbing;
}

.file-col-tag.mapped {
    border-color: #22c55e;
    background: #f0fdf4;
    color: #166534;
}

.mapping-target {
    min-width: 120px;
    height: 32px;
    border: 2px dashed var(--border);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.mapping-target.drag-over {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.05);
}

.preview-cell-error {
    background-color: #fef2f2 !important;
    color: #ef4444 !important;
    position: relative;
}

.preview-cell-error::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid #fee2e2;
    pointer-events: none;
}


.form-group-compact {
    margin-bottom: 1rem;
}

.form-group-compact label {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    display: block;
}

.form-group-compact input {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
}

#import-preview-table {
    min-width: 1500px;
    table-layout: auto !important;
}

#import-step-3 .table-container {
    overflow: auto !important;
    display: block;
    width: 100%;
}

#import-preview-table {
    table-layout: auto !important;
}

#import-preview-table th,
#import-preview-table td {
    white-space: nowrap !important;
}

.import-drop-zone {
    border: 3px dashed #cbd5e1;
    background-color: #f8fafc;
    border-radius: 1.5rem;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.import-drop-zone:hover, .import-drop-zone.border-blue-500 {
    border-color: #3b82f6;
    background-color: #eff6ff;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.import-drop-zone .icon {
    color: #94a3b8;
    transition: color 0.3s ease;
    width: 3rem;
    height: 3rem;
    margin-bottom: 1rem;
}

.import-drop-zone:hover .icon, .import-drop-zone.border-blue-500 .icon {
    color: #3b82f6;
}

.edit-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--accent);
    border-radius: 0.5rem;
    outline: none;
    font-size: 0.875rem;
    font-family: inherit;
    background-color: white;
}

.edit-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Supplemental Utilities for Inset Layout */
.shadow-2xl {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.m-2 {
    margin: 0.5rem;
}

@media (min-width: 768px) {
    .md\:m-3 {
        margin: 0.75rem;
    }

    .md\:rounded-\[2rem\] {
        border-radius: 2rem;
    }
}

/* Dynamic Table Resizing & Sticky Headers */
.page-flex-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 0.75rem;
}

.table-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* Important for flex child overflow */
}

.table-wrapper {
    flex: 1;
    overflow-y: auto;
    position: relative;
    overflow-anchor: none;
}

.sticky-header th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: white !important;
    box-shadow: 0 1px 0 var(--border-color);
}


/* Modal & Overlay Utilities */
.z-100 {
    z-index: 100;
}

.bg-overlay {
    background-color: rgba(15, 23, 42, 0.4);
}

.backdrop-blur-sm {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.duration-200 {
    transition-duration: 200ms;
}

.scale-95 {
    transform: scale(0.95);
}

.scale-100 {
    transform: scale(1);
}

/* Validation Styles */
.pr-10 {
    padding-right: 2.5rem !important;
}

.validation-icon-container {
    position: absolute !important;
    right: 0.75rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 30 !important;
    cursor: help;
    height: 100%;
}

.validation-tooltip {
    position: absolute;
    bottom: 110%;
    right: -10px;
    width: 180px;
    padding: 8px 12px;
    background-color: #1e293b;
    color: #ffffff;
    font-size: 11px;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    text-align: center;
    line-height: 1.4;
    font-weight: 500;
    z-index: 50;
}

.validation-icon-container:hover .validation-tooltip {
    opacity: 1;
    visibility: visible;
    bottom: 125%;
}

.validation-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 20px;
    border-width: 6px;
    border-style: solid;
    border-color: #1e293b transparent transparent transparent;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    background-color: #ffffff;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    min-width: 320px;
    border-left: 4px solid #10b981;
    transform: translateX(3rem);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-success {
    border-left-color: #10b981;
}

.toast-error {
    border-left-color: #ef4444;
}

.toast-warning {
    border-left-color: #f59e0b;
}

.toast-icon-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 9999px;
    flex-shrink: 0;
}

.toast-success .toast-icon-dot {
    background-color: #10b981;
}

.toast-error .toast-icon-dot {
    background-color: #ef4444;
}

.toast-warning .toast-icon-dot {
    background-color: #f59e0b;
}

.toast-message {
    color: #334155;
    font-weight: 600;
    font-size: 0.875rem;
    flex: 1;
}

.toast-close {
    color: #cbd5e1;
    cursor: pointer;
    transition: color 0.2s;
    background: none;
    border: none;
    padding: 0.25rem;
    display: flex;
}

.toast-close:hover {
    color: #64748b;
}

/* Autocomplete Dropdowns */
.autocomplete-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    background: white;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 0.75rem 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    overflow-y: auto;
}

.autocomplete-results.show {
    display: block;
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f1f5f9;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background-color: #f1f5f9;
}

/* Hide Spin Buttons */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}

/* Tab Styling */
.tabs-border-bottom {
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 0.25rem;
}

.tabs-flex {
    display: flex;
    gap: 2rem;
    padding: 0 1rem;
}

.tab-btn {
    background: none;
    border: none;
    padding: 1rem 0;
    font-weight: 700;
    font-size: 1.1rem;
    color: #64748b;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    box-shadow: none !important;
}

.tab-btn:hover {
    color: #2563eb;
}

.tab-btn.active {
    color: #2563eb;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #2563eb;
}

.tab-content.hidden {
    display: none;
}

/* Typeahead Dropdown */
.typeahead-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    margin-top: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 99999 !important;
}

.typeahead-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid var(--border);
}

.typeahead-item:last-child {
    border-bottom: none;
}

.typeahead-item:hover {
    background-color: var(--bg-main);
}

/* Toggle Switch */
.toggle-checkbox {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-color: #64748b !important;
    width: 3rem !important;
    height: 1.5rem !important;
    border-radius: 9999px !important;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
    flex-shrink: 0 !important;
    box-sizing: border-box;
    border: 2px solid #475569 !important;
    display: inline-block !important;
    outline: none !important;
}

.toggle-checkbox:checked {
    background-color: var(--accent) !important;
    border-color: var(--accent) !important;
}

.toggle-checkbox::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    width: calc(1.5rem - 6px) !important;
    height: calc(1.5rem - 6px) !important;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.toggle-checkbox:checked::after {
    transform: translateX(1.5rem);
}

/* Toggle Switch (label + span pattern) */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 3rem;
    height: 1.75rem;
}

.toggle-switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 9999px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 1.25rem;
    width: 1.25rem;
    left: 0.25rem;
    bottom: 0.25rem;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked+.toggle-slider {
    background-color: #3b82f6;
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(1.25rem);
}

.toggle-switch input:focus+.toggle-slider {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}


/* Column spanning utilities */
.col-span-3 {
    grid-column: 1 / -1;
}

/* Amber validation colors */
.bg-amber-50 {
    background-color: #fffbeb !important;
}

.bg-amber-600 {
    background-color: #d97706 !important;
}

.border-amber-500 {
    border-color: #f59e0b !important;
}

.text-amber-500 {
    color: #f59e0b;
}

/* Input validation styles with higher specificity */
input.border-amber-500 {
    border-color: #f59e0b !important;
}

input.bg-amber-50 {
    background-color: #fffbeb !important;
}

input.border-amber-500:focus {
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.1) !important;
}

.icon-fill {
    fill: currentColor !important;
    stroke: none !important;
}

#refresh-transactions {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    height: 44px !important;
}

/* Additional Utility Classes */
.whitespace-nowrap {
    white-space: nowrap;
}

.ml-2 {
    margin-left: 0.5rem;
}

.pr-3 {
    padding-right: 0.75rem;
}

.border-gray-200 {
    border-color: #e5e7eb;
}

.w-40 {
    width: 10rem;
}

.gap-2 {
    gap: 0.5rem;
}

.text-left {
    text-align: left;
}

.duration-150 {
    transition-duration: 150ms;
}

/* Avatar Dropdown Menu */
.avatar-btn {
    cursor: pointer;
    transition: opacity 0.2s, box-shadow 0.2s;
}

.avatar-btn:hover {
    opacity: 0.85;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.avatar-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 14rem;
    background-color: white;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 4px 10px -3px rgba(0, 0, 0, 0.08);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px) scale(0.97);
    transition: opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0.375rem;
}

.avatar-dropdown.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.avatar-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: none;
    background: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s;
}

.avatar-dropdown-item:hover {
    background-color: #f1f5f9;
}

.avatar-dropdown-item--danger {
    color: #dc2626;
}

.avatar-dropdown-item--danger:hover {
    background-color: #fef2f2;
}

.avatar-dropdown-divider {
    height: 1px;
    background-color: var(--border);
    margin: 0.25rem 0;
}

/* Screen reader only - accessible text hidden visually */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Small button variant */
.btn-sm {
    padding: var(--sp-2) var(--sp-4);
    font-size: var(--fs-sm);
    line-height: 1.2;
    border-radius: var(--r-sm);
}

/* Active navigation link */
.active-link {
    background-color: var(--primary);
    color: white;
}

/* Form utility classes */
.form-label {
    display: block;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: var(--sp-1);
}

.form-input,
.form-control,
.form-select {
    width: 100%;
    height: 28px;
    padding: var(--sp-1) var(--sp-4);
    font-size: var(--fs-base);
    line-height: 1.2;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--bg-white);
    color: var(--text-main);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

/* Multi-line inputs (textareas) override the fixed height */
textarea.form-input,
textarea.form-control {
    height: auto;
    min-height: 64px;
    padding: var(--sp-3) var(--sp-4);
    line-height: 1.4;
}

.help-text {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-top: var(--sp-1);
}

/* Custom scrollbar */
.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 3px;
}

/* Period selector buttons for report filters */
.period-btn {
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--bg-main);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.period-btn:hover {
    background: var(--bg-hover);
}

.period-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Statistic cards for dashboards and reports */
.stat-card {
    background: var(--bg-main);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
}

/* ── Bulk Dispensing Spreadsheet Grid ── */
.bd-grid {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.bd-th {
    background: #f8fafc;
    padding: 0.5rem 0.375rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    border: 1px solid #e2e8f0;
    text-align: center;
    white-space: nowrap;
    user-select: none;
}

.bd-cell {
    padding: 0;
    border: 1px solid #e2e8f0;
    font-size: 0.8125rem;
    height: 32px;
    vertical-align: middle;
    position: relative;
}

.bd-cell-text {
    padding: 0.25rem 0.375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bd-cell-actions {
    text-align: center;
    white-space: nowrap;
    width: 50px;
}

.bd-row:hover .bd-cell {
    background: #f8fafc;
}

.bd-row-editing {
    outline: 2px solid #3b82f6;
    outline-offset: -1px;
    border-radius: 0.375rem;
    z-index: 1;
    position: relative;
}

/* Detail / Edit modal field layout (shared across query and capture pages) */
.ea-core-info {
    background: #f1f5f9;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.ea-core-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.ea-core-field {
    display: flex;
    flex-direction: column;
}

.ea-core-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ea-core-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
}

.ea-section-header {
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 1rem 0 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #e2e8f0;
}

.ea-section-header:first-child {
    margin-top: 0;
}

.ea-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    align-items: start;
}

.ea-toggle-field {
    display: flex;
    flex-direction: column;
}

.ea-toggle-field .form-label {
    margin-bottom: 0.5rem;
}

.ea-toggle-label {
    display: flex;
    align-items: center;
    height: 2.75rem;
    cursor: pointer;
}

@media (max-width: 640px) {
    .ea-grid, .ea-core-row {
        grid-template-columns: 1fr;
    }
}

.bd-row-editing .bd-cell {
    background: #eff6ff;
}

.bd-row-new .bd-cell {
    background: #ecfdf5;
}

.bd-input {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    padding: 0.25rem 0.375rem;
    font-size: 0.8125rem;
    background: transparent;
    font-family: inherit;
    box-sizing: border-box;
}

.bd-input:focus {
    background: white;
    box-shadow: inset 0 0 0 2px #3b82f6;
}

.bd-input-readonly {
    background: #f8fafc;
    color: #64748b;
    cursor: not-allowed;
}

.bd-bold {
    font-weight: 700;
}

.bd-cell-warning {
    background: #fffbeb !important;
    box-shadow: inset 0 0 0 1px #f59e0b;
}

.bd-cell-warning .bd-input {
    background: #fffbeb;
    color: #92400e;
}

.bd-cell-warning .bd-input:focus {
    background: #fffbeb;
    box-shadow: inset 0 0 0 2px #f59e0b;
}

.bd-cell-error,
.bd-cell-danger {
    background: #fef2f2 !important;
    box-shadow: inset 0 0 0 1px #ef4444;
}

.bd-cell-danger .bd-input {
    background: #fef2f2;
    color: #991b1b;
}

/* ── Trip Sheet Route Pills ───────────────────────────────────────── */
.ts-route-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    min-height: 28px;
    padding: 2px;
}

.ts-route-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #e0e7ff;
    color: #3730a3;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    max-width: 180px;
}

.ts-route-pill-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.ts-route-pill-remove {
    background: none;
    border: none;
    color: #6366f1;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0 2px;
    line-height: 1;
}

.ts-route-pill-remove:hover {
    color: #dc2626;
}

.ts-route-pill-error {
    background: #fef2f2;
    color: #991b1b;
    box-shadow: inset 0 0 0 1px #ef4444;
}

.ts-edit-row {
    background: #f8fafc;
}

.ts-edit-row .bd-cell {
    padding: 2px 4px;
}

.ts-route-input {
    border: none;
    outline: none;
    font-size: 0.75rem;
    min-width: 70px;
    flex: 1;
    background: transparent;
}

/* ── Query page tabs ──────────────────────────────────────────────── */
.qt-tab {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    transition: all 0.15s ease;
}

.qt-tab:hover {
    color: var(--text-main, #1e293b);
}

.qt-tab.active {
    color: var(--accent, #3b82f6);
    border-bottom-color: var(--accent, #3b82f6);
}

.bd-cell-error .bd-input {
    background: #fef2f2;
    color: #991b1b;
}

.bd-cell-error .bd-input:focus {
    background: #fef2f2;
    box-shadow: inset 0 0 0 2px #ef4444;
}

.bd-warning-tooltip {
    position: fixed;
    z-index: 9999;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid #fbbf24;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    white-space: nowrap;
    pointer-events: none;
    display: none;
}

.bd-warning-tooltip.show {
    display: block;
}

.bd-cell-view-warning {
    background: #fef3c7;
    color: #92400e;
    font-weight: 700;
}

.bd-cell-external {
    background: #fef3c7;
    color: #92400e;
    font-style: italic;
}

.bd-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 0.375rem;
    border: 1px solid #e2e8f0;
    background: white;
    cursor: pointer;
    color: #64748b;
    transition: all 0.15s;
    margin: 0 1px;
}

.bd-action-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.bd-action-btn.bd-save:hover {
    color: #16a34a;
    border-color: #16a34a;
}

.bd-action-btn.bd-cancel:hover {
    color: #dc2626;
    border-color: #dc2626;
}

.bd-action-btn.bd-comment-active {
    color: #1d4ed8;
    border-color: #1d4ed8;
    background: #eff6ff;
}

.bd-cell-zero-odo {
    background: #fee2e2 !important;
}

.bd-actions-trigger.has-comment {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

.bd-actions-trigger.has-comment:hover {
    background: #fecaca;
}

/* Actions dropdown menu */
.bd-actions-menu {
    position: relative;
    display: inline-block;
}

.bd-actions-trigger {
    font-size: 1rem;
}

.bd-actions-dropdown {
    display: none;
    position: fixed;
    min-width: 160px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 4px 0;
}

.bd-actions-dropdown.open {
    display: block;
}

.bd-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.8rem;
    color: #334155;
    white-space: nowrap;
    transition: background 0.1s;
}

.bd-dropdown-item:hover {
    background: #f1f5f9;
}

.bd-dropdown-item.bd-comment-active {
    color: #1d4ed8;
    font-weight: 600;
}

.bd-dropdown-danger {
    color: #dc2626;
}

.bd-dropdown-danger:hover {
    background: #fef2f2;
}

.bd-dropdown-divider {
    height: 1px;
    margin: 4px 0;
    background: #e2e8f0;
}

.bd-autocomplete {
    position: fixed;
    z-index: 9999;
    background: #fffbeb;
    border: 2px solid #f59e0b;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    max-height: 200px;
    overflow-y: auto;
    display: none;
    min-width: 200px;
}

.bd-autocomplete.show {
    display: block;
}

.bd-autocomplete-item {
    padding: 0.5rem 0.625rem;
    cursor: pointer;
    border-bottom: 1px solid #fde68a;
    font-size: 0.8125rem;
}

.bd-autocomplete-item:hover {
    background: #fef3c7;
}

.bd-autocomplete-item:last-child {
    border-bottom: none;
}

/* ── Offline Status Indicator ── */
.offline-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
    user-select: none;
}

.offline-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.offline-status-dot.online {
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.offline-status-dot.offline {
    background: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
    animation: pulse-red 2s ease-in-out infinite;
}

@keyframes pulse-red {
    0%, 100% {
        box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
    }

    50% {
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.3);
    }
}

.offline-status-text {
    color: #475569;
}

.offline-pending-count {
    background: #fef3c7;
    color: #92400e;
    padding: 1px 8px;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 700;
}

.offline-pending-count.hidden {
    display: none;
}

/* Offline-queued row indicator */
.bd-row-offline .bd-cell {
    background: #fffbeb;
    border-left: 2px solid #f59e0b;
}

/* ─── Capture (fav-card) shared styles ─── */
.fav-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.fav-section-header .fav-section-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.fav-section-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e293b;
}

.fav-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.fav-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

@media (max-width: 640px) {
    .fav-row, .fav-row-3 {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .fav-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

.fav-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem 1rem;
    background: white;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    color: #1e293b;
    transition: all 0.15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    text-align: center;
    cursor: pointer;
}

.fav-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #93c5fd;
    transform: translateY(-2px);
}

.fav-card .fav-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.fav-card .fav-label {
    font-size: 0.875rem;
    font-weight: 700;
}

.fav-card .fav-desc {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 0.125rem;
}

/* ============ Work Records ============ */
.wr-shell {
    max-width: 640px;
    margin: 0 auto;
    padding: 0.5rem;
}
.wr-toolbar {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0.75rem;
}
.wr-tab {
    flex: 1;
    padding: 0.6rem 0.75rem;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    color: #64748b;
    font-weight: 600;
    cursor: pointer;
}
.wr-tab-active {
    color: #1d4ed8;
    border-bottom-color: #1d4ed8;
}
.wr-pill {
    background: #eff6ff;
    color: #1d4ed8;
    padding: 0 6px;
    border-radius: 9999px;
    font-size: 11px;
    margin-left: 4px;
}
.wr-section { padding-bottom: 4rem; }
.wr-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.85rem;
}
.wr-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1f2937;
}
.wr-field input[type="text"],
.wr-field input[type="date"],
.wr-field input[type="datetime-local"],
.wr-field textarea {
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.6rem 0.75rem;
    font-size: 1rem;
    min-height: 44px;
    width: 100%;
    box-sizing: border-box;
}
.wr-field-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}
.wr-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    color: #1f2937;
}
.wr-toggle input { width: 22px; height: 22px; }
.wr-followup-due { max-width: 14rem; }
.wr-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 0.5rem;
    margin: 0.5rem 0;
}
.wr-photo-tile {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #f1f5f9;
}
.wr-photo-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.wr-photo-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.75);
    color: white;
    border: 0;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}
.wr-photo-buttons {
    display: flex;
    gap: 0.5rem;
}
.wr-photo-add {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 1.5px dashed #94a3b8;
    border-radius: 0.5rem;
    color: #475569;
    cursor: pointer;
    font-weight: 600;
    min-height: 56px;
    flex: 1;
    justify-content: center;
}
.wr-photo-tile img {
    cursor: zoom-in;
}
.wr-card-thumb {
    cursor: zoom-in;
}
.wr-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2147483647;
    padding: 1rem;
}
.wr-lightbox.hidden { display: none; }
.wr-lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 0.5rem;
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.5);
}
.wr-lightbox-close {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 0;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}
.wr-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
}
.wr-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    position: sticky;
    bottom: 0.5rem;
    background: linear-gradient(180deg, rgba(248,250,252,0) 0%, #f9fafb 30%);
    padding-top: 0.5rem;
}
.wr-actions .btn { flex: 1; min-height: 48px; font-weight: 700; }

.wr-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.wr-filter-input {
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    flex: 1 1 120px;
    min-height: 40px;
}
.wr-list { display: flex; flex-direction: column; gap: 0.6rem; }
.wr-empty {
    color: #6b7280;
    font-style: italic;
    text-align: center;
    padding: 2rem 0.5rem;
}
.wr-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.75rem;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.wr-card-done { background: #f0fdf4; }
.wr-card-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}
.wr-card-title { font-weight: 700; color: #0f172a; }
.wr-card-when { color: #64748b; font-size: 0.8rem; white-space: nowrap; }
.wr-card-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.4rem;
    align-items: center;
}
.wr-card-meta { color: #475569; font-size: 0.85rem; }
.wr-card-notes {
    margin-top: 0.4rem;
    color: #1f2937;
    white-space: pre-wrap;
}
.wr-card-decline {
    margin-top: 0.4rem;
    color: #b91c1c;
    font-size: 0.85rem;
}
.wr-card-photos {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.5rem;
    overflow-x: auto;
}
.wr-card-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}
.wr-card-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.6rem;
    flex-wrap: wrap;
}
.wr-card-actions .btn { min-height: 40px; padding: 0.4rem 0.75rem; font-size: 0.85rem; }
.wr-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}
.wr-badge-done     { background: #dcfce7; color: #166534; }
.wr-badge-open     { background: #fef3c7; color: #92400e; }
.wr-badge-follow   { background: #fde68a; color: #92400e; }
.wr-badge-pending  { background: #dbeafe; color: #1e3a8a; }
.wr-badge-accepted { background: #dcfce7; color: #166534; }
.wr-badge-declined { background: #fee2e2; color: #991b1b; }

/* Layers dashboard: per-chart pill selector + smooth toggle row below each canvas. */
.ld-chart-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}
.ld-pills {
    display: inline-flex;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    background: #f8fafc;
    padding: 2px;
}
.ld-pill {
    appearance: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    border-radius: 9999px;
    line-height: 1;
}
.ld-pill:hover { color: #1e293b; }
.ld-pill.active {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.ld-smooth-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: #475569;
    cursor: pointer;
    user-select: none;
}
.ld-smooth-toggle input[type="checkbox"] {
    appearance: auto;
    width: 14px;
    height: 14px;
    cursor: pointer;
    margin: 0;
}

/* Kiosk / quick-capture mode: hide sidebar margins so the form takes the full width. */
body.kiosk .flex.h-screen { padding: 0; margin: 0; }
body.kiosk header { padding-left: 1rem; padding-right: 1rem; }
@media (max-width: 767px) {
    body.kiosk main { padding: 0.75rem !important; padding-bottom: 5rem !important; }
}

/* ─────────────────────────────────────────────────────────────────
   Hoisted Component Styles (Phase 2)
   Previously embedded in template <style> blocks. Class names preserved
   so templates work without changes. Hardcoded colors/radii migrated
   to tokens where reasonable.
   ─────────────────────────────────────────────────────────────── */

/* Header user-info responsive (base.html, layers_base.html) */
#header-user-info { display: none; }
@media (min-width: 768px) { #header-user-info { display: block; } }

/* Dashboard — dash cards, stock table, workshop stats */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sp-6);
}
@media (min-width: 768px) {
    .dash-grid { grid-template-columns: 1fr 1fr; }
}
.dash-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.dash-card-header {
    padding: var(--sp-4) var(--sp-5);
    font-weight: 800;
    font-size: var(--fs-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: var(--sp-4);
}
.dash-card-body { padding: var(--sp-5); flex: 1; }

.stock-table { width: 100%; font-size: var(--fs-sm); border-collapse: collapse; }
.stock-table th {
    text-align: right;
    font-weight: 700;
    font-size: var(--fs-2xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: var(--sp-2) var(--sp-4);
    border-bottom: 2px solid var(--border);
}
.stock-table th:first-child { text-align: left; }
.stock-table td {
    padding: var(--sp-2) var(--sp-4);
    text-align: right;
    border-bottom: 1px solid var(--bg-main);
    white-space: nowrap;
}
.stock-table td:first-child { text-align: left; font-weight: 600; color: #334155; }
.stock-table tr:last-child td { border-bottom: none; font-weight: 700; }

.pct-up { color: var(--ok); }
.pct-down { color: var(--danger-hover); }
.pct-neutral { color: var(--text-subtle); }

.ws-stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: var(--sp-3) 0;
    border-bottom: 1px solid var(--bg-main);
}
.ws-stat:last-child { border-bottom: none; }
.ws-stat-label { font-size: var(--fs-sm); font-weight: 600; color: #334155; }
.ws-stat-value { font-size: var(--fs-md); font-weight: 800; color: var(--primary-light); }
.ws-stat-prior { font-size: var(--fs-xs); color: var(--text-subtle); margin-left: var(--sp-4); }

.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    color: var(--text-subtle);
}

.exception-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-5);
    border-radius: var(--r-pill);
    font-size: var(--fs-xs);
    font-weight: 700;
}
.exception-badge.warning { background: var(--warn-bg); color: var(--warn-fg); }
.exception-badge.ok { background: var(--ok-bg); color: var(--ok-fg); }

.stock-on-hand {
    font-size: var(--fs-lg);
    font-weight: 900;
    color: var(--info-fg);
    margin-bottom: var(--sp-4);
}
.stock-on-hand span {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-muted);
}

/* Exception-card tailwind-style color utilities (used in diesel_reports + others) */
.bg-orange-600 { background-color: #ea580c; }
.bg-orange-50 { background-color: #fff7ed; }
.text-orange-600 { color: #ea580c; }
.text-orange-900 { color: #7c2d12; }
.bg-emerald-50 { background-color: #ecfdf5; }
.text-emerald-600 { color: #059669; }
.text-emerald-900 { color: #064e3b; }
.text-blue-900 { color: #1e3a5f; }
.text-blue-100 { color: #dbeafe; }
.text-amber-600 { color: #d97706; }
.text-amber-900 { color: #78350f; }

/* Compact filter-bar inputs — formalized so templates don't respawn via style="" */
.input-compact,
.form-select.h-8,
.form-input.h-8 {
    padding-top: 0;
    padding-bottom: 0;
}

/* Reports tables: sticky header + filter row (fires only when 2 thead rows exist) */
.data-table thead tr:first-child th { top: 0; z-index: 30; }
.data-table thead tr:nth-child(2) th {
    top: 28px;
    padding: var(--sp-1) var(--sp-1);
    background: var(--bg-white);
    z-index: 29;
}
.data-table thead tr:nth-child(2) input,
.data-table thead tr:nth-child(2) select {
    padding: 2px var(--sp-2);
    height: 22px;
    font-size: var(--fs-xs);
    line-height: 1;
    min-height: 0;
}

/* Attribute setup cards & pills */
.attr-grid { display: grid; grid-template-columns: 1fr; }
@media (min-width: 768px) {
    .attr-grid { grid-template-columns: 4fr 6fr; }
}
.attr-card {
    transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-4) var(--sp-5);
    position: relative;
    overflow: hidden;
    background: var(--bg-white);
}
.attr-card:hover { border-color: var(--accent); background-color: var(--bg-subtle); }
.attr-card.active-card {
    border-color: var(--accent);
    background-color: #eff6ff;
    box-shadow: 0 0 0 1px var(--accent);
}
.attr-pill {
    padding: 2px var(--sp-4);
    border-radius: var(--r-pill);
    font-size: var(--fs-xs);
    font-weight: 600;
    text-transform: uppercase;
}
.attr-pill-type { background: #e0e7ff; color: #3730a3; }
.attr-pill-table { background: var(--bg-main); color: #475569; }
.attr-pill-search { background: var(--ok-bg); color: var(--ok-fg); }

/* Autocomplete dropdown */
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: var(--z-toast);
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--sh-md);
    max-height: 200px;
    overflow-y: auto;
    display: none;
}
.autocomplete-results.show { display: block; }
.autocomplete-item {
    padding: var(--sp-3) var(--sp-5);
    cursor: pointer;
    font-size: var(--fs-sm);
    border-bottom: 1px solid var(--bg-main);
    text-align: left;
    color: var(--primary-light);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--bg-subtle); }

/* Custom toggle switch (attributes form) */
.custom-toggle {
    width: 2.5rem;
    height: 1.25rem;
    background-color: var(--border-strong);
    border-radius: var(--r-pill);
    position: relative;
    transition: background-color 0.25s, border-color 0.25s;
    border: 2px solid var(--border);
}
.custom-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 0.95rem;
    height: 0.95rem;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.25s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.peer:checked + .custom-toggle { background-color: var(--accent-hover); border-color: #1d4ed8; }
.peer:checked + .custom-toggle::after { transform: translateX(1.1rem); }
.peer:focus + .custom-toggle { box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2); }

/* Tab buttons — used by jobcards (.jc-tab-btn) and parts-tx modal (.ptx-tab-btn) */
.tab-btn,
.jc-tab-btn,
.ptx-tab-btn {
    padding: var(--sp-3) var(--sp-5);
    font-size: var(--fs-sm);
    font-weight: 600;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--bg-subtle);
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.tab-btn:hover,
.jc-tab-btn:hover,
.ptx-tab-btn:hover { background: var(--bg-main); }
.tab-btn.active,
.jc-tab-btn.active,
.ptx-tab-btn.active {
    background: var(--accent-hover);
    color: #fff;
    border-color: var(--accent-hover);
}
.tab-btn:disabled,
.ptx-tab-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.ptx-tab-bar {
    display: flex;
    gap: var(--sp-4);
    margin-bottom: var(--sp-5);
}

/* Job card checklist items */
.cl-item {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-4);
    padding: var(--sp-4) var(--sp-5);
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}
.cl-item input[type="checkbox"] {
    margin-top: var(--sp-2);
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}
.cl-item-body { flex: 1; min-width: 0; }
.cl-item-label { font-weight: 600; color: #334155; font-size: var(--fs-sm); }
.cl-item-comment {
    margin-top: var(--sp-2);
    width: 100%;
    font-size: var(--fs-sm);
    padding: var(--sp-2) var(--sp-4);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
}

/* Typeahead dropdown (jobcards) */
.typeahead-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: var(--z-modal);
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--sh-md);
    margin-top: var(--sp-1);
    max-height: 300px;
    overflow-y: auto;
}
.typeahead-item {
    padding: var(--sp-2) var(--sp-4);
    cursor: pointer;
    transition: background 0.15s;
    font-size: var(--fs-sm);
}
.typeahead-item .font-bold { font-size: var(--fs-sm); margin-bottom: 0.1rem; }
.typeahead-item .text-xs { font-size: var(--fs-2xs); }
.typeahead-item:hover { background: var(--bg-subtle); }
.typeahead-item.selected { background: #eff6ff; }

/* Sort chevron in data tables — keep visible */
.data-table th .sort-icon {
    display: inline-block;
    vertical-align: middle;
    width: 14px;
    height: 14px;
    margin-left: var(--sp-3);
    stroke: #334155;
    fill: none;
}

/* Pagination button used by jobcards (.pagination-btn) — global so other pages can adopt */
.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 var(--sp-4);
    border: 1px solid var(--border-strong);
    background-color: var(--bg-white);
    color: #374151;
    border-radius: var(--r-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: var(--fs-sm);
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.pagination-btn:hover:not(:disabled) {
    background-color: #f3f4f6;
    border-color: #9ca3af;
    color: #111827;
}
.pagination-btn.active {
    background-color: var(--accent-hover);
    color: #fff;
    border-color: var(--accent-hover);
}
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; background-color: #f3f4f6; }

/* Parts table responsive (jobcards) — desktop table, mobile cards */
.parts-table-scroll { width: 100%; background: var(--bg-white); }
#parts-usage-table { width: 100%; border-collapse: collapse; }
#parts-usage-body td.part-total,
#parts-total-sum { text-align: right; }
@media (min-width: 769px) {
    .parts-table-scroll {
        overflow-x: auto;
        border: 1px solid #e5e7eb;
        border-radius: var(--r-md);
    }
    #parts-usage-table { min-width: 800px; }
}
@media (max-width: 768px) {
    #parts-usage-table,
    #parts-usage-table thead,
    #parts-usage-table tbody,
    #parts-usage-table th,
    #parts-usage-table td,
    #parts-usage-table tr { display: block; }
    #parts-usage-table thead { display: none; }
    #parts-usage-body tr {
        margin-bottom: var(--sp-6);
        border: 1px solid var(--border);
        border-radius: var(--r-lg);
        padding: var(--sp-5);
        background: var(--bg-subtle);
        box-shadow: var(--sh-sm);
        position: relative;
    }
    #parts-usage-body td {
        border: none;
        padding: var(--sp-3) 0;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }
    #parts-usage-body td::before {
        content: attr(data-label);
        font-size: var(--fs-xs);
        font-weight: 700;
        text-transform: uppercase;
        color: var(--text-muted);
        margin-bottom: var(--sp-1);
    }
    #parts-usage-body td[data-label="Qty"] { width: 80px; }
    #parts-usage-body td.remove-cell {
        position: absolute;
        top: var(--sp-3);
        right: var(--sp-3);
        padding: 0;
    }
    #parts-usage-body td.remove-cell::before { display: none; }
    #parts-usage-body td.part-total {
        align-items: flex-start;
        border-top: 1px dashed var(--border);
        margin-top: var(--sp-3);
        padding-top: var(--sp-4);
    }
    .parts-footer {
        flex-direction: column;
        align-items: flex-end;
        gap: var(--sp-6);
        margin-top: var(--sp-8);
    }
    .parts-footer #add-part-row {
        align-self: center;
        width: 100%;
        max-width: 200px;
    }
    .parts-footer .flex {
        flex-direction: column;
        align-items: flex-end;
        gap: var(--sp-1);
    }
    #parts-total-sum { font-size: var(--fs-lg); }
}

/* Date-column wrapping in jobcards table */
#jobcards-table tbody td:first-child { white-space: nowrap; }

/* Favorite-action cards (data_capture landing page) */
.fav-section-header {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    margin-bottom: var(--sp-5);
}
.fav-section-header .fav-section-icon {
    width: 2rem;
    height: 2rem;
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.fav-section-header h3 {
    font-size: var(--fs-md);
    font-weight: 700;
    color: var(--primary-light);
}
.fav-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-5);
}
.fav-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-5);
}
@media (max-width: 640px) {
    .fav-row,
    .fav-row-3 { grid-template-columns: 1fr; }
}
@media (min-width: 641px) and (max-width: 1024px) {
    .fav-row { grid-template-columns: repeat(2, 1fr); }
}
.fav-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--sp-4);
    padding: var(--sp-6) var(--sp-5);
    background: var(--bg-white);
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--primary-light);
    transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
    box-shadow: var(--sh-sm);
    text-align: center;
    cursor: pointer;
}
.fav-card:hover {
    box-shadow: var(--sh-lg);
    border-color: #93c5fd;
    transform: translateY(-1px);
}
.fav-card .fav-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.fav-card .fav-label { font-size: var(--fs-sm); font-weight: 700; }
.fav-card .fav-desc { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }

/* Edit-asset / edit-staff modal grid */
.ea-section-header {
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: var(--sp-5) 0 var(--sp-3);
    padding-bottom: var(--sp-1);
    border-bottom: 1px solid var(--border);
}
.ea-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
    align-items: start;
}
.ea-toggle-field { display: flex; flex-direction: column; }
.ea-toggle-field .form-label { margin-bottom: var(--sp-3); }
.ea-toggle-label {
    display: flex;
    align-items: center;
    height: 28px;
    cursor: pointer;
}
@media (max-width: 640px) {
    .ea-grid { grid-template-columns: 1fr; }
}

/* Autoreports tab grids */
.quick-send-grid,
.schedules-grid,
.packs-grid {
    display: grid;
    grid-template-columns: 1fr;
}
.quick-send-grid { max-width: 900px; }
@media (min-width: 768px) {
    .quick-send-grid { grid-template-columns: 5fr 5fr; }
    .schedules-grid,
    .packs-grid { grid-template-columns: 4fr 6fr; }
}

/* Empty-state row for tables: <tr class="empty-state"><td colspan="N">Loading…</td></tr> */
.empty-state td {
    text-align: center;
    color: var(--text-subtle);
    padding: var(--sp-6);
}

/* ─────────────────────────────────────────────────────────────────
   Hoisted Component Styles (Phase 2 cont.) — remaining templates
   ─────────────────────────────────────────────────────────────── */

/* Services setup tab grids — same 4/6 split as attributes/autoreports */
.types-grid,
.checklists-grid {
    display: grid;
    grid-template-columns: 1fr;
}
@media (min-width: 768px) {
    .types-grid,
    .checklists-grid { grid-template-columns: 4fr 6fr; }
}

/* Trip-reports group/summary table */
.tr-table th { font-size: var(--fs-xs); white-space: nowrap; }
.tr-table td {
    font-size: var(--fs-sm);
    padding: var(--sp-2) var(--sp-4);
    white-space: nowrap;
}
.tr-summary { cursor: pointer; }
.tr-summary td {
    background: var(--bg-subtle);
    font-weight: 600;
    font-size: var(--fs-sm);
    border-top: 1px solid var(--border);
    color: #334155;
}
.tr-summary:hover td { background: var(--bg-main); }
.tr-summary td:first-child::before {
    content: '\25B6';
    margin-right: var(--sp-3);
    font-size: var(--fs-2xs);
    color: var(--text-subtle);
    display: inline-block;
    transition: transform 0.15s;
}
.tr-summary.expanded td:first-child::before { transform: rotate(90deg); }
.tr-summary-noarrow { cursor: default; }
.tr-summary-noarrow td:first-child::before { display: none; }
.tr-grand-total td {
    background: #eff6ff;
    font-weight: 700;
    font-size: var(--fs-sm);
    border-top: 2px solid #93c5fd;
    color: #1e3a5f;
}
.tr-detail-row { display: none; }
.tr-detail-row.visible { display: table-row; }
.tr-spacer td {
    height: var(--sp-4);
    border: none;
    background: transparent;
    padding: 0;
}

/* Trip-reports selector modal */
.trsel-list { max-height: 300px; overflow-y: auto; }
.trsel-item {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-1) 0;
    font-size: var(--fs-sm);
}
.trsel-item input { width: auto; }
.trsel-bar {
    display: flex;
    gap: var(--sp-4);
    align-items: center;
    padding: var(--sp-3) 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--sp-3);
}

/* Workshop-reports print rules */
@media print {
    .sidebar,
    .bottom-nav,
    .no-print,
    .tab-btn { display: none !important; }
    .main-content { margin: 0 !important; padding: 0 !important; }
    .print-section { display: block !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* Migrate wizard — file-import drop zone, field mapping cards, preview tables */
.fi-drop-zone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--r-md);
    padding: var(--sp-8);
    text-align: center;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}
.fi-drop-zone:hover,
.fi-drop-zone.dragover {
    border-color: var(--accent);
    background: #eff6ff;
}
.fi-mapping-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-5);
}
.fi-field-card {
    padding: var(--sp-3) var(--sp-4);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    margin-bottom: var(--sp-2);
    cursor: pointer;
    font-size: var(--fs-sm);
    transition: background-color 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    gap: var(--sp-4);
}
.fi-field-card:hover {
    border-color: var(--accent);
    background: #eff6ff;
}
.fi-field-card.mapped {
    border-color: var(--ok);
    background: #f0fdf4;
}
.fi-field-card.selected {
    border-color: var(--accent);
    background: var(--info-bg);
    box-shadow: 0 0 0 2px #93c5fd;
}
.fi-field-card .badge-req {
    background: var(--warn-bg);
    color: var(--warn-fg);
    font-size: var(--fs-2xs);
    padding: 2px var(--sp-3);
    border-radius: var(--r-sm);
    font-weight: 600;
}
.fi-field-card .mapped-arrow {
    color: var(--ok);
    font-size: var(--fs-xs);
}
.fi-preview-table {
    overflow-x: auto;
    max-height: 150px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
}
.fi-preview-table table { font-size: var(--fs-xs); margin: 0; }
.fi-result-card {
    display: inline-block;
    padding: var(--sp-3) var(--sp-6);
    border-radius: var(--r-sm);
    text-align: center;
    margin-right: var(--sp-3);
}
.fi-error-table {
    overflow: auto;
    max-height: 200px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
}
.fi-error-table table { font-size: var(--fs-xs); margin: 0; }

/* Generic 2-column grid span (parts.html) */
.col-span-2 { grid-column: span 2 / span 2; }

/* Diesel-use chart: draggable header, filter chips, scrollbar-hide */
.draggable-header { cursor: grab; }
.draggable-header:active { cursor: grabbing; }
.filter-drop-active {
    border-color: var(--accent-hover);
    background-color: #eff6ff;
}
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-1) var(--sp-4);
    background: var(--accent-hover);
    color: white;
    border-radius: var(--r-pill);
    font-size: var(--fs-xs);
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}
.filter-chip button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: var(--fs-sm);
    line-height: 1;
    transition: background 0.15s;
}
.filter-chip button:hover { background: rgba(255, 255, 255, 0.4); }

/* Diesel transactions: pills (blue/purple/emerald/amber/rose) */
.pill {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-1) var(--sp-4);
    border-radius: var(--r-pill);
    font-size: var(--fs-xs);
    font-weight: 800;
    border: 1px solid rgba(0, 0, 0, 0.1);
    position: relative;
    margin: 2px;
    box-shadow: var(--sh-sm);
}
.pill-blue { background-color: var(--accent-hover); color: white; }
.pill-purple { background-color: #9333ea; color: white; }
.pill-emerald { background-color: #059669; color: white; }
.pill-amber { background-color: #d97706; color: white; }
.pill-rose { background-color: #e11d48; color: white; }
.pill button {
    all: unset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    width: 14px;
    height: 14px;
    margin-left: 3px;
    opacity: 0.8;
    transition: opacity 0.15s;
}
.pill button:hover { opacity: 1; }

/* Diesel transactions table — uses the global .data-table sticky rules, but the
   tx-details modal had bespoke padded inputs. Drop those overrides and let
   the global .form-input / .form-control / .form-select rules take over. */

/* Users / roles setup grids */
.users-grid,
.roles-grid {
    display: grid;
    grid-template-columns: 1fr;
}
@media (min-width: 768px) {
    .users-grid,
    .roles-grid { grid-template-columns: 4fr 6fr; }
}

/* User / role / attr cards share the same pattern */
.user-card,
.role-card {
    transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-4) var(--sp-5);
    position: relative;
    overflow: hidden;
    background: var(--bg-white);
}
.user-card:hover,
.role-card:hover {
    border-color: var(--accent);
    background-color: var(--bg-subtle);
}
.user-card.active-card,
.role-card.active-card {
    border-color: var(--accent);
    background-color: #eff6ff;
    box-shadow: 0 0 0 1px var(--accent);
}
.role-card.reserved {
    border-color: var(--border);
    opacity: 0.7;
    cursor: default;
}

/* Status pills (users) */
.status-pill {
    padding: 2px var(--sp-4);
    border-radius: var(--r-pill);
    font-size: var(--fs-xs);
    font-weight: 600;
    text-transform: uppercase;
}
.status-active { background: var(--ok-bg); color: var(--ok-fg); }
.status-inactive { background: var(--danger-bg); color: var(--danger-fg); }

/* Slate utility colors used in users.html (lighter shades not in global utilities) */
.border-slate-100 { border-color: var(--bg-main); }
.border-slate-200 { border-color: var(--border); }
.bg-slate-50 { background-color: var(--bg-subtle); }
.bg-slate-100 { background-color: var(--bg-main); }
.text-slate-500 { color: var(--text-muted); }
.text-slate-700 { color: #334155; }
.text-slate-800 { color: var(--primary-light); }

/* Permissions panel — module tabs, section titles, CRUD matrix, tree */
.perm-tab-bar {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: var(--sp-4);
    gap: 0;
}
.perm-tab {
    display: inline-flex;
    align-items: center;
    padding: var(--sp-3) var(--sp-4);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-muted);
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.perm-tab:hover { color: var(--primary-light); }
.perm-tab.active {
    color: var(--accent-hover);
    border-bottom-color: var(--accent-hover);
}
.perm-tab svg { flex-shrink: 0; }

.perm-section-title {
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-subtle);
    margin: var(--sp-4) 0 var(--sp-2);
    padding-bottom: var(--sp-1);
    border-bottom: 1px solid var(--border);
}
.perm-tab-content .perm-section-title:first-child { margin-top: 0; }

.perm-crud-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-sm);
    margin-bottom: var(--sp-3);
}
.perm-crud-table th {
    text-align: center;
    font-size: var(--fs-2xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: var(--sp-2) var(--sp-1);
    width: 3.5rem;
}
.perm-crud-table th:first-child {
    text-align: left;
    width: auto;
}
.perm-crud-table td.perm-crud-label {
    font-size: var(--fs-sm);
    font-weight: 500;
    color: #334155;
    padding: var(--sp-1) var(--sp-3);
}
.perm-crud-table td.perm-crud-cell {
    text-align: center;
    padding: var(--sp-1);
}
.perm-crud-table tbody tr:hover { background: var(--border); }

.perm-menu-tree { padding: var(--sp-1) 0; }
.perm-section { margin-bottom: var(--sp-1); }
.perm-section-header {
    display: flex;
    align-items: center;
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-sm);
    font-weight: 600;
    font-size: var(--fs-sm);
    color: var(--primary-light);
    cursor: pointer;
}
.perm-section-header:hover { background: var(--border); }
.perm-children {
    margin-left: var(--sp-6);
    border-left: 2px solid var(--border);
    padding-left: var(--sp-3);
}
.perm-item {
    display: flex;
    align-items: center;
    padding: var(--sp-1) var(--sp-3);
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    color: #334155;
}
.perm-item:hover { background: var(--border); }
.perm-item input[type="checkbox"],
.perm-section-header input[type="checkbox"],
.perm-crud-table input[type="checkbox"] {
    margin-right: var(--sp-3);
    accent-color: var(--accent-hover);
    width: 14px;
    height: 14px;
    appearance: auto;
    -webkit-appearance: checkbox;
    cursor: pointer;
    flex-shrink: 0;
}
.perm-crud-table input[type="checkbox"] { margin-right: 0; }
.perm-item span,
.perm-section-header span {
    cursor: pointer;
    user-select: none;
}

/* Layers dashboard — house trend cards (rows of 5, grouped by site) */
.ld-site-block { display: flex; flex-direction: column; gap: 0.5rem; }
.ld-site-label {
    font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em;
    text-transform: uppercase; color: #475569;
    border-bottom: 1px solid #e2e8f0; padding-bottom: 0.25rem;
}
.ld-house-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
}
@media (max-width: 1280px) { .ld-house-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1024px) { .ld-house-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 768px)  { .ld-house-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px)  { .ld-house-grid { grid-template-columns: 1fr; } }

.ld-house-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.ld-house-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem;
}
.ld-house-code { font-size: 1rem; font-weight: 800; color: #0f172a; }
.ld-house-age {
    background: #2563eb; color: #fff; font-size: 0.75rem; font-weight: 700;
    padding: 0.15rem 0.5rem; border-radius: 999px; white-space: nowrap;
}
.ld-house-meta { font-size: 0.7rem; color: #64748b; display: flex; flex-direction: column; gap: 0.1rem; }
.ld-house-meta .row { display: flex; justify-content: space-between; gap: 0.5rem; }
.ld-house-meta .lbl { color: #94a3b8; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.ld-house-meta .val { color: #1e293b; font-weight: 600; }
.ld-house-mort-good { color: #15803d; }
.ld-house-mort-bad  { color: #b91c1c; }

.ld-trend-row {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem; margin-top: 0.5rem;
}
.ld-trend-cell { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.ld-trend-arrow {
    /* Force text-variant rendering so the up/down/right arrows pick up our
       CSS color instead of being drawn by the browser's color-emoji font. */
    font-family: "Segoe UI Symbol", "Apple Symbols", "DejaVu Sans", sans-serif;
    font-variant-emoji: text;
    font-size: 2.25rem; line-height: 1; font-weight: 900;
    -webkit-text-stroke: 1.5px currentColor;
    color: #94a3b8;
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.5rem; height: 2.5rem;
}
.ld-trend-arrow.good   { color: #15803d; }
.ld-trend-arrow.bad    { color: #b91c1c; }
.ld-trend-arrow.flat   { color: #d97706; }
.ld-trend-arrow.nodata { color: #94a3b8; }
.ld-trend-label {
    font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; padding: 0.15rem 0.5rem; border-radius: 0.375rem;
    background: #f1f5f9; color: #334155; white-space: nowrap;
}
.ld-trend-label.production { background: #dbeafe; color: #1e40af; }
.ld-trend-label.mortality  { background: #fee2e2; color: #991b1b; }
.ld-trend-label.feed       { background: #dcfce7; color: #166534; }
.ld-house-empty {
    margin-top: 0.5rem;
    background: #f1f5f9; color: #475569;
    border: 1px dashed #cbd5e1; border-radius: 0.5rem;
    padding: 0.6rem 0.5rem; text-align: center;
    font-size: 0.7rem; font-weight: 800; letter-spacing: 0.1em;
}

/* =========================================================================
 * Layers Dashboard — alert tiles, Needs Attention list, success card,
 * and severity-coloured borders on the house grid.
 * ========================================================================= */

.ld-tile {
    appearance: none;
    text-align: left;
    border: 1px solid transparent;
    border-left: 4px solid transparent;
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    cursor: pointer;
    transition: transform 0.06s ease, box-shadow 0.12s ease, filter 0.12s ease;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.ld-tile:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15, 23, 42, 0.10); }

/* Compact tile variant — used in the dashboard header so the Red / Amber /
   Data State indicators sit inline with the as-of / sync controls instead of
   taking their own row of full-size cards. All three tiles share the same
   fixed width so they read as a clean row of equal-sized badges; the Data
   State tile stacks Daily/Feed vertically to fit that width. */
.ld-tile--compact {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.5rem 0.85rem;
    border-radius: 0.75rem;
    width: 220px;
    min-height: 64px;
}
.ld-tile--compact .ld-tile-count { font-size: 1.4rem; line-height: 1; }
.ld-tile--compact .ld-tile-label { font-size: 0.72rem; }
.ld-tile--compact .ld-tile-sub { display: none; }
.ld-tile-data-inline {
    display: flex; flex-direction: column;
    gap: 0.1rem;
    font-size: 0.74rem;
    width: 100%;
}
.ld-tile-data-pair { display: flex; gap: 0.3rem; align-items: baseline; white-space: nowrap; }
.ld-tile-data-pair .ld-tile-data-key { font-weight: 600; min-width: 3rem; }
.ld-tile-data-pair .ld-tile-data-val { font-variant-numeric: tabular-nums; }

/* Tinted backgrounds — the colour is the signal, not a stripe on the side. */
.ld-tile--red   { background: #fee2e2; border-color: #fecaca; border-left-color: #b91c1c; }
.ld-tile--amber { background: #ffedd5; border-color: #fed7aa; border-left-color: #d97706; }
.ld-tile--green { background: #dcfce7; border-color: #bbf7d0; border-left-color: #15803d; }
.ld-tile--stale { background: #e2e8f0; border-color: #cbd5e1; border-left-color: #475569; }

.ld-tile-count {
    font-size: 2rem; font-weight: 800; line-height: 1;
}
.ld-tile--red   .ld-tile-count { color: #991b1b; }
.ld-tile--amber .ld-tile-count { color: #9a3412; }
.ld-tile--green .ld-tile-count { color: #14532d; }
.ld-tile--stale .ld-tile-count { color: #1e293b; }
.ld-tile--zero  .ld-tile-count { color: #94a3b8; }
.ld-tile--zero  { opacity: 0.6; }
.ld-tile-label  { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.ld-tile--red   .ld-tile-label { color: #7f1d1d; }
.ld-tile--amber .ld-tile-label { color: #7c2d12; }
.ld-tile--green .ld-tile-label { color: #14532d; }
.ld-tile--stale .ld-tile-label { color: #0f172a; }
.ld-tile-sub    { font-size: 0.75rem; }
.ld-tile--red   .ld-tile-sub { color: #991b1b; }
.ld-tile--amber .ld-tile-sub { color: #9a3412; }
.ld-tile--green .ld-tile-sub { color: #166534; }
.ld-tile--stale .ld-tile-sub { color: #475569; }

/* Data State tile — two date rows in place of the big count number. */
.ld-tile-data-rows {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-top: 0.15rem;
}
.ld-tile-data-row {
    display: flex; align-items: baseline; gap: 0.4rem;
    font-size: 0.9rem; line-height: 1.25;
}
.ld-tile-data-key {
    font-weight: 700; min-width: 3.25rem;
}
.ld-tile-data-val {
    font-variant-numeric: tabular-nums;
}
.ld-tile--red   .ld-tile-data-row { color: #7f1d1d; }
.ld-tile--amber .ld-tile-data-row { color: #7c2d12; }
.ld-tile--green .ld-tile-data-row { color: #14532d; }

.ld-tile--active {
    box-shadow: 0 0 0 2px #0f172a, 0 4px 12px rgba(15, 23, 42, 0.12);
    filter: saturate(1.1);
}

.ld-attention-list { display: block; max-height: 30rem; overflow-y: auto; }
.ld-attention-empty {
    padding: 1.5rem 1rem; text-align: center; color: #94a3b8;
    font-size: 0.85rem;
}
.ld-attention-row {
    display: grid;
    grid-template-columns: 4rem auto 1fr 3rem 6rem 1.5rem;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    text-decoration: none;
    color: inherit;
    transition: background 0.08s ease;
}
.ld-attention-row:hover { background: #f8fafc; }
.ld-attention-row:last-child { border-bottom: none; }
.ld-attention-row--farm { cursor: default; }
.ld-attention-row--farm:hover { background: transparent; }
.ld-attention-row--farm .ld-attention-jump { display: none; }
.ld-attention-house { font-weight: 800; color: #0f172a; font-size: 0.9rem; }
.ld-attention-house--farm { color: #7c2d12; font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; }
.ld-attention-value { color: #1e293b; font-size: 0.85rem; }
.ld-attention-target { color: #94a3b8; font-size: 0.8rem; margin-left: 0.25rem; }
.ld-attention-age   { color: #64748b; font-size: 0.8rem; text-align: right; }
.ld-attention-last  { color: #64748b; font-size: 0.8rem; }
.ld-attention-jump  { color: #94a3b8; display: inline-flex; justify-content: flex-end; }
.ld-attention-row:hover .ld-attention-jump { color: #2563eb; }

@media (max-width: 720px) {
    .ld-attention-row {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "house chip"
            "value value"
            "meta meta";
        row-gap: 0.25rem;
    }
    .ld-attention-house { grid-area: house; }
    .ld-attention-row > .ld-reason-chip { grid-area: chip; justify-self: end; }
    .ld-attention-value { grid-area: value; }
    .ld-attention-age, .ld-attention-last { grid-area: meta; }
    .ld-attention-last::before { content: ' · '; color: #cbd5e1; }
    .ld-attention-jump { display: none; }
}

.ld-reason-chip {
    display: inline-block;
    font-size: 0.7rem; font-weight: 800; letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
}
.ld-reason-chip--red   { background: #fee2e2; color: #991b1b; }
.ld-reason-chip--amber { background: #ffedd5; color: #9a3412; }
.ld-reason-chip--stale { background: #e2e8f0; color: #334155; }

.ld-success-card {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 1rem;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #065f46;
}
.ld-success-card svg { color: #059669; }
.ld-success-title { font-size: 1rem; font-weight: 800; color: #065f46; }
.ld-success-sub   { font-size: 0.85rem; color: #047857; }

.ld-house-card--red {
    border-color: #b91c1c;
    box-shadow: 0 0 0 1px #b91c1c, 0 1px 2px rgba(15, 23, 42, 0.04);
}
.ld-house-card--amber {
    border-color: #d97706;
    box-shadow: 0 0 0 1px #d97706, 0 1px 2px rgba(15, 23, 42, 0.04);
}
.ld-house-card--stale {
    border-color: #94a3b8;
    box-shadow: 0 0 0 1px #94a3b8, 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* Vertically-stacked trend panels — each panel shares the chart card's
 * width and the JS pins the y-axis label area so x-columns align across
 * panels. The bottom panel renders x-axis ticks; the upper two omit them. */
.ld-chart-stack {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.ld-chart-panel { display: flex; flex-direction: column; }
.ld-chart-panel-title {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-left: 0.25rem;
    line-height: 1.2;
}
.ld-chart-canvas-wrap {
    position: relative;
    height: 140px;
}

.ld-asof-input {
    appearance: none;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    color: #0f172a;
    line-height: 1;
}
.ld-asof-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

/* ─── Layers Reports — embedded PDF viewer ─── */
.lr-pdf-viewer {
    margin-top: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #f8fafc;
}
.lr-pdf-viewer__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}
.lr-pdf-viewer__toolbar a {
    text-decoration: none;
    font-weight: 500;
}
.lr-pdf-viewer__toolbar a:hover {
    text-decoration: underline;
}
.lr-pdf-viewer__frame {
    width: 100%;
    height: 80vh;
    min-height: 480px;
    border: 0;
    display: block;
    background: #ffffff;
}

/* ─────────────────────────────────────────────────────────────────────────
   Layers Capture matrix (Daily Records + Feed Deliveries).
   Desktop: scrollable table with sticky header AND sticky house column so
   the row identifier stays visible on wide grids.
   Mobile (≤768px): each row becomes a stacked card, fields stacked
   vertically with the house code as a header.
   ───────────────────────────────────────────────────────────────────────── */
.lc-matrix-wrap {
    overflow: auto;
    max-height: calc(100vh - 14rem);
}
.lc-matrix {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
}
.lc-matrix thead th,
.lc-matrix tfoot th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.5rem 0.6rem;
    text-align: left;
    font-weight: 600;
    color: #334155;
    z-index: 2;
    white-space: nowrap;
}
.lc-matrix tfoot th {
    top: auto;
    bottom: 0;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}
.lc-matrix th.num,
.lc-matrix td.num { text-align: right; }
.lc-matrix tbody td {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.lc-matrix tbody tr:hover td { background: #fafafa; }
.lc-matrix-house,
.lc-matrix th.lc-matrix-house {
    position: sticky;
    left: 0;
    background: #ffffff;
    z-index: 3;
    border-right: 1px solid #e2e8f0;
    min-width: 6.5rem;
    white-space: nowrap;
}
.lc-matrix thead th.lc-matrix-house,
.lc-matrix tfoot th.lc-matrix-house {
    background: #f8fafc;
    z-index: 4;
}
.lc-matrix tbody tr:hover .lc-matrix-house { background: #fafafa; }
.lc-matrix-flock { color: #475569; white-space: nowrap; }
.lc-matrix-input {
    width: 100%;
    min-width: 0;
    padding: 0.25rem 0.4rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    background: #ffffff;
    transition: border-color 0.12s, box-shadow 0.12s;
    box-sizing: border-box;
}
.lc-matrix-input--computed {
    background: #f1f5f9;
    color: #475569;
    cursor: not-allowed;
    font-weight: 600;
}
.lc-matrix tbody td { padding: 0.25rem 0.4rem; }

/* Feed Deliveries history columns — read-only date columns to the right of
   the editable column. Slightly muted background so the editable column
   stands out and the date / "tons" labels stack inside the header cell. */
.cf-col-date { font-size: 0.78rem; font-weight: 600; color: #334155; }
.cf-col-sub  { font-size: 0.7rem;  color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; }
.lc-matrix th.cf-col-readonly,
.lc-matrix td.cf-col-readonly {
    background: #f8fafc;
    color: #475569;
}
.lc-matrix tbody tr:hover td.cf-col-readonly { background: #f1f5f9; }
.lc-matrix-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.lc-matrix-input[type="number"] { text-align: right; -moz-appearance: textfield; }
.lc-matrix-input[type="number"]::-webkit-outer-spin-button,
.lc-matrix-input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none; margin: 0;
}

/* Stacked-card layout on narrow screens. The table becomes a block; each
   row turns into a card with the house as a header and every cell stacked
   under it as label/value pairs (the label comes from the <th> via the
   row's nth-child relationship — we use data-label set in JS instead so
   labels remain accessible). */
@media (max-width: 768px) {
    .lc-matrix-wrap { max-height: none; }
    .lc-matrix, .lc-matrix thead, .lc-matrix tbody, .lc-matrix tr, .lc-matrix td, .lc-matrix tfoot { display: block; width: 100%; }
    .lc-matrix thead { display: none; }
    .lc-matrix tbody tr {
        border: 1px solid #e2e8f0;
        border-radius: 0.75rem;
        background: #ffffff;
        margin: 0.5rem;
        padding: 0.5rem 0.75rem 0.75rem;
    }
    .lc-matrix tbody td {
        border-bottom: none;
        padding: 0.2rem 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
    }
    .lc-matrix tbody td.lc-matrix-house {
        position: static;
        border-right: none;
        border-bottom: 1px solid #f1f5f9;
        font-size: 1rem;
        padding-bottom: 0.4rem;
        margin-bottom: 0.25rem;
        background: transparent;
        display: block;
    }
    .lc-matrix tbody td.lc-matrix-flock { color: #64748b; font-size: 0.75rem; }
    .lc-matrix tbody td[data-label]::before {
        content: attr(data-label);
        text-transform: uppercase;
        letter-spacing: 0.03em;
        font-size: 0.7rem;
        color: #64748b;
        flex: 1;
    }
    .lc-matrix-input { width: auto; min-width: 6rem; }
    .lc-matrix tfoot { padding: 0.5rem; font-weight: 600; }
}
