/* ============================================================
   HumRide — Global Theme
   Premium palette, mobile-first, override layer on top of Bootstrap 5.
   All UI colors, radii, spacing, shadows flow from these tokens.
   ============================================================ */

:root {
    /* ---- Brand Palette ---- */
    --hr-primary: #0F766E; /* Teal-700: trust + transit */
    --hr-primary-hover: #115E59; /* Teal-800 */
    --hr-primary-soft: #CCFBF1; /* Teal-100 */
    --hr-accent: #F59E0B; /* Amber-500: highlights, badges */
    --hr-accent-soft: #FEF3C7; /* Amber-100 */
    --hr-success: #15803D;
    --hr-success-soft: #DCFCE7;
    --hr-danger: #B91C1C;
    --hr-danger-soft: #FEE2E2;
    --hr-warning: #B45309;
    --hr-warning-soft: #FEF3C7;
    --hr-info: #1D4ED8;
    --hr-info-soft: #DBEAFE;
    /* ---- Neutrals ---- */
    --hr-bg: #F8FAFC; /* page background */
    --hr-surface: #FFFFFF; /* card surface */
    --hr-surface-2: #F1F5F9; /* subtle surface */
    --hr-border: #E2E8F0;
    --hr-border-strong: #CBD5E1;
    --hr-text: #0F172A; /* primary text */
    --hr-text-muted: #475569; /* secondary text */
    --hr-text-subtle: #94A3B8; /* tertiary / placeholders */
    /* ---- Typography ---- */
    --hr-font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --hr-font-mono: "JetBrains Mono", "SF Mono", Menlo, monospace;
    /* ---- Radius / Shadow ---- */
    --hr-radius-sm: 6px;
    --hr-radius: 10px;
    --hr-radius-lg: 16px;
    --hr-radius-pill: 5px;
    --hr-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --hr-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --hr-shadow: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
    --hr-shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.10), 0 4px 8px rgba(15, 23, 42, 0.05);
    /* ---- Layout ---- */
    --hr-sidebar-w: 260px;
    --hr-sidebar-w-mobile: 100%;
    --hr-header-h: 60px;
    --hr-content-max: 1320px;
    /* ---- Transitions ---- */
    --hr-trans-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --hr-trans: 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   Base
   ============================================================ */

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: var(--hr-font-sans);
    color: var(--hr-text);
    background: var(--hr-bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--hr-primary);
    text-decoration: none;
    transition: color var(--hr-trans-fast);
}

    a:hover {
        color: var(--hr-primary-hover);
    }

/* Bootstrap primary override */
.btn-primary,
.bg-primary,
.text-primary,
.link-primary {
    --bs-primary: var(--hr-primary);
    --bs-primary-rgb: 15, 118, 110;
}

.btn-primary {
    background-color: var(--hr-primary);
    border-color: var(--hr-primary);
    color: #fff;
    transition: background-color var(--hr-trans-fast), transform var(--hr-trans-fast);
}

    .btn-primary:hover,
    .btn-primary:focus {
        background-color: var(--hr-primary-hover);
        border-color: var(--hr-primary-hover);
        color: #fff;
    }

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

    .btn-primary:disabled {
        opacity: 0.65;
    }

.btn-outline-disabled {
    color: var(--hr-primary);
    border-color: var(--hr-primary);
}

    .btn-outline-disabled:hover {
        background-color: var(--hr-surface-2);
        border-color: var(--hr-primary);
    }

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

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

.btn {
    border-radius: var(--hr-radius);
    font-weight: 500;
    padding: 0.55rem 1.1rem;
    letter-spacing: -0.01em;
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.4rem;
    font-size: 1rem;
}

/* ============================================================
   Auth Pages (centralized)
   ============================================================ */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: radial-gradient(circle at 20% 20%, rgba(15, 118, 110, 0.08), transparent 40%), radial-gradient(circle at 80% 80%, rgba(245, 158, 11, 0.06), transparent 40%), var(--hr-bg);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--hr-surface);
    border-radius: var(--hr-radius-lg);
    box-shadow: var(--hr-shadow-lg);
    padding: 36px 32px;
}

/* Constrains the card to the viewport and scrolls only the form region, so a
   widget that grows taller (e.g. the Turnstile CAPTCHA rendering) or a
   scroll-into-view from a child iframe can't carry the brand/title off-screen. */
