/* ═══════════════════════════════════════════════════════════════════
   AwaisMotors – Modern Sidebar UI  |  site.css
   ═══════════════════════════════════════════════════════════════════ */

/* ── Google Font & CSS Tokens ─────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Sidebar */
    --sb-width:            260px;
    --sb-collapsed-width:  70px;
    --sb-bg:               #0f172a;
    --sb-bg-hover:         #1e293b;
    --sb-bg-active:        #1d4ed8;
    --sb-accent:           #3b82f6;
    --sb-text:             #94a3b8;
    --sb-text-hover:       #f1f5f9;
    --sb-text-active:      #ffffff;
    --sb-section-title:    #475569;
    --sb-border:           #1e293b;
    --sb-submenu-bg:       #0a1020;
    --sb-submenu-text:     #94a3b8;
    --sb-submenu-hover:    #3b82f6;
    --sb-brand-height:     66px;
    --sb-footer-height:    72px;
    --sb-transition:       0.28s cubic-bezier(.4,0,.2,1);

    /* Top Header */
    --hdr-height:          56px;
    --hdr-bg:              #ffffff;
    --hdr-border:          #e2e8f0;
    --hdr-shadow:          0 1px 3px rgba(0,0,0,0.08);
    --hdr-text:            #334155;

    /* Content */
    --content-bg:          #f1f5f9;
    --content-padding:     1.5rem;

    /* Card / UI */
    --radius-sm:           6px;
    --radius-md:           10px;
    --radius-lg:           16px;
    --shadow-sm:           0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:           0 4px 16px rgba(0,0,0,0.1);
    --primary:             #3b82f6;
    --primary-dark:        #1d4ed8;
}

/* ── Reset & Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
    font-size: 14px;
    height: 100%;
}

@media (min-width: 768px) {
    html { font-size: 15px; }
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--content-bg);
    color: #334155;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   TOP NAVBAR LAYOUT SCAFFOLD
   ═══════════════════════════════════════════════════════════════════ */

body.top-navbar-layout {
    padding-top: 60px; /* Offset for fixed navbar */
}

/* ── Top Navbar ───────────────────────────────────────────────────── */
.top-navbar-custom {
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    min-height: 60px;
}

.top-navbar-custom .navbar-brand .brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 1rem;
}

.top-navbar-custom .navbar-brand .brand-text {
    font-size: 1.15rem;
    color: #f8fafc;
    letter-spacing: -0.01em;
}

.top-navbar-custom .nav-link {
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 0.8rem !important;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
    margin: 0 0.2rem;
}

.top-navbar-custom .nav-link:hover,
.top-navbar-custom .nav-link:focus {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

.top-navbar-custom .nav-link.active {
    color: #fff;
    background: rgba(59, 130, 246, 0.2);
}

/* Dropdown tweaks */
.top-navbar-custom .dropdown-menu {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    animation: fadeInDropdown 0.2s ease;
}

@keyframes fadeInDropdown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.top-navbar-custom .dropdown-item {
    font-size: 0.85rem;
    padding: 0.5rem 1.25rem;
    color: #334155;
    transition: background 0.15s, color 0.15s;
    font-weight: 500;
}

.top-navbar-custom .dropdown-item:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.top-navbar-custom .dropdown-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    padding: 0.25rem 1.25rem;
}

