:root {
    --navy-950: #071529;
    --navy-900: #0b1f3a;
    --navy-800: #122c4f;
    --blue-700: #1d4ed8;
    --blue-600: #2563eb;
    --blue-100: #dbeafe;
    --blue-50: #eff6ff;
    --slate-900: #0f172a;
    --slate-700: #334155;
    --slate-500: #64748b;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --bg-app: #f8fafc;
    --sidebar-width: 260px;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-app);
    color: var(--slate-900);
    -webkit-font-smoothing: antialiased;
}

.num {
    font-variant-numeric: tabular-nums;
}

/* Cards */
.app-card {
    background: #ffffff;
    border: 1px solid var(--slate-200);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.app-card-header {
    padding: 0.95rem 1.25rem;
    border-bottom: 1px solid var(--slate-200);
    background: #ffffff;
    border-radius: 14px 14px 0 0;
}

.kpi-card {
    background: #ffffff;
    border: 1px solid var(--slate-200);
    border-radius: 14px;
    padding: 1rem 1.15rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    height: 100%;
}

.kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* Sidebar (Admin / Accountant) */
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--navy-900);
    color: #cbd5e1;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1035;
    overflow-y: auto;
}

.app-mobile-sidebar {
    width: 275px !important;
    background: var(--navy-900) !important;
    color: #cbd5e1 !important;
}

.app-mobile-sidebar .offcanvas-header {
    background: var(--navy-950);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.95rem 1.15rem;
}

.app-mobile-sidebar .offcanvas-body {
    overflow-y: auto;
}

.sidebar-nav .brand-box {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: var(--navy-950);
}

.sidebar-nav .nav-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    padding: 1rem 1.25rem 0.35rem;
    font-weight: 700;
}

.sidebar-nav .nav-link {
    color: #cbd5e1 !important;
    padding: 0.65rem 1.15rem;
    margin: 0.12rem 0.75rem;
    border-radius: 9px;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
}

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

.sidebar-nav .nav-link.active {
    background: var(--blue-600);
    color: #ffffff !important;
    font-weight: 600;
}

.app-main-with-sidebar {
    margin-left: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

@media (min-width: 992px) {
    .app-main-with-sidebar {
        margin-left: var(--sidebar-width);
    }
}

.app-topbar {
    background: #ffffff;
    border-bottom: 1px solid var(--slate-200);
    height: 62px;
    position: sticky;
    top: 0;
    z-index: 1020;
}

/* Driver Mobile Layout */
.driver-shell {
    padding-bottom: 84px;
    min-height: 100vh;
}

.driver-topbar {
    background: var(--navy-900);
    color: #ffffff;
    position: sticky;
    top: 0;
    z-index: 1025;
}

.driver-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 68px;
    background: #ffffff;
    border-top: 1px solid var(--slate-200);
    box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.06);
    z-index: 1030;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding-bottom: env(safe-area-inset-bottom);
}

.driver-bottom-nav a {
    text-decoration: none;
    color: var(--slate-500);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 600;
    gap: 2px;
}

.driver-bottom-nav a i {
    font-size: 1.25rem;
}

.driver-bottom-nav a.active {
    color: var(--blue-700);
}

/* Touch-friendly controls */
.btn-touch {
    min-height: 46px;
    font-weight: 600;
    border-radius: 10px;
}

.form-control,
.form-select {
    border-radius: 10px;
    border-color: #cbd5e1;
    min-height: 42px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--blue-600);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--slate-700);
    margin-bottom: 0.35rem;
}

/* Responsive Table -> Cards on Mobile */
@media (max-width: 767.98px) {
    .table-mobile-cards thead {
        display: none;
    }

    .table-mobile-cards tbody tr {
        display: block;
        background: #ffffff;
        border: 1px solid var(--slate-200);
        border-radius: 12px;
        margin-bottom: 0.75rem;
        padding: 0.75rem 0.9rem;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    }

    .table-mobile-cards tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none;
        padding: 0.32rem 0;
        text-align: right;
        gap: 0.75rem;
    }

    .table-mobile-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.78rem;
        color: var(--slate-500);
        text-align: left;
    }

    .table-mobile-cards tbody td:last-child {
        border-top: 1px dashed var(--slate-200);
        margin-top: 0.35rem;
        padding-top: 0.55rem;
        justify-content: flex-end;
    }

    .table-mobile-cards tbody td:last-child::before {
        content: '';
    }
}

/* Searchable Select Wrapper */
.searchable-select-wrap {
    position: relative;
}

.searchable-select-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 1050;
    background: #ffffff;
    border: 1px solid var(--slate-200);
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
    max-height: 240px;
    overflow-y: auto;
    margin-top: 4px;
    display: none;
}

.searchable-select-dropdown.show {
    display: block;
}

.searchable-select-option {
    padding: 0.6rem 0.85rem;
    cursor: pointer;
    border-bottom: 1px solid var(--slate-100);
    font-size: 0.9rem;
}

.searchable-select-option:hover,
.searchable-select-option.active {
    background: var(--blue-50);
    color: var(--blue-700);
}

/* Status Badges */
.badge-soft-primary { background: #dbeafe; color: #1e40af; }
.badge-soft-success { background: #d1fae5; color: #065f46; }
.badge-soft-warning { background: #fef3c7; color: #92400e; }
.badge-soft-danger { background: #fee2e2; color: #991b1b; }
.badge-soft-secondary { background: #e2e8f0; color: #334155; }
.badge-soft-info { background: #e0e7ff; color: #3730a3; }

/* Print helper */
@media print {
    .no-print, .app-sidebar, .app-topbar, .driver-bottom-nav {
        display: none !important;
    }
    .app-main-with-sidebar {
        margin-left: 0 !important;
    }
}
