/* =====================================================
   VahanSetu — Vehicle Tracking System
   Custom UI Design
   ===================================================== */

/* ---- CSS Variables ---- */
:root {
    --sidebar-w: 272px;
    --topbar-h: 64px;

    --primary: #2563eb;
    --primary-light: #dbeafe;
    --primary-dark: #1d4ed8;
    --primary-50: rgba(37, 99, 235, .05);

    --accent: #16a34a;
    --accent-light: #dcfce7;
    --accent-dark: #15803d;
    --accent-50: rgba(22, 163, 74, .06);

    --orange: #ea580c;
    --orange-light: #fff7ed;
    --red: #dc2626;
    --red-light: #fef2f2;

    --bg: #f0f4f8;
    --surface: #ffffff;
    --surface-2: #f7fafd;
    --border: #e1e8ef;
    --border-light: #edf1f7;

    --text: #1a2332;
    --text-muted: #6b7a90;

    --sidebar-bg: linear-gradient(185deg, #0c1929 0%, #0f2440 40%, #0a2a3a 100%);
    --sidebar-text: #8899aa;
    --sidebar-hover: rgba(255, 255, 255, .05);
    --sidebar-active-bg: rgba(37, 99, 235, .15);
    --sidebar-active-text: #60a5fa;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .04);
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, .05), 0 1px 2px rgba(0, 0, 0, .03);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, .07);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, .1);
    --shadow-glow: 0 0 20px rgba(37, 99, 235, .12);

    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 7px;
    --radius-pill: 999px;
}

[data-theme="dark"] {
    --bg: #0a0f1a;
    --surface: #111827;
    --surface-2: #1a2332;
    --border: #1e2d42;
    --border-light: #253448;
    --text: #e8edf5;
    --text-muted: #7a8ba0;
    --sidebar-bg: linear-gradient(185deg, #050a12 0%, #0a1525 40%, #061a28 100%);
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, .3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, .35);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, .45);
}

*,
*::before,
*::after {
    box-sizing: border-box
}

body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
    font-size: .9375rem;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale
}

/* =====================================================  SIDEBAR  */
.ms-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .3s cubic-bezier(.4, 0, .2, 1), width .3s cubic-bezier(.4, 0, .2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid rgba(255, 255, 255, .04)
}

.ms-sidebar::-webkit-scrollbar {
    width: 4px
}

.ms-sidebar::-webkit-scrollbar-track {
    background: transparent
}

.ms-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .1);
    border-radius: 99px
}

.ms-sidebar-brand {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1.35rem 1.35rem 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    flex-shrink: 0;
    position: relative
}

.ms-sidebar-brand::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 1.35rem;
    right: 1.35rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(37, 99, 235, .3), rgba(22, 163, 74, .3), transparent)
}

.ms-brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(37, 99, 235, .25), rgba(22, 163, 74, .2));
    border: 1px solid rgba(255, 255, 255, .08)
}

.ms-brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px
}

.ms-brand-text {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.02em;
    white-space: nowrap;
    background: linear-gradient(135deg, #fff 0%, #c8daf0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text
}

.ms-sidebar-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 4px;
    line-height: 1
}

.ms-sidebar-section-label {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(136, 153, 170, .5);
    padding: 1.25rem 1.35rem .5rem;
    white-space: nowrap
}

.ms-sidebar-nav {
    padding: 0 .85rem;
    display: flex;
    flex-direction: column;
    gap: 3px
}

.ms-nav-item {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .65rem .85rem;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    font-size: .9rem;
    transition: all .2s ease;
    cursor: pointer;
    position: relative;
    border-left: 3px solid transparent
}

.ms-nav-item:hover {
    background: var(--sidebar-hover);
    color: #c8d6e5;
    border-left-color: rgba(255, 255, 255, .1)
}

.ms-nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    border-left-color: var(--primary);
    font-weight: 600
}

.ms-nav-item.active .ms-nav-icon {
    color: var(--sidebar-active-text)
}

.ms-nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: .75;
    transition: opacity .2s
}

.ms-nav-item:hover .ms-nav-icon,
.ms-nav-item.active .ms-nav-icon {
    opacity: 1
}

.ms-nav-label {
    white-space: nowrap
}

