/* =====================================================
   MitraServices VTS — Modern Admin CSS
   ===================================================== */

/* ---- CSS Variables ---- */
:root {
    --sidebar-w: 260px;
    --topbar-h: 60px;

    --primary: #4f46e5;
    --primary-light: #ede9fe;
    --primary-dark: #3730a3;

    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e2e8f0;

    --text: #0f172a;
    --text-muted: #64748b;

    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-hover: rgba(255, 255, 255, .06);
    --sidebar-active-bg: rgba(79, 70, 229, .18);
    --sidebar-active-text: #a5b4fc;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, .08);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, .12);

    --radius: .75rem;
    --radius-sm: .5rem;
}

[data-theme="dark"] {
    --bg: #0b1120;
    --surface: #131d2e;
    --surface-2: #1a2540;
    --border: #1e2d45;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --sidebar-bg: #08101c;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, .4);
}

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

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: .9rem;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden
}

/* =====================================================  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 .25s ease, width .25s ease;
    overflow-y: auto;
    overflow-x: hidden
}

.ms-sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    flex-shrink: 0
}

.ms-brand-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: .6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0
}

.ms-brand-text {
    font-size: .95rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.01em;
    white-space: nowrap
}

.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: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--sidebar-text);
    padding: 1.1rem 1.25rem .4rem;
    opacity: .7
}

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

.ms-nav-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .75rem;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    font-size: .875rem;
    transition: background .15s, color .15s;
    cursor: pointer
}

.ms-nav-item:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0
}

.ms-nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text)
}

.ms-nav-item.active .ms-nav-icon {
    color: #818cf8
}

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

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

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

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

.ms-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0
}

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

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

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

.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 .25s ease, width .25s ease
}

/* Admin only: reserve space for fixed sidebar — width must shrink or the column overflows the viewport */
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: .15rem;
    margin-left: .25rem;
    flex-wrap: wrap;
}

.ms-topbar-link {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    padding: .35rem .65rem;
    border-radius: .45rem;
    transition: background .15s, color .15s;
}

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

.ms-topbar-link.active {
    color: var(--primary);
    background: 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-user-topbar {
        min-width: 5.7rem;
        height: 2.7rem;
        gap: .65rem;
        padding: .35rem .55rem;
        border-radius: .7rem;
    }

    .ms-user-menu-lines span {
        width: 1.25rem;
        height: .16rem;
    }

    .ms-user-menu-lines span:nth-child(2) {
        width: 1.05rem;
    }

    .ms-user-avatar-sm {
        width: 2rem;
        height: 2rem;
    }

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

    /* Stat cards — vertical layout on mobile */
    .ms-stat-card {
        flex-direction: column;
        align-items: flex-start;
        padding: .9rem 1rem;
        gap: .55rem;
    }

    .ms-stat-icon {
        width: 38px;
        height: 38px;
        border-radius: .6rem;
    }

    .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);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm)
}

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

.ms-topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    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: 2rem;
    height: 2rem;
    display: block;
    border-radius: .55rem;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .12)
}

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

.ms-topbar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: .4rem;
    display: flex;
    align-items: center;
    transition: background .15s, color .15s
}

.ms-topbar-toggle:hover {
    background: var(--border);
    color: var(--text)
}

.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: #2563eb;
    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: .4rem;
    font-size: .82rem;
    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: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .24)
}

[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: #4f46e5;
    border-color: #4f46e5
}

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

[data-theme="dark"] .auth-card-body .btn-primary {
    background: linear-gradient(90deg, #4f46e5, #4338ca);
    border-color: #4f46e5
}

[data-theme="dark"] .auth-card-body .btn-primary:hover {
    background: linear-gradient(90deg, #6366f1, #4f46e5)
}

.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: 36px;
    height: 36px;
    border-radius: .5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s, color .15s
}

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

.ms-user-topbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .1);
    border-radius: .9rem;
    /* padding: .55rem .85rem .55rem 1rem;
    min-width: 7.8rem;
    height: 3.55rem;
    color: var(--text);
    font-size: .84rem;
    font-weight: 500; */
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
    transition: transform .15s, background .15s, border-color .15s, box-shadow .15s
}

.ms-user-topbar:hover {
    background: #fbfdff;
    border-color: rgba(79, 70, 229, .25);
    box-shadow: 0 10px 28px rgba(15, 23, 42, .12);
    transform: translateY(-1px)
}

.ms-user-topbar.dropdown-toggle::after {
    display: none
}

.ms-user-menu-lines {
    display: inline-flex;
    flex-direction: column;
    gap: .28rem;
    flex-shrink: 0
}

.ms-user-menu-lines span {
    display: block;
    width: 1.55rem;
    height: .2rem;
    border-radius: 999px;
    background: #64748b
}

.ms-user-menu-lines span:nth-child(2) {
    width: 1.35rem
}

.ms-user-avatar-sm {
    width: 2.45rem;
    height: 2.45rem;
    border-radius: 50%;
    background: linear-gradient(145deg, #667196 0%, #4f5a7d 100%);
    display: block;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18), 0 3px 8px rgba(15, 23, 42, .16)
}

