/* ===================================
   CSS Variables & Reset
   =================================== */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
    --primary-color: #4f46e5;
    --secondary-color: #7c3aed;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --dark-color: #1f2937;
    --light-color: #f3f4f6;
    --sidebar-bg: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-hover: #334155;
    --sidebar-active: var(--primary-color);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-color);
    overflow-x: hidden;
}

/* Login system - removed problematic visibility rules */
/* Content is always visible - login system controls access via JavaScript */

body.not-logged-in {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Show content when logged in */
body.logged-in #sidebar,
body.logged-in #mainContent {
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

body.logged-in.client-portal-user #sidebar {
    display: none !important;
}

body.logged-in.client-portal-user #mainContent {
    margin-left: 0 !important;
}

body.logged-in.client-portal-user .main-content,
body.logged-in.client-portal-user #mainContent.main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
}

body.logged-in.client-portal-user,
body.logged-in.client-portal-user #mainContent,
body.logged-in.client-portal-user .content-wrapper,
body.logged-in.client-portal-user .client-portal-dashboard,
body.logged-in.client-portal-user .client-portal-dashboard-shell {
    overflow-x: hidden !important;
}

body.logged-in.client-portal-user .sidebar-overlay {
    display: none !important;
    pointer-events: none !important;
}

.client-portal-dashboard {
    min-height: calc(100vh - 24px);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: radial-gradient(circle at top right, #eef4ff 0%, #f7f9fc 45%, #f3f6fb 100%);
}

.client-portal-dashboard-shell {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    min-width: 0;
}

.client-portal-dashboard * {
    max-width: 100%;
}

.client-mobile-header {
    display: none;
    border-radius: 12px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #0d6efd 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.client-mobile-header-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.client-mobile-header-subtitle {
    font-size: 1rem;
    font-weight: 700;
    margin-top: 2px;
}

.client-mobile-header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.client-mobile-header-actions .btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 8px;
}

.client-mobile-lang {
    display: inline-flex;
    gap: 4px;
}

.client-mobile-lang .btn {
    width: auto;
    min-width: 30px;
    padding: 0 6px;
    font-size: 0.72rem;
    font-weight: 700;
}

.client-portal-hero {
    border: 0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 28px rgba(31, 41, 55, 0.08);
    background: linear-gradient(130deg, #ffffff 0%, #f5f8ff 100%);
}

.client-portal-hero .card-body {
    padding: 20px;
}

.client-portal-hero h4 {
    font-weight: 700;
    color: #1f2937;
}

.client-portal-hero-actions .btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 0.5rem 0.9rem;
}

.client-stat-card {
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(2, 27, 121, 0.06) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.client-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(2, 27, 121, 0.1) !important;
}

.client-stat-card .card-body {
    padding: 18px;
}

.client-stat-card small {
    font-size: 0.82rem;
    font-weight: 600;
}

