/* ================================================================
   MAHALAKSHMI TRANSPORTS — ADMIN DESIGN SYSTEM
   Theme: "Route Line" — logistics/highway inspired, navy + amber
   ================================================================ */

/* ---------- Fonts ---------- */
/* Loaded in _Layout.cshtml: Sora (display), Inter (body), IBM Plex Mono (data) */

/* ---------- Design Tokens ---------- */
:root {
    /* Brand — Deep Maroon (primary, from logo) + Navy (secondary/accent) */
    --ink-900: #5C1D16; /* Deep Maroon — primary brand color */
    --ink-800: #431410; /* darker maroon, depth/gradients */
    --ink-700: #70231B; /* lighter maroon — hover/border state */
    --amber-500: #122A5E; /* Navy — accent (route-line, CTA, icons on light surfaces) */
    --amber-600: #0C1F45; /* darker navy — hover */
    --amber-100: #E1E6F2; /* light navy tint — chips/backgrounds */
    --accent-on-dark: #4A6FA5; /* lighter navy — legible against the maroon sidebar */
    --steel-600: #122A5E; /* Navy — links, secondary buttons, focus */
    --steel-500: #1D3A7A; /* lighter navy — hover/focus ring */
    --steel-100: #E1E6F2; /* light navy tint — focus ring glow */
    /* Semantic */
    --success-600: #1E8E5A;
    --success-100: #DCF3E7;
    --danger-600: #D64545;
    --danger-100: #FBE2E2;
    --warning-600: #B8790F;
    --warning-100: #FDECC8;
    --info-600: #2D8FD6;
    --info-100: #DDEEFB;
    /* Surfaces — light mode */
    --bg: #F5F6FA;
    --surface: #FFFFFF;
    --surface-2: #EFF1F6;
    --surface-sidebar: var(--ink-900);
    --border: #E1E4EC;
    --border-strong: #CBD1DE;
    /* Text */
    --text-primary: #16202E;
    --text-secondary: #5B6B7F;
    --text-muted: #8B97A8;
    --text-on-dark: #EDF1F6;
    --text-on-dark-muted: #94A4B8;
    /* Type */
    --font-display: 'Sora', 'Inter', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
    /* Radius / shadow / motion */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(16,27,44,.06);
    --shadow-md: 0 4px 16px rgba(16,27,44,.08);
    --shadow-lg: 0 12px 32px rgba(16,27,44,.14);
    --ease: cubic-bezier(.4,0,.2,1);
    --dur: 180ms;
    /* Layout */
    --sidebar-w: 264px;
    --sidebar-w-collapsed: 76px;
    --topnav-h: 64px;
}

/* ---------- Dark mode ---------- */
[data-theme="dark"] {
    --bg: #0B121C;
    --surface: #121B29;
    --surface-2: #17222F;
    --surface-sidebar: #0B121C;
    --border: #233043;
    --border-strong: #2C3B52;
    --text-primary: #E8EDF3;
    --text-secondary: #92A2B4;
    --text-muted: #5F7086;
    --amber-100: #16233F;
    --steel-100: #16233F;
    --success-100: #0F2A1D;
    --danger-100: #301414;
    --warning-100: #3A2C10;
    --info-100: #0F2436;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
    --shadow-md: 0 4px 18px rgba(0,0,0,.45);
    --shadow-lg: 0 16px 40px rgba(0,0,0,.55);
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
    max-width: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14.5px;
    line-height: 1.55;
    overflow-x: hidden;
    max-width: 100%;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -.01em;
    margin: 0 0 .4em;
}

a {
    color: var(--steel-600);
    text-decoration: none;
}

    a:hover {
        color: var(--steel-500);
    }

::selection {
    background: var(--amber-100);
    color: var(--ink-900);
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
    }
}

