/*
 * Bismillah Rice Commission ERP - Modern Mandi Style & Print CSS
 */

:root {
    --primary: #047857;
    --primary-dark: #064e3b;
    --primary-light: #ecfdf5;
    --secondary: #0284c7;
    --accent: #f59e0b;
    --dark: #0f172a;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-600: #475569;
    --gray-700: #334155;
    --danger: #dc2626;
    --success: #16a34a;
    --border-radius: 12px;
    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Global High-Visibility Permanent Scrollbar (Never Auto-Hides) */
html {
    overflow-y: scroll !important;
    scrollbar-gutter: stable;
}

/* Chromium (Chrome, Edge, Opera, Brave) - Permanent Solid Scrollbar */
::-webkit-scrollbar {
    width: 14px !important;
    height: 14px !important;
    background-color: #f1f5f9 !important;
}

::-webkit-scrollbar-track {
    background: #e2e8f0 !important;
    border: 1px solid #cbd5e1 !important;
}

::-webkit-scrollbar-thumb {
    background: #047857 !important;
    border-radius: 7px !important;
    border: 2px solid #e2e8f0 !important;
    min-height: 40px !important;
}

::-webkit-scrollbar-thumb:hover {
    background: #064e3b !important;
}

/* For all scrollable containers (tables, cards, modals, bill views) */
*::-webkit-scrollbar {
    width: 12px !important;
    height: 12px !important;
    background-color: #f1f5f9 !important;
}

*::-webkit-scrollbar-track {
    background: #e2e8f0 !important;
    border: 1px solid #cbd5e1 !important;
}

*::-webkit-scrollbar-thumb {
    background: #047857 !important;
    border-radius: 6px !important;
    border: 2px solid #e2e8f0 !important;
    min-height: 30px !important;
}

*::-webkit-scrollbar-thumb:hover {
    background: #064e3b !important;
}

/* Firefox standard support */
@supports (-moz-appearance: none) {
    html, body, * {
        scrollbar-width: auto !important;
        scrollbar-color: #047857 #e2e8f0 !important;
    }
}

body {
    background-color: #f1f5f9;
    color: #1e293b;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

body.lang-ur {
    font-family: 'Noto Nastaliq Urdu', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    direction: rtl;
    text-align: right;
    font-size: 13.5px;
    line-height: 1.7;
}

body.lang-en {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    direction: ltr;
    text-align: left;
    font-size: 14px;
    line-height: 1.5;
}

/* Tabular & Precision Figures for Accounting */
.num, .amount, .date, .code, [data-num],
td.text-end, th.text-end, .bill-meta-box,
.metric-val, .action-badge {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace, sans-serif !important;
    font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4, h5, h6 {
    color: #0f172a;
    line-height: 1.35;
}

h1 { font-size: 21px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
h4 { font-size: 14px; font-weight: 600; }
h5 { font-size: 13px; font-weight: 600; }

/* App Wrapper */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar with Sticky & Smooth Visible Scrollbar */
.sidebar {
    width: 260px;
    background: #064e3b;
    color: #f8fafc;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    z-index: 100;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow: hidden;
}

.sidebar-brand {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(180deg, #043d2e 0%, #033225 100%);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sidebar-fold-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #a7f3d0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-fold-btn:hover {
    background: #10b981;
    color: #ffffff;
    border-color: #10b981;
    transform: scale(1.05);
}

body.lang-ur .sidebar-fold-btn .fold-icon,
body[dir="rtl"] .sidebar-fold-btn .fold-icon,
[dir="rtl"] .sidebar-fold-btn .fold-icon {
    transform: scaleX(-1);
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
}

.brand-details {
    overflow: hidden;
}

.brand-title {
    margin: 0 !important;
    font-size: 18px !important;
    font-weight: 900 !important;
    letter-spacing: -0.3px;
    color: #ffffff !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    line-height: 1.2 !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.brand-subtitle {
    font-size: 11px;
    font-weight: 600;
    color: #a7f3d0;
    margin-top: 2px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-menu {
    list-style: none;
    padding: 15px 0 40px;
    flex-grow: 1;
    overflow-y: auto !important;
}

.sidebar-menu::-webkit-scrollbar {
    width: 7px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: #043d2e;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: #34d399;
    border-radius: 4px;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #e2e8f0;
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-inline-start: 4px solid transparent;
}

.sidebar-menu li a i {
    width: 22px;
    font-size: 16px;
    color: #6ee7b7;
    text-align: center;
}

.sidebar-menu li a:hover,
.sidebar-menu li.active a {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-inline-start-color: #34d399;
}

.sidebar-menu li.menu-header {
    padding: 14px 20px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6ee7b7;
    font-weight: 700;
}

/* Top Navbar Support & Software Inquiry Pill */
.nav-support-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 9999px;
    text-decoration: none;
    color: #065f46;
    font-size: 12.5px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.nav-support-pill:hover {
    background: #d1fae5;
    border-color: #6ee7b7;
    color: #064e3b;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.18);
    transform: translateY(-1px);
}

.nav-support-pill .support-pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulseSupport 2s infinite;
}

@keyframes pulseSupport {
    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);
    }
}

.nav-support-pill .support-num {
    font-weight: 800;
    color: #047857;
    direction: ltr;
    display: inline-block;
}

.nav-support-pill .support-tag {
    background: #0284c7;
    color: #ffffff;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

/* Floating Quick Support Dock (Permanently Removed per user instruction) */
.floating-support-dock {
    display: none !important;
}

html[dir="rtl"] .floating-support-dock {
    left: 20px;
    right: auto;
}

html[dir="ltr"] .floating-support-dock {
    right: 20px;
    left: auto;
}

.floating-support-dock .dock-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    border-radius: 12px;
    padding: 7px 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
}

.floating-support-dock .dock-pulse-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.floating-support-dock .dock-content {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.floating-support-dock .dock-title {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 600;
}

.floating-support-dock .dock-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.floating-support-dock .dock-tel {
    color: #34d399;
    font-weight: 800;
    text-decoration: none;
    direction: ltr;
}

.floating-support-dock .dock-sep {
    color: #64748b;
    font-size: 10px;
}

.floating-support-dock .dock-brand {
    color: #38bdf8;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 0.3px;
}

.floating-support-dock .dock-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-inline-start: 4px;
}

.floating-support-dock .dock-btn-wa,
.floating-support-dock .dock-btn-call {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    text-decoration: none;
    color: #ffffff;
    transition: transform 0.15s ease;
}

.floating-support-dock .dock-btn-wa {
    background: #25d366;
}

.floating-support-dock .dock-btn-call {
    background: #0284c7;
}

.floating-support-dock .dock-btn-wa:hover,
.floating-support-dock .dock-btn-call:hover {
    transform: scale(1.1);
}

.floating-support-dock .dock-btn-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    margin-inline-start: 2px;
}

.floating-support-dock .dock-btn-close:hover {
    color: #ffffff;
}

/* Print Micro-Credit Hidden on Screen */
.print-subtle-credit {
    display: none;
}

@media (max-width: 768px) {
    .nav-support-pill .support-label,
    .nav-support-pill .support-tag {
        display: none;
    }
    .floating-support-dock {
        bottom: 12px;
    }
    html[dir="rtl"] .floating-support-dock {
        left: 12px;
        right: auto;
    }
    html[dir="ltr"] .floating-support-dock {
        right: 12px;
        left: auto;
    }
}

/* Main Content */
.main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #f8fafc;
}

/* Header Navbar */
.top-navbar {
    background: #ffffff;
    padding: 12px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    position: sticky;
    top: 0;
    z-index: 90;
    flex-wrap: wrap;
    gap: 12px;
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Sidebar Toggle Button (Desktop Foldable & Mobile Drawer) */
.sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: #f1f5f9;
    border: 1.5px solid #cbd5e1;
    color: #064e3b;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background: #047857;
    color: #ffffff;
    border-color: #047857;
}

.sidebar-folded .sidebar-toggle-btn {
    background: #ecfdf5;
    border-color: #059669;
    color: #047857;
}

/* Sidebar Backdrop Overlay */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

.nav-shop-location {
    font-weight: 700;
    color: #064e3b;
    font-size: 14.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Top Navbar Business Book Brand Header (Always Visible) */
.nav-brand-title {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    background: #064e3b;
    color: #ffffff;
    border-radius: 8px;
    font-weight: 800;
    font-size: 13.5px;
    letter-spacing: -0.2px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    box-shadow: 0 1px 3px rgba(6, 78, 59, 0.25);
    flex-shrink: 0;
}

.nav-brand-title .brand-book-icon {
    color: #34d399;
    font-size: 14px;
}

.nav-brand-title .brand-book-text {
    font-weight: 800;
    white-space: nowrap;
}

/* Balanced Top Navbar Company Brand Pill */
.nav-company-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    padding: 3px 12px 3px 6px;
    border-radius: 20px;
    transition: all 0.2s ease;
}

body.lang-ur .nav-company-pill {
    padding: 3px 6px 3px 12px;
}

.nav-company-pill:hover {
    border-color: #a7f3d0;
    background: #f0fdf4;
}

.company-badge-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #047857, #065f46);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11.5px;
    flex-shrink: 0;
}

