/* 
 * Material Design Refactored CSS
 * Entry point for the new Material CSS structure.
 */

@import url('material/material-base.css');
@import url('material/material-layout.css');
@import url('material/material-components.css');
@import url('material/material-utilities.css');
@import url('material/material-forms.css');
@import url('material/material-calendar.css');

/* --- Project Management Dashboard Redesign Styles --- */

/* 1. Global Project Selector Truncation Fix */
.project-selector-box .bootstrap-select {
    width: 100% !important;
    max-width: 100% !important;
}

.project-selector-box .bootstrap-select .dropdown-toggle {
    display: flex !important;
    align-items: center;
    overflow: hidden !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    background: transparent !important;
    border: none !important;
}

.project-selector-box .bootstrap-select .dropdown-toggle .filter-option {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
    padding-right: 0 !important;
}

.project-selector-box .bootstrap-select .dropdown-toggle .bs-caret {
    display: none !important;
}

.project-selector-box .bootstrap-select .dropdown-toggle .filter-option-inner,
.project-selector-box .bootstrap-select .dropdown-toggle .filter-option-inner-inner {
    display: block !important;
    width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* 2. Responsive Card Layout Fixes */
.tw-bg-white {
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1) !important;
}

.tw-rounded-2xl {
    border-radius: 1rem !important;
}

/* --- Customers Page Redesign Styles --- */
.stats-card-modern {
    background: #ffffff;
    border: 1px solid #eef2f7;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 100px;
}

.stats-card-modern:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    border-color: #d1d9e6;
}

.stats-icon-wrapper {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stats-content {
    flex-grow: 1;
}

.stats-number {
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
    color: #1e293b;
}

.stats-label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 6px;
    display: block;
}

.stats-trend {
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

.trend-up {
    color: #10b981;
}

.trend-down {
    color: #ef4444;
}

.glass-effect {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(8px);
}

/* Compact Customers Table Styles */
.table-clients tbody tr td {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    vertical-align: middle;
}

.table-clients thead tr th {
    padding-top: 12px !important;
    padding-bottom: 12px !important;
    background-color: #f8fafc;
}

.table-clients .row-options {
    margin-top: 4px !important;
    opacity: 0.7;
}

.table-clients tbody tr:hover .row-options {
    opacity: 1;
}

/* --- UNIVERSAL PREMIUM STAT CARD SYSTEM --- 
   Unified across Subscriptions, Expenses, Contracts, Tasks, and Estimates
------------------------------------------------------------------------- */

/* 1. Master Card Container (Standardized Size & Shape) */
.sub-summary-card,
.exp-summary-card,
.cnt-summary-card,
.task-summary-card,
.estimate-stat-card,
.stats-card-modern {
    background: #ffffff;
    border-radius: 16px !important;
    padding: 16px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border: 1px solid #f1f5f9;
    height: 100% !important;
    min-height: 165px !important;
    /* Standardized height across all pages */
    text-align: left !important;
    cursor: pointer;
    width: 100%;
}

.sub-summary-card:hover,
.exp-summary-card:hover,
.cnt-summary-card:hover,
.task-summary-card:hover,
.estimate-stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

/* 2. Unified Header / Icon Area */
.sub-icon-wrapper,
.exp-icon-wrapper,
.cnt-icon-wrapper,
.task-icon-wrapper,
.estim-header,
.stats-icon-wrapper {
    display: flex !important;
    align-items: center !important;
    margin-bottom: 5px !important;
}

/* Unified Pill Styling (Icon + Label) */
.estim-pill,
.sub-icon-wrapper,
.exp-icon-wrapper,
.cnt-icon-wrapper,
.task-icon-wrapper {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 4px 12px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    width: fit-content !important;
    height: auto !important;
    box-shadow: none !important;
}

.sub-icon-wrapper i,
.exp-icon-wrapper i,
.cnt-icon-wrapper i,
.task-icon-wrapper i,
.estim-pill i {
    font-size: 13px !important;
}

/* 3. Unified Body / Stat Area */
.estim-body,
.cnt-content,
.task-content,
.sub-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sub-number,
.exp-value,
.cnt-number,
.task-number,
.estim-count {
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #475569 !important;
    margin-bottom: 2px !important;
    line-height: 1.2 !important;
}

.sub-text,
.exp-label,
.cnt-label,
.task-label,
.estim-percent {
    font-size: 16px !important;
    font-weight: 900 !important;
    color: #0f172a !important;
    line-height: 1 !important;
    margin: 0 !important;
    display: flex;
    align-items: baseline;
}

/* If it's a percent with a % sign */
.estim-percent span {
    font-size: 13px !important;
    font-weight: 700 !important;
    margin-left: 2px !important;
}

/* 4. Unified Footer / Trend Area */
.sub-trend,
.cnt-trend,
.task-sub,
.estim-footer {
    border-top: 1px solid #f8fafc;
    padding-top: 10px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #64748b !important;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
}

/* Unified Status Colors (Global Mapping) */
/* Green / Active / Lead-Working */
.sub-card-active,
.exp-card-billable,
.cnt-card-active,
.task-card-status-5,
.est-card-5 {
    background: #f0fdf4 !important;
    border-bottom: 3px solid #22c55e !important;
}

.sub-card-active .sub-icon-wrapper,
.exp-card-billable .exp-icon-wrapper,
.cnt-card-active .cnt-icon-wrapper,
.task-card-status-5 .task-icon-wrapper,
.est-card-5 .estim-pill {
    background: #22c55e !important;
    color: white !important;
}

/* Blue / Future / Lead-Proposal */
.sub-card-future,
.cnt-card-recently,
.task-card-status-4,
.est-card-2 {
    background: #eff6ff !important;
    border-bottom: 3px solid #3b82f6 !important;
}

.sub-card-future .sub-icon-wrapper,
.cnt-card-recently .cnt-icon-wrapper,
.task-card-status-4 .task-icon-wrapper,
.est-card-2 .estim-pill {
    background: #3b82f6 !important;
    color: white !important;
}

/* Amber / Warning / Expiring */
.sub-card-past_due,
.exp-card-all,
.cnt-card-expiring,
.task-card-status-2,
.est-card-3 {
    background: #fff7ed !important;
    border-bottom: 3px solid #f59e0b !important;
}

.sub-card-past_due .sub-icon-wrapper,
.exp-card-all .exp-icon-wrapper,
.cnt-card-expiring .cnt-icon-wrapper,
.task-card-status-2 .task-icon-wrapper,
.est-card-3 .estim-pill {
    background: #f59e0b !important;
    color: white !important;
}

/* Red / Danger / Expired */
.sub-card-unpaid,
.exp-card-unbilled,
.cnt-card-expired,
.task-card-status-1,
.est-card-4 {
    background: #fef2f2 !important;
    border-bottom: 3px solid #ef4444 !important;
}

.sub-card-unpaid .sub-icon-wrapper,
.exp-card-unbilled .exp-icon-wrapper,
.cnt-card-expired .cnt-icon-wrapper,
.task-card-status-1 .task-icon-wrapper,
.est-card-4 .estim-pill {
    background: #ef4444 !important;
    color: white !important;
}

/* Grid layout for stats area (Fixed: Now wraps correctly for 8+ cards) */
.estimate-stats-grid,
.quick-top-stats [class*="tw-grid"],
.subscriptions-summary .tw-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)) !important;
    gap: 12px !important;
    width: 100% !important;
}