/* Visible keyboard focus everywhere */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, .nav-link:focus-visible {
    outline: 2px solid var(--amber-500);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ================================================================
   SIGNATURE ELEMENT — "Route Line"
   A dashed waypoint rule used under titles / card headers,
   echoing highway lane markings & delivery route maps.
   ================================================================ */
.route-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0 20px;
}

    .route-line::before {
        content: "";
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--amber-500);
        flex: 0 0 auto;
        box-shadow: 0 0 0 3px var(--amber-100);
    }

    .route-line::after {
        content: "";
        flex: 1 1 auto;
        height: 0;
        border-top: 2px dashed var(--border-strong);
    }

/* ================================================================
   LAYOUT SHELL
   ================================================================ */
.wrapper {
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100%;
}

.main-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--surface-sidebar);
    z-index: 1030;
    display: flex;
    flex-direction: column;
    transition: width var(--dur) var(--ease), transform var(--dur) var(--ease);
    box-shadow: var(--shadow-lg);
}

    .main-sidebar.sidebar-collapsed {
        width: var(--sidebar-w-collapsed);
    }

.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--topnav-h);
    padding: 0 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex: 0 0 auto;
    overflow: hidden;
    white-space: nowrap;
}

.brand-image {
    height: 32px;
    width: 32px;
    object-fit: contain;
    flex: 0 0 auto;
    border-radius: 6px;
}

.brand-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    letter-spacing: .01em;
}

.sidebar-collapsed .brand-text {
    display: none;
}

.sidebar {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 10px 20px;
}

    .sidebar::-webkit-scrollbar {
        width: 6px;
    }

    .sidebar::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,.14);
        border-radius: 4px;
    }

.nav-header {
    font-family: var(--font-display);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .12em;
    color: var(--text-on-dark-muted);
    padding: 16px 12px 6px;
    text-transform: uppercase;
}

.nav-sidebar .nav-item {
    position: relative;
    margin-bottom: 2px;
    list-style: none;
}

.nav-sidebar {
    padding-left: 0;
    margin: 0;
}

    .nav-sidebar .nav-link {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 9px 12px;
        border-radius: var(--radius-sm);
        color: var(--text-on-dark);
        font-size: 13.5px;
        font-weight: 500;
        position: relative;
        transition: background var(--dur) var(--ease), color var(--dur) var(--ease), padding var(--dur) var(--ease);
    }

        .nav-sidebar .nav-link p {
            margin: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .nav-sidebar .nav-link .nav-icon {
            width: 18px;
            text-align: center;
            flex: 0 0 auto;
            color: var(--text-on-dark-muted);
            transition: color var(--dur) var(--ease);
        }

        .nav-sidebar .nav-link:hover {
            background: rgba(255,255,255,.06);
            color: #fff;
        }

            .nav-sidebar .nav-link:hover .nav-icon {
                color: var(--accent-on-dark);
            }

        /* Active item: amber waypoint dot + connecting line on the rail — ties to .route-line motif */
        .nav-sidebar .nav-link.active {
            background: rgba(74,111,165,.20);
            color: #fff;
        }

            .nav-sidebar .nav-link.active .nav-icon {
                color: var(--accent-on-dark);
            }

    .nav-sidebar .nav-item::before {
        content: "";
        position: absolute;
        left: 0;
        top: 50%;
        width: 3px;
        height: 0;
        background: var(--accent-on-dark);
        border-radius: 0 3px 3px 0;
        transform: translateY(-50%);
        transition: height var(--dur) var(--ease);
    }

    .nav-sidebar .nav-item:has(.nav-link.active)::before {
        height: 60%;
    }

.sidebar-collapsed .nav-link p,
.sidebar-collapsed .nav-header {
    display: none;
}

.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 10px;
}

/* ---------- Main wrapper / content ---------- */
.main-wrapper {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--dur) var(--ease);
    min-width: 0;
    overflow-x: hidden;
    max-width: 100%;
}

    .main-sidebar.sidebar-collapsed ~ .main-wrapper,
    .main-wrapper.sidebar-collapsed {
        margin-left: var(--sidebar-w-collapsed);
    }