/* User actions in navbar */
.user-header-card {
    background-color: #f8fafc;
    border-color: #e2e8f0;
}
.user-name-text { color: #0f172a; }
.user-email-text { color: #64748b; }

.navbar-user-area .header-badge {
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    color: #a7f3d0;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 100px;
    padding: 0.15rem 0.6rem;
}

.navbar-user-area .header-date {
    font-size: 0.8rem;
    color: #94a3b8;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE TOP NAVBAR (<1200px)
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 1199.98px) {
    .top-navbar-custom .navbar-collapse {
        background: #0f172a;
        padding: 1rem 1.25rem;
        margin-top: 0.5rem;
        border-radius: 12px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
        max-height: calc(100vh - 75px);
        overflow-y: auto;
    }

    .top-navbar-custom .nav-link {
        padding: 0.65rem 0.85rem !important;
        font-size: 0.95rem;
    }

    .top-navbar-custom .navbar-nav .dropdown-menu,
    .navbar-user-area .user-menu-dropdown {
        position: static !important;
        float: none !important;
        width: 100% !important;
        max-width: 100% !important;
        transform: none !important;
        background: #1e293b !important;
        border: 1px solid #334155 !important;
        border-radius: 8px !important;
        margin-top: 0.35rem !important;
        margin-bottom: 0.75rem !important;
        box-shadow: none !important;
    }

    .top-navbar-custom .dropdown-item {
        color: #cbd5e1 !important;
        padding: 0.55rem 1rem !important;
    }

    .top-navbar-custom .dropdown-item:hover,
    .top-navbar-custom .dropdown-item:focus {
        background: #334155 !important;
        color: #ffffff !important;
    }

    .top-navbar-custom .dropdown-header {
        color: #64748b !important;
    }

    .navbar-user-area {
        width: 100%;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        margin-top: 0.75rem;
        padding-top: 0.75rem;
    }

    .user-header-card {
        background-color: #0f172a !important;
        border-color: #334155 !important;
    }

    .user-name-text {
        color: #f8fafc !important;
    }

    .user-email-text {
        color: #94a3b8 !important;
    }
}

/* Main Wrapper & Page Title */
.main-wrapper {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 60px);
}

.page-title-bar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.page-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
}

/* Page Content */
.page-content {
    flex: 1;
    padding: var(--content-padding);
}

/* ═══════════════════════════════════════════════════════════════════
   CONTENT ELEMENT STYLES
   ═══════════════════════════════════════════════════════════════════ */

/* Cards */
.card {
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    background: #fff;
}
.card-header {
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
    font-weight: 600;
    color: #1e293b;
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
}

/* ═══════════════════════════════════════════════════════════════════
   GLOBAL TABLE SYSTEM
   – 100% width, centered, responsive, smart column sizing
   ═══════════════════════════════════════════════════════════════════ */

/* ── Scroll wrapper: auto-injected by JS (see layout script) ──────── */
.qa-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

/* ── All tables: 100% wide, auto-layout ──────────────────────────── */
table {
    border-collapse: collapse;
    width: 100% !important;
    max-width: 100%;
    table-layout: auto;          /* columns self-adjust to content */
    margin-bottom: 0;
    font-size: 0.85rem;
}

table, th, td {
    border: 1px solid #cbd5e1;
}

table > :not(caption) > * > * {
    padding: 0.3rem 0.5rem !important;
}

/* ── THEAD – rich gradient, unique color scheme ───────────────────── */
thead tr th {
    /* Indigo → Blue gradient unique to AwaisMotors */
    background: linear-gradient(135deg, #312e81 0%, #1d4ed8 60%, #0ea5e9 100%) !important;
    color: #ffffff !important;
    font-family: 'Inter', system-ui, sans-serif !important;
    font-weight: 700 !important;
    font-size: 0.78rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.07em !important;
    white-space: nowrap;              /* header labels never wrap */
    vertical-align: middle !important;
    position: relative;
    user-select: none;
    border-color: rgba(255,255,255,0.15) !important;
    /* subtle bottom border glow */
    box-shadow: inset 0 -2px 0 rgba(14,165,233,0.4);
}

/* Sortable header links inside th (BikePurchase/Index pattern) */
thead th a {
    color: #bfdbfe !important;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    width: 100%;
    justify-content: center;
}
thead th a:hover {
    color: #ffffff !important;
}

/* ── Column resize handle (CSS grab line on th right edge) ────────── */
thead th .col-resizer {
    position: absolute;
    right: 0;
    top: 20%;
    height: 60%;
    width: 4px;
    background: rgba(255,255,255,0.25);
    border-radius: 2px;
    cursor: col-resize;
    transition: background 0.15s;
}
thead th .col-resizer:hover,
thead th.resizing .col-resizer {
    background: rgba(255,255,255,0.75);
}

/* ── TFOOT – matches brand, no icons ─────────────────────────────── */
tfoot tr td {
    background: linear-gradient(135deg, #1e293b, #334155) !important;
    color: #f1f5f9 !important;
    font-weight: 700 !important;
    font-size: 0.82rem !important;
    font-family: 'Inter', system-ui, sans-serif !important;
    border-color: #475569 !important;
}

/* Override per-view inline thead/tfoot maroon styles */
thead, tfoot {
    font-family: 'Inter', system-ui, sans-serif !important;
}

/* ── TBODY rows ───────────────────────────────────────────────────── */
tbody tr {
    transition: background 0.12s;
}
tbody tr:hover {
    background: #eff6ff !important;
}
tbody tr:nth-child(even) {
    background: #f8fafc;
}
tbody tr:nth-child(even):hover {
    background: #dbeafe !important;
}

/* ── Text columns: allow wrapping, max 2 lines ────────────────────── */
tbody td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    vertical-align: middle;
    /* Clamp to 2 lines on desktop – shows ellipsis on overflow */
    max-width: 260px;
    overflow: hidden;
}

/* ── ACTION COLUMN (last th / last td in each row) ───────────────── */
/* Prevent icons from ever wrapping */
thead th:last-child,
tbody td:last-child,
tfoot td:last-child {
    white-space: nowrap !important;
    width: 1%;             /* shrink-wrap to content */
    min-width: fit-content;
    text-align: center !important;
}

/* Also protect cells containing only icon buttons (no text content) */
td:has(> a.btn-sm),
td:has(> form),
td:has(> .btn) {
    white-space: nowrap !important;
    width: 1%;
    min-width: 80px;
}

/* Icon buttons inside action cells */
td .btn-sm,
td > a.btn,
td > form > button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 1px;
    flex-shrink: 0;
}
td .btn-sm img {
    display: block;
    flex-shrink: 0;
}