/* Specific fix for squashed subscription cards */
.sub-summary-card,
.exp-summary-card,
.cnt-summary-card,
.task-summary-card,
.estimate-stat-card {
    flex-shrink: 0 !important;
    /* Prevents cards from becoming narrow */
}

@media (max-width: 1200px) {

    [class*="tw-grid"],
    .subscriptions-summary .tw-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
    }
}

@media (max-width: 768px) {

    [class*="tw-grid"],
    .subscriptions-summary .tw-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    }
}



/* Add New Lead Modal - High Precision UI Fixes */
#lead_form .modal-body {
    padding: 25px !important;
}

/* Ensure columns are consistent */
#lead_form .row>div[class*="col-md-4"] {
    margin-bottom: 20px;
    padding-left: 15px;
    padding-right: 15px;
}

/* Base form-group fixes */
#lead_form .form-group {
    margin-bottom: 0 !important;
    width: 100%;
}

/* Robust Flex-box for Input Groups */
#lead_form .input-group {
    display: flex !important;
    width: 100% !important;
    align-items: center !important;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
}

/* Ensure bootstrap-select takes available space but leaves room for button */
#lead_form .input-group .bootstrap-select {
    flex: 1 !important;
    width: auto !important;
    margin: 0 !important;
}

/* The detached plus button addon */
#lead_form .input-group-addon {
    background: #ffffff !important;
    border: 1px solid #eef2f7 !important;
    border-radius: 12px !important;
    margin-left: 12px !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    color: #64748b !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02) !important;
    flex-shrink: 0 !important;
    float: none !important;
    position: relative !important;
    top: 0 !important;
}

#lead_form .input-group-addon:hover {
    background: #f8fafc !important;
    border-color: #3b82f6 !important;
    color: #3b82f6 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05) !important;
}

#lead_form .input-group-addon i {
    font-size: 16px;
}

/* Standardize Inputs and Selects */
#lead_form .bootstrap-select .btn,
#lead_form .form-control {
    height: 42px !important;
    border-radius: 12px !important;
    border: 1px solid #eef2f7 !important;
    background-color: #ffffff !important;
    color: #1e293b !important;
    font-size: 14px !important;
    padding: 0 15px !important;
    line-height: 40px !important;
    box-shadow: none !important;
    transition: all 0.2s ease;
}

#lead_form .bootstrap-select .btn:hover {
    border-color: #d1d9e6 !important;
}

#lead_form .bootstrap-select .btn:focus,
#lead_form .form-control:focus {
    border-color: #3b82f6 !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

/* Label Alignment Fixes */
#lead_form label {
    display: block !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    color: #475569 !important;
    margin-bottom: 8px !important;
    margin-top: 0 !important;
}

/* Required star color */
#lead_form label .text-danger {
    color: #ef4444 !important;
}

/* Modal Styling */
.modal-content {
    border-radius: 20px !important;
    border: none !important;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15) !important;
}

.modal-header {
    background: #ffffff !important;
    border-bottom: 1px solid #f1f5f9 !important;
    padding: 20px 25px !important;
}

/* Fixed spacing for Tags row */
#lead_form .col-md-12 hr {
    margin: 10px -25px 25px -25px !important;
    border-color: #f1f5f9;
}

/* --- Modern Unified DataTable Top Controls --- */
.dataTables_wrapper .dt_top_area,
.dataTables_wrapper .tw-flex.tw-items-center.tw-justify-between {
    margin-bottom: 25px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: #fcfdfe;
    padding: 12px 15px !important;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
}

/* 1. Unified Left-Side Group (Length + Buttons) */
.dataTables_wrapper .dt_top_area > div:first-child,
.dataTables_wrapper .tw-flex.tw-items-center.tw-justify-between > div:first-child {
    display: inline-flex !important;
    align-items: center !important;
    background: #ffffff;
    border: 1px solid #eef2f7;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02) !important;
}

/* Length Selector (The first item in the group) */
.dataTables_length {
    margin: 0 !important;
    padding: 0 !important;
    border-right: 1px solid #eef2f7 !important;
}