.client-stat-card h3 {
    margin-top: 6px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.client-portal-section-card {
    border: 0;
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(30, 41, 59, 0.07);
}

.client-portal-section-card .card-header {
    background: #f8fbff;
    border-bottom: 1px solid #e5e7eb;
    padding: 14px 16px;
}

.client-portal-section-card .card-header h6 {
    font-weight: 700;
    color: #1f2937;
}

.client-invoice-filters .form-control,
.client-invoice-filters .form-select,
.client-invoice-filters .btn {
    min-height: 42px;
    border-radius: 10px;
}

.client-invoice-filters .input-group-text {
    border-radius: 10px 0 0 10px;
    background: #f8fafc;
}

.client-invoice-filters .input-group .form-control {
    border-radius: 0 10px 10px 0;
}

.client-invoices-toolbar {
    background: #f8fbff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px;
}

.client-invoices-toolbar-modern {
    background: linear-gradient(180deg, #f9fbff 0%, #f3f7ff 100%);
    border-color: #dbe7ff;
}

.client-status-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.client-status-chip {
    border-radius: 999px;
    font-weight: 600;
}

.client-status-chip.active {
    background: #0d6efd;
    color: #fff;
    border-color: #0d6efd;
}

.client-invoice-counter {
    font-weight: 600;
    color: #334155;
}

.client-invoice-filters .form-select {
    background-color: #fff;
}

.client-portal-table thead th {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #64748b;
    border-bottom-width: 1px;
}

.client-portal-table tbody td {
    vertical-align: middle;
    padding-top: 10px;
    padding-bottom: 10px;
}

.client-portal-table .btn-group .btn {
    border-radius: 8px !important;
}

.client-portal-table .btn-group .dropdown-toggle {
    width: 1cm !important;
    height: 1cm !important;
    min-width: 1cm !important;
    max-width: 1cm !important;
    min-height: 1cm !important;
    max-height: 1cm !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

.client-portal-table .btn-group .dropdown-toggle .dropdown-action-label {
    display: none !important;
}

.client-portal-table .btn-group .dropdown-toggle::after {
    display: none !important;
}

@media (max-width: 768px) {
    .client-mobile-header {
        display: block;
    }

    .client-portal-hero-actions {
        display: none !important;
    }

    .client-portal-dashboard {
        min-height: 0;
        padding-top: 0;
    }

    body.logged-in.client-portal-user .top-header {
        padding: 0 10px;
        min-height: 48px;
    }

    body.logged-in.client-portal-user .top-header .header-actions {
        display: none !important;
    }

    body.logged-in.client-portal-user .top-header .header-title h5 {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 86vw;
    }

    .client-portal-dashboard .row.g-3.mb-4 > [class*="col-"] {
        width: 50%;
        flex: 0 0 50%;
        max-width: 50%;
    }

    .client-portal-dashboard .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .client-portal-dashboard [class*="col-"] {
        padding-left: 6px !important;
        padding-right: 6px !important;
        min-width: 0;
    }

    .client-portal-dashboard-shell {
        max-width: 100%;
    }

    .client-portal-hero .card-body {
        padding: 14px;
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    .client-portal-hero h4 {
        font-size: 1.1rem;
    }

    .client-portal-hero-actions {
        width: auto;
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 6px;
        margin-left: auto;
    }

    .client-portal-hero-actions .btn {
        flex: 0 0 auto;
        min-width: 32px;
        padding: 0.3rem 0.4rem;
        font-size: 0.78rem;
        line-height: 1.15;
        white-space: nowrap;
    }

    .client-portal-hero-actions .btn i {
        font-size: 0.82rem;
        margin-right: 0;
    }

    .client-portal-hero-actions .client-action-label {
        display: none;
    }

    .client-portal-hero .card-body > div:first-child {
        max-width: 56vw;
    }

    .client-stat-card .card-body {
        padding: 14px;
    }

    .client-portal-dashboard .table-responsive {
        overflow-x: visible;
    }

    .client-invoices-toolbar {
        padding: 8px;
    }

    .client-portal-table thead {
        display: none;
    }

    .client-portal-table tbody tr[data-invoice-id],
    .client-portal-table tbody tr[data-payment-id] {
        display: block;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        padding: 8px 10px;
        margin-bottom: 10px;
        background: #fff;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    }

    .client-portal-table tbody tr[data-invoice-id] td,
    .client-portal-table tbody tr[data-payment-id] td {
        display: block;
        border: 0;
        padding: 7px 0;
        font-size: 0.9rem;
        text-align: start;
        overflow-wrap: anywhere;
    }

    .client-portal-table tbody tr[data-invoice-id] td::before,
    .client-portal-table tbody tr[data-payment-id] td::before {
        display: block;
        content: attr(data-label);
        color: #64748b;
        font-size: 0.78rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.35px;
        min-width: 0;
        margin-bottom: 3px;
    }

    .client-portal-table tbody tr[data-invoice-id] td:last-child,
    .client-portal-table tbody tr[data-payment-id] td:last-child {
        padding-top: 10px;
    }

    .client-portal-table .btn-group {
        flex-wrap: wrap;
        justify-content: flex-start;
        width: 100%;
        gap: 6px;
        display: flex;
    }

    .client-portal-table .btn-group .btn {
        padding: 0.25rem 0.45rem;
    }

    .client-portal-table td[data-label="Actions"] .dropdown-toggle {
        width: auto;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0;
        padding: 0.3rem 0.45rem;
        min-width: 32px;
        font-size: 0.8rem;
    }

    .client-portal-table td[data-label="Actions"] .dropdown-toggle .dropdown-action-label {
        display: none;
    }

    .client-portal-table td[data-label="Actions"] .dropdown-toggle::after {
        margin-left: 0.25rem;
    }

    .client-portal-table td[data-label="Actions"] .dropdown-menu {
        width: 100%;
        position: static !important;
        inset: auto !important;
        transform: none !important;
        margin-top: 6px;
        border-radius: 10px;
        border: 1px solid #e5e7eb;
        box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
        overflow: hidden;
    }

    .client-portal-table td[data-label="Actions"] .dropdown-item {
        padding: 0.5rem 0.65rem;
        font-size: 0.9rem;
    }

    /* Mobile payments: keep Date / Payment# / Amount / Method in one row */
    .client-portal-table tbody tr[data-payment-id] {
        white-space: nowrap;
    }

    .client-portal-table tbody tr[data-payment-id] td:nth-child(-n+4) {
        display: inline-block !important;
        width: auto !important;
        padding: 2px 8px 2px 0 !important;
        font-size: 0.82rem;
        vertical-align: top;
    }

    .client-portal-table tbody tr[data-payment-id] td:nth-child(-n+4)::before {
        display: none !important;
        content: '' !important;
    }

    .client-portal-table tbody tr[data-payment-id] td:nth-child(5) {
        display: block !important;
        width: 100% !important;
        margin-top: 6px;
        white-space: normal;
    }
}

/* ===================================
   Left Sidebar Navigation
   =================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition);
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

/* Global sidebar overlay (prevent stuck click blockers) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

@media (min-width: 1201px) {
    .sidebar-overlay,
    .sidebar-overlay.active {
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-header {
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h4 {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.btn-close-sidebar {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
}

.sidebar-menu {
    padding: 10px 0;
}

.sidebar-menu .nav {
    padding: 0;
}

.sidebar-menu .nav-item {
    margin-bottom: 2px;
}

.sidebar-menu .nav-link {
    color: var(--sidebar-text);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
    font-size: 0.95rem;
}

.sidebar-menu .nav-link > i:not(.bi-chevron-down) {
    margin-right: 0;
    font-size: 1.1rem;
    width: 20px;
    flex: 0 0 20px;
}

.sidebar-menu .nav-link .bi-chevron-down {
    margin-left: auto;
    margin-right: 0;
    width: auto;
    flex: 0 0 auto;
    font-size: 0.9rem;
}

.sidebar-menu .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-menu .nav-link.active {
    background: var(--sidebar-hover);
    color: #fff;
    border-left-color: var(--sidebar-active);
}

.sidebar-menu .nav-link.collapsed i.bi-chevron-down {
    transform: rotate(-90deg);
    transition: var(--transition);
}

.sidebar-menu .nav-link:not(.collapsed) i.bi-chevron-down {
    transform: rotate(0deg);
}

/* Submenu Styles */
.submenu {
    background: rgba(0, 0, 0, 0.2);
    list-style: none;
    padding: 0;
    margin: 0;
}

.submenu li {
    margin: 0;
}

.submenu a {
    color: var(--sidebar-text);
    padding: 10px 20px 10px 50px;
    display: block;
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.9rem;
}

.submenu a:hover {
    background: var(--sidebar-hover);
    color: #fff;
    padding-left: 55px;
}

.submenu a.active {
    background: var(--sidebar-hover);
    color: #fff;
    border-left: 3px solid var(--sidebar-active);
    padding-left: 52px;
    font-weight: 600;
}

/* ===================================
   Main Content Area
   =================================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

.top-header {
    background: #fff;
    height: var(--header-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 999;
}

.btn-toggle-sidebar {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark-color);
    padding: 5px 10px;
    margin-right: 15px;
    display: none;
}

.header-title {
    flex: 1;
}

.header-title h5 {
    color: var(--dark-color);
    font-weight: 600;
}

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

.content-wrapper {
    padding: 0;
}

.viewing-year-footer {
    position: fixed;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 998;
    background: rgba(30, 41, 59, 0.9);
    color: #fff;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    pointer-events: none;
}

@media (max-width: 768px) {
    .viewing-year-footer {
        bottom: 6px;
        font-size: 11px;
        padding: 3px 8px;
        max-width: calc(100% - 16px);
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* ===================================
   Dashboard Cards & Stats
   =================================== */
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    min-height: 130px;
    height: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-right: 15px;
}

.stat-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-height: 70px;
}

.stat-primary .stat-icon {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}

.stat-success .stat-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.stat-warning .stat-icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.stat-info .stat-icon {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

.stat-info h6 {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 5px;
    min-height: 1.2rem;
}

.stat-info h3 {
    color: var(--dark-color);
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.stat-info small {
    display: block;
    min-height: 1.2rem;
}

/* ===================================
   Quick Action Buttons
   =================================== */
.section-header {
    display: flex;
    align-items: center;
    color: var(--dark-color);
}

.section-header h5 {
    font-weight: 600;
    margin: 0;
}

.quick-action-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 25px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.quick-action-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

.quick-action-btn i {
    font-size: 2rem;
}

.quick-action-btn span {
    font-size: 1rem;
    font-weight: 600;
}

/* Invoice Item Rows - Compact Spacing */
.invoice-row td {
    padding-top: 6px !important;
    padding-bottom: 6px !important;
}

.invoice-row .form-control-sm {
    margin: 0;
}

/* Disable mouse spinner controls for number inputs (keyboard only) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    appearance: none;
    appearance: none;
    appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

#invoiceItemsTable tbody td {
    padding-top: 3px !important;
    padding-bottom: 3px !important;
    vertical-align: middle;
}

#invoiceItemsTable textarea.form-control-sm.item-search {
    margin: 0 !important;
}

/* ===================================
   Cards & Tables
   =================================== */
.card {
    border: none;
    border-radius: 10px;
    margin-bottom: 20px;
}

.card-header {
    border-bottom: 1px solid #e5e7eb;
    padding: 15px 20px;
    border-radius: 10px 10px 0 0 !important;
}

.card-header h6 {
    font-weight: 600;
    color: var(--dark-color);
}

.card-body {
    padding: 20px;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: var(--light-color);
    color: var(--dark-color);
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
    padding: 12px;
}

.table tbody td {
    padding: 12px;
    vertical-align: middle;
}

/* ===================================
   Modal Styles
   =================================== */
.modal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    border-radius: 10px 10px 0 0;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.modal-content {
    border-radius: 10px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-footer {
    border-top: 1px solid #e5e7eb;
    padding: 15px 20px;
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 1200px) {
    .btn-toggle-sidebar {
        display: block;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .btn-close-sidebar {
        display: block;
    }
}

@media (max-width: 991.98px) {
    .quick-action-btn {
        padding: 16px 14px;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        gap: 12px;
        text-align: left;
        border-radius: 10px;
    }

    .quick-action-btn i {
        font-size: 1.6rem;
    }

    .quick-action-btn span {
        font-size: 0.95rem;
        font-weight: 600;
    }

    .invoice-row .form-control-sm {
        padding: 0.3rem 0.45rem;
        font-size: 0.85rem;
        line-height: 1.2;
    }

    .invoice-row textarea.form-control-sm.item-search {
        min-height: 38px;
        height: 38px;
        resize: none;
    }

    .invoice-row .btn-group .btn {
        padding: 4px 6px;
        font-size: 0.8rem;
    }

    .invoice-row .item-suggestions {
        width: 240px;
        max-width: 90vw;
    }

    #invoiceItemsTable td,
    #invoiceItemsTable th {
        padding: 6px 6px !important;
    }

    .invoice-row td {
        padding-top: 4px !important;
        padding-bottom: 4px !important;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 280px;
    }
    
    .stat-card {
        margin-bottom: 15px;
    }
    
    .quick-action-btn {
        padding: 14px 12px;
        flex-direction: row;
        justify-content: flex-start;
        gap: 10px;
        min-height: 56px;
    }
    
    .top-header {
        padding: 0 15px;
    }
    
    .content-wrapper {
        padding: 0;
    }
}

@media (max-width: 576px) {
    .header-title h5 {
        font-size: 1rem;
    }
    
    .stat-info h3 {
        font-size: 1.5rem;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .card-header, .card-body {
        padding: 15px;
    }

    .quick-action-btn {
        padding: 12px 10px;
        box-shadow: 0 3px 8px rgba(79, 70, 229, 0.25);
        min-height: 52px;
    }

    .quick-action-btn i {
        font-size: 1.35rem;
    }

    .quick-action-btn span {
        font-size: 0.9rem;
    }

    .quick-actions-grid > [class*="col-"] {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .invoice-row .form-control-sm {
        padding: 0.25rem 0.4rem;
        font-size: 0.8rem;
    }

    .invoice-row textarea.form-control-sm.item-search {
        min-height: 34px;
        height: 34px;
    }

    .invoice-row .btn-group .btn {
        padding: 3px 5px;
        font-size: 0.75rem;
    }

    #invoiceItemsTable td,
    #invoiceItemsTable th {
        padding: 5px 5px !important;
    }

    .invoice-row td {
        padding-top: 3px !important;
        padding-bottom: 3px !important;
    }
}

@media (max-width: 420px) {
    .quick-actions-grid > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ===================================
   Extra Mobile View Fixes
   =================================== */
@media (max-width: 768px) {
    .top-header {
        height: auto;
        min-height: var(--header-height);
        padding-top: 8px;
        padding-bottom: 8px;
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-title {
        order: 3;
        flex: 0 0 100%;
        width: 100%;
    }

    .header-actions {
        margin-left: auto;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        justify-content: flex-end;
        max-width: calc(100% - 56px);
    }

    .header-actions .btn {
        padding: 0.25rem 0.45rem;
        min-width: 34px;
    }

    .language-switcher {
        display: flex;
        gap: 4px;
    }

    .language-switcher .lang-btn {
        min-width: 32px;
        height: 32px;
        padding: 0 8px;
        font-size: 0.8rem;
    }

    .card-header-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .card-header-tabs::-webkit-scrollbar {
        height: 6px;
    }

    .card-header-tabs::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.05);
    }

    .card-header-tabs::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 3px;
    }

    .card-header-tabs .nav-link {
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .container-fluid.py-4 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .header-title h5 {
        margin-top: 2px;
        font-size: 0.95rem;
    }

    .header-actions {
        max-width: calc(100% - 46px);
    }
}

/* ===================================
   Utility Classes
   =================================== */
.badge {
    padding: 5px 10px;
    font-weight: 500;
}

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

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

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

/* Invoice Table Input Fields */
table .ctn-input {
    min-width: 60px !important;
    width: 100% !important;
}

table .qty-input {
    min-width: 90px !important;
    width: 100% !important;
}

table .price-input {
    min-width: 100px !important;
    width: 100% !important;
}

table .total-input {
    min-width: 110px !important;
    width: 100% !important;
}

table .item-search {
    min-width: 200px !important;
    width: 100% !important;
    min-height: 38px;
    resize: vertical;
}

table .form-control-sm {
    font-size: 0.875rem;
    padding: 0.375rem 0.5rem;
}

/* Ensure number inputs show full value */
input[type="number"] {
    text-align: right;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
}

/* Client Cards Hover Effect */
.hover-shadow-lg {
    transition: all 0.3s ease;
}

.hover-shadow-lg:hover {
    transform: translateY(-5px);
    box-shadow: 0 1rem 3rem rgba(0,0,0,.175) !important;
}

.card:hover {
    border-color: var(--primary-color);
}

/* Recent Invoices Scrollable Table */
#recentInvoicesTab {
    max-height: 600px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

#recentInvoicesTab::-webkit-scrollbar {
    width: 8px;
}

#recentInvoicesTab::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#recentInvoicesTab::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#recentInvoicesTab::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Make table header sticky when scrolling */
#recentInvoicesTab table thead {
    position: sticky;
    top: 0;
    background-color: #fff;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ===================================
   Auto-Save & Multi-Tab Invoice System
   =================================== */

/* Invoice Tabs Container */
#invoiceTabsContainer {
    margin-bottom: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 10px;
}

.invoice-tabs-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.invoice-tabs {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    flex-grow: 1;
    overflow-x: auto;
    padding: 5px 0;
    scroll-behavior: smooth;
}

.invoice-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.invoice-tab:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.invoice-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    font-weight: 600;
}

.invoice-tab .tab-title {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.invoice-tab.active .tab-title {
    color: white;
}

.invoice-tab .save-indicator {
    display: inline-block;
    margin-left: 5px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

.invoice-tab .tab-close {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    margin-left: 5px;
    transition: all 0.2s ease;
    line-height: 1;
}

.invoice-tab.active .tab-close {
    color: white;
}

.invoice-tab .tab-close:hover {
    color: #dc3545;
    transform: scale(1.2);
}

.invoice-tabs-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

/* Draft Recovery Alert */
.draft-item {
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

.draft-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

/* Responsive Tabs */
@media (max-width: 768px) {
    .invoice-tabs-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .invoice-tabs {
        overflow-x: auto;
    }
    
    .invoice-tabs-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .invoice-tabs-actions button {
        flex: 1;
    }
}

/* Dashboard Draft Cards */
.draft-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

.draft-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15) !important;
}

.draft-card .card-body {
    position: relative;
}

.draft-card h6 {
    font-weight: 600;
}

.draft-card .badge {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
}

/* Dashboard Drafts Section Animation */
#dashboardDraftsSection {
    animation: slideDown 0.3s ease;
}

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

/* ===================================
   Admin Panel Styles
   =================================== */
.admin-panel-container {
    padding: 20px;
}

.admin-panel-container .nav-tabs {
    border-bottom: 2px solid #e5e7eb;
    gap: 5px;
}

.admin-panel-container .nav-tabs .nav-link {
    color: #6b7280;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 12px 20px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.admin-panel-container .nav-tabs .nav-link:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: #f9fafb;
}

.admin-panel-container .nav-tabs .nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: transparent;
}

.admin-panel-container .nav-tabs .nav-link i {
    margin-right: 8px;
    font-size: 1.1rem;
}

.admin-panel-container .card {
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.admin-panel-container .card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 15px 20px;
}

.admin-panel-container .card-header h5 {
    margin: 0;
    font-size: 1.1rem;
}

.admin-panel-container .card-header i {
    margin-right: 10px;
}

.admin-panel-container .form-label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.admin-panel-container .form-control,
.admin-panel-container .form-select {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 10px 14px;
    transition: all 0.2s ease;
}

.admin-panel-container .form-control:focus,
.admin-panel-container .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.admin-panel-container .form-check-input {
    width: 50px;
    height: 26px;
    border-radius: 13px;
    cursor: pointer;
}

.admin-panel-container .form-check-input:checked {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.admin-panel-container .form-check-label {
    margin-left: 10px;
    cursor: pointer;
}

.admin-panel-container .form-check-label strong {
    display: block;
    color: #111827;
    margin-bottom: 2px;
}

.admin-panel-container .alert {
    border-radius: 8px;
    border: none;
}

.admin-panel-container .btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.admin-panel-container .btn i {
    margin-right: 8px;
}

.admin-panel-container .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.admin-panel-container .tab-content {
    padding-top: 20px;
}

.admin-panel-container small.text-muted {
    font-size: 0.85rem;
    display: block;
    margin-top: 4px;
}

/* Print Styles */
@media print {
    .sidebar,
    .top-header,
    .quick-action-btn,
    .btn,
    .modal-footer,
    #invoiceTabsContainer,
    #draftRecoveryAlert,
    #dashboardDraftsSection {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ===================================
   User Management Styles
   =================================== */
.user-management-container {
    padding: 20px;
}

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.avatar-circle-sm {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.user-management-container .table td {
    vertical-align: middle;
}

.permissions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.user-info {
    margin-right: 15px;
}

.user-info .dropdown-toggle {
    color: #374151;
    padding: 8px 15px;
}

.user-info .dropdown-toggle:hover {
    background-color: #f3f4f6;
    border-radius: 6px;
}

.user-info .badge {
    font-size: 0.7rem;
    margin-left: 5px;
}

/* ==========================================
   LOGIN PANEL STYLES - MODERN REDESIGN WITH RTL SUPPORT
========================================== */
.login-panel {
    border: none;
    border-radius: 24px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    max-width: 480px;
    width: 90%;
    background: white;
    position: relative;
}

/* Full page login container */
body.not-logged-in .modal {
    display: block !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body.not-logged-in .modal-dialog {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    max-width: none;
}

body.not-logged-in .modal-content {
    border: none;
    border-radius: 24px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.35);
    max-width: 480px;
    width: 90%;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Language Switcher */
.login-lang-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.rtl-login .login-lang-switcher {
    right: auto;
    left: 20px;
}

.login-lang-switcher .btn {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 12px;
    padding: 8px 16px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.login-lang-switcher .btn:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.login-lang-switcher .lang-text {
    margin-left: 6px;
}

.rtl-login .login-lang-switcher .lang-text {
    margin-left: 0;
    margin-right: 6px;
}

.login-lang-switcher .dropdown-menu {
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: none;
    padding: 8px;
    min-width: 200px;
}

.login-lang-switcher .dropdown-item {
    border-radius: 8px;
    padding: 10px 16px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.login-lang-switcher .dropdown-item:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.login-lang-switcher .dropdown-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
}

.login-lang-switcher .dropdown-item i {
    width: 20px;
}

/* Login Header */
.login-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 60px 40px 50px;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.login-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    animation: float 20s infinite linear;
}

@keyframes float {
    from {
        transform: translate(0, 0) rotate(0deg);
    }
    to {
        transform: translate(50px, 50px) rotate(360deg);
    }
}

.login-header-wave {
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 50px;
    background: white;
    clip-path: polygon(0 50%, 100% 30%, 100% 100%, 0% 100%);
    display: none; /* Removed white line over logo */
}

.login-header > * {
    position: relative;
    z-index: 1;
}

.login-logo {
    max-width: 200px;
    max-height: 90px;
    object-fit: contain;
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    margin-bottom: 20px;
    transition: transform 0.3s;
}

.login-logo:hover {
    transform: scale(1.05);
}

.login-icon-wrapper {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 25px;
    border-radius: 50%;
    margin-bottom: 20px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.login-icon {
    font-size: 4rem;
    color: white;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.login-title {
    margin: 20px 0 10px;
    font-weight: 700;
    color: white;
    font-size: 2rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    letter-spacing: 0.5px;
}

.login-subtitle {
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
    font-size: 1.05rem;
    font-weight: 400;
}

/* Login Body */
.login-body {
    padding: 45px 40px 40px;
    background: white;
}

.login-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-label i {
    color: #667eea;
    font-size: 1.1rem;
}

/* Input Icon Wrapper */
.input-icon-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1.2rem;
    z-index: 2;
    transition: color 0.3s;
}

.rtl-login .input-icon {
    left: auto;
    right: 18px;
}

.login-input {
    padding: 16px 20px 16px 50px !important;
    border-radius: 14px !important;
    border: 2px solid #e2e8f0 !important;
    transition: all 0.3s !important;
    font-size: 1rem !important;
    background: #f8fafc !important;
}

.rtl-login .login-input {
    padding: 16px 50px 16px 20px !important;
}

.login-input:focus {
    border-color: #667eea !important;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1) !important;
    background: white !important;
    transform: translateY(-2px);
}

.login-input:focus + .input-icon,
.login-input:focus ~ .input-icon {
    color: #667eea;
}

/* Password Toggle */
.btn-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    z-index: 3;
}

.rtl-login .btn-password-toggle {
    right: auto;
    left: 12px;
}

.btn-password-toggle:hover {
    background: #f1f5f9;
    color: #667eea;
}

/* Remember Me */
.login-remember {
    display: flex;
    align-items: center;
}

.login-remember .form-check-input {
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.login-remember .form-check-input:checked {
    background-color: #667eea;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.login-remember .form-check-label {
    color: #64748b;
    font-size: 0.95rem;
    cursor: pointer;
    margin-left: 10px;
}

.rtl-login .login-remember .form-check-label {
    margin-left: 0;
    margin-right: 10px;
}

/* Login Button */
.btn-login {
    padding: 16px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.4);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-login:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 35px rgba(102, 126, 234, 0.5);
    color: white;
}

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

/* Login Divider */
.login-divider {
    text-align: center;
    margin: 25px 0;
    position: relative;
}

.login-divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: linear-gradient(to right, transparent, #cbd5e1, transparent);
}

.login-divider span {
    background: white;
    padding: 0 15px;
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

/* Reset Users Button */
.btn-reset-users {
    border-radius: 12px;
    padding: 10px 20px;
    transition: all 0.3s;
    border: 2px solid #fbbf24;
    color: #f59e0b;
    background: #fffbeb;
    font-weight: 600;
    font-size: 0.9rem;
}

.btn-reset-users:hover {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #d97706;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-reset-users i {
    margin-right: 6px;
}

.rtl-login .btn-reset-users i {
    margin-right: 0;
    margin-left: 6px;
}

/* Login Footer */
.login-footer {
    background: linear-gradient(to bottom, white, #f8fafc);
    padding: 25px 30px;
    text-align: center;
    border-top: 1px solid #e2e8f0;
}

.login-footer-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.login-footer small {
    color: #64748b;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.login-footer small i {
    font-size: 0.75rem;
}

/* RTL Specific Styles */
.rtl-login {
    direction: rtl;
    text-align: right;
}

.rtl-login .login-header,
.rtl-login .login-body,
.rtl-login .login-footer {
    direction: rtl;
    text-align: right;
}

.rtl-login .form-label,
.rtl-login .login-label {
    flex-direction: row-reverse;
}

.rtl-login .btn-login {
    flex-direction: row-reverse;
}

/* Language Change Overlay */
.language-change-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: fadeIn 0.2s ease-in;
}

.language-change-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 576px) {
    .login-panel {
        max-width: 95%;
        border-radius: 20px;
    }
    
    .login-body {
        padding: 35px 25px 30px;
    }
    
    .login-header {
        padding: 50px 25px 40px;
    }
    
    .login-title {
        font-size: 1.6rem;
    }
    
    .login-subtitle {
        font-size: 0.95rem;
    }
    
    .login-lang-switcher {
        top: 15px;
        right: 15px;
    }
    
    .rtl-login .login-lang-switcher {
        right: auto;
        left: 15px;
    }
}


/* Logo Upload Container */
.logo-upload-container {
    border: 2px dashed #dee2e6;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
}

.logo-upload-container:hover {
    border-color: var(--primary-color);
    background: rgba(13, 110, 253, 0.02);
}

.logo-upload-container .current-logo {
    display: inline-block;
}

.logo-upload-container .current-logo img {
    display: block;
    margin: 0 auto 10px;
}

/* ==========================================
   QUICK PROFILE PANEL STYLES
========================================== */
.quick-profile-panel {
    position: fixed;
    top: 70px;
    right: -400px;
    width: 350px;
    max-height: calc(100vh - 90px);
    background: white;
    border-radius: 15px 0 0 15px;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    overflow-y: auto;
    transition: right 0.3s ease;
}

.quick-profile-panel.show {
    right: 0;
}

.profile-panel-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
}

.btn-close-panel {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #6c757d;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.3s;
}

.btn-close-panel:hover {
    background: #f8f9fa;
    color: #dc3545;
}

.profile-panel-body {
    padding: 20px;
    text-align: center;
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    margin: 0 auto 20px;
    box-shadow: 0 5px 20px rgba(13, 110, 253, 0.3);
}

.profile-info-section {
    margin-bottom: 25px;
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
}

.profile-username {
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.profile-stats {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 0;
}

.stat-item:not(:last-child) {
    border-bottom: 1px solid #e9ecef;
}

.stat-item i {
    font-size: 1.5rem;
}

.stat-item small {
    display: block;
    font-size: 0.75rem;
}

.stat-value {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

.profile-contact {
    text-align: left;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    color: #495057;
}

.contact-item i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.profile-actions {
    margin-top: 20px;
}

.profile-actions .btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s;
}

.profile-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.profile-panel-footer {
    padding: 15px 20px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 0 0 0 15px;
    text-align: center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .quick-profile-panel {
        width: 100%;
        right: -100%;
        border-radius: 0;
        top: 60px;
        max-height: calc(100vh - 60px);
    }
    
    .quick-profile-panel.show {
        right: 0;
    }
}

/* ===================================
   Reports & Charts Styles
   =================================== */

.reports-container {
    padding: 20px;
    animation: fadeIn 0.3s ease-in;
}

.stats-card {
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    min-height: 140px;
    display: flex;
    align-items: center;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.bg-gradient-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.bg-gradient-danger {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
}

.stats-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
}

.stats-card h3 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.stats-card h6 {
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.stats-card .ms-3 {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 76px;
}

.reports-container .card {
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.reports-container .card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.reports-container .card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid #dee2e6;
    padding: 15px 20px;
    border-radius: 12px 12px 0 0 !important;
}

.reports-container .card-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
}

.reports-container .card-header h5 i {
    margin-right: 8px;
    color: var(--primary-color);
}

.reports-container .card-body {
    padding: 20px;
}

.reports-container canvas {
    max-height: 400px;
}

.reports-container .table {
    margin-bottom: 0;
}

.reports-container .table thead th {
    background: #f8f9fa;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #dee2e6;
    padding: 12px;
}

.reports-container .table tbody tr {
    transition: background-color 0.2s ease;
}

.reports-container .table tbody tr:hover {
    background-color: #f8f9fa;
}

.reports-container .table tbody td {
    padding: 12px;
    vertical-align: middle;
}

/* Chart Container Responsive */
@media (max-width: 768px) {
    .reports-container {
        padding: 10px;
    }
    
    .stats-card {
        margin-bottom: 15px;
    }
    
    .stats-icon {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .stats-card h3 {
        font-size: 1.5rem;
    }
    
    .reports-container .card-body {
        padding: 15px;
    }
}

/* Print Styles */
@media print {
    .reports-container .btn,
    .reports-container .card-header button {
        display: none !important;
    }
    
    .reports-container .card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* ===================================
   Daily Sales Report Styles
   =================================== */

.daily-sales-container {
    padding: 20px;
    animation: fadeIn 0.3s ease-in;
}

.summary-card {
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 0;
}

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.summary-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
}

.summary-card h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
}

.summary-card h6 {
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.user-sales-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
}

.user-sales-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
    flex-shrink: 0;
}

.sales-amount h4 {
    font-size: 1.75rem;
    font-weight: 700;
}

.empty-state {
    padding: 40px 20px;
}

.empty-state i {
    opacity: 0.5;
}

.daily-sales-container .card {
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
}

.daily-sales-container .card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid #dee2e6;
    padding: 15px 20px;
    border-radius: 12px 12px 0 0 !important;
}

.daily-sales-container .card-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
}

.daily-sales-container .card-header h5 i {
    margin-right: 8px;
    color: var(--primary-color);
}

.daily-sales-container .table thead th {
    background: #f8f9fa;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #dee2e6;
    padding: 12px;
}

.daily-sales-container .table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .daily-sales-container {
        padding: 10px;
    }
    
    .summary-card {
        margin-bottom: 15px;
    }
    
    .summary-icon {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .summary-card h2 {
        font-size: 2rem;
    }
    
    .user-sales-card {
        margin-bottom: 15px;
    }
}

/* ===================================
   Mobile & Tablet Friendly Forms
   =================================== */

/* Tablet Optimization (768px - 1024px) */
@media (max-width: 1024px) {
    /* Invoice Form Container */
    .invoice-form-container {
        padding: 15px !important;
    }
    
    /* Form Controls - Larger Touch Targets */
    .form-control,
    .form-select,
    .btn {
        min-height: 44px !important;
        font-size: 16px !important;
        padding: 10px 12px !important;
    }
    
    /* Input Groups */
    .input-group .form-control {
        min-height: 44px !important;
    }
    
    /* Buttons - Larger Touch Area */
    .btn {
        padding: 12px 20px !important;
        font-size: 15px !important;
        min-height: 48px !important;
    }
    
    .btn-sm {
        padding: 8px 16px !important;
        font-size: 14px !important;
        min-height: 40px !important;
    }
    
    /* Table Cells - Better Spacing */
    .invoice-items-table td input,
    .invoice-items-table td select {
        min-height: 44px !important;
        font-size: 15px !important;
    }
    
    /* Modal Dialogs */
    .modal-dialog {
        margin: 10px !important;
        max-width: calc(100% - 20px) !important;
    }
    
    .modal-content {
        border-radius: 8px !important;
    }
}

/* Mobile Optimization (Max 768px) */
@media (max-width: 768px) {
    /* Main Content - Full Width on Mobile */
    .main-content {
        padding: 10px !important;
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    /* Invoice Form Container */
    .invoice-form-container {
        padding: 10px !important;
        margin: 0 !important;
    }
    
    /* Cards - Reduce Padding */
    .card {
        margin-bottom: 15px !important;
        border-radius: 8px !important;
    }
    
    .card-body {
        padding: 15px !important;
    }
    
    /* Form Labels - Larger Text */
    .form-label {
        font-size: 14px !important;
        font-weight: 600 !important;
        margin-bottom: 6px !important;
        color: #1f2937 !important;
    }
    
    /* Form Controls - Extra Large Touch Targets */
    .form-control,
    .form-select {
        min-height: 48px !important;
        font-size: 16px !important;
        padding: 12px 14px !important;
        border-radius: 6px !important;
        border: 1.5px solid #d1d5db !important;
    }
    
    .form-control:focus,
    .form-select:focus {
        border-color: var(--primary-color) !important;
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1) !important;
    }
    
    /* Input Groups */
    .input-group {
        margin-bottom: 15px !important;
    }
    
    .input-group-text {
        min-height: 48px !important;
        font-size: 16px !important;
        padding: 12px 14px !important;
    }
    
    /* Buttons - Full Width and Large */
    .btn {
        width: 100% !important;
        padding: 14px 20px !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        min-height: 52px !important;
        margin-bottom: 10px !important;
        border-radius: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
    }
    
    /* Button Icons */
    .btn i {
        font-size: 18px !important;
    }
    
    /* Button Groups - Stack Vertically */
    .btn-group {
        flex-direction: column !important;
        width: 100% !important;
    }
    
    .btn-group .btn {
        border-radius: 8px !important;
        margin-bottom: 8px !important;
    }
    
    /* Action Buttons Container */
    .d-flex.gap-2,
    .d-flex.gap-3 {
        flex-direction: column !important;
        gap: 0 !important;
    }
    
    /* Keep invoice footer buttons in a row */
    .modal-footer .d-flex.gap-2,
    .modal-footer #invoiceFooterButtons,
    .modal-footer #afterSaveButtons {
        flex-direction: row !important;
        gap: 8px !important;
    }
    
    /* Invoice Items Table - Responsive */
    .invoice-items-table {
        display: block !important;
        overflow-x: auto !important;
        margin-bottom: 15px !important;
    }
    
    .invoice-items-table table {
        min-width: 100% !important;
    }
    
    .invoice-items-table th,
    .invoice-items-table td {
        padding: 12px 8px !important;
        font-size: 14px !important;
        white-space: nowrap !important;
    }
    
    .invoice-items-table td input,
    .invoice-items-table td select {
        min-height: 44px !important;
        font-size: 15px !important;
        padding: 10px 8px !important;
        min-width: 100px !important;
    }
    
    /* Remove Row Button */
    .invoice-items-table .btn-danger {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 10px !important;
    }
    
    /* Add Item Button */
    .btn-add-item {
        width: 100% !important;
        margin-top: 10px !important;
        min-height: 48px !important;
    }
    
    /* Payment Section */
    .payment-summary {
        padding: 15px !important;
        margin-top: 15px !important;
        background: #f9fafb !important;
        border-radius: 8px !important;
    }
    
    .payment-summary .row {
        margin-bottom: 10px !important;
    }
    
    .payment-summary h5,
    .payment-summary h4 {
        font-size: 16px !important;
        margin-bottom: 8px !important;
    }
    
    .payment-summary .total-amount {
        font-size: 22px !important;
        font-weight: 700 !important;
        color: var(--primary-color) !important;
    }
    
    /* Date Pickers */
    input[type="date"],
    input[type="datetime-local"] {
        min-height: 48px !important;
        font-size: 16px !important;
        padding: 12px 14px !important;
    }
    
    /* Select Dropdowns */
    select.form-select {
        background-size: 16px !important;
        padding-right: 40px !important;
    }
    
    /* Modal Full Screen on Mobile */
    .modal {
        padding: 0 !important;
    }
    
    .modal-dialog {
        margin: 0 !important;
        max-width: 100% !important;
        height: 100vh !important;
    }
    
    .modal-content {
        border-radius: 0 !important;
        height: 100vh !important;
        overflow-y: auto !important;
    }
    
    .modal-header {
        padding: 15px !important;
        position: sticky !important;
        top: 0 !important;
        background: white !important;
        z-index: 1050 !important;
        border-bottom: 2px solid #e5e7eb !important;
    }
    
    .modal-title {
        font-size: 18px !important;
        font-weight: 700 !important;
    }
    
    .modal-body {
        padding: 15px !important;
    }
    
    .modal-footer {
        padding: 15px !important;
        position: sticky !important;
        bottom: 0 !important;
        background: white !important;
        border-top: 2px solid #e5e7eb !important;
        flex-direction: column !important;
    }
    
    /* Keep invoice footer buttons in a row on mobile */
    .modal-footer #invoiceFooterButtons,
    .modal-footer #afterSaveButtonsMain {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        width: 100% !important;
    }
    
    .modal-footer #invoiceFooterButtons .btn,
    .modal-footer #afterSaveButtonsMain .btn {
        width: auto !important;
        flex: 1 !important;
        margin: 0 !important;
        padding: 12px 8px !important;
        font-size: 14px !important;
        white-space: nowrap !important;
    }

    /* Print button should be alone on its own row */
    .modal-footer #afterSaveButtonsPrint {
        display: flex !important;
        width: 100% !important;
    }

    .modal-footer #afterSaveButtonsPrint .btn {
        width: 100% !important;
        flex: 1 !important;
        margin: 0 !important;
    }

    /* Override the generic mobile full-width button rule for invoice footer buttons */
    .modal-footer #invoiceFooterButtons .btn,
    .modal-footer #afterSaveButtonsMain .btn {
        width: auto !important;
    }
    
    .modal-footer .btn {
        width: 100% !important;
        margin: 5px 0 !important;
    }
    
    /* Grid System - Stack on Mobile */
    .row.g-3 > .col-md-6,
    .row.g-3 > .col-md-4,
    .row.g-3 > .col-md-3,
    .row > .col-md-6,
    .row > .col-md-4,
    .row > .col-md-3 {
        margin-bottom: 15px !important;
    }
    
    /* Client/Supplier Select */
    #clientSelect,
    #supplierSelect {
        min-height: 48px !important;
        font-size: 16px !important;
    }
    
    /* Payment Type Buttons */
    .payment-type-buttons {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .payment-type-buttons .btn {
        width: 100% !important;
        min-height: 50px !important;
    }
    
    /* Toast Notifications - Better Positioning */
    .toast-container {
        bottom: 20px !important;
        right: 10px !important;
        left: 10px !important;
    }
    
    .toast {
        font-size: 15px !important;
        min-height: 60px !important;
    }
}