/* ── ID / numeric columns: center + fixed narrow ─────────────────── */
td[style*="text-align:center"],
th[style*="text-align:center"],
td[style*="text-align: center"],
th[style*="text-align: center"] {
    text-align: center !important;
    white-space: nowrap;
}

/* Numeric amount columns */
td[style*="text-align:end"],
th[style*="text-align:end"],
td[style*="text-align: end"],
th[style*="text-align: end"],
td[style*="text-align:right"],
th[style*="text-align:right"] {
    text-align: right !important;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ── Bootstrap table classes compatibility ────────────────────────── */
.table {
    width: 100% !important;
}
.table thead th {
    /* inherit qa gradient above */
    vertical-align: bottom;
}
.table-bordered th,
.table-bordered td {
    border: 1px solid #cbd5e1 !important;
}
.table-striped tbody tr:nth-of-type(odd) {
    background: #ffffff;
}
.table-striped tbody tr:nth-of-type(even) {
    background: #f8fafc;
}
.table-hover tbody tr:hover {
    background: #eff6ff !important;
}

/* ── .table-responsive wrapper ────────────────────────────────────── */
.table-responsive {
    border-radius: var(--radius-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

/* ── DataTables: 100% + own scroll ───────────────────────────────── */
table.dataTable {
    width: 100% !important;
    table-layout: auto !important;
}
.dataTables_wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

/* ── RESPONSIVE: mobile table behavior ───────────────────────────── */
@media (max-width: 991.98px) {
    tbody td {
        max-width: 180px;
    }
}

@media (max-width: 767.98px) {
    table {
        font-size: 0.78rem;
    }
    thead th {
        font-size: 0.7rem !important;
        letter-spacing: 0.04em !important;
        padding: 0.35rem 0.3rem !important;
    }
    tbody td {
        padding: 0.25rem 0.3rem !important;
        max-width: 140px;
    }
    /* Action column: keep icons visible and not squished */
    tbody td:last-child,
    thead th:last-child {
        min-width: 70px;
        padding: 0.25rem !important;
    }
}

@media (max-width: 575.98px) {
    table {
        font-size: 0.73rem;
    }
    thead th {
        font-size: 0.65rem !important;
        padding: 0.3rem 0.25rem !important;
    }
    tbody td {
        max-width: 110px;
        padding: 0.2rem 0.25rem !important;
    }
}

tbody tr:hover { background: #f0f7ff; }
tbody tr:nth-child(even) { background: #f8fafc; }
tbody tr:nth-child(even):hover { background: #e8f0fe; }

/* Form Controls */
.form-control {
    padding: 0.35rem 0.6rem;
    width: 75%;
    border-radius: var(--radius-sm);
    border: 1px solid #cbd5e1;
    font-size: 0.875rem;
    transition: border-color 0.18s, box-shadow 0.18s;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
    outline: none;
}
.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: #475569;
    margin-bottom: 0.3rem;
}
.col-form-label-lg { padding-top: 0; }

/* Buttons */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.18s;
}
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}
.btn:focus, .btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.15rem rgba(59,130,246,0.3);
}

/* Badges */
.badge {
    border-radius: 100px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Alerts */
.alert { border-radius: var(--radius-md); border: none; }

/* Utility */
.gap-right { padding-right: 10px !important; }
.gap-left  { padding-left: 10px !important; }

/* ─ Report table heading style (preserved) ────────────────────────── */
:is(table) thead.report-st th {
    font-family: 'Times New Roman', serif !important;
    font-weight: bold !important;
    font-size: 18px !important;
    color: maroon !important;
    background: transparent !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}

/* ─ DataTables tweaks ─────────────────────────────────────────────── */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
}
.dataTables_wrapper .dataTables_length select {
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

/* ─ Select2 tweaks ────────────────────────────────────────────────── */
.select2-container--default .select2-selection--single {
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm) !important;
    height: auto;
    padding: 0.3rem 0.6rem;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 1.4;
    padding: 0;
    color: #334155;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
}

/* ─ Page header helper ────────────────────────────────────────────── */
.page-header {
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.page-header h1, .page-header h2, .page-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e293b;
}

/* ─ Responsive table containers ──────────────────────────────────── */
.table-responsive { border-radius: var(--radius-md); overflow: hidden; }


/* ═══════════════════════════════════════════════════════════════════
   GLOBAL TABLE RESPONSIVENESS
   Wraps ALL tables in a horizontal scroll container automatically
   without touching individual view files.
   ═══════════════════════════════════════════════════════════════════ */

/* Make every plain <table> that is NOT inside .table-responsive
   scroll horizontally on small screens */
.page-content table:not(.select2-search *) {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Restore display for DataTables wrapper tables (DT handles its own scroll) */
.dataTables_wrapper table {
    display: table;
    overflow-x: visible;
}

/* Ensure min-widths so columns don't collapse to nothing */
.page-content table thead th {
    min-width: 60px;
}
.page-content table thead th:first-child {
    min-width: 40px;
}

/* ─ DataTables wrapper – own horizontal scroll on mobile ──────────── */
.dataTables_wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}
.dataTables_wrapper > .dataTables_scroll {
    overflow-x: auto;
}

/* ─ DataTables top/bottom bars – stack on mobile ──────────────────── */
@media (max-width: 575.98px) {
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        float: none;
        text-align: left;
        margin-bottom: 0.5rem;
        width: 100%;
    }
    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
        margin-left: 0;
    }
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        float: none;
        text-align: left;
        margin-top: 0.5rem;
    }
    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 0.3rem 0.5rem;
        font-size: 0.78rem;
    }
}