.dataTables_length select {
    height: 42px !important;
    border: none !important;
    padding: 0 12px !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    color: #334155 !important;
    background: transparent !important;
    min-width: 65px !important;
    cursor: pointer;
}

/* Export & Reload Buttons (The rest of the group) */
.dt-buttons {
    margin: 0 !important;
    display: inline-flex !important;
    gap: 0 !important;
}

.dt-buttons .btn-default {
    border: none !important;
    border-right: 1px solid #eef2f7 !important;
    background: transparent !important;
    height: 42px !important;
    border-radius: 0 !important;
    padding: 0 18px !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    color: #475569 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    box-shadow: none !important;
    transition: all 0.2s ease;
}

.dt-buttons .btn-default:last-child {
    border-right: none !important;
}

.dt-buttons .btn-default:hover {
    background: #f8fafc !important;
    color: #2563eb !important;
}

.dt-buttons .btn-default i {
    font-size: 16px !important;
    color: #64748b;
}

/* 2. Modern Search Input (Right-Side Simplified) */
.dataTables_filter {
    margin: 0 !important;
}

.dataTables_filter label {
    margin: 0 !important;
    display: block !important;
    font-size: 0 !important; /* Hides "Search:" text */
    color: transparent !important;
}

.dataTables_filter input {
    height: 42px !important;
    border-radius: 12px !important;
    border: 1px solid #eef2f7 !important;
    padding: 0 15px 0 40px !important; /* Space for lens icon */
    margin: 0 !important;
    font-size: 14px !important;
    color: #1e293b !important;
    width: 250px !important;
    background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%233b82f6' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E") no-repeat 12px center !important;
    background-size: 18px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02) !important;
    transition: all 0.3s ease !important;
    outline: none !important;
}