.ms-sidebar-footer {
    margin-top: auto;
    padding: 1rem .85rem;
    border-top: 1px solid rgba(255, 255, 255, .06);
    flex-shrink: 0
}

.ms-user-pill {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .75rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .03);
    border: 1px solid rgba(255, 255, 255, .04)
}

.ms-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: .875rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0
}

.ms-user-name {
    font-size: .875rem;
    font-weight: 600;
    color: #dce4ed;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.ms-user-role {
    font-size: .75rem;
    color: var(--sidebar-text);
    text-transform: capitalize
}

.ms-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 1039;
    opacity: 0;
    transition: opacity .3s
}

.ms-sidebar-overlay.show {
    display: block;
    opacity: 1
}

/* =====================================================  MAIN  */
.ms-main-wrapper {
    margin-left: 0;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    transition: margin-left .3s cubic-bezier(.4, 0, .2, 1), width .3s cubic-bezier(.4, 0, .2, 1)
}

body.ms-has-sidebar .ms-main-wrapper {
    margin-left: var(--sidebar-w);
    width: calc(100% - var(--sidebar-w));
    max-width: calc(100% - var(--sidebar-w));
}

.ms-topbar-links {
    display: flex;
    align-items: center;
    gap: .2rem;
    margin-left: .5rem;
    flex-wrap: wrap
}

.ms-topbar-link {
    font-size: .84rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    padding: .4rem .75rem;
    border-radius: var(--radius-xs);
    transition: all .2s;
    border: 1px solid transparent
}

.ms-topbar-link:hover {
    color: var(--text);
    background: var(--surface-2);
    border-color: var(--border-light)
}

.ms-topbar-link.active {
    color: var(--primary);
    background: var(--primary-50);
    border-color: var(--primary-light)
}

@media (max-width: 575.98px) {
    .ms-topbar {
        height: auto;
        min-height: var(--topbar-h);
        align-items: center;
        gap: .55rem;
        padding: .5rem .75rem;
        overflow: visible;
    }

    .ms-topbar-links {
        display: none;
    }

    .ms-topbar-links::-webkit-scrollbar {
        display: none;
    }

    .ms-topbar-left {
        flex-wrap: nowrap;
        min-width: 0;
        gap: .45rem;
        flex: 1;
    }

    .ms-topbar-brand-logo {
        width: 1.9rem;
        height: 1.9rem;
        border-radius: .5rem;
    }

    .ms-topbar-brand-text {
        font-size: .96rem;
        max-width: 8.2rem;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .ms-topbar-brand+.ms-breadcrumb .ms-breadcrumb-root {
        display: none;
    }

    .ms-breadcrumb {
        font-size: .8rem;
        min-width: 0;
        max-width: 9rem;
        gap: .3rem;
        white-space: nowrap;
        overflow: hidden;
    }

    .ms-breadcrumb-current {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .ms-profile-btn {
        gap: .45rem;
        padding: .3rem .5rem .3rem .35rem;
    }

    .ms-profile-avatar {
        width: 32px;
        height: 32px;
        font-size: .75rem;
    }

    .ms-profile-name {
        max-width: 80px;
        font-size: .78rem;
    }

    .ms-content {
        padding: 1rem;
        overflow-x: hidden;
    }

    .ms-stat-card {
        flex-direction: column;
        align-items: flex-start;
        padding: .9rem 1rem;
        gap: .55rem;
    }

    .ms-stat-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    .ms-stat-icon svg {
        width: 18px;
        height: 18px;
    }

    .ms-stat-value {
        font-size: 1.5rem;
        margin-bottom: .1rem;
    }

    .ms-stat-label {
        font-size: .7rem;
        letter-spacing: .03em;
    }

    .ms-stat-sublabel {
        font-size: .7rem;
    }
}

/* =====================================================  TOPBAR  */
.ms-topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .03)
}

.ms-topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem
}

.ms-topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
    letter-spacing: -.02em;
    flex-shrink: 0
}

.ms-topbar-brand:hover {
    color: var(--text);
    text-decoration: none
}

.ms-topbar-brand-logo {
    width: 2.1rem;
    height: 2.1rem;
    display: block;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08)
}

.ms-topbar-brand-text {
    font-size: 1.1rem;
    white-space: nowrap
}

.ms-topbar-toggle {
    background: var(--surface);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    box-shadow: var(--shadow-xs)
}