.auth-card--scrollable {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 48px);
    overflow: hidden;
}

    .auth-card--scrollable .auth-brand {
        flex: 0 0 auto;
    }

    .auth-card--scrollable .auth-scroll {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
    }

/* ── Brand logo (icon + wordmark lockup) ──────────────────────────────
   Renders /humride-logo.png cropped to its content. The source PNG is a
   centered ~1040×216 logo inside a 1685×1192 transparent canvas, so the
   padding is cropped away via background-size/position. The scale is uniform
   in both axes (162.02% ≈ 1685/1040, 551.85% ≈ 1192/216) so there is no
   distortion. Size it by setting `height`; width follows the aspect-ratio. */
.hr-logo {
    display: inline-block;
    height: 28px;
    aspect-ratio: 1040 / 216;
    background: url('/humride-logo.png') no-repeat center / 162.02% 551.85%;
    flex-shrink: 0;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 28px;
    text-decoration: none;
    color: inherit;
}

    .auth-brand .hr-logo {
        height: 34px;
    }

    .auth-brand .brand-mark {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        background: linear-gradient(135deg, var(--hr-primary), #14B8A6);
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff;
        font-weight: 700;
        font-size: 18px;
        letter-spacing: -0.02em;
    }

    .auth-brand .brand-name {
        font-weight: 700;
        font-size: 20px;
        color: var(--hr-text);
        letter-spacing: -0.02em;
    }

.auth-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--hr-text);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.auth-subtitle {
    color: var(--hr-text-muted);
    font-size: 15px;
    margin-bottom: 24px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--hr-text-muted);
    font-size: 14px;
}

/* Form controls */
.form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--hr-text);
    margin-bottom: 6px;
}

.form-control {
    border: 1px solid var(--hr-border);
    border-radius: var(--hr-radius);
    padding: 0.625rem 0.9rem;
    font-size: 15px;
    transition: border-color var(--hr-trans-fast), box-shadow var(--hr-trans-fast);
}

    .form-control:focus {
        border-color: var(--hr-primary);
        box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
    }

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

.form-select {
    border: 1px solid var(--hr-border);
    border-radius: var(--hr-radius);
    padding: 0.625rem 2.25rem 0.625rem 0.9rem;
}

    .form-select:focus {
        border-color: var(--hr-primary);
        box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
    }

.input-group .form-control {
    border-right: 0;
}

.input-group-text {
    background: var(--hr-surface-2);
    border-color: var(--hr-border);
    color: var(--hr-text-muted);
}

/* Validation */
.form-control.is-invalid,
.form-control.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.12);
    background-image: none;
}

.input-group.has-validation .btn-outline-secondary {
    border-color: var(--hr-border);
}

.input-group.has-validation .form-control.is-invalid ~ .btn-outline-secondary {
    border-color: #dc3545;
    border-left: 0;
}

.invalid-feedback {
    font-size: 13px;
    margin-top: 5px;
}

/* ============================================================
   Portal Shell (admin/driver/passenger)
   ============================================================ */

.app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--hr-bg);
}

/* Sidebar */
.app-sidebar {
    width: var(--hr-sidebar-w);
    background: var(--hr-surface);
    border-right: 1px solid var(--hr-border);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    overflow-y: auto;
    transition: transform var(--hr-trans);
    display: flex;
    flex-direction: column;
}

    .app-sidebar .sidebar-brand {
        padding: 20px 22px 16px;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 7px;
        border-bottom: 1px solid var(--hr-border);
    }

        .app-sidebar .sidebar-brand .hr-logo {
            height: 28px;
            max-width: 100%;
        }

        .app-sidebar .sidebar-brand .brand-role {
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: var(--hr-text-subtle);
        }

    .app-sidebar nav {
        padding: 14px 12px;
        flex: 1;
    }

        .app-sidebar nav .nav-section {
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: var(--hr-text-subtle);
            padding: 14px 12px 8px;
            font-weight: 600;
        }

        .app-sidebar nav a {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 9px 12px;
            margin-bottom: 2px;
            border-radius: var(--hr-radius);
            color: var(--hr-text-muted);
            font-size: 14px;
            font-weight: 500;
            transition: background var(--hr-trans-fast), color var(--hr-trans-fast);
        }

            .app-sidebar nav a i {
                font-size: 17px;
                width: 20px;
                text-align: center;
            }

            .app-sidebar nav a:hover {
                background: var(--hr-surface-2);
                color: var(--hr-text);
            }

            .app-sidebar nav a.active {
                background: var(--hr-primary-soft);
                color: var(--hr-primary-hover);
            }

                .app-sidebar nav a.active i {
                    color: var(--hr-primary);
                }

    .app-sidebar .sidebar-footer {
        padding: 12px 12px 18px;
        border-top: 1px solid var(--hr-border);
    }