.main-header {
    height: var(--topnav-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: var(--shadow-sm);
}

    .main-header .navbar-nav {
        display: flex;
        align-items: center;
        gap: 2px;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .main-header .nav-link {
        color: var(--text-secondary);
        padding: 8px 10px;
        border-radius: var(--radius-sm);
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 13.5px;
        transition: background var(--dur), color var(--dur);
    }

        .main-header .nav-link:hover {
            background: var(--surface-2);
            color: var(--text-primary);
        }

.content-wrapper {
    flex: 1 1 auto;
    padding: 22px 24px 40px;
    min-width: 0;
}

.container-fluid {
    max-width: 1600px;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    font-family: var(--font-display);
    font-size: 13px;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "\203A";
    color: var(--text-muted);
    padding: 0 8px;
}

.breadcrumb-item a {
    color: var(--text-secondary);
    font-weight: 500;
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 600;
}

/* ---------- Footer ---------- */
.main-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 14px 24px;
    color: var(--text-muted);
    font-size: 12.5px;
}

    .main-footer a {
        color: var(--text-secondary);
        font-weight: 600;
    }

/* ================================================================
   TOP NAV EXTRAS: user avatar, theme switch, notifications
   ================================================================ */
.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--steel-600), var(--ink-900));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
}

.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    background: var(--surface);
    padding: 8px;
}

.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--text-primary);
    font-size: 13.5px;
    display: flex;
    align-items: center;
}

    .dropdown-item:hover {
        background: var(--surface-2);
        color: var(--text-primary);
    }

    .dropdown-item.text-danger:hover {
        background: var(--danger-100);
        color: var(--danger-600);
    }

.dropdown-divider {
    border-color: var(--border);
    margin: 6px 0;
}

.dropdown-header {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 700;
}

/* Theme switcher — three-way segmented control (Light / Dark / Auto) */
.theme-switch {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px;
}

    .theme-switch button {
        border: 0;
        background: transparent;
        cursor: pointer;
        width: 32px;
        height: 28px;
        border-radius: 999px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--text-secondary);
        transition: background var(--dur), color var(--dur);
        font-size: 13px;
    }

        .theme-switch button.active {
            background: var(--ink-900);
            color: #fff;
        }

[data-theme="dark"] .theme-switch button.active {
    background: var(--amber-500);
    color: #fff;
}

/* ================================================================
   CARDS
   ================================================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
}

    .card-header .card-title {
        font-family: var(--font-display);
        font-size: 15px;
        font-weight: 600;
        margin: 0;
        display: flex;
        align-items: center;
        gap: 10px;
    }

        .card-header .card-title .card-icon {
            width: 32px;
            height: 32px;
            border-radius: 8px;
            background: var(--amber-100);
            color: var(--amber-600);
            display: flex;
            align-items: center;
            justify-content: center;
            flex: 0 0 auto;
        }

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Page title block used at the top of Create/Edit/Index views */
.page-header {
    margin-bottom: 6px;
}

    .page-header .page-eyebrow {
        font-family: var(--font-mono);
        font-size: 11px;
        letter-spacing: .1em;
        text-transform: uppercase;
        color: var(--steel-600);
        font-weight: 600;
        margin-bottom: 4px;
    }

    .page-header h1 {
        font-size: 22px;
    }

    .page-header p {
        color: var(--text-secondary);
        margin: 0;
        font-size: 13.5px;
    }

/* Stat cards for dashboard */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform var(--dur), box-shadow var(--dur);
}

    .stat-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

    .stat-card .stat-icon {
        width: 44px;
        height: 44px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        flex: 0 0 auto;
    }

    .stat-card .stat-value {
        font-family: var(--font-mono);
        font-size: 22px;
        font-weight: 600;
        color: var(--text-primary);
        line-height: 1.1;
    }

    .stat-card .stat-label {
        color: var(--text-secondary);
        font-size: 12.5px;
        margin-top: 2px;
    }

/* ================================================================
   FORMS — the priority for Create / Edit pages
   ================================================================ */