.dataTables_filter input:focus {
    border-color: #3b82f6 !important;
    width: 320px !important; /* Elegant expansion */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

.dataTables_filter input::placeholder {
    color: #94a3b8 !important;
}



@media (max-width: 768px) {
    .dataTables_wrapper .dt_top_area {
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    .dataTables_filter, .dataTables_filter input {
        width: 100% !important;
    }
}


/* Modern Financial Dashboard Table Styling */
.expenses-report-container {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    margin-top: 20px;
    overflow: hidden;
    border: 1px solid #eef2f7;
}

.expenses-report {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    width: 100% !important;
    margin-bottom: 0 !important;
    border: none !important;
}

/* Sticky Header */
.expenses-report thead th {
    position: sticky;
    top: 0;
    background: #f8fafc !important;
    color: #475569 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    padding: 16px 12px !important;
    border-bottom: 2px solid #e2e8f0 !important;
    z-index: 10;
    white-space: nowrap;
}

/* Zebra Striping & Padding */
.expenses-report tbody tr:nth-child(even) {
    background-color: #fbfcfe;
}

.expenses-report td {
    padding: 14px 12px !important;
    font-size: 14px !important;
    color: #1e293b !important;
    border-bottom: 1px solid #f1f5f9 !important;
    border-right: 1px solid #f8fafc !important;
    vertical-align: middle !important;
    transition: all 0.2s ease;
}

.expenses-report tbody tr:hover td {
    background-color: #f1f5f9 !important;
}

/* Currency Alignment */
.expenses-report td:not(:first-child),
.expenses-report th:not(:first-child) {
    text-align: right !important;
}

/* Muted Zero Values */
.currency-zero {
    color: #cbd5e1 !important;
    font-weight: 400 !important;
}

/* Category Badges */
.expense-category-badge {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    display: inline-block;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.badge-advertisement {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

.badge-office {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #dcfce7;
}

.badge-travel {
    background: #fef9c3;
    color: #854d0e;
    border-color: #fef08a;
}

.badge-salary {
    background: #faf5ff;
    color: #7c3aed;
    border-color: #e9d5ff;
}

/* Important Rows Highlighting (Subtotal, Tax, Total) */
.expenses-report tr.summary-row td {
    background-color: #f8fafc !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    border-top: 2px solid #eef2f7 !important;
}

.expenses-report tr.summary-row-total td {
    background-color: #f1f5f9 !important;
    font-weight: 900 !important;
    color: #2563eb !important;
    font-size: 16px !important;
    border-top: 2px solid #cbd5e1 !important;
}

/* Monthly Highlighting */
.expenses-report td.current-month {
    background-color: #eff6ff !important;
    font-weight: 700 !important;
}

/* Action Icons */
.expense-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.expense-actions a {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #eef2f7;
    color: #64748b;
    transition: all 0.2s ease;
    text-decoration: none !important;
}

.expense-actions a:hover {
    background: #f8fafc;
    color: #1e293b;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.expense-actions a.delete:hover {
    color: #ef4444;
    border-color: #fecaca;
}

/* Report Action Buttons & Toolbar Fixes */
.tw-flex.tw-space-x-2 a.btn-default,
.pull-right a.btn-default,
.btn-report-action {
    height: 40px !important;
    min-width: 42px !important;
    border-radius: 12px !important;
    border: 1px solid #eef2f7 !important;
    background: #ffffff !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 15px !important;
    font-weight: 700 !important;
    color: #475569 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 8px !important;
    text-decoration: none !important;
}

.tw-flex.tw-space-x-2 a.btn-default i,
.pull-right a.btn-default i {
    font-size: 18px !important;
    /* Fix squashed icon size */
}

.tw-flex.tw-space-x-2 a.btn-default:hover,
.pull-right a.btn-default:hover {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #2563eb !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05) !important;
}

/* Fix for narrow PDF/Excel buttons specifically */
.tw-flex.tw-space-x-2 a.btn-default:has(i.fa-file-pdf),
.tw-flex.tw-space-x-2 a.btn-default:has(i.fa-file-excel) {
    padding: 0 12px !important;
}

/* Standardize Detailed Report button position */
.pull-right a.btn-default {
    float: right;
    margin-bottom: 20px;
}

/* Table Compactness & Row Spacing Optimization */
.table:not(.expenses-report) tbody td {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    vertical-align: middle !important;
}

.table:not(.expenses-report) thead th {
    padding-top: 12px !important;
    padding-bottom: 12px !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    vertical-align: middle !important;
}

/* Ensure Toggle/Switch Alignment within compact rows */
.table .onoffswitch,
.table .onoffswitch-label {
    margin-bottom: 0 !important;
}

/* Smooth Row Hover Transition */
.table tbody tr {
    transition: background-color 0.2s ease;
}

/* Global Layout Compactness & Whitespace Optimization */
#wrapper .content {
    padding: 15px 20px !important;
}

.panel_s {
    margin-bottom: 18px !important;
    border-radius: 12px !important;
}

.panel-body {
    padding: 15px 18px !important;
}

/* Grid Gutter Optimization (Reduces wide gaps between columns) */
.row {
    margin-left: -10px !important;
    margin-right: -10px !important;
}

.row>div[class*="col-"] {
    padding-left: 10px !important;
    padding-right: 10px !important;
    margin-bottom: 15px;
    /* Consistent vertical stacking gap */
}

/* Refined Typography & Rule Spacing */
hr {
    margin-top: 12px !important;
    margin-bottom: 12px !important;
    border-color: #f1f5f9 !important;
}

h4,
.h4,
h3,
.h3 {
    margin-top: 0 !important;
    margin-bottom: 12px !important;
    font-weight: 800 !important;
    color: #1e293b !important;
}

/* Content Area Spacing */
.mtop15,
.mbot15 {
    margin-top: 10px !important;
    margin-bottom: 10px !important;
}

.mtop20,
.mbot20 {
    margin-top: 15px !important;
    margin-bottom: 15px !important;
}

.mtop25,
.mbot25 {
    margin-top: 18px !important;
    margin-bottom: 18px !important;
}

/* Dashboard Widget Spacing Fix */
.home-summary .col-md-3,
.home-summary .col-sm-6 {
    margin-bottom: 20px !important;
}

/* --- Top Bar & Header Responsiveness --- */
@media (max-width: 768px) {
    #header {
        height: auto !important;
        min-height: 60px !important;
    }

    .navbar-header {
        display: flex !important;
        align-items: center !important;
        width: 100% !important;
        justify-content: space-between !important;
    }

    /* Hide redundant elements on mobile */
    .top-search-icon,
    #top_search_button {
        display: none !important;
    }

    /* Compact Top Search Bar */
    #top_search {
        margin: 5px 10px !important;
        width: calc(100% - 150px) !important;
    }

    #top_search .input-group {
        width: 100% !important;
    }

    #top_search input {
        height: 36px !important;
        border-radius: 10px !important;
        font-size: 13px !important;
        padding-left: 12px !important;
    }

    /* Navigation Icons Spacing */
    .navbar-right {
        margin: 0 !important;
        display: flex !important;
        padding-right: 10px !important;
    }

    .navbar-right li.nav-icon {
        padding: 0 !important;
    }

    .navbar-right li.nav-icon a {
        padding: 10px 8px !important;
        font-size: 16px !important;
    }

    /* Profiles & Avatars */
    .navbar-right li.profile {
        display: flex !important;
        align-items: center !important;
    }

    /* Hide Profile Name on extra small screens */
    .navbar-right li.profile a span {
        display: none !important;
    }

    .navbar-right li.profile img {
        margin-right: 0 !important;
        width: 32px !important;
        height: 32px !important;
    }

    /* Notification Badge Correction */
    .navbar-right .label-notifications {
        top: 8px !important;
        right: 2px !important;
        padding: 2px 4px !important;
        font-size: 9px !important;
    }
}

/* Support for medium screens */
@media (min-width: 769px) and (max-width: 1024px) {
    #top_search {
        width: 250px !important;
    }
}


/* Modern Estimate Stats Redesign */
.estimate-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 25px;
}

@media (max-width: 1200px) {
    .estimate-stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .estimate-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.estimate-stat-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 15px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex !important;
    flex-direction: column !important;
    min-height: 160px;
    width: 100%;
}

.estimate-stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.estim-header {
    margin-bottom: 12px;
    display: flex;
}

.estim-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
}

.estim-pill i {
    font-size: 12px;
}

.estim-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 5px 0;
}

.estim-count {
    font-size: 16px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 2px;
}

.estim-percent {
    font-size: 28px;
    font-weight: 900;
    color: #0f172a;
    line-height: 1;
    display: flex;
    align-items: baseline;
}

.estim-percent span {
    font-size: 14px;
    font-weight: 700;
    margin-left: 2px;
}

.estim-footer {
    border-top: 1px solid #f8fafc;
    padding-top: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
}


.estim-trend-up {
    color: #16a34a;
}

.estim-trend-neutral {
    color: #64748b;
}

.estim-trend-down {
    color: #f97316;
}

/* Status Themes */
/* Draft (1) */
.est-card-1 .estim-pill {
    background: #f1f5f9;
    color: #475569;
}

/* Sent (2) */
.est-card-2 .estim-pill {
    background: #eff6ff;
    color: #2563eb;
}

/* Expired (3) */
.est-card-3 {
    background: #fffcf0 !important;
}

.est-card-3 .estim-pill {
    background: #fef3c7;
    color: #b45309;
}

/* Declined (4) */
.est-card-4 .estim-pill {
    background: #fef2f2;
    color: #ef4444;
}