/* Mobile sidebar toggle */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1039;
    display: none;
}

    .sidebar-backdrop.show {
        display: block;
    }

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        box-shadow: var(--hr-shadow-lg);
    }

        .app-sidebar.show {
            transform: translateX(0);
        }
}

/* Main content area */
.app-main {
    flex: 1;
    margin-left: var(--hr-sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

@media (max-width: 991.98px) {
    .app-main {
        margin-left: 0;
    }
}

.app-header {
    height: var(--hr-header-h);
    background: var(--hr-surface);
    border-bottom: 1px solid var(--hr-border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 1030;
}

    .app-header .page-title {
        flex: 1;
        font-size: 17px;
        font-weight: 600;
        color: var(--hr-text);
        margin: 0;
        letter-spacing: -0.01em;
    }

    .app-header .header-actions {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .app-header .header-user {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 6px 10px 6px 6px;
        border-radius: var(--hr-radius-pill);
        cursor: pointer;
        transition: background var(--hr-trans-fast);
    }

        .app-header .header-user:hover {
            background: var(--hr-surface-2);
        }

    .app-header .avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--hr-primary), #14B8A6);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        font-size: 13px;
    }

    .app-header .user-name {
        font-size: 14px;
        font-weight: 500;
        color: var(--hr-text);
        line-height: 1.1;
    }

    .app-header .user-role {
        font-size: 11px;
        color: var(--hr-text-subtle);
    }

    .app-header .mobile-menu-btn {
        display: none;
        background: transparent;
        border: 0;
        font-size: 20px;
        color: var(--hr-text);
        padding: 6px 8px;
        cursor: pointer;
    }

    .app-header .notif-bell-btn {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        color: var(--hr-text-subtle);
        font-size: 18px;
        text-decoration: none;
        transition: background var(--hr-trans-fast), color var(--hr-trans-fast);
        flex-shrink: 0;
    }

    .app-header .notif-bell-btn:hover {
        background: var(--hr-surface-2);
        color: var(--hr-text);
    }

    .app-header .notif-badge {
        display: none;
        position: absolute;
        top: 3px;
        right: 3px;
        min-width: 16px;
        height: 16px;
        border-radius: 8px;
        background: var(--hr-danger);
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        line-height: 16px;
        text-align: center;
        padding: 0 4px;
        pointer-events: none;
    }

    .app-header .notif-badge.show {
        display: block;
    }

    /* Passenger emergency SOS — pinned to the header's horizontal center so it stays reachable
       and visible on narrow/mobile viewports; only shown once a confirmed ride's start time has passed. */
    .app-header .sos-header-btn {
        display: none;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        align-items: center;
        gap: 6px;
        padding: 7px 18px;
        border-radius: var(--hr-radius-pill);
        background: var(--hr-danger);
        color: #fff;
        font-size: 13px;
        font-weight: 700;
        letter-spacing: 0.03em;
        border: none;
        cursor: pointer;
        white-space: nowrap;
        z-index: 5;
        animation: sos-pulse 1.6s ease-in-out infinite;
    }

    .app-header .sos-header-btn.show {
        display: inline-flex;
    }

    .app-header .sos-header-btn:hover {
        background: #991B1B;
    }

    .app-header .sos-header-btn:disabled {
        opacity: 0.7;
        cursor: not-allowed;
        animation: none;
    }

    @keyframes sos-pulse {
        0%, 100% { box-shadow: 0 0 0 0 rgba(185, 28, 28, 0.45); }
        50% { box-shadow: 0 0 0 6px rgba(185, 28, 28, 0); }
    }

    /* Simulated "test time" pill — shown only when a time-travel offset is active. */
    .app-header .hr-server-clock {
        display: none;
        align-items: center;
        gap: 6px;
        padding: 5px 11px;
        border-radius: var(--hr-radius-pill);
        background: #FEF3C7;
        color: #92400E;
        font-size: 13px;
        font-weight: 600;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .app-header .hr-server-clock.show {
        display: inline-flex;
    }

@media (max-width: 991.98px) {
    .app-header .mobile-menu-btn {
        display: inline-flex;
    }

    .app-header .user-name,
    .app-header .user-role {
        display: none;
    }
}

.app-content {
    padding: 24px;
    max-width: var(--hr-content-max);
    width: 100%;
    margin: 0 auto;
}

@media (max-width: 575.98px) {
    .app-content {
        padding: 16px;
    }

    .app-header {
        padding: 0 16px;
    }

    /* Kill Bootstrap row negative gutters inside DataTables so nothing bleeds outside the card */
    .dataTables_wrapper .row {
        --bs-gutter-x: 0;
    }
}

/* ============================================================
   Cards / panels
   ============================================================ */

.hr-card {
    background: var(--hr-surface);
    border: 1px solid var(--hr-border);
    border-radius: var(--hr-radius-lg);
    box-shadow: var(--hr-shadow-xs);
    overflow: hidden;
}

.hr-card-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--hr-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.hr-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--hr-text);
    margin: 0;
    letter-spacing: -0.01em;
}

.hr-card-body {
    padding: 20px;
}
/*.hr-card-body.tight { padding: 0; }*/

/* Stat card (dashboard tiles) */
.stat-card {
    background: var(--hr-surface);
    border: 1px solid var(--hr-border);
    border-radius: var(--hr-radius-lg);
    padding: 20px;
    box-shadow: var(--hr-shadow-xs);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform var(--hr-trans-fast), box-shadow var(--hr-trans-fast);
}

    .stat-card:hover {
        transform: translateY(-1px);
        box-shadow: var(--hr-shadow-sm);
    }

    .stat-card .stat-label {
        font-size: 13px;
        font-weight: 500;
        color: var(--hr-text-muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .stat-card .stat-value {
        font-size: 22px;
        font-weight: 700;
        color: var(--hr-text);
        letter-spacing: -0.02em;
        line-height: 1.1;
    }

    .stat-card .stat-meta {
        font-size: 12px;
        color: var(--hr-text-subtle);
    }

    .stat-card.accent .stat-value {
        color: var(--hr-primary);
    }

/* ============================================================
   Tables
   ============================================================ */

table.dataTable {
    width: 100% !important;
    margin: 0 !important;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

    table.dataTable thead th {
        background: var(--hr-primary);
        color: #fff;
        font-size: 12px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        padding: 12px 12px;
        border-bottom: 1px solid var(--hr-border);
        border-top: 0;
        white-space: nowrap;
    }

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

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

    table.dataTable tbody tr:last-child td {
        border-bottom: 0;
    }

/* DataTables UI overrides */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--hr-border);
    border-radius: var(--hr-radius);
    padding: 6px 12px;
    font-size: 14px;
}

/*
 * DataTables Bootstrap5 generates col-sm-12 col-md-6 (top) and col-sm-12 col-md-5/7 (bottom).
 * Bootstrap's .row > * rule sets width:100% on every child, making them stack below md.
 * Override: non-sole children in a DataTables row should size to their content.
 */
.dataTables_wrapper .row > *:not(:only-child) {
    width: auto !important;
    flex: 0 0 auto !important;
    max-width: 100% !important;
}

/* Space length and search to opposite ends */
.dataTables_wrapper .row:has(.dataTables_length) {
    justify-content: space-between;
    align-items: center;
}

/* Constrain search input on small screens so length+search fit side-by-side */
@media (max-width: 575.98px) {
    .dataTables_wrapper .dataTables_filter input[type="search"] {
        width: 130px;
    }
}

/* Bottom row: swap visual order so paginate is LEFT, info is RIGHT */
.dataTables_wrapper .row:has(.dataTables_info) {
    justify-content: space-between;
    align-items: center;
}
.dataTables_wrapper .row > *:has(.dataTables_paginate) { order: -1; }
.dataTables_wrapper .dataTables_paginate {
    float: none !important;
    text-align: left !important;
}
.dataTables_wrapper .dataTables_info {
    text-align: right !important;
}

    .dataTables_wrapper .dataTables_filter input:focus,
    .dataTables_wrapper .dataTables_length select:focus {
        border-color: var(--hr-primary);
        outline: none;
        box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
    }

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border: 1px solid transparent !important;
    border-radius: var(--hr-radius) !important;
    padding: 6px 12px !important;
    margin: 0 2px !important;
    color: var(--hr-text-muted) !important;
    background: transparent !important;
}

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

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

.dataTables_wrapper .dataTables_info {
    color: var(--hr-text-muted);
    font-size: 13px;
    text-align: right !important;
}

.dataTables_wrapper .dataTables_processing {
    background: var(--hr-surface);
    border: 1px solid var(--hr-border);
    border-radius: var(--hr-radius);
    box-shadow: var(--hr-shadow);
    color: var(--hr-text-muted);
    font-weight: 500;
}

/* Horizontal-scroll wrapper for mobile tables */
.table-responsive-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ============================================================
   Badges / status pills
   ============================================================ */

.hr-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--hr-radius-pill);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

    .hr-badge.primary {
        background: var(--hr-primary-soft);
        color: var(--hr-primary-hover);
    }

    .hr-badge.success {
        background: var(--hr-success-soft);
        color: var(--hr-success);
    }

    .hr-badge.danger {
        background: var(--hr-danger-soft);
        color: var(--hr-danger);
    }

    .hr-badge.warning {
        background: var(--hr-warning-soft);
        color: var(--hr-warning);
    }

    .hr-badge.info {
        background: var(--hr-info-soft);
        color: var(--hr-info);
    }

    .hr-badge.neutral {
        background: var(--hr-surface-2);
        color: var(--hr-text-muted);
    }