.form-section-title {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--steel-600);
    margin: 28px 0 4px;
}

    .form-section-title:first-child {
        margin-top: 0;
    }

.form-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: block;
    letter-spacing: .01em;
}

    .form-label .required {
        color: var(--danger-600);
        margin-left: 2px;
    }

.form-control, .form-select {
    width: 100%;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-size: 13.5px;
    color: var(--text-primary);
    font-family: var(--font-body);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur);
}

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

    .form-control:focus, .form-select:focus {
        outline: none;
        border-color: var(--steel-500);
        box-shadow: 0 0 0 3px var(--steel-100);
    }

    .form-control:disabled, .form-control[readonly] {
        background: var(--surface-2);
        color: var(--text-muted);
    }

    .form-control.is-invalid, .was-validated .form-control:invalid {
        border-color: var(--danger-600);
    }

        .form-control.is-invalid:focus {
            box-shadow: 0 0 0 3px var(--danger-100);
        }

.invalid-feedback {
    color: var(--danger-600);
    font-size: 12px;
    margin-top: 4px;
}

.form-text {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 4px;
}

/* Numeric / amount fields get mono for scanability */
.form-control.numeric-only, .form-control.decimal-only, .form-control[type="number"] {
    font-family: var(--font-mono);
    text-align: right;
}

.form-group {
    margin-bottom: 16px;
}

/* Input group with icon/prefix (e.g. ₹ amounts) */
.input-group-text {
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 13px;
}

/* Checkbox / switch / radio */
.form-check-input {
    width: 17px;
    height: 17px;
    border: 1.5px solid var(--border-strong);
    border-radius: 4px;
}

    .form-check-input:checked {
        background-color: var(--steel-600);
        border-color: var(--steel-600);
    }

.form-check-label {
    font-size: 13.5px;
    color: var(--text-primary);
    margin-left: 4px;
}

/* Fieldset card wrapper for grouped form fields */
.form-panel {
    background: var(--surface-2);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    margin-bottom: 18px;
}

/* Sticky form action bar */
.form-actions {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 14px 20px;
    margin: 24px -20px -20px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13.5px;
    border-radius: var(--radius-sm);
    padding: 9px 16px;
    border: 1.5px solid transparent;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

    .btn:active {
        transform: translateY(1px);
    }

.btn-primary {
    background: var(--ink-900);
    border-color: var(--ink-900);
    color: #fff;
}

    .btn-primary:hover {
        background: var(--ink-700);
        border-color: var(--ink-700);
        color: #fff;
    }

.btn-accent {
    background: var(--amber-500);
    border-color: var(--amber-500);
    color: #fff;
}

    .btn-accent:hover {
        background: var(--amber-600);
        border-color: var(--amber-600);
        color: #fff;
    }

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

    .btn-outline-secondary:hover {
        background: var(--surface-2);
        color: var(--text-primary);
    }

.btn-danger {
    background: var(--danger-600);
    border-color: var(--danger-600);
    color: #fff;
}

    .btn-danger:hover {
        background: #B93838;
        border-color: #B93838;
    }

.btn-success {
    background: var(--success-600);
    border-color: var(--success-600);
    color: #fff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12.5px;
}

/* ================================================================
   TABLES / DataTables theming
   ================================================================ */
table.dataTable, .table {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13.5px;
}

    .table thead th, table.dataTable thead th {
        background: var(--surface-2);
        color: var(--text-secondary);
        font-family: var(--font-display);
        font-size: 11.5px;
        text-transform: uppercase;
        letter-spacing: .05em;
        font-weight: 700;
        border-bottom: 1px solid var(--border) !important;
        padding: 11px 14px;
        white-space: nowrap;
    }

    .table tbody td, table.dataTable tbody td {
        padding: 11px 14px;
        border-bottom: 1px solid var(--border);
        color: var(--text-primary);
        vertical-align: middle;
    }

    .table tbody tr:hover, table.dataTable tbody tr:hover {
        background: var(--surface-2);
    }

    .table td.numeric, table.dataTable td.numeric {
        font-family: var(--font-mono);
        text-align: right;
    }

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    color: var(--text-primary);
}

.dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_paginate {
    color: var(--text-secondary);
    font-size: 12.5px;
}

.dataTables_wrapper .paginate_button {
    border-radius: var(--radius-sm) !important;
    border: 1px solid transparent !important;
}

    .dataTables_wrapper .paginate_button.current {
        background: var(--ink-900) !important;
        color: #fff !important;
        border-color: var(--ink-900) !important;
    }

/* ================================================================
   BADGES / ALERTS
   ================================================================ */
.badge {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 11px;
    padding: 5px 9px;
    border-radius: 999px;
}

.badge-success {
    background: var(--success-100);
    color: var(--success-600);
}

.badge-danger {
    background: var(--danger-100);
    color: var(--danger-600);
}

.badge-warning {
    background: var(--warning-100);
    color: var(--warning-600);
}

.badge-info {
    background: var(--info-100);
    color: var(--info-600);
}

.badge-warning.navbar-badge {
    position: absolute;
    top: 4px;
    right: 2px;
}

.alert {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 13.5px;
}

.alert-success {
    background: var(--success-100);
    border-color: transparent;
    color: var(--success-600);
}

.alert-danger {
    background: var(--danger-100);
    border-color: transparent;
    color: var(--danger-600);
}

.alert-warning {
    background: var(--warning-100);
    border-color: transparent;
    color: var(--warning-600);
}

.alert-info {
    background: var(--info-100);
    border-color: transparent;
    color: var(--info-600);
}

/* ================================================================
   LOADING / OVERLAYS
   ================================================================ */
.spinner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11,18,28,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur) var(--ease);
}

    .spinner-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    .spinner-overlay > div {
        background: var(--surface);
        padding: 24px 32px;
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-lg);
    }

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11,18,28,.5);
    z-index: 1025;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur) var(--ease);
}

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

/* ================================================================
   RESPONSIVE DESIGN SYSTEM & BREAKPOINTS
   ================================================================ */

/* Tablet & Smaller (< 992px) */
@media (max-width: 991px) {
    .main-sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-w);
    }

        .main-sidebar.sidebar-open {
            transform: translateX(0);
        }

    .main-wrapper {
        margin-left: 0 !important;
    }

    .content-wrapper {
        padding: 16px 14px 32px;
    }

    .form-actions {
        margin: 20px -14px -14px;
        flex-direction: column-reverse;
    }

        .form-actions .btn {
            width: 100%;
            justify-content: center;
        }

    .card-body {
        padding: 16px;
    }

    .main-header {
        padding: 0 12px;
    }
}

/* Tablets & Mobile Landscape (< 768px) */
@media (max-width: 768px) {
    .content-wrapper {
        padding: 12px 8px 24px;
    }

    .container-fluid {
        padding-left: 6px !important;
        padding-right: 6px !important;
    }

    /* Card Padding Normalization */
    .card {
        border-radius: var(--radius-md);
        margin-bottom: 14px;
    }

    .card-header {
        padding: 12px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .card-body {
        padding: 14px 12px;
    }

    /* DataTables Mobile Layout Normalization */
    .dataTables_wrapper {
        padding: 0 !important;
    }

    .dataTables_wrapper .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: left !important;
        padding: 0 !important;
        margin-bottom: 8px !important;
        width: 100% !important;
    }

    .dataTables_wrapper .dataTables_filter label {
        display: flex;
        align-items: center;
        width: 100%;
        gap: 8px;
        margin: 0;
    }

    .dataTables_wrapper .dataTables_filter input {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        height: 34px !important;
    }

    .dataTables_wrapper .dataTables_length select {
        height: 34px !important;
    }

    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        text-align: center !important;
        display: flex;
        justify-content: center !important;
        flex-wrap: wrap;
        gap: 4px;
        padding: 8px 0 !important;
        width: 100% !important;
    }

    .dataTables_wrapper .pagination {
        flex-wrap: wrap;
        justify-content: center;
        margin: 4px 0 0;
    }

    /* Table Touch Scrolling & Density */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
        position: relative;
        border-radius: var(--radius-sm);
        margin-bottom: 12px;
    }

    /* Touch-Friendly Action Buttons */
    .btn-action {
        min-height: 34px;
        min-width: 34px;
        padding: 4px 8px !important;
        font-size: 12px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
    }

    .action-group {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        justify-content: center;
        flex-wrap: nowrap;
    }
}