.est-card-5 .estim-pill {
    background: #f0fdf4;
    color: #16a34a;
}

/* --- Modern Project Status Cards Redesign --- */
.project-pills-container {
    display: flex !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
    align-items: stretch !important;
}

.project-pill {
    background: #ffffff !important;
    border-radius: 12px !important;
    border: 1px solid #eef2f7 !important;
    padding: 0 !important;
    min-width: 155px !important;
    display: flex !important;
    flex-direction: column !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    text-decoration: none !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03) !important;
    overflow: hidden !important;
}

.project-pill:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08) !important;
    border-color: #d1d9e6 !important;
}

/* Card Header (Icon + Name + Small Count on same line) */
.project-pill-header {
    padding: 10px 12px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

.project-pill-header i {
    font-size: 14px !important;
}

.pill-status-label {
    flex-grow: 1 !important;
    white-space: nowrap !important;
}

.pill-small-count {
    opacity: 0.8 !important;
    font-size: 11px !important;
    margin-left: auto !important;
    background: rgba(0,0,0,0.05);
    padding: 1px 6px;
    border-radius: 4px;
}

/* Card Body (Large Number) */
.project-pill-body {
    padding: 15px !important;
    text-align: center !important;
    background: #fafbfc !important;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-pill-large-count {
    font-size: 26px !important;
    font-weight: 800 !important;
    color: #1e293b !important;
    line-height: 1 !important;
}

/* Project Status Themes */
/* 1: Not Started (Gray) */
.project-pill-status-1 .project-pill-header { background: #f8fafc !important; color: #64748b !important; }
.project-pill-status-1 i { color: #94a3b8 !important; }

/* 2: In Progress (Blue) */
.project-pill-status-2 .project-pill-header { background: #eff6ff !important; color: #2563eb !important; }
.project-pill-status-2 i { color: #3b82f6 !important; }

/* 3: On Hold (Amber) */
.project-pill-status-3 .project-pill-header { background: #fffbeb !important; color: #b45309 !important; }
.project-pill-status-3 i { color: #f59e0b !important; }

/* 4: Finished (Green) */
.project-pill-status-4 .project-pill-header { background: #f0fdf4 !important; color: #16a34a !important; }
.project-pill-status-4 i { color: #22c55e !important; }

/* 5: Cancelled (Red) */
.project-pill-status-5 .project-pill-header { background: #fef2f2 !important; color: #ef4444 !important; }
.project-pill-status-5 i { color: #ef4444 !important; }

/* "New Project" Button Styling */
#wrapper ._buttons .btn-primary {
    background: #4f46e5 !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 10px !important;
    font-weight: 700 !important;
    height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2) !important;
    transition: all 0.3s ease !important;
}

#wrapper ._buttons .btn-primary:hover {
    background: #4338ca !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3) !important;
}

/* --- Modern Table Card Architecture (Card-Style Rows) --- */
.table-responsive {
    border: none !important;
    overflow-x: auto !important; /* Restores standard scrolling */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.table-responsive::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

.table.dataTable {
    border-collapse: separate !important;
    border-spacing: 0 12px !important;
    width: calc(100% - 5px) !important; /* Precision buffer to prevent right-edge bleed */
    margin: 0 auto !important;
    border: none !important;
    background: transparent !important;
    table-layout: auto !important;
}

/* Header Alignment Clean up */
table.dataTable thead th {
    background: #f8fafc !important;
    border: none !important;
    color: #475569 !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    font-weight: 800 !important;
    padding: 12px 15px !important;
    border-bottom: 2px solid #f1f5f9 !important;
}

/* Column Dividers for Header only */
table.dataTable thead th:not(:last-child) {
    border-right: 1px solid #eef2f7 !important;
}

/* Individual Row Card Styling */
table.dataTable tbody tr {
    background: #ffffff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02) !important;
    transition: all 0.2s ease !important;
    border: none !important;
}

/* Prevents row backgrounds from leaking past boundaries */
table.dataTable tbody tr td {
    border: none !important;
    background: transparent !important;
    padding: 15px !important;
    vertical-align: middle !important;
    box-sizing: border-box !important;
}

/* Rounded Corners for the Row Cards */
table.dataTable tbody tr td:first-child {
    border-top-left-radius: 12px !important;
    border-bottom-left-radius: 12px !important;
    padding-left: 20px !important;
    border-left: 1px solid #f1f5f9 !important;
}

table.dataTable tbody tr td:last-child {
    border-top-right-radius: 12px !important;
    border-bottom-right-radius: 12px !important;
    padding-right: 20px !important;
    border-right: 1px solid #f1f5f9 !important;
}

/* Hover Effect for Table Cards */
table.dataTable tbody tr:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06) !important;
    z-index: 5;
    position: relative;
}

table.dataTable tbody tr:hover td {
    background: #ffffff !important;
}

/* Strip Default Table Borders */
.table-bordered, .table-bordered > thead > tr > th, .table-bordered > tbody > tr > td {
    border: none !important;
}

/* DataTable Wrapper Alignment Fixes (Scrolling Enabled) */
.dataTables_wrapper {
    width: 100% !important;
    overflow-x: auto !important;
    padding: 5px 2px !important; /* Space for elevations */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.dataTables_wrapper::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}


.alert.float-alert {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14) !important;
}

.alert.float-alert.alert-success {
    background-color: #d1fae5 !important;
    color: #065f46 !important;
    border-left: 4px solid #10b981 !important;
}

.alert.float-alert.alert-info {
    background-color: #dbeafe !important;
    color: #1e40af !important;
    border-left: 4px solid #3b82f6 !important;
}

.alert.float-alert.alert-warning {
    background-color: #fef3c7 !important;
    color: #92400e !important;
    border-left: 4px solid #f59e0b !important;
}

.alert.float-alert.alert-danger {
    background-color: #fee2e2 !important;
    color: #991b1b !important;
    border-left: 4px solid #ef4444 !important;
}

/* Newsfeed form responsive fixes */
#newsfeed-form-container.newsfeed-dialog-layout {
    margin-left: 0 !important;
    margin-right: 0 !important;
    min-height: calc(100vh - 90px);
    display: flex !important;
    justify-content: center !important;
    align-items: flex-start !important;
    padding: clamp(36px, 8vh, 90px) 12px 24px !important;
}

#newsfeed-form-container .newsfeed-dialog-col {
    width: 100%;
    max-width: 760px;
}

#newsfeed-form-container .newsfeed-post-shell {
    position: relative !important;
    margin-bottom: 0 !important;
    border-radius: 12px !important;
    overflow: hidden;
}

#newsfeed-form-container .newsfeed-post-close {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    z-index: 20 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 999px !important;
    background: #e5e7eb !important;
    color: #111827 !important;
    text-decoration: none !important;
}

#newsfeed-form-container .newsfeed-post-close:hover,
#newsfeed-form-container .newsfeed-post-close:focus {
    background: #d1d5db !important;
    color: #111827 !important;
}

#newsfeed-form-container .newsfeed-author {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
    max-width: calc(100% - 50px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#newsfeed-form-container .newsfeed-post-actions {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

#newsfeed-form-container .newsfeed-post-actions .bootstrap-select,
#newsfeed-form-container .newsfeed-post-actions #post-visibility {
    width: 100% !important;
    max-width: 320px !important;
}

#newsfeed-form-container .newsfeed-post-actions .newsfeed-submit-btn {
    margin-left: auto;
}