/* ============================================================
   Toasts (Bootstrap 5 overrides)
   ============================================================ */

.toast-container.hr-toasts {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1080;
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Container stays click-through so it never blocks the page underneath;
       each .hr-toast re-enables pointer events for itself (Bootstrap does the
       same for .toast, which these custom toasts do not use). */
    pointer-events: none;
}

.hr-toast {
    pointer-events: auto;
    min-width: 280px;
    background: var(--hr-surface);
    border: 1px solid var(--hr-border);
    border-radius: var(--hr-radius);
    box-shadow: var(--hr-shadow);
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: var(--hr-text);
    animation: hr-toast-in 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

    .hr-toast .icon {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff;
        font-size: 12px;
    }

    .hr-toast.success .icon {
        background: var(--hr-success);
    }

    .hr-toast.danger .icon {
        background: var(--hr-danger);
    }

    .hr-toast.warning .icon {
        background: var(--hr-warning);
    }

    .hr-toast.info .icon {
        background: var(--hr-info);
    }

    .hr-toast .close {
        border: 0;
        background: transparent;
        color: var(--hr-text-subtle);
        margin-left: auto;
        margin-right: -6px;
        padding: 0;
        font-size: 18px;
        line-height: 1;
        cursor: pointer;
        /* 32px hit area + no 300ms tap delay so the X is reliably tappable on mobile */
        flex-shrink: 0;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        touch-action: manipulation;
    }

@keyframes hr-toast-in {
    from {
        transform: translateX(20px);
        opacity: 0;
    }

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

@media (max-width: 575.98px) {
    .toast-container.hr-toasts {
        top: auto;
        bottom: 16px;
        left: 16px;
        right: 16px;
    }

    .hr-toast {
        min-width: 0;
    }
}

/* ============================================================
   Loading states
   ============================================================ */

.btn .spinner-border-sm {
    width: 0.95em;
    height: 0.95em;
    border-width: 0.15em;
}

.btn[data-loading="true"] .btn-label {
    opacity: 0;
}

.btn[data-loading="true"]::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: hr-spin 0.7s linear infinite;
    left: 50%;
    top: 50%;
    margin: -8px 0 0 -8px;
}

.btn {
    position: relative;
}

@keyframes hr-spin {
    to {
        transform: rotate(360deg);
    }
}

.skeleton {
    background: linear-gradient(90deg, var(--hr-surface-2) 25%, #E2E8F0 37%, var(--hr-surface-2) 63%);
    background-size: 400% 100%;
    animation: hr-skeleton 1.4s ease infinite;
    border-radius: var(--hr-radius-sm);
}

@keyframes hr-skeleton {
    0% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0 50%;
    }
}

/* ============================================================
   Empty states
   ============================================================ */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--hr-text-muted);
}

    .empty-state .empty-icon {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--hr-surface-2);
        color: var(--hr-text-subtle);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        margin-bottom: 14px;
    }

    .empty-state .empty-title {
        color: var(--hr-text);
        font-size: 16px;
        font-weight: 600;
        margin-bottom: 4px;
    }

    .empty-state .empty-text {
        font-size: 14px;
    }