/* Mobile Devices (< 576px) */
@media (max-width: 575px) {
    .content-wrapper {
        padding: 10px 4px 20px;
    }

    .stat-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px 12px;
    }

    .theme-switch {
        display: none;
    }

    /* Typography scaling for mobile */
    h1, .h1 {
        font-size: 1.25rem !important;
    }

    h4, .h4 {
        font-size: 1.05rem !important;
    }

    h6, .h6 {
        font-size: 0.925rem !important;
    }

    /* Form Fields & Full-width Actions on Mobile */
    .filter-bar {
        padding: 10px 8px !important;
        margin-bottom: 12px !important;
    }

    .filter-bar .form-label {
        font-size: 10.5px !important;
    }

    .filter-bar .form-control,
    .filter-bar .form-select {
        font-size: 12px !important;
        height: 34px !important;
    }

    /* Ensure modals and dropdowns don't clip */
    .dropdown-menu {
        max-width: calc(100vw - 20px);
    }
}

/* ================================================================
   TOM SELECT — searchable dropdowns, themed to the design tokens
   (loaded via CDN in _Layout.cshtml, base theme = bootstrap5)
   ================================================================ */
.ts-wrapper {
    font-size: 13.5px;
    font-family: var(--font-body);
}

    .ts-wrapper.single .ts-control, .ts-control {
        background: var(--surface) !important;
        border: 1.5px solid var(--border) !important;
        border-radius: var(--radius-sm) !important;
        padding: 7px 10px !important;
        min-height: 36px;
        color: var(--text-primary) !important;
        box-shadow: none !important;
    }

    .ts-wrapper.focus .ts-control {
        border-color: var(--steel-500) !important;
        box-shadow: 0 0 0 3px var(--steel-100) !important;
    }

.ts-dropdown {
    position: absolute !important;
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-md) !important;
    font-family: var(--font-body);
    z-index: 3050 !important;
    max-height: 260px;
    overflow-y: auto;
}

    .ts-dropdown .option, .ts-dropdown .ts-dropdown-content .option {
        padding: 8px 12px !important;
        font-size: 13.5px;
        color: var(--text-primary) !important;
    }

        .ts-dropdown .option.active, .ts-dropdown .option:hover {
            background: var(--surface-2) !important;
            color: var(--text-primary) !important;
        }

    .ts-dropdown .create {
        color: var(--steel-600) !important;
        padding: 8px 12px !important;
    }

.ts-control input::placeholder {
    color: var(--text-muted);
}

.ts-wrapper.single .ts-control::after {
    border-color: var(--text-muted) transparent transparent transparent !important;
}

.item-hint {
    color: var(--text-muted);
    font-size: 12px;
    margin-left: 6px;
}
/* Compact variant used inside dense transaction forms */
.ts-compact .ts-control {
    min-height: 30px !important;
    padding: 3px 8px !important;
    font-size: 12.5px !important;
}

/* ================================================================
   COMPACT FORM SECTIONS (Create / Edit — Consignment-style forms)
   ================================================================ */
.form-panel {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 14px;
}

.form-panel-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-primary);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border-strong);
    display: flex;
    align-items: center;
    gap: 8px;
}

    .form-panel-title i {
        color: var(--steel-600);
        font-size: 13px;
    }

.form-panel .form-group {
    margin-bottom: 8px;
}

.form-panel .form-label {
    font-size: 11px;
    margin-bottom: 3px;
}

.form-panel .form-control,
.form-panel .form-select {
    font-size: 13px;
    padding: 6px 10px;
    min-height: 34px;
}