@media (max-width: 767px) {
    #newsfeed-form-container.newsfeed-dialog-layout {
        min-height: calc(100vh - 70px);
        padding-top: 24px !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    #newsfeed-form-container .newsfeed-post-actions .newsfeed-submit-btn {
        width: 100%;
        margin-left: 0;
    }
}

/* Leads page top status buttons */
.leads-overview .lead-pills-container {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    align-items: center !important;
    overflow: visible !important;
    padding-bottom: 0 !important;
}

.leads-overview .lead-pill {
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px !important;
    padding: 7px 12px !important;
    border-radius: 999px !important;
    border: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    color: #334155 !important;
    text-decoration: none !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06) !important;
    transition: all 0.2s ease !important;
}

.leads-overview .lead-pill i {
    font-size: 12px !important;
    opacity: 0.9;
}

.leads-overview .lead-pill .lead-pill-count {
    font-weight: 800 !important;
    color: #0f172a !important;
}

.leads-overview .lead-pill .status-name {
    font-weight: 700 !important;
    color: #475569 !important;
}

.leads-overview .lead-pill:hover,
.leads-overview .lead-pill:focus {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12) !important;
    text-decoration: none !important;
}

/* Status variants */
.leads-overview .lead-pill.lead-pill-proposal {
    background: #eff6ff !important;
    border-color: #bfdbfe !important;
    color: #1d4ed8 !important;
}

.leads-overview .lead-pill.lead-pill-email {
    background: #f5f3ff !important;
    border-color: #ddd6fe !important;
    color: #6d28d9 !important;
}

.leads-overview .lead-pill.lead-pill-qualified {
    background: #ecfdf5 !important;
    border-color: #a7f3d0 !important;
    color: #047857 !important;
}

.leads-overview .lead-pill.lead-pill-working {
    background: #fff7ed !important;
    border-color: #fed7aa !important;
    color: #c2410c !important;
}

.leads-overview .lead-pill.lead-pill-lost {
    background: #fef2f2 !important;
    border-color: #fecaca !important;
    color: #b91c1c !important;
}

/* Tickets page status cards */
.tickets-summary-cards .ticket-pills-container {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important;
    gap: 14px !important;
}

.tickets-summary-cards .ticket-pill {
    display: block !important;
    padding: 14px 16px !important;
    border-radius: 12px !important;
    border: 1px solid transparent !important;
    text-decoration: none !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
    min-height: 120px !important;
    background-clip: padding-box !important;
}

.tickets-summary-cards .ticket-pill:hover,
.tickets-summary-cards .ticket-pill:focus {
    transform: translateY(-1px) !important;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08) !important;
    text-decoration: none !important;
}

.tickets-summary-cards .ticket-pill-head {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    margin-bottom: 8px !important;
}

.tickets-summary-cards .ticket-pill-head i {
    width: 18px !important;
    text-align: center !important;
    font-size: 15px !important;
}

.tickets-summary-cards .ticket-pill-count {
    font-size: 42px !important;
    line-height: 1 !important;
    font-weight: 700 !important;
    margin-bottom: 8px !important;
}

.tickets-summary-cards .ticket-pill-subtitle {
    font-size: 13px !important;
    color: #6b7280 !important;
}

.tickets-summary-cards .ticket-pill-status-1 {
    background: #eef3ff !important;
    border-color: #dbe5ff !important;
}

.tickets-summary-cards .ticket-pill-status-1 .ticket-pill-head,
.tickets-summary-cards .ticket-pill-status-1 .ticket-pill-count {
    color: #5b44d6 !important;
}

.tickets-summary-cards .ticket-pill-status-2 {
    background: #eef6ff !important;
    border-color: #d9e8ff !important;
}

.tickets-summary-cards .ticket-pill-status-2 .ticket-pill-head,
.tickets-summary-cards .ticket-pill-status-2 .ticket-pill-count {
    color: #2f7cf6 !important;
}

.tickets-summary-cards .ticket-pill-status-3 {
    background: #e9f8f2 !important;
    border-color: #caefdf !important;
}