/* Extra Small Mobile (Max 576px) */
@media (max-width: 576px) {
    /* Even Larger Touch Targets */
    .form-control,
    .form-select,
    .btn {
        min-height: 52px !important;
        font-size: 17px !important;
    }
    
    /* Table - Better Scrolling */
    .table-responsive {
        border-radius: 8px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    }
    
    /* Reduce Font Sizes Slightly */
    .card-title {
        font-size: 18px !important;
    }
    
    h5 {
        font-size: 16px !important;
    }
    
    /* Invoice Items - Compact View */
    .invoice-items-table th,
    .invoice-items-table td {
        font-size: 13px !important;
        padding: 10px 6px !important;
    }
    
    /* Action Buttons - Stack */
    .invoice-actions {
        flex-direction: column !important;
    }
    
    .invoice-actions .btn {
        width: 100% !important;
        margin-bottom: 8px !important;
    }
}

/* Landscape Tablets (768px - 1024px in landscape) */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .form-control,
    .form-select {
        min-height: 42px !important;
        font-size: 15px !important;
    }
    
    .btn {
        min-height: 46px !important;
        padding: 10px 18px !important;
    }
    
    .modal-dialog {
        max-width: 90% !important;
        margin: 20px auto !important;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* All clickable elements larger */
    button,
    a,
    input,
    select,
    textarea {
        min-height: 44px !important;
    }
    
    /* Better tap highlights */
    * {
        -webkit-tap-highlight-color: rgba(79, 70, 229, 0.2);
    }
    
    /* Prevent zoom on input focus */
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="tel"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* ===================================
   Notifications Panel Styles
   =================================== */

.notifications-panel {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    display: none;
    z-index: 1001;
}

.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.notification-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateX(5px);
}