.ms-topbar-toggle:hover {
    background: var(--primary-50);
    color: var(--primary);
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm)
}

.auth-card-body h4 {
    color: var(--text);
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: -.02em
}

.auth-card-body .text-muted {
    color: var(--text-muted) !important
}

.auth-card-body .form-label {
    color: var(--text-muted);
    font-weight: 600
}

.auth-card-body .form-check-label {
    color: var(--text)
}

.auth-card-body .form-control {
    height: 44px
}

.auth-card-body a {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none
}

.auth-card-body a:hover {
    text-decoration: underline
}

.auth-card-body input:-webkit-autofill,
.auth-card-body input:-webkit-autofill:hover,
.auth-card-body input:-webkit-autofill:focus,
.auth-card-body input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--text);
    -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
    box-shadow: 0 0 0 1000px var(--surface) inset;
    transition: background-color 5000s ease-in-out 0s;
}

.ms-breadcrumb {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .875rem;
    color: var(--text-muted)
}

.ms-breadcrumb-root {
    color: var(--text-muted)
}

.ms-breadcrumb-current {
    color: var(--text);
    font-weight: 600
}

[data-theme="dark"] .auth-card {
    border: 1px solid rgba(148, 163, 184, .2);
    box-shadow: 0 18px 55px rgba(2, 8, 23, .65)
}

[data-theme="dark"] .auth-card-body {
    background: linear-gradient(180deg, #0f172a 0%, #0b1324 100%)
}

[data-theme="dark"] .auth-card-body h4 {
    color: #dbe7ff
}

[data-theme="dark"] .auth-card-body .text-muted {
    color: #94a3b8 !important
}

[data-theme="dark"] .auth-card-body .form-label {
    color: #8ea3c0
}

[data-theme="dark"] .auth-card-body .form-control {
    background: #0d1a31;
    border-color: #2e3e66;
    color: #e5efff
}

[data-theme="dark"] .auth-card-body .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .2)
}

[data-theme="dark"] .auth-card-body .form-check-input {
    background-color: #10203d;
    border-color: #334a75
}

[data-theme="dark"] .auth-card-body .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary)
}

[data-theme="dark"] .auth-card-body a {
    color: #7dd3fc
}

[data-theme="dark"] .auth-card-body .btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent-dark));
    border-color: var(--primary)
}

[data-theme="dark"] .auth-card-body .btn-primary:hover {
    background: linear-gradient(135deg, #3b82f6, var(--primary))
}

[data-theme="dark"] .ms-topbar {
    background: #111827;
    border-bottom-color: var(--border)
}

.ms-topbar-right {
    display: flex;
    align-items: center;
    gap: .75rem
}

.ms-icon-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s
}

.ms-icon-btn:hover {
    background: var(--primary-50);
    color: var(--primary);
    border-color: var(--primary-light)
}

/* =====================================================  PROFILE BUTTON  */
.ms-profile-btn {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .4rem .65rem .4rem .4rem;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all .2s ease;
    box-shadow: var(--shadow-xs)
}

.ms-profile-btn:hover {
    background: var(--surface-2);
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm)
}

.ms-profile-btn.dropdown-toggle::after {
    display: none
}

.ms-profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: .82rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0
}

.ms-profile-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    min-width: 0
}

.ms-profile-name {
    font-size: .875rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px
}

.ms-profile-role {
    font-size: .73rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: capitalize;
    line-height: 1.2
}

.ms-profile-chevron {
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform .2s
}

.ms-profile-btn[aria-expanded="true"] .ms-profile-chevron {
    transform: rotate(180deg)
}

/* =====================================================  PROFILE DROPDOWN  */
.ms-profile-dropdown {
    min-width: 240px;
    padding: .5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
    margin-top: .5rem !important
}

.ms-dropdown-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem;
    border-radius: var(--radius-sm)
}

.ms-dropdown-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: .85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0
}

.ms-dropdown-name {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3
}

.ms-dropdown-email {
    font-size: .8rem;
    color: var(--text-muted);
    line-height: 1.3
}

.ms-dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: .35rem 0
}

.ms-dropdown-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem .75rem;
    border-radius: var(--radius-xs);
    color: var(--text);
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all .15s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: start
}