.form-panel .input-group-text {
    font-size: 12px;
    padding: 6px 10px;
}

.required-star {
    color: var(--danger-600);
    margin-left: 2px;
}

/* ================================================================
   CALCULATION GRID — live financial summary tiles
   ================================================================ */
.calc-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.calc-box {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    border-left: 3px solid var(--steel-600);
    text-align: center;
}

    .calc-box .calc-label {
        font-size: 9.5px;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: var(--text-muted);
        font-weight: 700;
    }

    .calc-box .calc-value {
        font-family: var(--font-mono);
        font-size: 15px;
        font-weight: 600;
        color: var(--text-primary);
        margin-top: 2px;
    }

    .calc-box[data-tone="amber"] {
        border-left-color: var(--warning-600);
    }

        .calc-box[data-tone="amber"] .calc-value {
            color: var(--warning-600);
        }

    .calc-box[data-tone="danger"] {
        border-left-color: var(--danger-600);
    }

        .calc-box[data-tone="danger"] .calc-value {
            color: var(--danger-600);
        }

    .calc-box[data-tone="success"] {
        border-left-color: var(--success-600);
    }

        .calc-box[data-tone="success"] .calc-value {
            color: var(--success-600);
        }

    .calc-box[data-tone="info"] {
        border-left-color: var(--info-600);
    }

        .calc-box[data-tone="info"] .calc-value {
            color: var(--info-600);
        }

    .calc-box[data-tone="steel"] {
        border-left-color: var(--steel-600);
    }

        .calc-box[data-tone="steel"] .calc-value {
            color: var(--steel-600);
        }

@media (max-width: 991px) {
    .calc-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 575px) {
    .calc-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ================================================================
   DETAILS / READ-ONLY VIEWS
   ================================================================ */
.info-grid {
}

.info-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

    .info-row:last-child {
        border-bottom: none;
    }

    .info-row .detail-label {
        color: var(--text-secondary);
        font-weight: 600;
        font-size: 11.5px;
        text-transform: uppercase;
        letter-spacing: .03em;
        flex: 0 0 auto;
    }

    .info-row .detail-value {
        color: var(--text-primary);
        font-weight: 500;
        text-align: right;
    }

        .info-row .detail-value.mono {
            font-family: var(--font-mono);
        }

.summary-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--steel-600);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}

    .summary-tile .label {
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: var(--text-muted);
        font-weight: 700;
    }

    .summary-tile .value {
        font-family: var(--font-mono);
        font-size: 19px;
        font-weight: 700;
        color: var(--text-primary);
        margin-top: 3px;
    }

    .summary-tile[data-tone="success"] {
        border-left-color: var(--success-600);
    }

        .summary-tile[data-tone="success"] .value {
            color: var(--success-600);
        }

    .summary-tile[data-tone="amber"] {
        border-left-color: var(--warning-600);
    }

        .summary-tile[data-tone="amber"] .value {
            color: var(--warning-600);
        }

    .summary-tile[data-tone="info"] {
        border-left-color: var(--info-600);
    }

        .summary-tile[data-tone="info"] .value {
            color: var(--info-600);
        }

/* ================================================================
   STATUS BADGES — normalize Bootstrap bg-* utilities used as
   status pills (bg-success / bg-warning / bg-danger / bg-info)
   to the design system's palette
   ================================================================ */
.badge.bg-success {
    background: var(--success-100) !important;
    color: var(--success-600) !important;
}

.badge.bg-warning {
    background: var(--warning-100) !important;
    color: var(--warning-600) !important;
}

.badge.bg-danger {
    background: var(--danger-100) !important;
    color: var(--danger-600) !important;
}

.badge.bg-info {
    background: var(--info-100) !important;
    color: var(--info-600) !important;
}

.badge.bg-primary {
    background: var(--ink-900) !important;
    color: #fff !important;
}

.badge.bg-secondary {
    background: var(--surface-2) !important;
    color: var(--text-secondary) !important;
}