.notification-item.unread {
    background: #f0f9ff;
    border-left-color: var(--primary-color);
}

.notification-item.read {
    opacity: 0.7;
}

.notification-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    flex-shrink: 0;
}

.notification-icon.bg-primary {
    background: linear-gradient(135deg, var(--primary-color), #6366f1);
}

.notification-icon.bg-success {
    background: linear-gradient(135deg, var(--success-color), #34d399);
}

.notification-icon.bg-danger {
    background: linear-gradient(135deg, var(--danger-color), #f87171);
}

.notification-icon.bg-warning {
    background: linear-gradient(135deg, var(--warning-color), #fbbf24);
}

.notification-icon.bg-info {
    background: linear-gradient(135deg, var(--info-color), #60a5fa);
}

.notification-icon.bg-secondary {
    background: linear-gradient(135deg, #6b7280, #9ca3af);
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    gap: 10px;
}

.notification-header strong {
    color: var(--dark-color);
    font-size: 1rem;
    font-weight: 600;
}

.notification-time {
    color: #6b7280;
    font-size: 0.85rem;
    white-space: nowrap;
}

.notification-message {
    color: #4b5563;
    font-size: 0.95rem;
    line-height: 1.5;
}

.notification-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.notification-actions .btn {
    min-height: 36px;
    width: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state {
    background: white;
    border-radius: 12px;
    padding: 60px 20px;
}

/* Mobile Responsive for Notifications */
@media (max-width: 768px) {
    .notifications-panel {
        padding: 10px;
    }
    
    .notification-item {
        padding: 15px;
        gap: 12px;
    }
    
    .notification-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .notification-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .notification-time {
        font-size: 0.75rem;
    }
    
    .notification-message {
        font-size: 0.9rem;
    }
    
    .notification-actions {
        flex-direction: column;
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-bottom: 8px;
    }
}

/* Print Styles - Keep Original */
@media print {
    .sidebar,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
}

/* ===================================
   Language Switcher & RTL Support
   =================================== */

.language-switcher {
    display: flex;
    gap: 5px;
    margin-right: 10px;
    background: #f8f9fa;
    padding: 4px;
    border-radius: 8px;
}

.lang-btn {
    background: transparent;
    border: none;
    padding: 6px 12px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6c757d;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 40px;
}

.lang-btn:hover {
    background: #e9ecef;
    color: var(--primary-color);
}

.lang-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}

/* RTL Support */
body.rtl {
    direction: rtl;
    text-align: right;
}

body.rtl .sidebar {
    left: auto;
    right: 0;
}

body.rtl .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

body.rtl .sidebar-menu .bi-chevron-down {
    margin-right: auto;
    margin-left: 0;
}

/* RTL Menu Link Fixes */
body.rtl .sidebar-menu .nav-link {
    border-left: none;
    border-right: 3px solid transparent;
}

body.rtl .sidebar-menu .nav-link.active {
    border-right-color: var(--sidebar-active);
    border-left: none;
}

body.rtl .sidebar-menu .nav-link i {
    margin-right: 0;
    margin-left: 0;
}

body.rtl .sidebar-menu .nav-link > i:not(.bi-chevron-down) {
    margin-left: 10px;
    margin-right: 0;
}

/* RTL Submenu Fixes */
body.rtl .submenu a {
    padding: 10px 50px 10px 20px;
}

body.rtl .submenu a i {
    margin-right: 0;
    margin-left: 8px;
}

body.rtl .submenu a:hover {
    padding-right: 55px;
    padding-left: 20px;
}

body.rtl .submenu a.active {
    border-left: none;
    border-right: 3px solid var(--sidebar-active);
    padding-right: 52px;
    padding-left: 20px;
}

body.rtl .notification-badge {
    right: auto;
    left: -5px;
}

body.rtl .btn-toggle-sidebar {
    margin-right: 0;
    margin-left: auto;
}

body.rtl .header-actions {
    margin-right: auto;
    margin-left: 0;
}

body.rtl .language-switcher {
    margin-right: 0;
    margin-left: 10px;
}

body.rtl .modal-header .btn-close {
    margin: 0 auto 0 0;
}

body.rtl .input-group-text {
    border-radius: 0 0.375rem 0.375rem 0;
}

body.rtl .form-control {
    text-align: right;
}

body.rtl .toast-container {
    right: auto;
    left: 20px;
}

body.rtl .sidebar {
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

body.rtl .notification-item {
    border-right: 4px solid transparent;
    border-left: none;
}

body.rtl .notification-item.unread {
    border-right-color: var(--primary-color);
}

/* Mobile RTL */
@media (max-width: 1200px) {
    body.rtl .sidebar {
        transform: translateX(100%);
        right: 0;
        left: auto;
    }
    
    body.rtl .sidebar.active {
        transform: translateX(0);
        right: 0;
    }
    
    body.rtl .main-content {
        margin-right: 0;
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .language-switcher {
        gap: 3px;
        padding: 3px;
    }
    
    .lang-btn {
        padding: 4px 8px;
        font-size: 0.75rem;
        min-width: 32px;
    }
}

/* ===================================
   COMPREHENSIVE MOBILE ENHANCEMENTS
   =================================== */

/* Mobile - Extra Small Devices (Portrait Phones, < 576px) */
@media (max-width: 575.98px) {
    /* Sidebar - Full Screen Overlay on Mobile */
    .sidebar {
        position: fixed;
        left: -100%;
        width: 85%;
        max-width: 300px;
        height: 100vh;
        z-index: 9999;
        transition: left 0.3s ease-in-out;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar.active {
        left: 0;
    }
    
    /* Mobile Overlay for Sidebar */
    .sidebar-overlay {
        display: block;
    }
    
    /* Main Content - Full Width */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 15px 10px !important;
    }
    
    /* Header - Mobile Friendly */
    .header {
        padding: 10px 15px !important;
        height: auto !important;
        min-height: 60px;
    }
    
    /* Mobile Menu Toggle Button */
    .btn-toggle-sidebar {
        display: block !important;
        font-size: 24px !important;
        padding: 8px 12px !important;
        background: var(--primary-color);
        color: white;
        border: none;
        border-radius: 8px;
    }
    
    /* Tables - Horizontal Scroll */
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        scroll-behavior: smooth;
    }
    
    table {
        min-width: 600px;
        font-size: 14px;
    }
    
    table th,
    table td {
        padding: 10px 8px !important;
        white-space: nowrap;
    }
    
    /* Action Buttons in Tables - Smaller */
    table .btn-sm {
        padding: 6px 10px !important;
        font-size: 12px !important;
        min-height: initial !important;
        width: auto !important;
        margin: 2px !important;
    }
    
    /* Modal - Full Screen on Mobile */
    .modal-dialog {
        margin: 0 !important;
        max-width: 100% !important;
        height: 100vh !important;
    }
    
    .modal-content {
        height: 100%;
        border-radius: 0 !important;
    }
    
    .modal-body {
        overflow-y: auto;
        max-height: calc(100vh - 140px);
    }
    
    /* Form Rows - Stack Vertically */
    .row > [class*="col-"] {
        margin-bottom: 15px;
    }
    
    /* Cards - Compact */
    .card {
        border-radius: 10px !important;
        margin-bottom: 15px !important;
    }
    
    .card-header {
        padding: 12px 15px !important;
        font-size: 16px !important;
    }
    
    .card-body {
        padding: 15px !important;
    }
    
    /* Statistics Cards - Full Width */
    .stat-card,
    .stats-card {
        margin-bottom: 15px;
    }
    
    /* Dashboard Grid - Single Column */
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Quick Actions - Vertical Stack */
    .quick-actions {
        flex-direction: column !important;
    }
    
    .quick-actions .btn {
        width: 100% !important;
        margin-bottom: 10px !important;
    }
    
    /* Search and Filters - Full Width */
    .search-box,
    .filter-group {
        width: 100% !important;
        margin-bottom: 10px;
    }
    
    /* Pagination - Compact */
    .pagination {
        font-size: 14px !important;
    }
    
    .pagination .page-link {
        padding: 8px 12px !important;
    }
    
    /* Alerts - Compact */
    .alert {
        padding: 12px !important;
        font-size: 14px !important;
        margin-bottom: 15px !important;
    }
    
    /* Breadcrumb - Smaller */
    .breadcrumb {
        font-size: 13px !important;
        padding: 8px 12px !important;
    }
    
    /* Nav Tabs - Scrollable */
    .nav-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        scroll-behavior: smooth;
    }
    
    .nav-tabs .nav-link {
        white-space: nowrap;
        padding: 10px 15px !important;
        font-size: 14px !important;
    }
    
    /* Input Groups - Stack */
    .input-group {
        flex-wrap: wrap !important;
    }
    
    .input-group .btn {
        width: 100% !important;
        margin-top: 5px !important;
    }
    
    /* Dropdown Menus - Full Width */
    .dropdown-menu {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Badge - Smaller */
    .badge {
        font-size: 11px !important;
        padding: 4px 8px !important;
    }
    
    /* Toast Notifications - Bottom */
    .toast-container {
        bottom: 20px !important;
        top: auto !important;
        left: 10px !important;
        right: 10px !important;
    }
    
    .toast {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Login Modal - Full Screen */
    .login-modal .modal-dialog {
        margin: 0;
        height: 100vh;
    }
    
    .login-modal .modal-content {
        border-radius: 0;
        height: 100%;
    }
    
    /* Invoice/Estimate Forms - Mobile Optimized */
    .invoice-items-table th,
    .invoice-items-table td {
        font-size: 13px !important;
        padding: 8px 5px !important;
    }
    
    /* Remove Row Buttons - Larger Touch Target */
    .btn-remove-row {
        min-width: 40px !important;
        min-height: 40px !important;
        padding: 8px !important;
    }
    
    /* Number Inputs - Larger */
    input[type="number"] {
        -webkit-appearance: none;
        -moz-appearance: textfield;
        appearance: textfield;
    }
    
    /* Select Dropdowns - Native on Mobile */
    select.form-select {
        -webkit-appearance: menulist;
        -moz-appearance: menulist;
        appearance: menulist;
    }
    
    /* Checkbox and Radio - Larger */
    .form-check-input {
        width: 24px !important;
        height: 24px !important;
        margin-top: 0 !important;
    }
    
    .form-check-label {
        padding-left: 10px !important;
        font-size: 15px !important;
    }
    
    /* Switch - Larger */
    .form-switch .form-check-input {
        width: 48px !important;
        height: 26px !important;
    }
    
    /* Year Management Panel - Mobile */
    .year-management-panel table {
        min-width: 700px;
    }
    
    /* Admin Panel Tabs - Scrollable */
    #adminTabs {
        overflow-x: auto;
        flex-wrap: nowrap !important;
        border-bottom: 2px solid #dee2e6;
    }
    
    #adminTabs .nav-link {
        white-space: nowrap;
        font-size: 13px !important;
        padding: 10px 12px !important;
    }
    
    /* Trash View - Mobile Optimized */
    .trash-table {
        min-width: 650px;
    }
    
    /* Payment Forms - Mobile */
    .payment-form .row {
        margin-bottom: 0;
    }
    
    /* Reports - Scrollable */
    .report-container {
        overflow-x: auto;
    }
    
    /* Charts - Responsive */
    .chart-container {
        height: 250px !important;
        margin-bottom: 20px;
    }
    
    /* Print Button - Float Bottom Right */
    .btn-print {
        position: fixed !important;
        bottom: 20px;
        right: 20px;
        z-index: 1000;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
        border-radius: 50% !important;
        width: 56px !important;
        height: 56px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Language Switcher - Compact */
    .language-switcher {
        gap: 2px !important;
        padding: 2px !important;
    }
    
    .lang-btn {
        padding: 6px 10px !important;
        font-size: 11px !important;
        min-width: 36px !important;
    }
}

/* Mobile - Small Devices (Landscape Phones, 576px - 767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .sidebar {
        width: 260px;
    }
    
    .main-content {
        padding: 20px 15px !important;
    }
    
    .btn {
        width: auto !important;
        min-width: 120px;
    }
    
    table {
        font-size: 15px;
    }
}

/* Tablet - Medium Devices (Tablets, 768px - 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .sidebar {
        width: 240px;
    }
    
    .main-content {
        margin-left: 240px;
        padding: 20px;
    }
    
    /* Show sidebar toggle on tablets */
    .btn-toggle-sidebar {
        display: inline-block !important;
    }
}

/* Landscape Mode Optimizations */
@media (max-height: 500px) and (orientation: landscape) {
    .modal-dialog {
        max-height: 100vh;
    }
    
    .modal-body {
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }
    
    .sidebar {
        height: 100vh;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn,
    .form-control,
    .form-select,
    a.nav-link {
        min-height: 44px !important;
    }
    
    /* Remove hover effects on touch devices */
    .btn:hover,
    .nav-link:hover {
        transform: none !important;
    }
    
    /* Better tap highlighting */
    * {
        -webkit-tap-highlight-color: rgba(79, 70, 229, 0.2);
    }
}

/* High DPI Screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper text rendering */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Dark Mode Support for Mobile */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }
    
    .card {
        background-color: #2d2d2d;
        border-color: #444;
    }
    
    .form-control,
    .form-select {
        background-color: #2d2d2d;
        border-color: #444;
        color: #e0e0e0;
    }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles for Mobile */
@media print {
    .sidebar,
    .btn-toggle-sidebar,
    .header-actions,
    .quick-actions,
    .btn-print {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    
    .card {
        page-break-inside: avoid;
    }
}

/* Invoice Table - Compact Overrides (Tablet/Mobile) */
@media (max-width: 991.98px) {
    #invoiceItemsTable {
        border-collapse: collapse;
        min-width: 520px;
    }

    #invoiceItemsTable td,
    #invoiceItemsTable th,
    #invoiceItemsTable.table td,
    #invoiceItemsTable.table th {
        padding: 3px 4px !important;
        line-height: 1.1 !important;
    }

    #invoiceItemsTable tbody tr {
        height: auto !important;
    }

    #invoiceItemsTable .form-control-sm {
        min-height: 32px !important;
        height: 32px !important;
        padding: 0.2rem 0.35rem !important;
        font-size: 0.8rem !important;
    }

    #invoiceItemsTable textarea.form-control-sm.item-search {
        min-height: 32px !important;
        height: 32px !important;
        line-height: 1.1 !important;
    }

    #invoiceItemsTable .btn-group .btn {
        padding: 2px 5px !important;
        min-height: 28px !important;
        font-size: 0.75rem !important;
    }
}

@media (max-width: 576px) {
    #invoiceItemsTable td,
    #invoiceItemsTable th,
    #invoiceItemsTable.table td,
    #invoiceItemsTable.table th {
        padding: 2px 3px !important;
    }

    #invoiceItemsTable tbody tr {
        height: auto !important;
    }

    #invoiceItemsTable .form-control-sm {
        min-height: 30px !important;
        height: 30px !important;
        font-size: 0.75rem !important;
    }

    #invoiceItemsTable {
        min-width: 460px;
    }
}