.ms-user-avatar-head {
    position: absolute;
    top: .45rem;
    left: 50%;
    width: .92rem;
    height: .92rem;
    border-radius: 50%;
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    transform: translateX(-50%)
}

.ms-user-avatar-body {
    position: absolute;
    left: 50%;
    bottom: -.3rem;
    width: 2.05rem;
    height: 1.45rem;
    border-radius: 50% 50% 0 0;
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    transform: translateX(-50%)
}

/* =====================================================  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.5rem;
    flex-wrap: wrap
}

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

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

/* =====================================================  STAT CARDS  */
.ms-stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.4rem 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: box-shadow .2s, transform .2s;
    position: relative;
    overflow: hidden
}

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

.ms-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stat-color, var(--primary));
    border-radius: var(--radius) var(--radius) 0 0
}

.ms-stat-icon {
    width: 52px;
    height: 52px;
    border-radius: .8rem;
    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
}

.ms-stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
    margin-bottom: .2rem
}

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

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

.stat-indigo {
    --stat-color: #4f46e5;
    --stat-color-light: #ede9fe
}

.stat-emerald {
    --stat-color: #10b981;
    --stat-color-light: #d1fae5
}

.stat-amber {
    --stat-color: #f59e0b;
    --stat-color-light: #fef3c7
}

.stat-rose {
    --stat-color: #f43f5e;
    --stat-color-light: #ffe4e6
}

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

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

.ms-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    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);
    color: var(--text)
}

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

.table {
    color: var(--text);
    border-color: var(--border);
    --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: rgba(79, 70, 229, .05)
}

.table thead th {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--surface-2);
    border-bottom: 2px solid var(--border)
}

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

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

.modal-header,
.modal-footer {
    border-color: var(--border)
}

.form-control,
.form-select {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-size: .875rem
}

.form-control:focus,
.form-select:focus {
    background: var(--surface);
    color: var(--text);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .15)
}

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

.btn {
    font-size: .84rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: .45rem 1rem;
    transition: all .15s
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark)
}

.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: .78rem;
    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: #2563eb;
    border-color: #2563eb;
    color: #fff
}

.btn-live-fleet:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff
}

[data-theme="dark"] .btn-live-fleet {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff
}

[data-theme="dark"] .btn-live-fleet:hover {
    background: #60a5fa;
    border-color: #60a5fa;
    color: #0b1120
}

.btn-report {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: #0f766e;
    border-color: #0f766e;
    color: #fff
}

.btn-report:hover {
    background: #0d9488;
    border-color: #0d9488;
    color: #fff
}

[data-theme="dark"] .btn-report {
    background: #14b8a6;
    border-color: #14b8a6;
    color: #062b27
}

[data-theme="dark"] .btn-report:hover {
    background: #2dd4bf;
    border-color: #2dd4bf;
    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)
}

.btn-report-icon:hover {
    background: #0f766e;
    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: #14b8a6;
    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: .65rem;
    background: var(--surface-2)
}

.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: .8rem .85rem;
    border: 1px solid var(--border);
    border-radius: .65rem;
    background: var(--surface);
    margin-bottom: .55rem;
    transition: border-color .15s, background .15s, transform .15s;
    text-align: left
}

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

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

.playback-trip-tab.active {
    border-color: var(--primary);
    background: rgba(79, 70, 229, .08);
    box-shadow: 0 0 0 1px rgba(79, 70, 229, .18) 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(79, 70, 229, .16)
}

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

.dropdown-item {
    color: var(--text);
    padding: .5rem .9rem;
    border-radius: .3rem;
    display: flex;
    align-items: center
}

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

.dropdown-divider {
    border-color: var(--border)
}

.badge {
    font-weight: 600;
    font-size: .72rem;
    border-radius: .4rem
}

/* 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)
}

.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: .3rem .6rem;
    font-size: .84rem
}

.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: .4rem
}

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

/* Keep DataTables layout inside the content column (filter row + wide tables) */
.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)
}

.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 8px 18px rgba(15, 23, 42, .28);
    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 10px 22px rgba(15, 23, 42, .3);
    border-radius: 6px;
    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: #16a34a;
}

.route-point-pin.route-point-end {
    background: #0f172a;
}

.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: #2563eb;
    border: 2px solid #fff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .28);
    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);
    border-radius: 18px;
    overflow: hidden;
    background: #e5eef7
}

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

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-sidebar-nav {
    padding: 0 .35rem
}

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

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

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

/* =====================================================  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(135deg, #4f46e5 0%, #7c3aed 50%, #0ea5e9 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem
}

.auth-card {
    background: var(--surface);
    border-radius: 1.25rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    overflow: hidden
}

.auth-card-header {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    padding: 2rem 2rem 1.5rem;
    text-align: center;
    color: #fff
}

.auth-logo {
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, .2);
    border-radius: .9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto .75rem;
    backdrop-filter: blur(4px)
}

.auth-brand-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 .2rem
}

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

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

[data-theme="dark"] body.auth-body {
    background: linear-gradient(145deg, #050b16 0%, #0f1d33 45%, #0b2338 100%)
}

[data-theme="dark"] .auth-card-header {
    background: linear-gradient(135deg, #1d4ed8, #0f766e)
}

.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)
}