/* ============================================================
   SmartInvoice India - Premium CSS Design System
   ============================================================ */

:root {
    --primary: #1e40af;
    --primary-light: #3b82f6;
    --primary-dark: #1e3a8a;
    --primary-gradient: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #2563eb 100%);
    --secondary: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --purple: #8b5cf6;

    --bg-body: #f0f4f8;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;
    --bg-sidebar-active: #1e40af;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-white: #ffffff;

    --border-color: #e2e8f0;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 50px -12px rgba(0, 0, 0, 0.15);

    --sidebar-width: 260px;
    --navbar-height: 70px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

.app-wrapper {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* ─── AUTH PAGES ─── */
.auth-body {
    min-height: 100vh;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.auth-body::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    top: -200px;
    right: -200px;
    animation: float 6s ease-in-out infinite;
}

.auth-body::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
    bottom: -150px;
    left: -150px;
    animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0);
    }

    50% {
        transform: translateY(-30px) rotate(5deg);
    }
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 10;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo .logo-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-gradient);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    margin-bottom: 16px;
    box-shadow: 0 8px 25px rgba(30, 64, 175, 0.3);
}

.auth-logo h2 {
    font-weight: 800;
    color: var(--text-primary);
    font-size: 24px;
    letter-spacing: -0.5px;
}

.auth-logo p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.auth-card .form-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.auth-card .form-control {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 12px 16px;
    font-size: 15px;
    transition: var(--transition);
    background: #f8fafc;
}

.auth-card .form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    background: white;
}

.btn-auth {
    background: var(--primary-gradient);
    border: none;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    border-radius: var(--border-radius-sm);
    color: white;
    width: 100%;
    transition: var(--transition);
    letter-spacing: 0.3px;
}

.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(30, 64, 175, 0.35);
    color: white;
}

/* ─── SIDEBAR ─── */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-start;
}

.brand-logo {
    max-height: 44px;
    max-width: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 8px rgba(59, 130, 246, 0.35));
}

.brand-info {
    display: flex;
    flex-direction: column;
}

.brand-text {
    font-size: 20px;
    font-weight: 800;
    color: white;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 10px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--primary-light);
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: #94a3b8;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 2px;
    transition: var(--transition);
}

.sidebar-nav .nav-link i {
    font-size: 18px;
    width: 22px;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    color: white;
    background: var(--bg-sidebar-hover);
}

.sidebar-nav .nav-link.active {
    color: white;
    background: var(--bg-sidebar-active);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
}

.nav-divider {
    padding: 16px 16px 8px;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar,
.nav-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.nav-avatar {
    width: 34px;
    height: 34px;
    font-size: 14px;
}

.user-name {
    color: white;
    font-weight: 600;
    font-size: 14px;
    display: block;
    line-height: 1.3;
}

.user-role {
    color: #64748b;
    font-size: 12px;
    display: block;
}

/* ─── MAIN CONTENT ─── */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
    min-width: 0;
    overflow-x: hidden;
    max-width: 100%;
}

.content-area {
    overflow-x: hidden;
    max-width: 100%;
}

/* Prevent Bootstrap .row negative margins from causing overflow */
.content-area>.fade-in,
.content-area>.fade-in>.row,
.content-area .filter-bar {
    max-width: 100%;
    overflow-x: hidden;
}