/* Invoice create form - reduce oversized columns on mobile */
@media (max-width: 768px) {
    #invoiceItemsTable {
        table-layout: fixed;
        min-width: 100%;
    }

    #invoiceItemsTable th:nth-child(1),
    #invoiceItemsTable td:nth-child(1) {
        width: 34% !important;
    }

    #invoiceItemsTable th:nth-child(2),
    #invoiceItemsTable td:nth-child(2),
    #invoiceItemsTable th:nth-child(3),
    #invoiceItemsTable td:nth-child(3) {
        width: 11% !important;
    }

    #invoiceItemsTable th:nth-child(4),
    #invoiceItemsTable td:nth-child(4) {
        width: 12% !important;
    }

    #invoiceItemsTable th:nth-child(5),
    #invoiceItemsTable td:nth-child(5),
    #invoiceItemsTable th:nth-child(6),
    #invoiceItemsTable td:nth-child(6) {
        width: 14% !important;
    }

    #invoiceItemsTable th:nth-child(7),
    #invoiceItemsTable td:nth-child(7) {
        width: 14% !important;
    }

    #invoiceItemsTable .item-search,
    #invoiceItemsTable .ctn-input,
    #invoiceItemsTable .qty-input,
    #invoiceItemsTable .unit-input,
    #invoiceItemsTable .price-input,
    #invoiceItemsTable .total-input {
        min-width: 0 !important;
        width: 100% !important;
    }
}