.tickets-summary-cards .ticket-pill-status-3 .ticket-pill-head,
.tickets-summary-cards .ticket-pill-status-3 .ticket-pill-count {
    color: #19a06b !important;
}

.tickets-summary-cards .ticket-pill-status-4 {
    background: #fff6e8 !important;
    border-color: #ffe8bf !important;
}

.tickets-summary-cards .ticket-pill-status-4 .ticket-pill-head,
.tickets-summary-cards .ticket-pill-status-4 .ticket-pill-count {
    color: #d58a00 !important;
}

.tickets-summary-cards .ticket-pill-status-5 {
    background: #eaf8f2 !important;
    border-color: #cceedd !important;
}

.tickets-summary-cards .ticket-pill-status-5 .ticket-pill-head,
.tickets-summary-cards .ticket-pill-status-5 .ticket-pill-count {
    color: #2a9d66 !important;
}

/* Tickets page filter button */
.tickets-filters-wrap .btn-group > .btn.btn-default.dropdown-toggle {
    height: 40px !important;
    border-radius: 999px !important;
    border: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    color: #334155 !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    padding: 0 14px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08) !important;
    transition: all 0.2s ease !important;
}

.tickets-filters-wrap .btn-group > .btn.btn-default.dropdown-toggle i {
    color: #475569 !important;
    font-size: 12px !important;
}

.tickets-filters-wrap .btn-group > .btn.btn-default.dropdown-toggle:hover,
.tickets-filters-wrap .btn-group > .btn.btn-default.dropdown-toggle:focus {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.1) !important;
}

.tickets-filters-wrap .btn-group.open > .btn.btn-default.dropdown-toggle,
.tickets-filters-wrap .btn-group > .btn.btn-default.dropdown-toggle.active {
    background: #eff6ff !important;
    border-color: #bfdbfe !important;
    color: #1d4ed8 !important;
}

/* Invoices page modern layout */
.invoices-modern-page {
    --inv-border: #e7ebf3;
    --inv-soft-bg: #f8faff;
}

.invoices-modern-page .invoices-modern-header {
    margin-bottom: 16px;
}

.invoices-modern-page .invoices-modern-subtitle {
    margin: 7px 0 9px !important;
    font-size: 14px !important;
    color: #64748b !important;
}

.invoices-modern-page .invoices-modern-recurring-link {
    color: #4f46e5 !important;
    font-weight: 700 !important;
    text-decoration: none !important;
}

.invoices-modern-page #invoices_total[data-type="badge"] {
    display: flex !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
    justify-content: flex-end;
}

.invoices-modern-page #invoices_total[data-type="badge"] > .tw-relative {
    width: 100% !important;
}

.invoices-modern-page #invoices_total[data-type="badge"] .md\:tw-flex.md\:tw-items-center {
    display: flex !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
    justify-content: flex-end !important;
}

.invoices-modern-page #invoices_total[data-type="badge"] .md\:tw-flex.md\:tw-items-center > div[class*="tw-border"] {
    border: 1px solid var(--inv-border) !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
}

.invoices-modern-page #invoices_total[data-type="badge"] .md\:tw-flex.md\:tw-items-center > div[class*="tw-border"]:nth-child(1) {
    background: #f2fcf6 !important;
    border-color: #d6f4e3 !important;
}

.invoices-modern-page #invoices_total[data-type="badge"] .md\:tw-flex.md\:tw-items-center > div[class*="tw-border"]:nth-child(2) {
    background: #fff4f3 !important;
    border-color: #ffdeda !important;
}

.invoices-modern-page #invoices_total[data-type="badge"] .md\:tw-flex.md\:tw-items-center > div[class*="tw-border"]:nth-child(3) {
    background: #fff9ec !important;
    border-color: #ffecc6 !important;
}

.invoices-modern-page .quick-top-stats .invoice-stat-card {
    border-radius: 14px !important;
    border: 1px solid var(--inv-border) !important;
    background: #ffffff !important;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04) !important;
    padding: 14px 16px !important;
    transition: all 0.2s ease !important;
    min-height: 98px !important;
}

.invoices-modern-page .quick-top-stats .invoice-stat-head {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 8px !important;
}

.invoices-modern-page .quick-top-stats .invoice-stat-card:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08) !important;
}

.invoices-modern-page .quick-top-stats .invoice-stat-title {
    font-weight: 700 !important;
    line-height: 1.3 !important;
    min-width: 0 !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
}

.invoices-modern-page .quick-top-stats .invoice-stat-percent {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    line-height: 1.3 !important;
}

.invoices-modern-page .quick-top-stats .invoice-stat-values {
    margin-top: 8px !important;
    padding-top: 8px !important;
    border-top: 1px dashed #e2e8f0 !important;
}

.invoices-modern-page .invoice-stat-card-1 .invoice-stat-title {
    color: #ef4444 !important;
}

.invoices-modern-page .invoice-stat-card-2 .invoice-stat-title {
    color: #16a34a !important;
}

.invoices-modern-page .invoice-stat-card-3 .invoice-stat-title {
    color: #f59e0b !important;
}

.invoices-modern-page .invoice-stat-card-4 .invoice-stat-title {
    color: #d97706 !important;
}

.invoices-modern-page .invoice-stat-card-5 .invoice-stat-title {
    color: #4f46e5 !important;
}

.invoices-modern-page .invoices-modern-actions {
    margin-top: 8px;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
    background: var(--inv-soft-bg);
    border: 1px solid var(--inv-border);
    border-radius: 14px;
    padding: 10px 12px;
}

.invoices-modern-page .invoices-modern-actions-left {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
}