.status-badge-lg {
    font-size: 12.5px;
    padding: 6px 14px;
}

/* ================================================================
   TOAST NOTIFICATIONS (floating, replaces per-page duplicates)
   ================================================================ */
.toast-stack {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 3000;
    max-width: 380px;
    width: calc(100% - 40px);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mlt-toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--steel-600);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: mltToastIn .25s var(--ease);
}

    .mlt-toast.success {
        border-left-color: var(--success-600);
    }

    .mlt-toast.error {
        border-left-color: var(--danger-600);
    }

    .mlt-toast.warning {
        border-left-color: var(--warning-600);
    }

    .mlt-toast.info {
        border-left-color: var(--info-600);
    }

    .mlt-toast .toast-icon {
        font-size: 17px;
        margin-top: 1px;
    }

    .mlt-toast.success .toast-icon {
        color: var(--success-600);
    }

    .mlt-toast.error .toast-icon {
        color: var(--danger-600);
    }

    .mlt-toast.warning .toast-icon {
        color: var(--warning-600);
    }

    .mlt-toast.info .toast-icon {
        color: var(--info-600);
    }

    .mlt-toast .toast-title {
        font-weight: 700;
        font-size: 13.5px;
        color: var(--text-primary);
    }

    .mlt-toast .toast-message {
        font-size: 12.5px;
        color: var(--text-secondary);
        margin-top: 1px;
    }

    .mlt-toast .toast-close {
        margin-left: auto;
        background: none;
        border: 0;
        color: var(--text-muted);
        font-size: 16px;
        cursor: pointer;
        line-height: 1;
    }

@keyframes mltToastIn {
    from {
        transform: translateX(24px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ================================================================
   FILTER BAR (Index / list views)
   ================================================================ */
.filter-bar {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 18px;
}

    .filter-bar .form-label {
        font-size: 11px;
        margin-bottom: 4px;
    }

/* ================================================================
   PRINT
   ================================================================ */
@media print {
    .main-sidebar, .main-header, .main-footer, .breadcrumb,
    .sidebar-overlay, .spinner-overlay, .toast-stack,
    .no-print, .form-actions, .btn {
        display: none !important;
    }

    .main-wrapper {
        margin-left: 0 !important;
    }

    .card {
        border: none !important;
        box-shadow: none !important;
    }

    body {
        background: #fff !important;
        color: #000 !important;
    }
}
/* Third-party Select2 Dropdown Overrides */
.select2-container--bootstrap-5 .select2-selection {
    min-height: 33px !important;
    height: 33px !important;
    padding: 2px 6px !important;
    font-size: 13px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
}

.select2-container--bootstrap-5 .select2-selection__rendered {
    color: #1e293b !important;
    line-height: 28px !important;
}

.select2-container--bootstrap-5 .select2-selection__arrow {
    height: 31px !important;
}
/* ==========================================
           🚀 SELECT2 FAST-ENTRY UI OVERRIDES
           ========================================== */
.select2-container--bootstrap-5 .select2-selection {
    min-height: 36px !important;
    font-size: 13px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    transition: all 0.15s ease;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12) !important;
}

/* The Dropdown "Modal" Box */
.select2-dropdown {
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
    overflow: hidden;
    margin-top: 4px;
    z-index: 1060 !important;
}

/* The Search Box inside the Dropdown */
.select2-search--dropdown {
    padding: 8px !important;
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.select2-search__field {
    border-radius: 6px !important;
    border: 1px solid #cbd5e1 !important;
    font-size: 13px !important;
    padding: 6px 12px !important;
}

    .select2-search__field:focus {
        border-color: #3b82f6 !important;
        outline: none !important;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12) !important;
    }

/* Highlighted Option for Fast Selection */
.select2-results__option--highlighted[aria-selected] {
    background-color: #eff6ff !important;
    color: #1d4ed8 !important;
    font-weight: 500;
}

.select2-results__option {
    font-size: 13px !important;
    padding: 8px 12px !important;
}