.company-badge-name {
    font-size: 13.5px;
    font-weight: 800;
    color: #064e3b;
    white-space: nowrap;
    letter-spacing: -0.2px;
}

.company-badge-tag {
    font-size: 10.5px;
    font-weight: 700;
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    padding: 1px 7px;
    border-radius: 10px;
    white-space: nowrap;
}

.nav-shortcuts-toggle {
    background: #f8fafc;
    color: #1e293b;
    border: 1.5px solid #cbd5e1;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.2s ease;
}

.nav-shortcuts-toggle:hover,
.nav-shortcuts-toggle.active {
    background: #ecfdf5;
    color: #047857;
    border-color: #047857;
    box-shadow: 0 2px 6px rgba(4, 120, 87, 0.12);
}

.shortcuts-chevron {
    transition: transform 0.2s ease;
}

.nav-shortcuts-toggle.active .shortcuts-chevron {
    transform: rotate(180deg);
}

/* Collapsible Keyboard Shortcuts Bar */
.shortcuts-collapsible-bar {
    background: #f8fafc;
    border-bottom: 1.5px solid #e2e8f0;
    padding: 10px 22px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    display: flex;
    align-items: center;
    transition: all 0.25s ease;
}

.shortcuts-bar-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.shortcut-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: #1e293b;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.shortcut-item kbd {
    color: #ffffff;
    font-weight: 800;
    font-size: 11px;
    padding: 2.5px 7px;
    border-radius: 4px;
    font-family: inherit;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.kbd-f1 { background: #059669 !important; }
.kbd-f2 { background: #047857 !important; }
.kbd-f3 { background: #0284c7 !important; }
.kbd-f4 { background: #d97706 !important; }
.kbd-f6 { background: #4f46e5 !important; }
.kbd-f7 { background: #0891b2 !important; }
.kbd-f8 { background: #7c3aed !important; }
.kbd-print { background: #475569 !important; }

/* Keyboard Shortcuts Modal Rows */
.shortcut-modal-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s ease;
    color: #1e293b;
    cursor: pointer;
}

.shortcut-modal-row:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.shortcut-modal-name {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 13.5px;
    color: #1e293b;
}

.shortcut-modal-row kbd {
    color: #ffffff;
    font-weight: 800;
    font-size: 12px;
    padding: 3px 12px;
    border-radius: 5px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    font-family: inherit;
    letter-spacing: 0.3px;
}

.shortcut-item:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.shortcut-close-btn {
    margin-inline-start: auto;
    background: transparent;
    border: none;
    font-size: 20px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 6px;
    line-height: 1;
    border-radius: 4px;
}

.shortcut-close-btn:hover {
    color: #ef4444;
    background: #fee2e2;
}

.nav-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #475569;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: all 0.2s ease;
}

.nav-icon-btn:hover {
    background: #047857;
    color: #ffffff;
    border-color: #047857;
}

.nav-support-btn {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.nav-support-btn:hover {
    background: #25d366;
    color: #ffffff;
    border-color: #25d366;
}

.nav-lang-btn {
    background: #f8fafc;
    color: #334155;
    border: 1px solid #cbd5e1;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.nav-lang-btn:hover {
    background: #047857;
    color: #ffffff;
    border-color: #047857;
}

/* User Profile Dropdown */
.nav-user-dropdown {
    position: relative;
}

.user-pill-btn {
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 30px;
    padding: 3px 12px 3px 4px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

body.lang-ur .user-pill-btn {
    padding: 3px 4px 3px 12px;
}

.user-pill-btn:hover {
    border-color: #047857;
    box-shadow: 0 2px 6px rgba(4, 120, 87, 0.15);
}

.user-avatar-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #047857, #065f46);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.user-pill-name {
    font-weight: 800;
    font-size: 13px;
    color: #0f172a;
}

.user-pill-role {
    font-size: 9.5px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 8px;
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-end: 0;
    width: 220px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.12);
    padding: 8px 0;
    z-index: 1050;
    display: none;
    animation: fadeInMenu 0.15s ease-out;
}

.user-dropdown-menu.show {
    display: block;
}

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

.user-dropdown-header {
    padding: 10px 16px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
    background: #f8fafc;
    border-radius: 11px 11px 0 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 16px;
    text-decoration: none;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s;
}

.user-dropdown-item:hover {
    background: #f0fdf4;
    color: #047857;
}

.user-dropdown-item.text-danger:hover {
    background: #fef2f2;
    color: #dc2626;
}

.user-dropdown-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 6px 0;
}

/* Bill Creation Balanced Two-Wing Layout */
.bill-layout-grid {
    display: grid;
    grid-template-columns: minmax(360px, 1.25fr) minmax(320px, 0.95fr);
    gap: 20px;
    margin-top: 20px;
    align-items: start;
}

@media (max-width: 1024px) {
    .bill-layout-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
}

.bill-items-table {
    min-width: 980px;
}

.bill-items-table th {
    background: #f8fafc;
    font-weight: 800;
    font-size: 13px;
    color: #1e293b;
    vertical-align: middle;
    padding: 10px 6px;
}

.bill-items-table td {
    padding: 6px 4px;
    vertical-align: middle;
}

.bill-items-table input.form-control {
    padding: 6px 6px;
    font-size: 13.5px;
    border-radius: 6px;
}

.text-emerald { color: #047857 !important; }
.text-sky { color: #0284c7 !important; }
.text-indigo { color: #4f46e5 !important; }
.text-purple { color: #7c3aed !important; }
.text-amber { color: #d97706 !important; }
.text-rose { color: #e11d48 !important; }

@media (max-width: 640px) {
    .hide-xs { display: none !important; }
}
@media (max-width: 768px) {
    .hide-sm { display: none !important; }
}

.btn-lang-toggle {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-lang-toggle:hover {
    background: #047857;
    color: #ffffff;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px;
    background: #f1f5f9;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: #047857;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* Page Content */
.page-content {
    padding: 25px;
    flex-grow: 1;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Dashboard Quick Actions Operations Grid */
.quick-actions-panel {
    background: #ffffff;
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--box-shadow);
    border: 1px solid #e2e8f0;
    margin-bottom: 28px;
}

.quick-actions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1.5px solid #f1f5f9;
}

.quick-actions-header h3 {
    font-size: 17px;
    font-weight: 800;
    color: #064e3b;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 16px;
}

.quick-action-card {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: #1e293b;
    transition: all 0.22s ease-in-out;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.quick-action-card:hover {
    border-color: #047857;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px -5px rgba(4, 120, 87, 0.16);
    background: #fcfdfd;
}

.quick-action-card:hover .action-icon {
    transform: scale(1.08);
}

.action-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.icon-emerald { background: #dcfce7; color: #047857; }
.icon-blue    { background: #e0f2fe; color: #0284c7; }
.icon-amber   { background: #fef3c7; color: #d97706; }
.icon-red     { background: #fee2e2; color: #dc2626; }
.icon-purple  { background: #f3e8ff; color: #7c3aed; }
.icon-teal    { background: #ccfbf1; color: #0d9488; }
.icon-indigo  { background: #e0e7ff; color: #4f46e5; }
.icon-slate   { background: #f1f5f9; color: #475569; }

.action-info {
    flex-grow: 1;
    min-width: 0;
}

.action-title {
    font-size: 14.5px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.6;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.action-subtitle {
    font-size: 11.5px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.quick-action-card:hover .action-title {
    color: #047857;
}

/* Dashboard Metric Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}


.metric-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 22px;
    box-shadow: var(--box-shadow);
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
}

.metric-info h4 {
    font-size: 13px;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 6px;
}

.metric-info .metric-val {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
}

.metric-info .metric-sub {
    font-size: 12px;
    color: #059669;
    font-weight: 600;
    margin-top: 4px;
}

.metric-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.icon-green { background: #dcfce7; color: #15803d; }
.icon-blue { background: #e0f2fe; color: #0369a1; }
.icon-amber { background: #fef3c7; color: #b45309; }
.icon-purple { background: #f3e8ff; color: #7e22ce; }
.icon-red { background: #fee2e2; color: #b91c1c; }

/* Quick Action Bar */
.quick-bar {
    background: white;
    border-radius: var(--border-radius);
    padding: 16px 20px;
    box-shadow: var(--box-shadow);
    border: 1px solid #e2e8f0;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.quick-bar .btn {
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.quick-bar .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px -2px rgba(0,0,0,0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #047857;
    color: white;
}
.btn-primary:hover { background: #065f46; }

.btn-secondary {
    background: #0284c7;
    color: white;
}
.btn-secondary:hover { background: #0369a1; }

.btn-outline {
    background: white;
    border: 1px solid #cbd5e1;
    color: #334155;
}
.btn-outline:hover { background: #f8fafc; border-color: #94a3b8; }

.btn-success { background: #16a34a; color: white; }
.btn-success:hover { background: #15803d; }

.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }

.btn-teal { background: #0d9488; color: white; }
.btn-teal:hover { background: #0f766e; }

.btn-indigo { background: #4f46e5; color: white; }
.btn-indigo:hover { background: #4338ca; }

.btn-purple { background: #7c3aed; color: white; }
.btn-purple:hover { background: #6d28d9; }

.btn-amber { background: #d97706; color: white; }
.btn-amber:hover { background: #b45309; }

.btn-sm {
    padding: 6px 12px;
    font-size: 12.5px;
    border-radius: 6px;
}

/* Card / Box */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 1px solid #e2e8f0;
    margin-bottom: 25px;
    overflow: hidden;
}

.card-header {
    padding: 16px 22px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 22px;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

/* Balanced Mandi Invoice Basic Details Section */
.invoice-meta-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.invoice-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.invoice-meta-row .form-group {
    margin-bottom: 0;
}

.invoice-meta-primary {
    padding-bottom: 16px;
    border-bottom: 1px dashed #cbd5e1;
}

.field-bill-no {
    flex: 0 0 135px;
}

.field-bill-date {
    flex: 0 0 170px;
}

.field-party-name {
    flex: 1 1 340px;
}

.field-broker {
    flex: 1 1 250px;
}

.field-broker-rate {
    flex: 1 1 270px;
}

.field-broker-presets {
    flex: 1.2 1 320px;
}

.broker-chips-wrapper {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    padding-top: 4px;
}

.btn-broker-quick {
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #1e293b;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    line-height: 1.4;
}

.btn-broker-quick:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.btn-broker-quick.active {
    background: #047857;
    border-color: #047857;
    color: #ffffff;
}

.btn-broker-quick.chip-zero {
    border-color: #fecaca;
    background: #fef2f2;
    color: #dc2626;
}

.btn-broker-quick.chip-zero:hover {
    background: #fee2e2;
}

@media (max-width: 768px) {
    .field-bill-no,
    .field-bill-date,
    .field-party-name,
    .field-broker,
    .field-broker-rate,
    .field-broker-presets {
        flex: 1 1 100% !important;
    }
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13.5px;
    color: #334155;
}

.form-control, .form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14.5px;
    outline: none;
    transition: all 0.2s;
    background-color: #ffffff;
    box-sizing: border-box;
}

.form-control:focus, .form-select:focus {
    border-color: #047857;
    box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.15);
}

/* Tables with High-Visibility Horizontal Scrollbar */
.table-responsive {
    overflow-x: auto !important;
    overflow-y: visible;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
}

.table-responsive::-webkit-scrollbar {
    height: 10px !important;
}

.table-responsive::-webkit-scrollbar-track {
    background: #e2e8f0 !important;
    border-radius: 5px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #047857 !important;
    border-radius: 5px;
    border: 2px solid #e2e8f0 !important;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #064e3b !important;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: inherit;
}

.table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    padding: 12px 14px;
    border-bottom: 2px solid #cbd5e1;
    white-space: nowrap;
    position: static;
}

.table td {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

.text-end { text-align: right !important; }
.text-start { text-align: left !important; }
.text-center { text-align: center !important; }

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #e0f2fe; color: #075985; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* Bill & Invoice Scroll Wrapper */
.bill-scroll-wrapper {
    width: 100%;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 20px;
}

/* ==========================================
 * EXACT MANDI BILL INVOICE FORMAT (Attachment 1 & 2)
 * ========================================== */
.mandi-bill-container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border: 3px double #0f172a;
    padding: 30px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    color: #000;
    direction: rtl;
    font-family: 'Noto Nastaliq Urdu', 'Gulzar', 'Inter', serif;
}

.bill-top-header {
    border-bottom: 2px solid #000;
    padding-bottom: 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bill-brand-urdu {
    font-size: 34px;
    font-weight: 800;
    color: #000;
    text-align: center;
    line-height: 2.2;
}

.bill-brand-sub {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 5px;
}

.bill-badge-pill {
    border: 1.5px solid #000;
    padding: 4px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
}

.bill-left-contact {
    text-align: right;
    font-size: 15px;
    font-weight: bold;
    line-height: 1.8;
}

.bill-meta-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 2px solid #000;
    padding: 10px 18px;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: bold;
    background: #fafafa;
}

.bill-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bill-meta-box {
    border: 1.5px solid #000;
    padding: 4px 14px;
    background: white;
    font-size: 17px;
    font-weight: 800;
    min-width: 80px;
    text-align: center;
}

/* ==========================================
 * SALE & PURCHASE CREATION ITEMS TABLE
 * Balanced, readable column widths, zero overlap, comfortable inputs
 * ========================================== */
#bill-items-table {
    width: 100% !important;
    min-width: 1220px !important;
    table-layout: auto !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    margin: 0 !important;
}

#bill-items-table thead th {
    position: static !important;
    top: auto !important;
    z-index: 1 !important;
    box-shadow: none !important;
    background: #f8fafc !important;
    color: #1e293b !important;
    padding: 12px 8px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    text-align: center !important;
    vertical-align: middle !important;
    border-bottom: 2px solid #cbd5e1 !important;
    border-top: 1px solid #e2e8f0 !important;
    line-height: 1.4 !important;
    white-space: normal !important;
    overflow: visible !important;
}

#bill-items-table tbody td {
    position: static !important;
    padding: 10px 6px !important;
    vertical-align: middle !important;
    border-bottom: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    height: 52px !important;
}

#bill-items-table tbody tr:hover td {
    background-color: #f8fafc !important;
}

#bill-items-table tfoot td {
    padding: 12px 8px !important;
    vertical-align: middle !important;
    border-top: 2px solid #0f172a !important;
    background: #f8fafc !important;
    font-weight: 800 !important;
}

#bill-items-table .form-control {
    height: 40px !important;
    min-height: 40px !important;
    padding: 6px 8px !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 6px !important;
    font-variant-numeric: tabular-nums !important;
    width: 100% !important;
    box-sizing: border-box !important;
    background-color: #ffffff !important;
    color: #0f172a !important;
    transition: border-color 0.15s, box-shadow 0.15s;
}

#bill-items-table .form-control:focus {
    border-color: #047857 !important;
    box-shadow: 0 0 0 2px rgba(4, 120, 87, 0.2) !important;
    outline: none !important;
}

#bill-items-table .select2-container {
    width: 100% !important;
}

#bill-items-table .select2-container--default .select2-selection--single {
    height: 40px !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 6px !important;
    display: flex !important;
    align-items: center !important;
    background-color: #ffffff !important;
}

#bill-items-table .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 38px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    padding-inline-start: 6px !important;
    padding-inline-end: 22px !important;
}

#bill-items-table .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 38px !important;
}

#bill-items-table .item-munds {
    font-size: 14px !important;
    font-weight: 800 !important;
}

#bill-items-table .item-munds-detail {
    font-size: 11px !important;
    font-weight: 700 !important;
    margin-top: 3px !important;
    color: #059669 !important;
    line-height: 1.2 !important;
}

/* Grid Table (View & Print) */
.mandi-grid-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    border: 2px solid #000;
    margin-bottom: 15px;
    font-size: 13.5px;
}

.mandi-grid-table th {
    border: 1.5px solid #000;
    background: #f1f5f9;
    padding: 7px 6px;
    text-align: center;
    font-weight: 700;
    font-size: 13.5px;
    vertical-align: middle;
    line-height: 1.35;
}

.mandi-grid-table td {
    border: 1.5px solid #000;
    padding: 6px 6px;
    text-align: center;
    font-weight: 600;
    vertical-align: middle;
    line-height: 1.35;
}

.mandi-grid-table tr.total-row td {
    font-weight: 800;
    background: #f8fafc;
    border-top: 2px solid #000;
    padding: 7px 6px;
    vertical-align: middle;
}

.blank-bill-row {
    height: 30px;
}

/* Bottom Split: Loading & Expenses */
.bill-bottom-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
}

.bill-box {
    border: 2px solid #000;
    padding: 0;
}

.bill-box-title {
    background: #e2e8f0;
    border-bottom: 1.5px solid #000;
    text-align: center;
    padding: 6px;
    font-size: 14.5px;
    font-weight: 800;
}

.bill-box-table {
    width: 100%;
    border-collapse: collapse;
}

.bill-box-table td {
    border: 1px solid #000;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 600;
    vertical-align: middle;
    line-height: 1.35;
}

.bill-box-table tr.highlight td {
    background: #f8fafc;
    font-weight: 800;
    font-size: 14px;
}

.bill-box-table tr.grand-total td {
    background: #e2e8f0;
    font-weight: 900;
    font-size: 15px;
}

/* Print Stylesheet */
@media print {
    @page {
        size: A4 portrait;
        margin: 8mm 10mm;
    }
    html, body {
        background: white !important;
        color: black !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        font-size: 12px !important;
    }
    .sidebar, .top-navbar, .no-print, .btn, .page-header, .quick-actions-panel, 
    .user-guide-card, .sidebar-toggle-btn, .sidebar-backdrop, .pagination-container, .floating-support-dock {
        display: none !important;
    }
    .app-container, .main-wrapper, .page-content, .bill-scroll-wrapper {
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
        background: white !important;
        overflow: visible !important;
        width: 100% !important;
    }

    /* Mandi Bill & Invoice Container - Compact Single Page Fit */
    .mandi-bill-container {
        border: 1.5px solid #000 !important;
        box-shadow: none !important;
        max-width: 100% !important;
        width: 100% !important;
        padding: 8px 14px !important;
        margin: 0 auto !important;
        overflow: visible !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* Bill Header Vertical Compactness */
    .bill-top-header {
        border-bottom: 1.5px solid #000 !important;
        padding-bottom: 4px !important;
        margin-bottom: 6px !important;
    }
    .bill-brand-urdu {
        font-size: 22px !important;
        line-height: 1.35 !important;
        margin: 0 !important;
    }
    .bill-brand-sub {
        margin-top: 1px !important;
        gap: 8px !important;
    }
    .bill-badge-pill {
        padding: 1px 8px !important;
        font-size: 11px !important;
        border-width: 1px !important;
    }
    .bill-left-contact {
        font-size: 11px !important;
        line-height: 1.35 !important;
    }
    .bill-left-contact > div:first-child {
        font-size: 14px !important;
        margin-bottom: 1px !important;
    }

    /* Meta Bar Compactness */
    .bill-meta-bar {
        padding: 3px 8px !important;
        margin-bottom: 6px !important;
        font-size: 12.5px !important;
        border-width: 1px !important;
        background: #f8fafc !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .bill-meta-box {
        padding: 1px 8px !important;
        font-size: 13px !important;
        min-width: 55px !important;
        border-width: 1px !important;
    }

    /* Items Table Proportional Vertical Sizing Matching Text Height */
    .mandi-grid-table {
        margin-bottom: 8px !important;
        border-width: 1.5px !important;
        font-size: 11.5px !important;
        table-layout: fixed !important;
        width: 100% !important;
    }
    .mandi-grid-table th {
        padding: 5px 4px !important;
        font-size: 11.5px !important;
        border-width: 1px !important;
        background: #f1f5f9 !important;
        vertical-align: middle !important;
        line-height: 1.35 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .mandi-grid-table td {
        padding: 5px 4px !important;
        font-size: 11.5px !important;
        border-width: 1px !important;
        line-height: 1.35 !important;
        vertical-align: middle !important;
    }
    .mandi-grid-table tr.total-row td {
        padding: 5px 4px !important;
        font-size: 12px !important;
        border-top: 1.5px solid #000 !important;
        background: #f8fafc !important;
        vertical-align: middle !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .blank-bill-row {
        height: 26px !important;
    }

    /* Bottom Split (Expenses & Loading) Compact Sizing */
    .bill-bottom-split {
        margin-top: 8px !important;
        gap: 12px !important;
    }
    .bill-box {
        border-width: 1.5px !important;
    }
    .bill-box-title {
        padding: 3px 6px !important;
        font-size: 11.5px !important;
        border-bottom: 1px solid #000 !important;
        background: #e2e8f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .bill-box-table td {
        padding: 4px 6px !important;
        font-size: 11px !important;
        line-height: 1.35 !important;
        vertical-align: middle !important;
        border-width: 0.5px !important;
    }
    .bill-box-table tr.highlight td {
        font-size: 11.5px !important;
        padding: 4px 6px !important;
    }
    .bill-box-table tr.grand-total td {
        font-size: 12.5px !important;
        padding: 5px 6px !important;
        background: #e2e8f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .bill-signature-box {
        margin-top: 10px !important;
        padding: 4px !important;
        font-size: 10.5px !important;
    }

    /* Voucher Print View Compactness */
    .bill-box-table td, 
    .mandi-bill-container table td {
        border-color: #000 !important;
    }

    /* Reports & General Ledger Print Compactness */
    .table-responsive {
        overflow: visible !important;
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .card {
        border: 1px solid #cbd5e1 !important;
        box-shadow: none !important;
        margin-bottom: 10px !important;
        page-break-inside: auto;
    }
    .card-header {
        padding: 5px 10px !important;
        font-size: 12px !important;
        background: #f8fafc !important;
        border-bottom: 1px solid #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .card-body {
        padding: 6px 8px !important;
    }
    .table {
        margin-bottom: 6px !important;
        font-size: 11px !important;
        width: 100% !important;
        max-width: 100% !important;
        table-layout: fixed !important;
        border-collapse: collapse !important;
    }
    .table th {
        padding: 4px 4px !important;
        font-size: 11px !important;
        background: #f1f5f9 !important;
        vertical-align: middle !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .table td {
        padding: 4px 4px !important;
        font-size: 11px !important;
        line-height: 1.3 !important;
        vertical-align: middle !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
    .table td.text-end, .table th.text-end {
        white-space: nowrap !important;
    }
    .ledger-summary-strip {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
        padding: 6px 8px !important;
        background: #f1f5f9 !important;
        border-bottom: 1.5px solid #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .ledger-summary-box {
        padding: 4px 6px !important;
        border-width: 1px !important;
        min-width: 0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .ledger-summary-box > div:first-child {
        font-size: 9.5px !important;
        line-height: 1.2 !important;
    }
    .ledger-summary-box > div:last-child {
        font-size: 11.5px !important;
        white-space: nowrap !important;
    }
    thead {
        display: table-header-group !important;
    }
    tr {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    .print-subtle-credit {
        display: block !important;
        margin-top: 10px !important;
        padding-top: 4px !important;
        border-top: 0.5px solid #cbd5e1 !important;
        text-align: center !important;
        font-size: 8pt !important;
        color: #64748b !important;
        line-height: 1.3 !important;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
        page-break-inside: avoid !important;
    }
}

/* ==========================================
 * MODERN OPTIMIZED PAGINATION STYLES
 * ========================================== */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1.5px solid #e2e8f0;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    flex-wrap: wrap;
    gap: 16px;
}

.pagination-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.pagination-badge i {
    color: #047857;
    font-size: 14px;
}

.pagination-controls-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pagination {
    display: flex;
    list-style: none;
    gap: 6px;
    margin: 0;
    padding: 0;
    align-items: center;
}

.page-item .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    color: #1e293b;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.page-item .page-link:hover {
    background: #ecfdf5;
    border-color: #059669;
    color: #047857;
    transform: translateY(-1.5px);
    box-shadow: 0 4px 10px rgba(5, 150, 105, 0.15);
}

.page-item.active .page-link {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    border-color: #047857 !important;
    color: #ffffff !important;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(4, 120, 87, 0.35);
    transform: translateY(-1px);
}

.page-item.disabled .page-link {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    opacity: 0.75;
}

.page-item.ellipsis .page-link {
    border: none;
    background: transparent;
    color: #94a3b8;
    box-shadow: none;
    cursor: default;
    min-width: 24px;
    padding: 0 4px;
}

.page-item.ellipsis .page-link:hover {
    background: transparent;
    color: #94a3b8;
    transform: none;
    box-shadow: none;
}

/* ==========================================
 * COLLAPSIBLE USER GUIDE CARD
 * ========================================== */
.user-guide-card {
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-inline-start: 5px solid #047857;
    border-radius: var(--border-radius);
    margin-bottom: 22px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.user-guide-header {
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: #ffffff;
    user-select: none;
    transition: background 0.2s;
}

.user-guide-header:hover {
    background: #f1f5f9;
}

.user-guide-title {
    font-size: 15px;
    font-weight: 700;
    color: #064e3b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-guide-badge {
    background: #ecfdf5;
    color: #047857;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #a7f3d0;
}

.user-guide-body {
    padding: 16px 20px;
    font-size: 14px;
    line-height: 1.7;
    color: #334155;
    background: #fcfdfd;
    border-top: 1px solid #e2e8f0;
    display: none; /* Collapsible toggle */
}

.user-guide-body.show {
    display: block;
}

.guide-step-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.guide-step-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 15px;
}

.guide-step-item h5 {
    font-size: 13.5px;
    font-weight: 700;
    color: #047857;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.guide-step-item p {
    font-size: 12.5px;
    color: #64748b;
    margin: 0;
}

/* ==========================================
 * SELECT2 THEME CUSTOMIZATION FOR MANDI APP
 * ========================================== */
.select2-container {
    width: 100% !important;
}

.table td .select2-container {
    width: 100% !important;
}

.table td .select2-container--default .select2-selection--single {
    height: 38px;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    padding: 3px 8px;
    background-color: #ffffff;
    display: flex;
    align-items: center;
}

.table td .select2-container--default .select2-selection--single .select2-selection__rendered {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 28px;
    padding-inline-start: 2px;
}

.table td .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
    inset-inline-end: 6px;
}

.select2-container--default .select2-selection--single {
    height: 44px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 7px 12px;
    background-color: #ffffff;
    transition: all 0.2s;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #1e293b;
    font-size: 14.5px;
    font-weight: 600;
    line-height: 28px;
    padding-inline-start: 0;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 42px;
    inset-inline-end: 10px;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: #047857 !important;
    box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.15);
}

.select2-dropdown {
    border: 1.5px solid #047857;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    font-family: inherit;
    z-index: 9999;
}

.select2-search--dropdown {
    padding: 8px;
}

.select2-search--dropdown .select2-search__field {
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 14px;
    outline: none;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #047857;
    color: white;
}

.select2-container--default .select2-results__option {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
}

/* ==========================================
 * RESPONSIVE LAYOUT & MEDIA QUERIES
 * ========================================== */

/* Dashboard Tables Grid */
.dashboard-tables-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
}

/* Balance Sheet Two-Column Layout */
.balance-sheet-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.balance-sheet-footer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: 2px solid #000;
    background: #e2e8f0;
    font-weight: 900;
    font-size: 16px;
}

/* ------------------------------------------
 * Desktop Foldable Sidebar (> 992px)
 * ------------------------------------------ */
@media (min-width: 993px) {
    /* Smooth transition for folding sidebar */
    .sidebar {
        transition: margin 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* English LTR: Folds to the LEFT */
    body.lang-en.sidebar-folded .sidebar,
    body[dir="ltr"].sidebar-folded .sidebar,
    .app-container.sidebar-folded .sidebar {
        margin-left: -260px;
        margin-right: 0;
        box-shadow: none;
    }

    /* Urdu RTL: Folds to the RIGHT */
    body.lang-ur.sidebar-folded .sidebar,
    body[dir="rtl"].sidebar-folded .sidebar,
    body.lang-ur .app-container.sidebar-folded .sidebar,
    [dir="rtl"] .app-container.sidebar-folded .sidebar {
        margin-right: -260px;
        margin-left: 0;
        box-shadow: none;
    }

    .sidebar-folded .main-wrapper {
        width: 100%;
        max-width: 100%;
    }
}

/* ------------------------------------------
 * Tablet & Mobile Drawer (<= 992px)
 * ------------------------------------------ */
@media (max-width: 992px) {
    .sidebar-toggle-btn {
        display: inline-flex !important;
    }

    /* Transform Sidebar to Off-Canvas Drawer */
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        z-index: 1060;
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.4);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        margin: 0 !important;
    }

    /* Off-screen placement based on direction */
    body[dir="rtl"] .sidebar,
    body.lang-ur .sidebar {
        right: 0;
        left: auto;
        transform: translateX(100%);
    }

    body[dir="ltr"] .sidebar,
    body.lang-en .sidebar {
        left: 0;
        right: auto;
        transform: translateX(-100%);
    }

    body[dir="rtl"] .sidebar.open,
    body.lang-ur .sidebar.open,
    body[dir="ltr"] .sidebar.open,
    body.lang-en .sidebar.open,
    .sidebar.open {
        transform: translateX(0) !important;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.65);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
        z-index: 1050;
    }

    .sidebar-backdrop.active {
        display: block !important;
        opacity: 1 !important;
    }

    .main-wrapper {
        width: 100%;
        min-width: 0;
    }

    .dashboard-tables-grid {
        grid-template-columns: 1fr;
    }

    .balance-sheet-grid {
        grid-template-columns: 1fr;
    }

    .balance-sheet-grid > div:first-child {
        border-inline-end: none !important;
        border-bottom: 2px solid #000;
    }

    .balance-sheet-footer-grid {
        grid-template-columns: 1fr;
    }

    .balance-sheet-footer-grid > div:first-child {
        border-inline-end: none !important;
        border-bottom: 1.5px solid #000;
    }

    .quick-actions-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 12px;
    }
}

/* ------------------------------------------
 * Mobile Devices (<= 768px)
 * ------------------------------------------ */
@media (max-width: 768px) {
    .page-content {
        padding: 14px 12px;
    }

    .top-navbar {
        padding: 10px 14px;
    }

    .nav-shortcuts-badge {
        display: none !important;
    }

    .nav-shop-location {
        font-size: 13px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 18px;
    }

    .page-title {
        font-size: 18px;
    }

    .quick-actions-panel {
        padding: 16px 14px;
        margin-bottom: 20px;
    }

    .quick-actions-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 14px;
    }

    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .quick-action-card {
        padding: 12px 10px;
        gap: 10px;
    }

    .action-icon {
        width: 38px;
        height: 38px;
        font-size: 16px;
        border-radius: 9px;
    }

    .action-title {
        font-size: 13px;
    }

    .action-subtitle {
        font-size: 11px;
    }

    /* Form Grid single column */
    .form-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    /* Mandi Bill & Invoices */
    .mandi-bill-container {
        padding: 14px 12px !important;
        border-width: 2px !important;
    }

    .bill-top-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .bill-brand-urdu {
        font-size: 24px !important;
        line-height: 1.8 !important;
    }

    .bill-left-contact {
        text-align: center !important;
        font-size: 13px !important;
    }

    .bill-meta-bar {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }

    .bill-meta-item {
        justify-content: space-between;
    }

    /* Filter Cards */
    form[method="GET"] {
        flex-direction: column;
        align-items: stretch !important;
    }

    form[method="GET"] > div {
        width: 100% !important;
        min-width: 0 !important;
    }

    form[method="GET"] button,
    form[method="GET"] a.btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    /* Pagination container wrap */
    .pagination-container {
        flex-direction: column;
        gap: 12px;
        padding: 12px 14px;
    }

    .pagination-badge {
        width: 100%;
        justify-content: center;
    }

    .pagination-controls-wrapper {
        width: 100%;
        justify-content: center;
    }

    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ------------------------------------------
 * Small Mobile Screens (<= 480px)
 * ------------------------------------------ */
@media (max-width: 480px) {
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }

    .btn-lang-toggle span {
        display: none;
    }

    .user-badge span {
        max-width: 110px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .user-guide-title {
        font-size: 13.5px;
    }

    .guide-step-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ==========================================
 * MANDI CONFIRMATION & ACTION MODALS
 * ========================================== */
.mandi-modal-backdrop {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(15, 23, 42, 0.7) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    z-index: 99999 !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    box-sizing: border-box !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.mandi-modal-backdrop.show {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.mandi-modal-dialog {
    background: #ffffff !important;
    border-radius: 14px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35) !important;
    width: 100% !important;
    max-width: 520px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    border: 1px solid #e2e8f0 !important;
    display: flex !important;
    flex-direction: column !important;
    animation: mandiModalIn 0.25s ease-out !important;
    direction: inherit;
    margin: auto !important;
}

@keyframes mandiModalIn {
    from {
        transform: translateY(-20px) scale(0.96);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.mandi-modal-header {
    padding: 16px 20px !important;
    border-bottom: 1.5px solid #e2e8f0 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-top-left-radius: 14px !important;
    border-top-right-radius: 14px !important;
}

.mandi-modal-body {
    padding: 20px !important;
    font-size: 13.5px !important;
    color: #334155 !important;
    flex-grow: 1 !important;
}

.mandi-modal-footer {
    padding: 14px 20px !important;
    border-top: 1.5px solid #e2e8f0 !important;
    background: #f8fafc !important;
    display: flex !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    border-bottom-left-radius: 14px !important;
    border-bottom-right-radius: 14px !important;
}

.verification-data-list {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 10px !important;
    padding: 12px 14px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

.verification-data-item {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-size: 13px !important;
    padding: 5px 6px !important;
    border-bottom: 1px dashed #e2e8f0 !important;
}

.verification-data-item:last-child {
    border-bottom: none !important;
}

.verification-data-label {
    color: #475569 !important;
    font-weight: 600 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.verification-data-val {
    font-weight: 700 !important;
    color: #0f172a !important;
}

/* ==========================================
 * FULLSCREEN & EXIT CONTROLS (LOGIN & LOGOUT)
 * ========================================== */
.login-top-bar {
    position: absolute;
    top: 18px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.login-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.exit-action-btn {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: inherit;
}

.exit-action-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: translateY(-1px);
}

.exit-action-btn.exit-danger {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

.exit-action-btn.exit-danger:hover {
    background: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.btn-exit-app {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    background: #fef2f2;
    color: #b91c1c;
    border: 1.5px solid #fecaca;
    border-radius: 12px;
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-exit-app:hover {
    background: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
    transform: translateY(-1px);
}

/* Fullscreen Exit Graceful Overlay */
.exit-screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.exit-dialog-card {
    background: #ffffff;
    border-radius: 20px;
    max-width: 460px;
    width: 100%;
    padding: 35px 30px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: mandiModalIn 0.25s ease-out;
}

.exit-dialog-icon {
    width: 64px;
    height: 64px;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 16px;
}