/* ============================================================
   Utility
   ============================================================ */

.hr-text-muted {
    color: var(--hr-text-muted) !important;
}

.hr-text-subtle {
    color: var(--hr-text-subtle) !important;
}

.hr-text-mono {
    font-family: var(--hr-font-mono);
    font-size: 0.92em;
}

.hr-divider {
    height: 1px;
    background: var(--hr-border);
    margin: 16px 0;
}

.hr-section-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--hr-text-muted);
    font-weight: 600;
    margin: 0 0 12px;
}

/* Touch targets — ensure 44px hit area on mobile */
@media (hover: none) and (pointer: coarse) {
    .btn, .nav a, .form-control, .form-select {
        min-height: 44px;
    }

    .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Focus ring (accessibility) */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(15, 118, 110, 0.4);
    outline-offset: 2px;
}

/* Print niceties for reports */
@media print {
    .app-sidebar, .app-header, .toast-container {
        display: none !important;
    }

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

    .app-content {
        padding: 0;
        max-width: none;
    }

    .hr-card {
        border: 1px solid #ddd;
        box-shadow: none;
    }
}

/* Length-menu select (per-page dropdown) */
.dataTables_wrapper select[name$="_length"] {
    border-color: var(--hr-primary-hover);
    width: 65px !important;
    margin-bottom: 10px;
}