@media (max-width: 576px) {
    #invoiceItemsTable {
        min-width: 420px;
    }

    #invoiceItemsTable th,
    #invoiceItemsTable td {
        padding-left: 2px !important;
        padding-right: 2px !important;
    }

    #invoiceItemsTable .btn-group {
        display: inline-flex;
        flex-direction: row !important;
        gap: 2px;
        width: auto !important;
    }

    #invoiceItemsTable .btn-group .btn {
        width: auto !important;
        min-height: 24px !important;
        height: 24px !important;
        padding: 1px 4px !important;
        margin: 0 !important;
        font-size: 0.7rem !important;
    }
}

/* Strong mobile compaction for Create Invoice modal */
@media (max-width: 768px) {
    #invoiceForm .row {
        --bs-gutter-x: 0.5rem;
        --bs-gutter-y: 0.4rem;
    }

    #invoiceForm .row > [class*="col-"] {
        margin-bottom: 8px !important;
    }

    #invoiceForm .form-control,
    #invoiceForm .form-select {
        min-height: 34px !important;
        height: 34px !important;
        padding: 0.3rem 0.45rem !important;
        font-size: 0.82rem !important;
    }

    #invoiceItemsTable th:nth-child(1),
    #invoiceItemsTable td:nth-child(1) {
        width: 38% !important;
    }

    #invoiceItemsTable th:nth-child(2),
    #invoiceItemsTable td:nth-child(2),
    #invoiceItemsTable th:nth-child(3),
    #invoiceItemsTable td:nth-child(3) {
        width: 9% !important;
    }

    #invoiceItemsTable th:nth-child(4),
    #invoiceItemsTable td:nth-child(4) {
        width: 10% !important;
    }

    #invoiceItemsTable th:nth-child(5),
    #invoiceItemsTable td:nth-child(5),
    #invoiceItemsTable th:nth-child(6),
    #invoiceItemsTable td:nth-child(6) {
        width: 12% !important;
    }

    #invoiceItemsTable th:nth-child(7),
    #invoiceItemsTable td:nth-child(7) {
        width: 10% !important;
    }
}