.invoices-modern-page .invoices-modern-actions .btn {
    min-height: 42px !important;
    height: auto !important;
    border-radius: 11px !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    white-space: normal !important;
    line-height: 1.2 !important;
    text-align: center !important;
}

.invoices-modern-page .invoices-modern-actions .btn-primary {
    background: #4f46e5 !important;
    border: none !important;
    box-shadow: 0 6px 14px rgba(79, 70, 229, 0.22) !important;
}

.invoices-modern-page .invoices-modern-actions-right {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin-left: auto !important;
}

.invoices-modern-page .invoices-modern-actions .pull-right,
.invoices-modern-page .invoices-modern-actions .pull-left {
    float: none !important;
}

.invoices-modern-page .invoices-modern-filters-wrap .btn-group > .btn.btn-default.dropdown-toggle {
    min-height: 42px !important;
    height: auto !important;
    border-radius: 11px !important;
    border: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08) !important;
    white-space: normal !important;
    line-height: 1.2 !important;
}

.invoices-modern-page .toggle-small-view.btn {
    width: 42px !important;
    justify-content: center !important;
    padding: 0 !important;
}

.invoices-modern-page #small-table .panel_s {
    border: 1px solid var(--inv-border) !important;
    border-radius: 16px !important;
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.05) !important;
    overflow: hidden;
}

.invoices-modern-page #small-table .panel-body {
    padding: 18px !important;
}

.invoices-modern-page #small-table .dataTables_filter input {
    border-radius: 10px !important;
    border: 1px solid #e2e8f0 !important;
    background-color: #f8fafc !important;
}

/* Language-safe hardening for long translated labels */
.quick-top-stats button,
.ticket-pill,
.payments-modern-stat-card,
.invoices-modern-page #invoices_total[data-type="badge"] > *,
.invoices-modern-page .invoices-modern-actions-left > * {
    min-width: 0 !important;
}

.invoices-modern-page #invoices_total[data-type="badge"] {
    align-items: stretch !important;
}

.invoices-modern-page #invoices_total[data-type="badge"] .tw-text-sm,
.invoices-modern-page #invoices_total[data-type="badge"] .text-success,
.invoices-modern-page #invoices_total[data-type="badge"] .text-danger,
.invoices-modern-page #invoices_total[data-type="badge"] .text-warning {
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
}

.invoices-modern-page .table.dataTable thead th,
.invoices-modern-page .table.dataTable tbody td {
    white-space: normal;
    word-break: break-word;
}

@media (max-width: 1200px) {
    .invoices-modern-page #invoices_total[data-type="badge"] {
        justify-content: flex-start !important;
    }
}

@media (max-width: 767px) {
    .invoices-modern-page #invoices_total[data-type="badge"] .md\:tw-flex.md\:tw-items-center {
        justify-content: flex-start !important;
    }

    .invoices-modern-page .invoices-modern-actions {
        padding: 10px;
    }

    .invoices-modern-page .invoices-modern-actions-right {
        margin-left: 0 !important;
        width: 100%;
        justify-content: flex-end;
    }

    .invoices-modern-page .invoices-modern-actions-left {
        width: 100%;
    }
}

/* Payments page modern header */
.payments-modern-page .payments-modern-title-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.payments-modern-page .payments-modern-title-icon {
    width: 68px;
    height: 68px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1efff;
    color: #5b44d6;
    font-size: 30px;
}

.payments-modern-page .payments-modern-subtitle {
    margin: 6px 0 0;
    font-size: 15px;
    color: #64748b;
}

.payments-modern-page .payments-modern-stats-grid {
    margin-top: 16px;
}

.payments-modern-page .payments-modern-stat-card {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #ffffff;
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 150px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.payments-modern-page .payments-modern-stat-icon {
    width: 72px;
    height: 72px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.payments-modern-page .payments-modern-stat-content {
    flex: 1;
}

.payments-modern-page .payments-modern-stat-value {
    font-weight: 800;
    font-size: 46px;
    line-height: 1.1;
}

.payments-modern-page .payments-modern-card-amount .payments-modern-stat-value {
    font-size: 42px;
}

.payments-modern-page .payments-modern-stat-label {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.2;
    font-weight: 700;
    color: #1f2937;
}

.payments-modern-page .payments-modern-stat-subtext {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.25;
    color: #64748b;
}

.payments-modern-page .payments-modern-stat-trend {
    width: 62px;
    height: 62px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
}

.payments-modern-page .payments-modern-card-total {
    background: #f7f5ff;
    border-color: #ece9ff;
}

.payments-modern-page .payments-modern-card-total .payments-modern-stat-icon {
    background: #ece8ff;
    color: #5b44d6;
}

.payments-modern-page .payments-modern-card-total .payments-modern-stat-trend {
    background: #ece8ff;
    color: #5b44d6;
}

.payments-modern-page .payments-modern-card-amount {
    background: #f7fffb;
    border-color: #dcf3e7;
}

.payments-modern-page .payments-modern-card-amount .payments-modern-stat-icon {
    background: #dff7ec;
    color: #11a86d;
}

.payments-modern-page .payments-modern-card-amount .payments-modern-stat-trend {
    background: #dff7ec;
    color: #11a86d;
}

@media (max-width: 991px) {
    .payments-modern-page .payments-modern-stat-value {
        font-size: 36px;
    }

    .payments-modern-page .payments-modern-card-amount .payments-modern-stat-value {
        font-size: 34px;
    }

    .payments-modern-page .payments-modern-stat-label {
        font-size: 14px;
    }

    .payments-modern-page .payments-modern-stat-subtext {
        font-size: 13px;
    }
}

@media (max-width: 767px) {
    .leads-overview .lead-pills-container {
        gap: 8px !important;
    }

    .leads-overview .lead-pill {
        font-size: 12px !important;
        padding: 6px 10px !important;
    }
}