/* Search input */
.dataTables_wrapper input[type="search"] {
    border-color: var(--hr-primary-hover) !important;
}

select, input {
    border-color: var(--hr-primary-hover) !important;
}

    input[type="date"] {
        border-color: var(--hr-primary-hover) !important;
    }


.active > .page-link, .page-link.active {
    color: var(--bs-pagination-active-color);
    background-color: var(--hr-primary) !important;
    border-color: var(--hr-primary) !important;
}

/* ============================================================
   Badge tooltip
   ============================================================ */
.hr-badge {
    position: relative;
    cursor: default;
}

    .hr-badge[data-tooltip]::after {
        content: attr(data-tooltip);
        position: absolute;
        bottom: calc(100% + 7px);
        left: 50%;
        transform: translateX(-50%) scale(0.94);
        background: var(--hr-primary); /* was: var(--hr-text-primary) */
        color: #ffffff; /* was: var(--hr-surface-1)    */
        font-size: 11.5px;
        font-weight: 400;
        line-height: 1.45;
        padding: 5px 10px;
        border-radius: var(--hr-radius-md);
        white-space: nowrap;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.15s ease, transform 0.15s ease;
        z-index: 999;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    }

    .hr-badge[data-tooltip]::before {
        content: '';
        position: absolute;
        bottom: calc(100% + 2px);
        left: 50%;
        transform: translateX(-50%) scaleY(0.8);
        border: 5px solid transparent;
        border-top-color: var(--hr-primary);
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.15s ease, transform 0.15s ease;
        z-index: 999;
    }

    .hr-badge[data-tooltip]:hover::after,
    .hr-badge[data-tooltip]:hover::before {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }

    .hr-badge[data-tooltip]:hover::before {
        transform: translateX(-50%) scaleY(1);
    }

/* ── Push permission modal ────────────────────────────────────────────────── */

.hr-push-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 16px;
    animation: hr-fade-in 0.2s ease;
}

@keyframes hr-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }

}

.hr-push-dialog {
    background: var(--hr-surface);
    border-radius: var(--hr-radius-xl);
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
    max-width: 500px;
    width: 100%;
    padding: 36px 32px 28px;
    animation: hr-slide-up 0.22s ease;
}