.ms-dropdown-item:hover {
    background: var(--primary-50);
    color: var(--primary)
}

.ms-dropdown-item svg {
    flex-shrink: 0;
    color: var(--text-muted)
}

.ms-dropdown-item:hover svg {
    color: var(--primary)
}

.ms-dropdown-logout {
    color: var(--red)
}

.ms-dropdown-logout svg {
    color: var(--red)
}

.ms-dropdown-logout:hover {
    background: var(--red-light);
    color: var(--red)
}

.ms-dropdown-logout:hover svg {
    color: var(--red)
}

/* =====================================================  CONTENT  */
.ms-content {
    flex: 1;
    padding: 1.75rem;
    min-width: 0
}

.ms-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap
}

.ms-page-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 .25rem;
    letter-spacing: -.02em
}

.ms-page-subtitle {
    font-size: .84rem;
    color: var(--text-muted);
    margin: 0
}

/* =====================================================  STAT CARDS  */
.ms-stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.35rem 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 1.15rem;
    transition: all .25s ease;
    position: relative;
    overflow: hidden
}

.ms-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--stat-color, var(--primary)), var(--stat-color-end, var(--accent)));
    opacity: .8
}

.ms-stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
    border-color: transparent
}

.ms-stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--stat-color-light, var(--primary-light));
    color: var(--stat-color, var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform .2s
}

.ms-stat-card:hover .ms-stat-icon {
    transform: scale(1.05)
}

.ms-stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
    margin-bottom: .25rem;
    letter-spacing: -.02em
}

.ms-stat-label {
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted)
}

.ms-stat-sublabel {
    font-size: .8rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: .1rem;
    text-transform: none;
    letter-spacing: 0
}

.stat-indigo {
    --stat-color: #2563eb;
    --stat-color-end: #3b82f6;
    --stat-color-light: #dbeafe
}

.stat-emerald {
    --stat-color: #16a34a;
    --stat-color-end: #22c55e;
    --stat-color-light: #dcfce7
}

.stat-amber {
    --stat-color: #ea580c;
    --stat-color-end: #f59e0b;
    --stat-color-light: #fff7ed
}

.stat-rose {
    --stat-color: #dc2626;
    --stat-color-end: #f43f5e;
    --stat-color-light: #fef2f2
}

.stat-sky {
    --stat-color: #0284c7;
    --stat-color-end: #0ea5e9;
    --stat-color-light: #e0f2fe
}

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

.ms-card-header {
    padding: 1.1rem 1.35rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap
}

.ms-card-title {
    font-size: .95rem;
    font-weight: 700;
    color: var(--text);
    margin: 0
}

.ms-card-body {
    padding: 1.25rem
}

/* =====================================================  BS OVERRIDES  */
.card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    color: var(--text);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs)
}

.card-header,
.card-footer {
    background: var(--surface-2);
    border-color: var(--border-light);
    color: var(--text)
}

.table {
    color: var(--text);
    border-color: var(--border-light);
    --bs-table-color: var(--text);
    --bs-table-bg: var(--surface);
    --bs-table-striped-color: var(--text);
    --bs-table-striped-bg: var(--surface-2);
    --bs-table-hover-color: var(--text);
    --bs-table-hover-bg: var(--primary-50)
}

.table thead th {
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #3b5998;
    background: linear-gradient(180deg, #eaf1fb 0%, #dce7f8 100%);
    border-bottom: 2px solid #c5d5f0;
    padding: .85rem .75rem
}

[data-theme="dark"] .table thead th {
    color: #93a8cc;
    background: linear-gradient(180deg, #152035 0%, #111b2e 100%);
    border-bottom-color: #1e3050;
}

.table> :not(caption)>*>* {
    color: var(--text);
    border-color: var(--border-light);
    padding: .8rem .75rem;
    vertical-align: middle
}

.table tbody tr {
    transition: background .15s
}

.table tbody tr:hover {
    background: var(--primary-50) !important
}

.modal-content {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    box-shadow: var(--shadow-lg)
}

.modal-header {
    border-color: var(--border-light);
    padding: 1.25rem 1.5rem
}

.modal-footer {
    border-color: var(--border-light);
    padding: 1rem 1.5rem
}

.modal-body {
    padding: 1.5rem
}

.form-control,
.form-select {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    padding: .55rem .85rem;
    transition: all .2s
}

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

.form-label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: .45rem
}

.btn {
    font-size: .875rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: .5rem 1.1rem;
    transition: all .2s ease;
    letter-spacing: .01em
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, .25)
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3b82f6, var(--primary));
    box-shadow: 0 4px 16px rgba(37, 99, 235, .35);
    transform: translateY(-1px)
}