/* ═══════════════════════════════════════════════════════════════════
   GLOBAL FORM RESPONSIVENESS
   Cascades to every form in every view automatically.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Tablet (≤991px) ──────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    /* form-control: full width on any column ≤ md */
    .form-control {
        width: 100%;
    }

    /* Two-column pairs (col-sm-1 label + col-sm-3 input, etc.)
       let Bootstrap stacking handle from sm down. Push labels left. */
    label.control-label,
    label.col-form-label {
        text-align: left !important;
        padding-bottom: 0.1rem;
    }
}

/* ── Phone (≤767px) ───────────────────────────────────────────────── */
@media (max-width: 767.98px) {
    /* ─ Content padding smaller on phone ─ */
    .page-content {
        padding: 0.85rem;
    }

    /* ─ Company heading (h22) responsive ─ */
    h22, .h22 {
        font-size: 20px !important;
    }

    /* ─ Page title row (big bold span used in all views) ─ */
    div > span[style*="font-size: 2em"],
    div > span[style*="font-size:2em"] {
        font-size: 1.3em !important;
    }
    div > span[style*="font-size: 1.5em"],
    div > span[style*="font-size:1.5em"] {
        font-size: 1.1em !important;
    }

    /* ─ form-group row: stack label above input ─ */
    .form-group.row {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        margin-bottom: 0.65rem;
    }

    /* Make every Bootstrap col inside a form-group row full width */
    .form-group.row > [class*="col-"] {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding-left: 0;
        padding-right: 0;
    }

    /* Labels inside form-group rows */
    .form-group.row label {
        text-align: left !important;
        padding-bottom: 0;
        padding-top: 0;
        margin-bottom: 0.15rem;
        font-weight: 600;
        font-size: 0.83rem;
        color: #475569;
    }

    /* All form controls full width */
    .form-control,
    select.form-control,
    input.form-control,
    textarea.form-control {
        width: 100% !important;
    }

    /* ─ Inline row forms (col-md-N without form-group.row wrapper) ─ */
    .row > [class*="col-md-"],
    .row > [class*="col-sm-"],
    .row > [class*="col-lg-"] {
        margin-bottom: 0.5rem;
    }

    /* ─ Button rows: full width stack ─ */
    .form-group .btn,
    .d-flex .btn,
    form .btn[type="submit"],
    form input[type="submit"] {
        width: 100%;
        margin-bottom: 0.4rem;
    }

    /* Button bars that use d-flex justify-content-between */
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 0.4rem;
    }
    .d-flex.justify-content-between > div {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    .d-flex.justify-content-between .btn {
        width: auto;
        flex: 1 1 auto;
    }

    /* ─ Inline action buttons in table cells ─ */
    td .btn,
    td .btn-sm {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin: 1px;
    }

    /* ─ Radio button groups ─ */
    .form-group.row .col-sm-9 input[type="radio"],
    .form-group.row .col-sm-9 input[type="checkbox"] {
        margin-top: 0.25rem;
    }

    /* ─ Header right items: hide date on very small screens ─ */
    .header-date {
        display: none;
    }
    .header-divider {
        display: none;
    }

    /* ─ Top header padding tighter ─ */
    .top-header {
        padding: 0 0.75rem;
    }

    /* ─ Page footer responsive styling ─ */
    .page-footer {
        padding: 0.75rem 0.5rem;
    }
}