@keyframes hr-slide-up {
    from { transform: translateY(18px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.hr-push-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--hr-primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 26px;
    color: var(--hr-primary);
}

.hr-push-dialog h4 {
    font-size: 18px;
    font-weight: 700;
    color: var(--hr-text);
    text-align: center;
    margin: 0 0 10px;
}

.hr-push-dialog p {
    font-size: 14px;
    color: var(--hr-text-muted);
    text-align: center;
    margin: 0 0 18px;
    line-height: 1.6;
}

.hr-push-list {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    background: var(--hr-surface-2);
    border-radius: var(--hr-radius-md);
    padding: 14px 16px;
}

.hr-push-list li {
    font-size: 13.5px;
    color: var(--hr-text-muted);
    padding: 4px 0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.hr-push-list li i {
    color: var(--hr-danger);
    font-size: 15px;
    margin-top: 1px;
    flex-shrink: 0;
}

.hr-push-instructions {
    background: var(--hr-warning-soft);
    border-radius: var(--hr-radius-md);
    padding: 12px 14px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--hr-warning);
    line-height: 1.6;
}

.hr-push-instructions strong {
    display: block;
    margin-bottom: 4px;
}

.hr-push-actions {
    display: flex;
    gap: 10px;
}

.hr-push-actions .btn {
    flex: 1;
    font-size: 14px;
    padding: 9px 16px;
}

/* ── Push permission modal ─────────────────────────────────────────── end ── */

/* Admin pages set body { zoom: 0.9 } (layout.js). CSS zoom also scales
   position:fixed descendants, so Bootstrap's .modal/.modal-backdrop render
   at 90% and leave a gap at the right/bottom of the viewport. Counter-zoom
   them back to true 100% so the popup still covers the full screen. */
body.hr-admin-zoomed .modal,
body.hr-admin-zoomed .modal-backdrop {
    zoom: calc(1 / 0.9);
}

#hr-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    background: var(--hr-primary);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 400;
    line-height: 1.45;
    padding: 5px 10px;
    border-radius: var(--hr-radius-md);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 9999;
}

    #hr-tooltip.visible {
        opacity: 1;
    }

/* ============================================================
   Select2 — theme integration
   ============================================================ */

/* Match font to rest of app */
.select2-container--bootstrap-5 .select2-selection,
.select2-container--bootstrap-5 .select2-dropdown,
.select2-container--bootstrap-5 .select2-search__field {
    font-family: var(--hr-font-sans);
    font-size: 14px;
    min-height: 45px !important;
    padding: .675rem 0.75rem .675rem .75rem !important;
}

/* Dropdown panel */
.select2-container--bootstrap-5 .select2-dropdown {
    border-color: var(--hr-border);
    border-radius: var(--hr-radius);
    box-shadow: var(--hr-shadow);
}

/* Search field inside dropdown */
.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    border-color: var(--hr-border);
    border-radius: var(--hr-radius-sm);
    background-color: var(--hr-surface);
    color: var(--hr-text);
}
.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--hr-primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
    outline: none;
}

/* Options hover / selected */
.select2-container--bootstrap-5 .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: var(--hr-primary-soft);
    color: var(--hr-primary-hover);
}
.select2-container--bootstrap-5 .select2-results__option--selected {
    background-color: var(--hr-surface-2);
    color: var(--hr-text);
    font-weight: 500;
}

/* Prevent the rendered selection text from overflowing when width is locked */
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option {
    padding: .375rem .75rem;
    font-size: 12px !important;
    font-weight: 400;
    line-height: 1.5;
}

.select2-container--bootstrap-5 .select2-dropdown .select2-search {
    padding: .375rem .01rem !important;
}

/* ── Page Loader overlay ───────────────────────────────────────────────────── */

#hr-page-loader {
    position: fixed;
    inset: 0;
    z-index: 10500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 180ms ease, visibility 180ms ease;
}

#hr-page-loader.visible {
    opacity: 1;
    visibility: visible;
}