@media (max-width: 576px) {
    #invoiceItemsTable {
        min-width: 380px;
    }

    #invoiceItemsTable .form-control-sm {
        min-height: 26px !important;
        height: 26px !important;
        padding: 0.1rem 0.25rem !important;
        font-size: 0.72rem !important;
    }

    #invoiceItemsTable th,
    #invoiceItemsTable td {
        font-size: 0.68rem !important;
    }
}

/* Final mobile hotfix for invoice modal layout */
@media (max-width: 768px) {
    #invoiceForm .form-label {
        font-size: 12px !important;
        margin-bottom: 4px !important;
    }

    #invoiceForm .btn {
        width: auto !important;
        min-height: 34px !important;
        height: 34px !important;
        padding: 0.3rem 0.6rem !important;
        font-size: 0.8rem !important;
        margin-bottom: 0 !important;
        border-radius: 6px !important;
    }

    #invoiceForm .d-flex.gap-2,
    #invoiceForm .d-flex.gap-3 {
        flex-direction: row !important;
        gap: 0.4rem !important;
    }

    #invoiceForm .table-responsive {
        margin-bottom: 8px !important;
        box-shadow: none !important;
        border-radius: 6px !important;
    }

    #invoiceItemsTable th:nth-child(1),
    #invoiceItemsTable td:nth-child(1) {
        width: 30% !important;
    }

    #invoiceItemsTable th:nth-child(2),
    #invoiceItemsTable td:nth-child(2),
    #invoiceItemsTable th:nth-child(3),
    #invoiceItemsTable td:nth-child(3),
    #invoiceItemsTable th:nth-child(4),
    #invoiceItemsTable td:nth-child(4) {
        width: 10% !important;
    }

    #invoiceItemsTable th:nth-child(5),
    #invoiceItemsTable td:nth-child(5),
    #invoiceItemsTable th:nth-child(6),
    #invoiceItemsTable td:nth-child(6) {
        width: 14% !important;
    }

    #invoiceItemsTable th:nth-child(7),
    #invoiceItemsTable td:nth-child(7) {
        width: 12% !important;
    }
}

@media (max-width: 576px) {
    #invoiceItemsTable {
        min-width: 360px;
    }

    #invoiceForm .form-control,
    #invoiceForm .form-select {
        min-height: 30px !important;
        height: 30px !important;
        font-size: 0.76rem !important;
        padding: 0.15rem 0.35rem !important;
    }

    #invoiceForm .btn {
        min-height: 30px !important;
        height: 30px !important;
        font-size: 0.74rem !important;
        padding: 0.15rem 0.45rem !important;
    }
}

/* Header actions mobile fix (final override) */
@media (max-width: 768px) {
    .top-header {
        position: relative !important;
        top: auto !important;
        z-index: 10 !important;
    }

    .top-header .header-actions {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 4px !important;
        overflow-x: auto;
        scroll-behavior: smooth;
        max-width: 100%;
    }

    .top-header .header-actions .btn {
        width: 32px !important;
        min-width: 32px !important;
        max-width: 32px !important;
        height: 32px !important;
        min-height: 32px !important;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 8px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 0 !important;
        line-height: 0 !important;
        overflow: hidden;
        flex: 0 0 auto;
    }

    .top-header .header-actions .btn i {
        font-size: 14px !important;
        line-height: 1 !important;
        margin: 0 !important;
    }

    .top-header .header-actions button[data-i18n="logout"]::after {
        content: "⎋";
        font-size: 14px;
        line-height: 1;
        color: currentColor;
    }

    .top-header .language-switcher {
        margin: 0 !important;
        padding: 2px !important;
        gap: 2px !important;
    }

    .top-header .language-switcher .lang-btn {
        min-width: 28px !important;
        width: 28px !important;
        height: 28px !important;
        padding: 0 !important;
        font-size: 10px !important;
    }
}

/* Hide heavy dashboard blocks on phone only (keep tablet/desktop) */
@media (max-width: 767.98px) {
    #smartInsightsHeader,
    #smartInsightsSection,
    #dashboardFocusHubSection {
        display: none !important;
    }
}

/* Quick Actions mobile grid: 3 per row, auto-wrap for future buttons */
@media (max-width: 767.98px) {
    .quick-actions-buttons-grid {
        --bs-gutter-x: 0.5rem;
        --bs-gutter-y: 0.5rem;
    }

    .quick-actions-buttons-grid > [class*="col-"] {
        flex: 0 0 33.3333% !important;
        max-width: 33.3333% !important;
        margin-bottom: 0 !important;
    }

    .quick-actions-buttons-grid .quick-action-btn {
        min-height: 50px !important;
        padding: 8px 6px !important;
        gap: 6px !important;
        border-radius: 10px !important;
        justify-content: center !important;
    }

    .quick-actions-buttons-grid .quick-action-btn i {
        font-size: 1.05rem !important;
    }

    .quick-actions-buttons-grid .quick-action-btn span {
        font-size: 0.72rem !important;
        line-height: 1.1;
        text-align: center;
    }
}

/* ===================================
   LOGIN MODAL MOBILE HOTFIX
   =================================== */