/* ── Footer Link Hover State ─────────────────────────────────────── */
.hover-primary {
    transition: color 0.15s ease-in-out;
}
.hover-primary:hover {
    color: var(--primary, #3b82f6) !important;
}

/* ── Small phone (≤575px) ─────────────────────────────────────────── */
@media (max-width: 575.98px) {
    /* Even smaller content padding */
    .page-content {
        padding: 0.6rem;
    }

    h22, .h22 {
        font-size: 17px !important;
    }

    /* Alerts inline in headings: block on mobile */
    span.alert.auto-hide {
        display: block !important;
        margin-left: 0 !important;
        margin-top: 0.35rem;
    }

    /* Nav section titles in sidebar: slightly larger tap targets */
    .sidebar-nav-link {
        padding: 0.65rem 0.75rem;
    }
    .submenu-link {
        padding: 0.45rem 0.5rem;
    }

    /* Top header title: clip long names */
    .top-header-title {
        max-width: 140px;
    }

    /* badge: hide on xs */
    .header-badge {
        display: none;
    }
}

/* ── Tablet landscape (768px–991px) ───────────────────────────────── */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Re-enable side-by-side for labels in tablet range for most forms */
    .form-group.row {
        flex-direction: row;
    }
    .form-group.row > [class*="col-"] {
        width: auto !important;
        max-width: none !important;
        flex: initial !important;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    /* But override col-sm-N fractions to be more generous */
    .form-group.row > .col-sm-1 { flex: 0 0 10%; max-width: 10%; }
    .form-group.row > .col-sm-2 { flex: 0 0 20%; max-width: 20%; }
    .form-group.row > .col-sm-3 { flex: 0 0 30%; max-width: 30%; }
    .form-group.row > .col-sm-4 { flex: 0 0 40%; max-width: 40%; }
    .form-group.row > .col-sm-5 { flex: 0 0 50%; max-width: 50%; }
    .form-group.row > .col-sm-6 { flex: 0 0 50%; max-width: 50%; }
    .form-group.row > .col-sm-9 { flex: 0 0 70%; max-width: 70%; }
    .form-group.row > .col-sm-12 { flex: 0 0 100%; max-width: 100%; }
    .form-control { width: 100%; }
}

/* ── Select2 – full width on mobile ──────────────────────────────── */
@media (max-width: 767.98px) {
    .select2-container {
        width: 100% !important;
    }
    .select2-container--default .select2-selection--single {
        width: 100%;
    }
}

/* ── Forms inside <form class="p-3"> used in complex invoices ──────── */
@media (max-width: 767.98px) {
    form.p-3 {
        padding: 0.5rem !important;
    }

    /* Multi-field rows used in BikeSaleInvoice, BikePurchase, etc.
       They use .row.mb-2 with multiple col-md-N siblings */
    .row.mb-2 > [class*="col-md-"],
    .row.mb-3 > [class*="col-md-"],
    .row.mb-2 > [class*="col-sm-"],
    .row.g-2 > [class*="col-"] {
        margin-bottom: 0.5rem;
    }
    .row.mb-2 > [class*="col-md-"] label,
    .row.mb-3 > [class*="col-md-"] label {
        font-size: 0.78rem;
        font-weight: 600;
        color: #475569;
        margin-bottom: 0.2rem;
        display: block;
    }
    .row.mb-2 > [class*="col-md-"] .form-control,
    .row.mb-3 > [class*="col-md-"] .form-control {
        width: 100%;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   COMPONENT-LEVEL RESPONSIVE RULES
   ═══════════════════════════════════════════════════════════════════ */

/* ─ d-flex rows used in list pages as action bars ──────────────────── */
@media (max-width: 575.98px) {
    .d-flex.justify-content-between:not(.top-header):not(.sidebar-brand) {
        flex-wrap: wrap;
        gap: 0.35rem;
    }
}

/* ─ Inline style overrides for company heading h22 ─────────────────── */
h22 {
    display: block;
    word-break: break-word;
}

/* ─ Table action icon buttons ─────────────────────────────────────── */
td > a.btn-sm img,
td > form > button.btn-sm img {
    vertical-align: middle;
}

/* ─ Overflow hidden fix for wide content ─────────────────────────── */
.page-content {
    overflow-x: hidden;
}
.row {
    margin-left: 0;
    margin-right: 0;
}

/* ─ Prevent horizontal scroll on body ────────────────────────────── */
body {
    overflow-x: hidden;
}

/* ─ Card inside page-content: full bleed on phone ─────────────────── */
@media (max-width: 575.98px) {
    .card {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* ─ Success/error alert auto-fade ─────────────────────────────────── */
span.alert.auto-hide {
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
}

/* ─ Admin layout card responsive (login page) ─────────────────────── */
@media (max-width: 575.98px) {
    .admin-card {
        padding: 1.5rem 1rem !important;
        border-radius: 10px !important;
    }
    .admin-content {
        padding: 1rem 0.5rem !important;
    }
}

/* ── Top Navbar User Dropdown & Live Status ── */
.user-icon-btn {
    border-radius: 20px;
    padding: 4px 8px !important;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.user-icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

.user-icon-btn:focus,
.user-icon-btn[aria-expanded="true"] {
    background-color: rgba(255, 255, 255, 0.15) !important;
    box-shadow: none;
}

.user-icon-live {
    color: #10b981 !important; /* Emerald green indicating live / active status */
    filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.5));
    transition: color 0.2s ease;
}

.user-icon-btn:hover .user-icon-live {
    color: #34d399 !important;
}

.live-status-dot {
    width: 10px;
    height: 10px;
    background-color: #10b981;
    border: 2px solid #0f172a;
    box-shadow: 0 0 6px #10b981;
    animation: livePulse 2s infinite;
}

@keyframes livePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.user-menu-dropdown {
    min-width: 250px;
    border-radius: 12px;
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════
   PRINT OVERRIDES  (kept last so they win over responsive rules)
   ═══════════════════════════════════════════════════════════════════ */
@media print {
    .sidebar,
    .top-header,
    .page-footer,
    .sidebar-overlay { display: none !important; }
    .main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }
    .page-content {
        padding: 0 !important;
        overflow-x: visible !important;
    }
    /* Restore normal table display for print */
    .page-content table,
    .dataTables_wrapper table {
        display: table !important;
        overflow-x: visible !important;
    }
    table, th, td { border: 1px solid #000 !important; }
    body { overflow-x: visible !important; }
}