.hr-loader-card {
    background: var(--hr-surface);
    border-radius: var(--hr-radius-lg);
    box-shadow: var(--hr-shadow-lg);
    padding: 40px 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    min-width: 220px;
    text-align: center;
    animation: hr-loader-pop 220ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes hr-loader-pop {
    from { transform: scale(0.88); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.hr-loader-spinner {
    width: 52px;
    height: 52px;
    border: 3.5px solid var(--hr-primary-soft);
    border-top-color: var(--hr-primary);
    border-radius: 50%;
    animation: hr-loader-spin 750ms linear infinite;
    flex-shrink: 0;
}

@keyframes hr-loader-spin {
    to { transform: rotate(360deg); }
}

.hr-loader-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--hr-text);
    margin: 0;
    letter-spacing: -0.01em;
}

.hr-loader-sub {
    font-size: 0.8125rem;
    color: var(--hr-text-muted);
    margin: -6px 0 0;
}

/* ── Page Loader overlay ────────────────────────────────────────────── end ── */


#bookings-table thead th {
    background: var(--hr-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 12px 12px;
    border-bottom: 1px solid var(--hr-border);
    border-top: 0;
    white-space: nowrap;
}

.showPassword {
    border-color: var(--hr-primary-hover) !important;
}

.badge {
    border-radius: var(--hr-radius-pill) !important;
}

/* ============================================================
   PWA install bar — driver & passenger dashboards (pwa-install.js)
   The "how to install" modal reuses the .hr-push-* dialog shell above;
   only the inline bar and the step list are defined here.
   ============================================================ */

/* Margin lives on the bar, not on its mount <section>: the mount stays in the page
   while empty (installed or snoozed users) and must take up no vertical space. */
.hr-install-bar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 14px 46px 14px 16px;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.07), rgba(20, 184, 166, 0.04));
    border: 1px solid var(--hr-border);
    border-left: 3px solid var(--hr-primary);
    border-radius: var(--hr-radius);
    box-shadow: var(--hr-shadow-xs);
}

.hr-install-icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: var(--hr-radius);
    background: var(--hr-primary-soft);
    color: var(--hr-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.hr-install-text {
    flex: 1 1 260px;
    min-width: 0;
}

.hr-install-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--hr-text);
    letter-spacing: -0.01em;
}

.hr-install-sub {
    font-size: 13px;
    color: var(--hr-text-muted);
    line-height: 1.5;
    margin-top: 2px;
}

.hr-install-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.hr-install-actions .btn i {
    margin-right: 5px;
}

.hr-install-later {
    color: var(--hr-text-muted);
    background: transparent;
    border: 0;
}

    .hr-install-later:hover {
        color: var(--hr-text);
        background: var(--hr-surface-2);
    }

.hr-install-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 26px;
    height: 26px;
    line-height: 1;
    font-size: 20px;
    color: var(--hr-text-subtle);
    background: transparent;
    border: 0;
    border-radius: var(--hr-radius-sm);
    transition: color var(--hr-trans-fast), background var(--hr-trans-fast);
}

    .hr-install-close:hover {
        color: var(--hr-text);
        background: var(--hr-surface-2);
    }

/* Stack on narrow screens and let the buttons span the full width. */
@media (max-width: 575.98px) {
    .hr-install-bar {
        gap: 10px;
    }

    .hr-install-actions {
        width: 100%;
    }

        .hr-install-actions .btn {
            flex: 1;
        }
}

/* The install guide is taller than the push-permission dialog this shell was built for.
   .hr-push-overlay centres a fixed-position box, so without these the steps clip off the
   top and bottom of a short screen with no way to scroll to them. Scoped to this dialog
   so the push modal keeps its existing behaviour. */
.hr-install-dialog {
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

@supports (max-height: 100dvh) {
    .hr-install-dialog {
        max-height: calc(100dvh - 32px);   /* excludes mobile browser chrome */
    }
}

/* Numbered steps inside the "how to install" modal. */
.hr-install-steps {
    counter-reset: hr-install-step;
    list-style: none;
    padding: 14px 16px;
    margin: 0 0 16px;
    background: var(--hr-surface-2);
    border-radius: var(--hr-radius);
}

    .hr-install-steps li {
        counter-increment: hr-install-step;
        position: relative;
        padding: 5px 0 5px 30px;
        font-size: 13.5px;
        line-height: 1.6;
        color: var(--hr-text-muted);
        text-align: left;
    }

        .hr-install-steps li::before {
            content: counter(hr-install-step);
            position: absolute;
            left: 0;
            top: 6px;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: var(--hr-primary);
            color: #fff;
            font-size: 11px;
            font-weight: 700;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .hr-install-steps li b {
            color: var(--hr-text);
            font-weight: 600;
        }

.hr-install-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 20px;
    background: var(--hr-info-soft);
    border-radius: var(--hr-radius);
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--hr-info);
    text-align: left;
}

    .hr-install-note i {
        flex-shrink: 0;
        margin-top: 2px;
        font-size: 14px;
    }