/* ─── TOP NAVBAR ─── */
.top-navbar {
    height: var(--navbar-height);
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    overflow: visible;
    max-width: 100%;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.breadcrumb {
    font-size: 12px;
}

.breadcrumb-item a {
    color: var(--text-secondary);
    text-decoration: none;
}

.breadcrumb-item.active {
    color: var(--text-muted);
}

/* ─── CARDS ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 700;
    font-size: 16px;
}

.card-body {
    padding: 20px;
}

/* ─── STAT CARDS ─── */
.stat-card {
    border: none;
    border-radius: var(--border-radius);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    flex-shrink: 0;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -1px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 4px;
}

.stat-card::after {
    content: '';
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    opacity: 0.06;
    right: -30px;
    top: -30px;
}

.stat-card.blue {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
}

.stat-card.blue .stat-icon {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
}

.stat-card.blue::after {
    background: #1e40af;
}

.stat-card.green {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
}

.stat-card.green .stat-icon {
    background: linear-gradient(135deg, #047857, #10b981);
}

.stat-card.green::after {
    background: #047857;
}

.stat-card.orange {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
}

.stat-card.orange .stat-icon {
    background: linear-gradient(135deg, #d97706, #f59e0b);
}

.stat-card.orange::after {
    background: #d97706;
}

.stat-card.red {
    background: linear-gradient(135deg, #fef2f2, #fecaca);
}

.stat-card.red .stat-icon {
    background: linear-gradient(135deg, #dc2626, #ef4444);
}

.stat-card.red::after {
    background: #dc2626;
}

.stat-card.purple {
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
}

.stat-card.purple .stat-icon {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
}

.stat-card.purple::after {
    background: #7c3aed;
}

.stat-card.cyan {
    background: linear-gradient(135deg, #ecfeff, #cffafe);
}

.stat-card.cyan .stat-icon {
    background: linear-gradient(135deg, #0891b2, #06b6d4);
}

.stat-card.cyan::after {
    background: #0891b2;
}

.stat-card.indigo {
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
}

.stat-card.indigo .stat-icon {
    background: linear-gradient(135deg, #4338ca, #6366f1);
}

.stat-card.indigo::after {
    background: #4338ca;
}

.stat-card.teal {
    background: linear-gradient(135deg, #f0fdfa, #ccfbf1);
}

.stat-card.teal .stat-icon {
    background: linear-gradient(135deg, #0d9488, #14b8a6);
}

.stat-card.teal::after {
    background: #0d9488;
}

/* ─── TABLE ─── */
.table-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid var(--border-color);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 14px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ─── BADGES ─── */
.badge {
    font-weight: 600;
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

.badge-status-paid {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.badge-status-unpaid {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.badge-status-partial {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

.badge-status-pending {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.badge-status-overdue {
    background: rgba(239, 68, 68, 0.2);
    color: #b91c1c;
    font-weight: 700;
}

.badge-status-draft {
    background: rgba(100, 116, 139, 0.12);
    color: #475569;
}

.badge-status-active {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.badge-status-inactive {
    background: rgba(100, 116, 139, 0.12);
    color: #64748b;
}

.text-purple {
    color: #7c3aed !important;
}

.badge-status-sent {
    background: rgba(6, 182, 212, 0.12);
    color: #0891b2;
}

.badge-status-approved {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.badge-status-rejected {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.badge-status-converted {
    background: rgba(139, 92, 246, 0.12);
    color: #7c3aed;
}

.badge-status-active {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.badge-status-inactive {
    background: rgba(100, 116, 139, 0.12);
    color: #475569;
}

/* ─── BUTTONS ─── */
.btn {
    font-weight: 600;
    font-size: 14px;
    border-radius: var(--border-radius-sm);
    padding: 8px 16px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.2);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(30, 64, 175, 0.3);
    background: var(--primary-gradient);
}

.btn-outline-primary {
    border: 2px solid var(--primary-light);
    color: var(--primary);
}

.btn-success {
    background: linear-gradient(135deg, #047857, #10b981);
    border: none;
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    border: none;
}

.btn-warning {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    border: none;
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #0891b2, #06b6d4);
    border: none;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
}

/* ─── FORMS ─── */
.form-control,
.form-select {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    transition: var(--transition);
    background-color: #fafbfc;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.08);
    background-color: white;
}

.form-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* ─── SEARCH & FILTERS ─── */
.filter-bar {
    background: white;
    border-radius: var(--border-radius);
    padding: 16px 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

/* ─── INVOICE DETAIL / SHOW PAGES ─── */
.detail-card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

.detail-header {
    background: var(--primary-gradient);
    color: white;
    padding: 24px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.detail-header h2 {
    font-weight: 800;
    font-size: 24px;
    margin: 0;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.info-item {
    padding: 8px 0;
}

.info-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 2px;
}

/* ─── PAYMENT STATUS WATERMARK ─── */
.watermark-unpaid {
    position: relative;
}

.watermark-unpaid::before {
    content: 'UNPAID';
    position: absolute;
    font-size: 80px;
    font-weight: 900;
    color: rgba(239, 68, 68, 0.08);
    transform: rotate(-30deg);
    top: 50%;
    left: 50%;
    margin-top: -40px;
    margin-left: -120px;
    z-index: 0;
    pointer-events: none;
    letter-spacing: 10px;
}

/* ─── FINANCIAL CARDS ─── */
.finance-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.finance-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.finance-card .amount {
    font-size: 24px;
    font-weight: 800;
    margin-top: 8px;
    letter-spacing: -0.5px;
}

.finance-card .label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ─── RESPONSIVE ─── */

/* Sidebar backdrop overlay for mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.sidebar-backdrop.show {
    display: block;
}

/* ── TABLET (≤991px) ── */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    /* Table horizontal scroll */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-container .table {
        min-width: 700px;
    }

    /* Action bars: allow wrap */
    .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 10px;
    }

    .d-flex.gap-2 {
        flex-wrap: wrap;
    }

    /* Detail header: stack on tablet */
    .detail-header .d-flex {
        flex-direction: column;
        gap: 10px;
    }

    .detail-header .text-end {
        text-align: left !important;
    }

    /* Summary box full width */
    .col-md-5 .summary-box,
    .col-md-6 .summary-box {
        width: 100%;
    }

    /* Filter bar: stack better on smaller screens */
    .filter-bar .row {
        row-gap: 8px;
    }

    /* Report cards: 2 per row */
    .report-card {
        padding: 18px 14px;
    }

    .report-card i {
        font-size: 32px;
        margin-bottom: 8px;
    }

    .report-card h5 {
        font-size: 14px;
    }

    .report-card p {
        font-size: 11px;
    }
}

/* ── MOBILE (≤767px) ── */
@media (max-width: 767.98px) {

    /* Content area spacing */
    .content-area {
        padding: 12px !important;
    }

    /* Stat cards */
    .stat-card {
        padding: 16px;
    }

    .stat-card .stat-value {
        font-size: 20px;
    }

    .stat-card .stat-label {
        font-size: 12px;
    }

    .stat-card .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 20px;
        border-radius: 10px;
    }

    /* Auth card */
    .auth-card {
        margin: 16px;
        padding: 28px 20px;
    }

    .auth-logo .logo-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }

    .auth-logo h2 {
        font-size: 20px;
    }

    /* Navbar adjustments */
    .top-navbar {
        height: auto;
        min-height: 56px;
        padding: 8px 12px;
    }

    .top-navbar>.d-flex {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Page title: truncate on mobile */
    .page-title-area {
        min-width: 0;
        flex: 1;
    }

    .page-title {
        font-size: 15px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 180px;
    }

    .breadcrumb {
        font-size: 11px;
    }

    /* Quick actions: hide text, icon only on mobile */
    .quick-actions .dropdown-toggle {
        font-size: 0;
        padding: 6px 10px;
        line-height: 1;
    }

    .quick-actions .dropdown-toggle i {
        font-size: 16px;
    }

    .quick-actions .dropdown-toggle i.me-1 {
        margin-right: 0 !important;
    }

    /* Nav avatar smaller on mobile */
    .nav-avatar {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    /* User dropdown: tighten gap */
    .top-navbar .gap-3 {
        gap: 8px !important;
    }

    /* Cards */
    .card-body {
        padding: 14px;
    }

    .card-header {
        padding: 12px 14px;
        font-size: 14px;
    }

    /* Finance cards */
    .finance-card {
        padding: 14px;
    }

    .finance-card .amount {
        font-size: 18px;
    }

    .finance-card .label {
        font-size: 11px;
    }

    /* Detail header */
    .detail-header {
        padding: 16px;
    }

    .detail-header h2 {
        font-size: 18px;
    }

    .detail-header h3 {
        font-size: 18px;
    }

    /* Table: smaller font, tighter padding */
    .table thead th {
        padding: 10px 8px;
        font-size: 11px;
    }

    .table tbody td {
        padding: 10px 8px;
        font-size: 13px;
    }

    /* Min-width for scrollable tables on mobile */
    .table-container .table {
        min-width: 600px;
    }

    /* Filter bar compact */
    .filter-bar {
        padding: 12px;
    }

    /* Buttons responsive */
    .btn {
        font-size: 13px;
        padding: 7px 12px;
    }

    .btn-sm {
        font-size: 12px;
        padding: 5px 10px;
    }

    /* Summary box */
    .summary-box {
        padding: 14px;
    }

    .summary-row {
        font-size: 13px;
    }

    .summary-row.total {
        font-size: 16px;
    }

    /* Settings */
    .settings-section {
        padding: 16px;
    }

    /* Empty state */
    .empty-state {
        padding: 40px 16px;
    }

    .empty-state i {
        font-size: 48px;
    }

    /* Force 2-column grid on mobile for all card layouts */
    .row>.col-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    /* Report cards: 2 per row on mobile */
    .report-card {
        padding: 14px 10px;
    }

    /* Items table form: stack for long forms */
    .items-table .form-control,
    .items-table .form-select {
        min-width: 70px;
        padding: 6px 8px;
        font-size: 12px;
    }

    /* Chart container smaller */
    .chart-container {
        height: 220px;
    }

    /* Pagination */
    .page-link {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Activity items */
    .activity-item {
        padding: 10px 0;
        gap: 8px;
    }

    /* Invoice/Quotation show page action bar: stack buttons */
    .fade-in>.d-flex:first-child {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }

    .fade-in>.d-flex:first-child .d-flex.gap-2 {
        width: 100%;
        flex-wrap: wrap;
    }

    .fade-in>.d-flex:first-child .d-flex.gap-2 .btn {
        flex: 1 1 auto;
        text-align: center;
        justify-content: center;
        min-width: 120px;
    }
}

/* ── SMALL MOBILE (≤480px) ── */
@media (max-width: 480px) {
    .stat-card .stat-value {
        font-size: 18px;
        letter-spacing: -0.5px;
    }

    .stat-card .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
        border-radius: 8px;
    }

    .page-title {
        font-size: 15px;
    }

    .detail-header h2 {
        font-size: 16px;
    }

    .finance-card .amount {
        font-size: 16px;
    }

    /* Table smaller min-width */
    .table-container .table {
        min-width: 500px;
    }

    .auth-card {
        margin: 10px;
        padding: 24px 16px;
    }

    /* Buttons: full width stacking */
    .fade-in>.d-flex:first-child .d-flex.gap-2 .btn {
        min-width: 100px;
        font-size: 12px;
    }

    .quick-actions .dropdown-toggle {
        padding: 5px 10px;
        font-size: 12px;
    }
}

/* ─── ANIMATION UTILITIES ─── */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── PAGINATION ─── */
.pagination {
    gap: 4px;
    flex-wrap: wrap;
}

.page-link {
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
    padding: 8px 14px;
}

.page-link:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
    color: white;
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

/* ─── SETTINGS PAGE ─── */
.settings-section {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 24px;
    background: white;
}

.settings-section h5 {
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
    color: var(--primary);
}

/* ─── EMPTY STATE ─── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 64px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h5 {
    font-weight: 700;
    color: var(--text-secondary);
}

.empty-state p {
    color: var(--text-muted);
    max-width: 400px;
    margin: 8px auto 24px;
}

/* ─── DYNAMIC ITEMS TABLE (Invoice/Quotation Form) ─── */
.items-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.items-table .form-control {
    min-width: 80px;
    padding: 8px 10px;
    font-size: 13px;
}

.items-table .form-select {
    min-width: 100px;
    padding: 8px 10px;
    font-size: 13px;
}

.add-item-btn {
    border: 2px dashed var(--primary-light);
    color: var(--primary);
    background: transparent;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    transition: var(--transition);
}

.add-item-btn:hover {
    background: rgba(59, 130, 246, 0.05);
    border-color: var(--primary);
    color: var(--primary);
}

/* ─── SUMMARY BOX ─── */
.summary-box {
    background: #f8fafc;
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid var(--border-color);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

.summary-row.total {
    border-top: 2px solid var(--primary);
    margin-top: 8px;
    padding-top: 12px;
    font-size: 18px;
    font-weight: 800;
    color: var(--primary);
}

/* ─── CHARTS AREA ─── */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* ─── ACTIVITY LIST ─── */
.activity-item {
    display: flex;
    align-items: start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

/* ─── REPORT CARDS ─── */
.report-card {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    display: block;
    color: var(--text-primary);
}

.report-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
    color: var(--primary);
}

.report-card i {
    font-size: 40px;
    margin-bottom: 12px;
}

.report-card h5 {
    font-weight: 700;
    font-size: 16px;
}

.report-card p {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ─── STICKY APP FOOTER ─── */
.app-footer {
    background: #0f172a;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    font-size: 12px;
    color: #64748b;
    letter-spacing: 0.5px;
}

.app-footer a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s;
}

.app-footer a:hover {
    color: var(--primary-light);
}

.footer-heart {
    color: #ef4444;
    animation: heartbeat 1.5s ease-in-out infinite;
    display: inline-block;
}

@keyframes heartbeat {

    0%,
    100% {
        transform: scale(1);
    }

    14% {
        transform: scale(1.15);
    }

    28% {
        transform: scale(1);
    }

    42% {
        transform: scale(1.15);
    }

    56% {
        transform: scale(1);
    }
}

.content-area {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--navbar-height));
}

.content-area>.fade-in,
.content-area>.container-fluid,
.content-area>div:first-child:not(.app-footer):not(.alert) {
    flex: 1;
    padding-bottom: 40px;
}

@media (max-width: 768px) {
    .app-footer {
        padding: 10px 16px;
        font-size: 11px;
        justify-content: center;
        text-align: center;
    }
}

/* ─── Floating Save Button ─── */
.sticky-save-bar {
    position: fixed;
    bottom: 24px;
    right: 24px;
    left: auto;
    z-index: 100;
}

.sticky-save-bar .btn {
    border-radius: 50px;
    padding: 12px 28px;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

.sticky-save-bar .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(99, 102, 241, 0.55);
}

/* ─── Clickable Stat Card Links ─── */
.stat-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card-link:hover {
    color: inherit;
    transform: translateY(-3px);
}

.stat-card-link:hover .stat-card {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* ─── AJAX Search Loading Overlay ─── */
.ajax-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: var(--radius);
    transition: opacity 0.2s ease;
}

.ajax-loading-overlay.active {
    display: flex;
}

.ajax-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.ajax-spinner span {
    font-size: 13px;
    color: var(--primary);
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Pagination row inside AJAX table body */
.ajax-pagination-row td {
    border: none !important;
    padding-top: 0 !important;
    background: transparent !important;
}

.ajax-pagination-row .pagination {
    margin-bottom: 0;
}

/* ─── WhatsApp Button ─── */
.btn-whatsapp {
    background-color: #25D366;
    border-color: #25D366;
    color: #fff;
}

.btn-whatsapp:hover,
.btn-whatsapp:focus {
    background-color: #1da851;
    border-color: #1da851;
    color: #fff;
}

.btn-whatsapp:disabled {
    background-color: #25D366;
    border-color: #25D366;
    color: #fff;
    opacity: 0.5;
}

.btn-whatsapp.dropdown-toggle::after {
    margin-left: 6px;
}