@media (max-width: 768px) {
    body.not-logged-in #loginModal .modal-dialog {
        margin: 8px auto !important;
        max-width: calc(100% - 16px) !important;
        height: auto !important;
        min-height: calc(100dvh - 16px) !important;
        align-items: flex-start !important;
    }

    body.not-logged-in #loginModal .modal-content.login-panel {
        width: 100% !important;
        max-width: 420px !important;
        height: auto !important;
        max-height: calc(100dvh - 16px) !important;
        border-radius: 16px !important;
        overflow-y: auto !important;
    }

    #loginModal .login-header {
        padding: 44px 18px 26px !important;
    }

    #loginModal .login-body {
        padding: 18px 16px 16px !important;
    }

    #loginModal .login-footer {
        padding: 12px 14px !important;
        border-bottom-left-radius: 16px !important;
        border-bottom-right-radius: 16px !important;
    }

    #loginModal .login-title {
        font-size: 1.25rem !important;
        margin: 12px 0 6px !important;
    }

    #loginModal .login-subtitle {
        font-size: 0.85rem !important;
    }

    #loginModal .login-icon-wrapper {
        padding: 14px !important;
        margin-bottom: 10px !important;
    }

    #loginModal .login-icon {
        font-size: 2rem !important;
    }

    #loginModal .login-logo {
        max-width: 130px !important;
        max-height: 64px !important;
        padding: 10px !important;
        margin-bottom: 10px !important;
        border-radius: 12px !important;
    }

    #loginModal .login-label {
        font-size: 0.86rem !important;
        margin-bottom: 6px !important;
    }

    #loginModal .login-input {
        padding: 12px 40px 12px 42px !important;
        border-radius: 10px !important;
        font-size: 0.95rem !important;
    }

    #loginModal.rtl-login .login-input,
    #loginModal .rtl-login .login-input {
        padding: 12px 42px 12px 40px !important;
    }

    #loginModal .btn {
        width: auto !important;
        min-height: 36px !important;
        margin-bottom: 0 !important;
    }

    #loginModal .btn-login {
        width: 100% !important;
        min-height: 44px !important;
        padding: 12px !important;
        font-size: 0.9rem !important;
        letter-spacing: 0.4px !important;
    }

    #loginModal .login-lang-switcher {
        top: 10px !important;
        right: 10px !important;
    }

    #loginModal .rtl-login .login-lang-switcher {
        right: auto !important;
        left: 10px !important;
    }

    #loginModal .login-lang-switcher .btn {
        width: auto !important;
        min-height: 30px !important;
        height: 30px !important;
        padding: 4px 10px !important;
        font-size: 0.75rem !important;
        border-radius: 8px !important;
    }

    #loginModal .login-lang-switcher .dropdown-menu {
        min-width: 160px !important;
    }
}

@media (max-width: 420px) {
    body.not-logged-in #loginModal .modal-dialog {
        margin: 6px auto !important;
        max-width: calc(100% - 12px) !important;
    }

    body.not-logged-in #loginModal .modal-content.login-panel {
        max-height: calc(100dvh - 12px) !important;
    }

    #loginModal .login-header {
        padding: 40px 14px 20px !important;
    }

    #loginModal .login-body {
        padding: 14px 12px 12px !important;
    }

    #loginModal .login-title {
        font-size: 1.1rem !important;
    }

    #loginModal .login-subtitle {
        font-size: 0.8rem !important;
    }

    #loginModal .login-input {
        font-size: 0.9rem !important;
        padding-top: 10px !important;
        padding-bottom: 10px !important;
    }
}

/* Mobile invoice actions dropdown layering fix */
@media (max-width: 768px) {
    .mobile-actions-container {
        overflow-x: auto !important;
        overflow-y: visible !important;
        position: relative;
    }

    .mobile-actions-container td,
    .mobile-actions-container tr {
        overflow: visible !important;
    }

    .mobile-actions-dropdown {
        position: relative;
    }

    .mobile-actions-dropdown.show {
        z-index: 1090;
    }

    .mobile-actions-dropdown .dropdown-menu {
        z-index: 1080 !important;
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
    }

    /* Compact recent invoices table to avoid left/right scroll */
    #recentInvoicesTab.table-responsive {
        overflow-x: hidden !important;
    }

    #recentInvoicesTab table {
        min-width: 100% !important;
        table-layout: fixed;
    }

    #recentInvoicesTab th,
    #recentInvoicesTab td {
        white-space: normal !important;
        font-size: 0.72rem !important;
        padding: 0.3rem 0.2rem !important;
        vertical-align: middle;
        word-break: break-word;
    }

    #recentInvoicesTab th:nth-child(1),
    #recentInvoicesTab td:nth-child(1) { width: 18%; }
    #recentInvoicesTab th:nth-child(2),
    #recentInvoicesTab td:nth-child(2) { width: 16%; }
    #recentInvoicesTab th:nth-child(3),
    #recentInvoicesTab td:nth-child(3) { width: 17%; }
    #recentInvoicesTab th:nth-child(4),
    #recentInvoicesTab td:nth-child(4) { width: 16%; }
    #recentInvoicesTab th:nth-child(5),
    #recentInvoicesTab td:nth-child(5) { width: 15%; }
    #recentInvoicesTab th:nth-child(6),
    #recentInvoicesTab td:nth-child(6) { width: 18%; }

    #recentInvoicesTab .badge {
        font-size: 0.64rem !important;
        padding: 2px 5px !important;
    }

    #recentInvoicesTab .btn.btn-sm {
        min-height: 28px !important;
        height: 28px !important;
        padding: 0.15rem 0.35rem !important;
        font-size: 0.72rem !important;
    }

    /* Compact payment receive/out tables to avoid horizontal scroll */
    #recentReceiveTab.table-responsive,
    #recentOutTab.table-responsive {
        overflow-x: hidden !important;
    }

    #recentReceiveTab table,
    #recentOutTab table {
        min-width: 100% !important;
        table-layout: fixed;
    }

    #recentReceiveTab th,
    #recentReceiveTab td,
    #recentOutTab th,
    #recentOutTab td {
        white-space: normal !important;
        font-size: 0.72rem !important;
        padding: 0.3rem 0.2rem !important;
        vertical-align: middle;
        word-break: break-word;
    }

    #recentReceiveTab th:nth-child(1),
    #recentReceiveTab td:nth-child(1),
    #recentOutTab th:nth-child(1),
    #recentOutTab td:nth-child(1) { width: 17%; }

    #recentReceiveTab th:nth-child(2),
    #recentReceiveTab td:nth-child(2),
    #recentOutTab th:nth-child(2),
    #recentOutTab td:nth-child(2) { width: 17%; }

    #recentReceiveTab th:nth-child(3),
    #recentReceiveTab td:nth-child(3),
    #recentOutTab th:nth-child(3),
    #recentOutTab td:nth-child(3) { width: 17%; }

    #recentReceiveTab th:nth-child(4),
    #recentReceiveTab td:nth-child(4),
    #recentOutTab th:nth-child(4),
    #recentOutTab td:nth-child(4) { width: 17%; }

    #recentReceiveTab th:nth-child(5),
    #recentReceiveTab td:nth-child(5),
    #recentOutTab th:nth-child(5),
    #recentOutTab td:nth-child(5) { width: 13%; }

    #recentReceiveTab th:nth-child(6),
    #recentReceiveTab td:nth-child(6),
    #recentOutTab th:nth-child(6),
    #recentOutTab td:nth-child(6) { width: 19%; }

    #recentReceiveTab .badge,
    #recentOutTab .badge {
        font-size: 0.64rem !important;
        padding: 2px 5px !important;
    }

    #recentReceiveTab .btn.btn-sm,
    #recentOutTab .btn.btn-sm {
        min-height: 28px !important;
        height: 28px !important;
        padding: 0.15rem 0.35rem !important;
        font-size: 0.72rem !important;
    }
}

/* ===================================
   Mobile Quick Footer Actions
   =================================== */
.mobile-quick-footer {
    display: none;
}

@media (max-width: 768px) {
    body.logged-in .mobile-quick-footer {
        position: fixed;
        left: 8px;
        right: 8px;
        bottom: 8px;
        z-index: 1060;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 255, 0.98) 100%);
        border: 1px solid rgba(219, 231, 255, 0.9);
        border-radius: 16px;
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16), 0 2px 8px rgba(37, 99, 235, 0.12);
        -webkit-backdrop-filter: blur(8px);
        backdrop-filter: blur(8px);
    }

    body.not-logged-in .mobile-quick-footer,
    body.logged-in.client-portal-user .mobile-quick-footer {
        display: none !important;
    }

    body.logged-in .content-wrapper {
        padding-bottom: 108px;
    }

    .mobile-quick-btn {
        border: 1px solid #d6e2ff;
        background: linear-gradient(180deg, #ffffff 0%, #f3f7ff 100%);
        color: #0f172a;
        border-radius: 12px;
        min-height: 50px;
        padding: 6px 2px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        font-size: 0.56rem;
        font-weight: 800;
        line-height: 1.1;
        text-align: center;
        letter-spacing: 0.1px;
        box-shadow: 0 3px 8px rgba(37, 99, 235, 0.08);
        transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    }

    .mobile-quick-btn:hover {
        border-color: #93c5fd;
        box-shadow: 0 6px 14px rgba(37, 99, 235, 0.16);
        transform: translateY(-1px);
    }

    .mobile-quick-btn i {
        font-size: 0.96rem;
        color: #1d4ed8;
        width: 22px;
        height: 22px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: rgba(37, 99, 235, 0.12);
        border-radius: 999px;
    }

    .mobile-quick-btn:active {
        transform: scale(0.97);
        box-shadow: 0 2px 6px rgba(37, 99, 235, 0.1);
    }

    /* Hide duplicated dashboard quick actions on mobile (footer has same actions) */
    #quickActionsHeader,
    .quick-actions-buttons-grid {
        display: none !important;
    }
}