.btn-primary:active {
    transform: translateY(0)
}

.btn-success {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(22, 163, 74, .25)
}

.btn-success:hover {
    background: linear-gradient(135deg, #22c55e, var(--accent));
    box-shadow: 0 4px 16px rgba(22, 163, 74, .35);
    transform: translateY(-1px)
}

.btn-danger {
    background: linear-gradient(135deg, var(--red), #b91c1c);
    border-color: var(--red)
}

.btn-outline-secondary {
    border-color: var(--border);
    color: var(--text-muted)
}

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

.table-action-cell {
    white-space: nowrap;
    min-width: 1%;
    width: 1%
}

.table-action-buttons {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: .4rem;
    flex-wrap: nowrap;
    white-space: nowrap;
    min-width: max-content
}

.table-action-buttons .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    white-space: nowrap;
    line-height: 1.2
}

.table-action-buttons .btn-sm {
    padding: .35rem .7rem;
    font-size: .8rem;
    min-height: 32px
}

.table-action-text {
    display: inline-block;
    white-space: nowrap;
    color: var(--text-muted);
    font-size: .82rem
}

@media(max-width:575.98px) {
    .table-action-cell {
        min-width: 220px;
        text-align: left !important
    }

    .table-action-buttons {
        justify-content: flex-start;
        gap: .35rem
    }

    .table-action-buttons .btn-sm {
        padding: .32rem .55rem;
        font-size: .76rem;
        min-height: 30px
    }
}

.btn-live-fleet {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, .25)
}

.btn-live-fleet:hover {
    background: linear-gradient(135deg, #3b82f6, var(--primary));
    box-shadow: 0 4px 16px rgba(37, 99, 235, .35);
    color: #fff;
    transform: translateY(-1px)
}

[data-theme="dark"] .btn-live-fleet {
    background: linear-gradient(135deg, #3b82f6, var(--primary));
    border-color: #3b82f6;
    color: #fff
}

[data-theme="dark"] .btn-live-fleet:hover {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    color: #fff
}

.btn-report {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: linear-gradient(135deg, #0f766e, #0d9488);
    border-color: #0f766e;
    color: #fff
}

.btn-report:hover {
    background: linear-gradient(135deg, #14b8a6, #0f766e);
    color: #fff;
    transform: translateY(-1px)
}

[data-theme="dark"] .btn-report {
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    border-color: #14b8a6;
    color: #062b27
}

[data-theme="dark"] .btn-report:hover {
    background: linear-gradient(135deg, #2dd4bf, #14b8a6);
    color: #042f2e
}

.btn-report-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    height: 38px;
    padding: 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-sm)
}

.btn-report-icon:hover {
    background: linear-gradient(135deg, #0f766e, #0d9488);
    border-color: #0f766e;
    color: #fff
}

[data-theme="dark"] .btn-report-icon {
    background: #162235;
    border-color: #223451;
    color: #93a4be
}

[data-theme="dark"] .btn-report-icon:hover {
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    border-color: #14b8a6;
    color: #062b27
}

.playback-filter-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    width: 100%
}

.playback-filter-actions .btn {
    height: 38px
}

.playback-filter-actions #loadTrips {
    flex: 0 0 auto;
    min-width: 112px;
    justify-content: center
}

.playback-filter-actions #reportPlayback {
    flex: 0 0 auto;
    min-width: 126px;
    justify-content: center
}

@media(max-width:1199.98px) {
    .playback-filter-actions {
        justify-content: flex-start
    }
}

.playback-trip-card {
    height: 100%
}

.playback-trip-list {
    max-height: 620px;
    overflow: auto;
    padding: .75rem;
    background: var(--surface-2);
    border-radius: var(--radius-sm)
}

.playback-trip-placeholder {
    padding: 1rem;
    color: var(--text-muted);
    font-size: .85rem
}

.playback-trip-tab {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .2rem;
    padding: .85rem .9rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--surface);
    margin-bottom: .55rem;
    transition: all .2s;
    text-align: left
}

.playback-trip-tab:last-child {
    margin-bottom: 0
}

.playback-trip-tab:hover {
    border-color: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm)
}

.playback-trip-tab.active {
    border-color: var(--primary);
    background: var(--primary-50);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, .15) inset
}

.playback-trip-title {
    font-size: .88rem;
    font-weight: 700;
    color: var(--text)
}

.playback-trip-time {
    font-size: .77rem;
    color: var(--text-muted)
}

.playback-trip-meta {
    font-size: .74rem;
    font-weight: 600;
    color: var(--primary)
}

#tripTabs .playback-trip-tab:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15)
}

.dropdown-menu {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: .84rem;
    min-width: 180px;
    box-shadow: var(--shadow-md);
    padding: .4rem
}

.dropdown-item {
    color: var(--text);
    padding: .5rem .85rem;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    transition: all .15s
}

.dropdown-item:hover {
    background: var(--primary-50);
    color: var(--primary)
}

.dropdown-divider {
    border-color: var(--border-light);
    margin: .3rem 0
}

.badge {
    font-weight: 600;
    font-size: .72rem;
    border-radius: var(--radius-xs);
    padding: .3em .6em
}

/* Select2 */
.select2-container .select2-selection--single {
    height: 38px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm)
}

.select2-container .select2-selection--single .select2-selection__rendered {
    color: var(--text);
    padding-top: 5px;
    padding-left: 10px
}

.select2-container .select2-selection--single .select2-selection__arrow {
    top: 6px
}

.select2-dropdown {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
    border-radius: var(--radius-sm)
}

.select2-results__option--highlighted {
    background: var(--primary) !important
}

/* DataTables */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: .4rem .75rem;
    font-size: .84rem;
    transition: border-color .2s
}

.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1)
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate .paginate_button {
    font-size: .82rem;
    color: var(--text-muted) !important
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
    border-radius: var(--radius-xs)
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--surface-2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    border-radius: var(--radius-xs)
}

.ms-content .dataTables_wrapper {
    max-width: 100%
}

.ms-content .dataTables_wrapper .dataTables_filter {
    float: none;
    text-align: end
}

.ms-content .table-responsive {
    min-width: 0
}

#map {
    min-height: 500px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light)
}

.stop-label-tooltip {
    background: transparent;
    border: 0;
    box-shadow: none;
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    margin-top: -1px
}

.stop-label-tooltip::before {
    display: none
}

.stop-balloon-marker {
    background: transparent;
    border: 0
}

.stop-balloon-pin {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50% 50% 50% 0;
    background: #dc2626;
    border: 2px solid #fff;
    box-shadow: 0 6px 16px rgba(220, 38, 38, .35);
    transform: rotate(-45deg)
}

.stop-balloon-pin::after {
    content: '';
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12)
}

.stop-balloon-pin span {
    position: relative;
    z-index: 1;
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
    transform: rotate(45deg)
}

.playback-vehicle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000
}

.playback-vehicle-icon svg {
    width: 44px;
    height: 44px;
    display: block
}

.route-point-marker {
    background: transparent;
    border: 0
}

.route-point-pin {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 2px solid #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
    border-radius: 8px;
    transform: none
}

.route-point-pin span {
    position: relative;
    z-index: 1;
    color: #fff;
    font-size: .8rem;
    font-weight: 800;
    transform: none
}

.route-point-pin.route-point-start {
    background: var(--accent)
}

.route-point-pin.route-point-end {
    background: var(--text)
}

.map-picker-marker {
    background: transparent;
    border: 0
}

.map-picker-pin {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50% 50% 50% 0;
    background: var(--primary);
    border: 2px solid #fff;
    box-shadow: 0 6px 18px rgba(37, 99, 235, .35);
    transform: rotate(-45deg)
}

.map-picker-pin span {
    position: relative;
    z-index: 1;
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
    transform: rotate(45deg)
}

.ms-map-picker-canvas {
    height: 380px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
    background: #e5eef7
}

/* =====================================================  SIDEBAR COLLAPSED  */
body.sidebar-collapsed .ms-sidebar {
    width: 72px
}

body.sidebar-collapsed .ms-sidebar .ms-brand-text,
body.sidebar-collapsed .ms-sidebar .ms-nav-label,
body.sidebar-collapsed .ms-sidebar .ms-user-info,
body.sidebar-collapsed .ms-sidebar .ms-sidebar-section-label,
body.sidebar-collapsed .ms-sidebar .ms-user-pill {
    display: none
}

body.sidebar-collapsed .ms-sidebar .ms-sidebar-brand {
    justify-content: center;
    padding: 1.25rem .5rem 1rem
}

body.sidebar-collapsed .ms-sidebar .ms-nav-item {
    justify-content: center;
    padding: .65rem .5rem;
    border-left: none
}

body.sidebar-collapsed .ms-sidebar .ms-nav-item.active {
    border-left: none;
    background: var(--sidebar-active-bg)
}

body.sidebar-collapsed .ms-sidebar .ms-sidebar-nav {
    padding: 0 .4rem
}

body.sidebar-collapsed .ms-sidebar .ms-sidebar-footer {
    padding: .75rem .5rem
}

body.ms-has-sidebar.sidebar-collapsed .ms-main-wrapper {
    margin-left: 72px;
    width: calc(100% - 72px);
    max-width: calc(100% - 72px)
}

/* =====================================================  RESPONSIVE  */
@media(max-width:991.98px) {
    .ms-sidebar {
        transform: translateX(-100%)
    }

    .ms-sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg)
    }

    .ms-main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important
    }

    .ms-content {
        padding: 1.25rem
    }
}

@media(max-width:767.98px) {
    .ms-main-wrapper {
        overflow-x: hidden
    }

    .ms-content {
        padding: 1.25rem;
        overflow-x: hidden
    }
}

/* =====================================================  AUTH  */
body.auth-body {
    background: linear-gradient(160deg, #0c1929 0%, #0f2440 30%, #0a2a3a 60%, #0c1929 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative
}

body.auth-body::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(37, 99, 235, .08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(22, 163, 74, .06) 0%, transparent 50%);
    pointer-events: none
}

.auth-card {
    background: var(--surface);
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .25);
    width: 100%;
    max-width: 440px;
    overflow: hidden;
    position: relative
}

.auth-card-header {
    background: linear-gradient(135deg, var(--primary), var(--accent-dark));
    padding: 2.25rem 2rem 1.75rem;
    text-align: center;
    color: #fff;
    position: relative
}

.auth-card-header::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 0;
    right: 0;
    height: 40px;
    background: var(--surface);
    border-radius: 20px 20px 0 0
}

.auth-logo {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, .2);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto .75rem;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, .15)
}

.auth-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 14px
}

.auth-brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0 0 .2rem;
    letter-spacing: -.01em
}

.auth-brand-sub {
    font-size: .8rem;
    opacity: .85;
    margin: 0
}

.auth-card-body {
    padding: 2rem 2rem 2.5rem
}

[data-theme="dark"] body.auth-body {
    background: linear-gradient(160deg, #050b16 0%, #0a1525 30%, #061a28 60%, #050b16 100%)
}

[data-theme="dark"] .auth-card-header {
    background: linear-gradient(135deg, var(--primary), var(--accent-dark))
}

.guest-theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 20;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text)
}

.guest-theme-toggle:hover {
    background: var(--surface-2)
}

/* =====================================================  ANIMATIONS  */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px)
    }

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

.ms-stat-card,
.ms-card {
    animation: fadeInUp .4s ease-out both
}

.ms-stat-card:nth-child(1) {
    animation-delay: .05s
}

.ms-stat-card:nth-child(2) {
    animation-delay: .1s
}

.ms-stat-card:nth-child(3) {
    animation-delay: .15s
}

.ms-stat-card:nth-child(4) {
    animation-delay: .2s
}

/* =====================================================  SCROLLBAR  */
::-webkit-scrollbar {
    width: 6px;
    height: 6px
}

::-webkit-scrollbar-track {
    background: transparent
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 99px
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted)
}

/* =====================================================  SELECTION  */
::selection {
    background: rgba(37, 99, 235, .15);
    color: var(--text)
}

/* =====================================================  LINKS  */
a {
    color: var(--primary);
    text-decoration: none;
    transition: color .2s
}

a:hover {
    color: var(--primary-dark)
}
