/* Auth Pages */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #4f46e5 60%, #06b6d4 100%);
    padding: 20px;
    position: relative;
    overflow: hidden
}

.auth-layout::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: rgba(255, 255, 255, .03);
    border-radius: 50%;
    top: -200px;
    right: -200px
}

.auth-layout::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, .03);
    border-radius: 50%;
    bottom: -100px;
    left: -100px
}

.auth-card {
    background: rgba(255, 255, 255, .95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 60px rgba(0, 0, 0, .3);
    padding: 48px;
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1
}

[data-theme="dark"] .auth-card {
    background: rgba(30, 41, 59, .95)
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px
}

.auth-logo .logo-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #fff;
    margin: 0 auto 12px
}

.auth-logo h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary)
}

.auth-logo p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-secondary)
}

.auth-footer a {
    color: var(--primary);
    font-weight: 600
}

.otp-inputs {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 24px 0
}

.otp-inputs input {
    width: 52px;
    height: 56px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    border: 2px solid var(--border-input);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition-fast)
}

.otp-inputs input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .1)
}

/* Invoice */
/* Invoice Premium Actions Bar */
.invoice-action-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 24px;
    margin-bottom: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: all var(--transition-normal);
}
[data-theme="dark"] .invoice-action-card {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1px solid rgba(255,255,255,0.05);
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.action-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.invoice-title-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.invoice-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-tertiary);
}
.invoice-id {
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.status-indicator {
    display: flex;
    align-items: center;
}
.badge-premium-paid,
.invoice-action-card .badge-paid {
    background: rgba(16, 185, 129, 0.12) !important;
    color: #10b981 !important;
    border: 1px solid rgba(16, 185, 129, 0.2) !important;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.15) !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px;
    padding: 6px 14px !important;
    border-radius: var(--radius-full) !important;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.badge-premium-unpaid,
.invoice-action-card .badge-pending,
.invoice-action-card .badge-unpaid {
    background: rgba(245, 158, 11, 0.12) !important;
    color: #f59e0b !important;
    border: 1px solid rgba(245, 158, 11, 0.2) !important;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.15) !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px;
    padding: 6px 14px !important;
    border-radius: var(--radius-full) !important;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.badge-premium-overdue,
.invoice-action-card .badge-overdue {
    background: rgba(239, 68, 68, 0.12) !important;
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.15) !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px;
    padding: 6px 14px !important;
    border-radius: var(--radius-full) !important;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.action-buttons-grid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}
.template-selector-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px 14px;
    gap: 8px;
    transition: all var(--transition-fast);
}
.template-selector-wrapper:hover {
    border-color: var(--primary);
}
.field-icon {
    font-size: 16px;
}
.custom-select {
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    padding-right: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M6 8.825a.5.5 0 01-.354-.146l-4-4a.5.5 0 01.708-.708L6 7.618l3.646-3.647a.5.5 0 01.708.708l-4 4A.5.5 0 016 8.825z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
    appearance: none;
}
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.btn-premium {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all var(--transition-normal);
    white-space: nowrap;
    text-decoration: none;
}
.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.btn-premium:active {
    transform: translateY(0);
}
.btn-p-neutral {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-p-neutral:hover {
    background: var(--border-color);
}
.btn-p-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}
.btn-p-success:hover {
    box-shadow: 0 6px 14px rgba(16, 185, 129, 0.3);
}
.btn-p-dark {
    background: linear-gradient(135deg, #334155, #1e293b);
    color: #fff;
}
.btn-p-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 10px rgba(var(--primary-rgb), 0.2);
}
.btn-p-primary:hover {
    box-shadow: 0 6px 14px rgba(var(--primary-rgb), 0.3);
}
.btn-p-whatsapp {
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: #fff;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.2);
}
.btn-p-whatsapp:hover {
    box-shadow: 0 6px 14px rgba(37, 211, 102, 0.3);
}
.btn-p-email {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}
.btn-p-email:hover {
    box-shadow: 0 6px 14px rgba(99, 102, 241, 0.3);
}

/* Invoice Classic Template Style */
.invoice-preview {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 48px;
    max-width: 850px;
    margin: 0 auto;
    color: #1e293b;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
}

[data-theme="dark"] .invoice-preview {
    background: #ffffff; /* Maintain standard paper aesthetic for dark mode too */
    color: #1e293b;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.invoice-header-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid #e2e8f0;
}

.invoice-company .company-name {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--primary);
}

.invoice-meta {
    text-align: right;
}

.invoice-meta .invoice-number {
    font-size: 32px;
    font-weight: 950;
    color: #0f172a;
    line-height: 1.1;
    margin-bottom: 8px;
}

.invoice-meta .invoice-date {
    font-size: 13px;
    color: #64748b;
    margin-top: 6px;
    font-weight: 500;
}

.invoice-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    margin-bottom: 40px;
}

.invoice-party {
    padding: 20px;
    background: #f8fafc;
    border-radius: var(--radius-md);
    border: 1px solid #f1f5f9;
}

.invoice-party label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #64748b;
    margin-bottom: 10px;
    display: block;
}

.invoice-party .party-name {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 6px;
}

.invoice-totals {
    display: flex;
    justify-content: flex-end;
    margin-top: 32px;
}

.invoice-totals table {
    width: 320px;
    border-collapse: collapse;
}

.invoice-totals td {
    padding: 10px 0;
    font-size: 14px;
    color: #475569;
    border-bottom: 1px solid #f1f5f9;
}

.invoice-totals td:last-child {
    text-align: right;
    font-weight: 700;
    color: #0f172a;
}

.invoice-totals .total-row {
    font-size: 20px;
    font-weight: 800;
}

.invoice-totals .total-row td {
    color: var(--primary) !important;
    border-top: 2px solid var(--primary);
    border-bottom: none;
    padding-top: 16px;
}

.invoice-totals .total-row td:last-child {
    color: var(--primary) !important;
    font-size: 22px;
}

.invoice-footer-section {
    margin-top: 48px;
    padding-top: 30px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    font-size: 14px;
    color: #64748b;
}

/* POS */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    height: calc(100vh - var(--navbar-height) - 48px)
}

.pos-products {
    overflow-y: auto
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast)
}

.product-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px)
}

.product-card .product-emoji {
    font-size: 32px;
    margin-bottom: 8px
}

.product-card .product-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px
}

.product-card .product-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary)
}

.pos-cart {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden
}

.pos-cart-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 16px;
    font-weight: 700
}

.pos-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 12px
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    transition: background var(--transition-fast)
}

.cart-item:hover {
    background: var(--bg-tertiary)
}

.cart-item .item-info {
    flex: 1
}

.cart-item .item-name {
    font-size: 14px;
    font-weight: 600
}

.cart-item .item-price {
    font-size: 13px;
    color: var(--text-secondary)
}

.cart-item .item-qty {
    display: flex;
    align-items: center;
    gap: 8px
}

.cart-item .qty-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer
}

.cart-item .qty-value {
    font-weight: 600;
    min-width: 20px;
    text-align: center
}

.pos-cart-footer {
    border-top: 1px solid var(--border-color);
    padding: 16px 20px
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
    color: var(--text-secondary)
}

.cart-summary-row.total {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    padding: 12px 0;
    border-top: 2px solid var(--border-color);
    margin-top: 8px
}

/* Settings */
.settings-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px
}

.settings-menu {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 8px
}

.settings-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left
}

.settings-menu-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary)
}

.settings-menu-item.active {
    background: var(--primary-50);
    color: var(--primary);
    font-weight: 600
}

[data-theme="dark"] .settings-menu-item.active {
    background: rgba(79, 70, 229, .15)
}

.settings-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px
}

/* Profile */
.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 32px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-xl);
    color: #fff;
    margin-bottom: 24px
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    flex-shrink: 0
}

/* Toast */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    gap: 10px
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    max-width: 420px;
    animation: slideInRight .3s ease
}

.toast.toast-success {
    border-left: 4px solid var(--success)
}

.toast.toast-error {
    border-left: 4px solid var(--danger)
}

.toast.toast-warning {
    border-left: 4px solid var(--warning)
}

.toast.toast-info {
    border-left: 4px solid var(--info)
}

.toast .toast-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 18px;
    cursor: pointer
}

/* Notification Panel */
.notification-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl);
    z-index: 2000;
    transition: right var(--transition-normal);
    display: flex;
    flex-direction: column
}

.notification-panel.open {
    right: 0
}

.notification-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-color)
}

.notification-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    cursor: pointer;
    transition: background var(--transition-fast)
}

.notification-item:hover {
    background: var(--bg-tertiary)
}

.notification-item.unread {
    background: var(--primary-50)
}

[data-theme="dark"] .notification-item.unread {
    background: rgba(79, 70, 229, .1)
}

.notification-item .notif-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0
}

.notification-item .notif-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4
}

.notification-item .notif-time {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px
}

.page-header-left h1 {
    font-size: 24px;
    font-weight: 800
}

.page-header-left p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px
}

.chart-container {
    position: relative;
    width: 100%;
    height: 300px
}

/* Utilities */
.text-center {
    text-align: center
}

.text-right {
    text-align: right
}

.text-primary-c {
    color: var(--primary) !important
}

.text-success {
    color: var(--success) !important
}

.text-danger {
    color: var(--danger) !important
}

.text-warning {
    color: var(--warning) !important
}

.text-secondary-c {
    color: var(--text-secondary) !important
}

.fw-600 {
    font-weight: 600
}

.fw-700 {
    font-weight: 700
}

.fw-800 {
    font-weight: 800
}

.mt-1 {
    margin-top: 8px
}

.mt-2 {
    margin-top: 16px
}

.mt-3 {
    margin-top: 24px
}

.mb-1 {
    margin-bottom: 8px
}

.mb-2 {
    margin-bottom: 16px
}

.mb-3 {
    margin-bottom: 24px
}

.d-flex {
    display: flex
}

.align-center {
    align-items: center
}

.justify-between {
    justify-content: space-between
}

.flex-wrap {
    flex-wrap: wrap
}

.flex-1 {
    flex: 1
}

.w-100 {
    width: 100%
}

.hidden {
    display: none !important
}

/* Spinner / Loading */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite
}

@keyframes slideInRight {
    from {
        transform: translateX(100px);
        opacity: 0
    }

    to {
        transform: translateX(0);
        opacity: 1
    }
}

@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg)
    }

    to {
        transform: rotate(360deg)
    }
}

.animate-fadeIn {
    animation: fadeIn .3s ease
}

.animate-fadeInUp {
    animation: fadeInUp .4s ease
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px
}

::-webkit-scrollbar-track {
    background: transparent
}

::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 3px
}

/* Responsive */
@media(max-width:1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr)
    }

    .grid-2 {
        grid-template-columns: 1fr
    }

    .pos-layout {
        grid-template-columns: 1fr;
        height: auto
    }

    .settings-layout {
        grid-template-columns: 1fr
    }

    .invoice-parties {
        grid-template-columns: 1fr;
        gap: 20px
    }
}

@media(max-width:768px) {
    .sidebar {
        transform: translateX(-100%)
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl)
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, .5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-fast)
    }

    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible
    }

    .main-content {
        margin-left: 0
    }

    .navbar {
        left: 0
    }

    .menu-toggle {
        display: flex
    }

    .navbar-search {
        display: none
    }

    .page-content {
        padding: 16px
    }

    .stats-grid {
        grid-template-columns: 1fr
    }

    .stat-value {
        font-size: 24px
    }

    .grid-3 {
        grid-template-columns: 1fr
    }

    .auth-card {
        padding: 32px 24px
    }

    .invoice-preview {
        padding: 24px
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch
    }

    .notification-panel {
        width: 100%;
        right: -100%
    }

    .user-menu .user-name {
        display: none
    }

    .profile-header {
        flex-direction: column;
        text-align: center
    }

    .pos-cart {
        min-height: 400px
    }
}

@media(max-width:480px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start
    }

    .otp-inputs input {
        width: 44px;
        height: 48px;
        font-size: 20px
    }

    .product-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px
    }
}

/* ── Enhanced Dashboard Styles ── */
.dash-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 20px
}

.dash-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px
}

.dash-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary)
}

.dash-filter {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    outline: none
}

/* Business Operations */
.biz-ops-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px
}

.biz-ops-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    transition: all var(--transition-fast)
}

.biz-ops-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px)
}

.biz-ops-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0
}

.biz-ops-icon.sale {
    background: #e3f2fd;
    color: #1565c0
}

.biz-ops-icon.purchase {
    background: #f3e5f5;
    color: #7b1fa2
}

.biz-ops-icon.expense {
    background: #fce4ec;
    color: #c62828
}

[data-theme="dark"] .biz-ops-icon.sale {
    background: rgba(21, 101, 192, .15)
}

[data-theme="dark"] .biz-ops-icon.purchase {
    background: rgba(123, 31, 162, .15)
}

[data-theme="dark"] .biz-ops-icon.expense {
    background: rgba(198, 40, 40, .15)
}

.biz-ops-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary)
}

.biz-ops-label {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px
}

/* Revenue Projections */
.rev-proj-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px
}

.rev-proj-card {
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light)
}

.rev-proj-amount {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px
}

.rev-proj-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px
}

.rev-proj-change {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    display: inline-block
}

.rev-proj-change.up {
    background: #e8f5e9;
    color: #2e7d32
}

.rev-proj-change.down {
    background: #fce4ec;
    color: #c62828
}

[data-theme="dark"] .rev-proj-change.up {
    background: rgba(46, 125, 50, .15)
}

[data-theme="dark"] .rev-proj-change.down {
    background: rgba(198, 40, 40, .15)
}

/* Quick Access */
.quick-access-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px
}

.quick-access-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    transition: all var(--transition-fast);
    cursor: pointer
}

.quick-access-btn:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px)
}

.qa-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px
}

/* Revenue Inflow */
.rev-inflow-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px
}

.rev-inflow-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light)
}

.rev-inflow-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0
}

.rev-inflow-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary)
}

.rev-inflow-label {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 1px
}

/* P&L Snapshot */
.pnl-snapshot {
    padding: 8px 0
}

.pnl-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0
}

.pnl-label {
    font-size: 14px;
    color: var(--text-secondary)
}

.pnl-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary)
}

.pnl-row.income .pnl-value {
    color: var(--success)
}

.pnl-row.expense .pnl-value {
    color: var(--danger)
}

.pnl-row.net {
    padding: 14px 0
}

.pnl-row.net .pnl-label {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary)
}

.pnl-row.net .pnl-value {
    font-size: 20px;
    font-weight: 800
}

.pnl-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0
}

.pnl-bar-container {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-tertiary);
    margin: 12px 0 8px
}

.pnl-bar {
    height: 100%;
    transition: width 0.5s ease
}

.income-bar {
    background: var(--success)
}

.expense-bar {
    background: var(--danger)
}

.pnl-legend {
    display: flex;
    gap: 20px;
    margin-bottom: 16px
}

.pnl-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary)
}

.pnl-legend-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block
}

.dot.income {
    background: var(--success)
}

.dot.expense {
    background: var(--danger)
}

.pnl-gst-summary {
    border-top: 1px solid var(--border-light);
    padding-top: 8px
}

.pnl-gst-summary .pnl-row {
    padding: 6px 0
}

.pnl-gst-summary .pnl-label {
    font-size: 13px
}

.pnl-gst-summary .pnl-value {
    font-size: 14px;
    font-weight: 600
}

/* Responsive Dashboard */
@media(max-width:1024px) {
    .biz-ops-grid {
        grid-template-columns: 1fr
    }

    .quick-access-grid {
        grid-template-columns: repeat(3, 1fr)
    }

    .rev-proj-grid {
        grid-template-columns: 1fr
    }
}

@media(max-width:768px) {
    .quick-access-grid {
        grid-template-columns: repeat(2, 1fr)
    }

    .rev-inflow-grid {
        grid-template-columns: 1fr
    }

    .biz-ops-value {
        font-size: 18px
    }

    .rev-proj-amount {
        font-size: 18px
    }
}

/* Sidebar Sub-menus */
.nav-submenu {
    display: none;
    padding-left: 20px
}

.nav-submenu.open {
    display: block
}

.nav-item-parent {
    position: relative;
    cursor: pointer
}

.nav-item-parent::after {
    content: '›';
    position: absolute;
    right: 16px;
    font-size: 16px;
    transition: transform 0.2s;
    color: var(--text-tertiary)
}

.nav-item-parent.open::after {
    transform: rotate(90deg)
}

.nav-submenu .nav-item {
    font-size: 13px;
    padding: 8px 14px
}

@media print {

    .sidebar,
    .navbar,
    .no-print {
        display: none !important
    }

    .main-content {
        margin: 0
    }

    .page-content {
        padding: 0;
        margin: 0
    }

    body {
        background: #fff
    }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE RESPONSIVE — All Pages
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

    /* ── Navbar ── */
    .navbar {
        padding: 8px 12px !important;
        gap: 8px !important;
    }

    .navbar .nav-title {
        font-size: 15px !important;
        line-height: 1.2 !important;
    }

    .navbar .nav-subtitle {
        display: none !important;
    }

    .navbar .nav-actions {
        gap: 6px !important;
    }

    .navbar .nav-actions .nav-action-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 16px !important;
    }

    .menu-toggle {
        width: 36px !important;
        height: 36px !important;
        font-size: 20px !important;
    }

    /* ── Page Header ── */
    .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        padding: 0 !important;
        margin-bottom: 16px !important;
    }

    .page-header h1 {
        font-size: 22px !important;
    }

    .page-header p {
        font-size: 13px !important;
        margin: 0 !important;
    }

    .page-header .btn {
        width: 100% !important;
        justify-content: center !important;
    }

    /* ── Page Content ── */
    .page-content {
        padding: 12px !important;
    }

    /* ── Stat Cards Grid ── */
    .stats-grid,
    .summary-stats {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }

    .stat-card {
        padding: 14px 12px !important;
    }

    .stat-card .stat-value,
    .stat-card .stat-num {
        font-size: 18px !important;
    }

    .stat-card .stat-label {
        font-size: 11px !important;
    }

    /* ── Tables — Horizontal Scroll ── */
    .card:has(table),
    .table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    table {
        min-width: 600px !important;
        font-size: 13px !important;
    }

    th,
    td {
        padding: 10px 8px !important;
        white-space: nowrap !important;
    }

    /* ── Toolbar ── */
    .toolbar {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .toolbar input,
    .toolbar select,
    .toolbar .btn {
        width: 100% !important;
    }

    /* ── Forms ── */
    .form-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* ── Modals ── */
    .modal-content {
        width: 95% !important;
        max-width: 95vw !important;
        margin: 16px auto !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }

    /* ── Cards ── */
    .card {
        padding: 14px !important;
        border-radius: 12px !important;
    }

    /* ── Dashboard Sections ── */
    .dash-section {
        padding: 12px !important;
        margin-bottom: 12px !important;
        border-radius: 12px !important;
    }

    .dash-section-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
        margin-bottom: 12px !important;
    }

    .dash-section-title {
        font-size: 14px !important;
    }

    .dash-filter {
        width: 100% !important;
        font-size: 12px !important;
    }

    /* Business Ops — vertical cards */
    .biz-ops-grid {
        grid-template-columns: 1fr 1fr 1fr !important;
        gap: 8px !important;
    }

    .biz-ops-card {
        flex-direction: column !important;
        text-align: center !important;
        padding: 10px 6px !important;
        gap: 6px !important;
    }

    .biz-ops-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
        margin: 0 auto !important;
    }

    .biz-ops-value {
        font-size: 14px !important;
        font-weight: 700 !important;
    }

    .biz-ops-label {
        font-size: 10px !important;
    }

    /* Revenue Projections */
    .rev-proj-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .rev-proj-card {
        padding: 12px 10px !important;
    }

    .rev-proj-amount {
        font-size: 18px !important;
    }

    .rev-proj-label {
        font-size: 11px !important;
    }

    .rev-proj-change {
        font-size: 10px !important;
        padding: 3px 8px !important;
    }

    /* Quick Actions */
    .quick-actions-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }

    .quick-action-card {
        padding: 12px 6px !important;
    }

    .quick-action-card .qa-icon {
        font-size: 20px !important;
    }

    .quick-action-card .qa-label {
        font-size: 10px !important;
    }

    /* Revenue Inflow */
    .inflow-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .inflow-card {
        padding: 10px !important;
    }

    .inflow-value {
        font-size: 16px !important;
    }

    .inflow-label {
        font-size: 10px !important;
    }

    /* Revenue Management */
    .rev-mgmt-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    /* P&L Grid */
    .pnl-grid {
        grid-template-columns: 1fr 1fr 1fr !important;
        gap: 6px !important;
    }

    .pnl-card {
        padding: 8px 4px !important;
    }

    .pnl-card .pnl-value {
        font-size: 13px !important;
    }

    .pnl-card .pnl-label {
        font-size: 9px !important;
    }

    /* Revenue Chart */
    .dash-section canvas {
        max-height: 200px !important;
    }

    /* Recent Invoices & Top Customers tables */
    .dash-section table {
        min-width: 500px !important;
        font-size: 12px !important;
    }

    .dash-section .card {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* ── POS Billing Layout ── */
    .pos-layout {
        flex-direction: column !important;
        height: auto !important;
    }

    .pos-products {
        max-height: none !important;
        overflow: visible !important;
        width: 100% !important;
    }

    .pos-cart {
        width: 100% !important;
        position: sticky !important;
        bottom: 0 !important;
        max-height: 50vh !important;
        overflow-y: auto !important;
        border-radius: 16px 16px 0 0 !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15) !important;
        z-index: 10 !important;
        background: var(--bg-card) !important;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .product-card {
        padding: 12px 8px !important;
    }

    .product-name {
        font-size: 12px !important;
    }

    /* ── Stat Cards (purchases, vendors etc.) ── */
    .stats-grid,
    .summary-stats {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .stat-card {
        padding: 12px 10px !important;
    }

    .stat-card .stat-value {
        font-size: 18px !important;
    }

    .stat-card .stat-label {
        font-size: 10px !important;
    }

    /* ── Tables — Horizontal Scroll ── */
    .card:has(table),
    .table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    table {
        min-width: 550px !important;
        font-size: 12px !important;
    }

    th,
    td {
        padding: 8px 6px !important;
        white-space: nowrap !important;
    }

    /* ── Filter Tabs ── */
    .tab-filters {
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
        gap: 4px !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .tab-filters .tab-btn {
        white-space: nowrap !important;
        font-size: 12px !important;
        padding: 6px 12px !important;
        flex-shrink: 0 !important;
    }

    /* ── Toolbar ── */
    .toolbar {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .toolbar input,
    .toolbar select,
    .toolbar .btn {
        width: 100% !important;
    }

    /* ── Forms ── */
    .form-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* ── Modals ── */
    .modal-content {
        width: 95% !important;
        max-width: 95vw !important;
        margin: 16px auto !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        border-radius: 12px !important;
    }

    /* ── Cards ── */
    .card {
        padding: 12px !important;
        border-radius: 12px !important;
    }

    /* ── Page Header ── */
    .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
        margin-bottom: 14px !important;
    }

    .page-header h1 {
        font-size: 20px !important;
    }

    .page-header p {
        font-size: 12px !important;
    }

    .page-header .btn {
        width: 100% !important;
    }

    /* ── Buttons ── */
    .btn-sm {
        padding: 6px 10px !important;
        font-size: 12px !important;
    }

    /* ── Account page ── */
    .account-group-accounts {
        overflow-x: auto !important;
    }

    .purchase-items-grid {
        overflow-x: auto !important;
    }
}/* --- INVOICE TEMPLATES --- */

/* ============================================
   1. MODERN TEMPLATE (.template-modern)
   ============================================ */
.template-modern {
    background: #ffffff !important;
    border: none !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08) !important;
    font-family: 'Inter', sans-serif !important;
    position: relative;
    overflow: hidden;
    padding: 0 !important;
    border-radius: 20px !important;
}

.template-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 10px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    z-index: 10;
}

.template-modern .invoice-header-section {
    border-bottom: none !important;
    background: linear-gradient(to bottom, rgba(79, 70, 229, 0.05), rgba(255, 255, 255, 0)) !important;
    padding: 48px 48px 24px !important;
    margin-bottom: 24px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
}

.template-modern .company-name {
    font-size: 30px !important;
    font-weight: 850 !important;
    letter-spacing: -1px !important;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

.template-modern .invoice-meta .invoice-number {
    font-size: 36px !important;
    font-weight: 900 !important;
    color: var(--primary-dark) !important;
    margin-bottom: 12px !important;
    letter-spacing: -0.5px !important;
}

.template-modern .invoice-meta .invoice-date {
    background: var(--primary-50) !important;
    color: var(--primary) !important;
    padding: 4px 12px !important;
    border-radius: var(--radius-full) !important;
    display: inline-block !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    margin-top: 4px !important;
}

.template-modern .invoice-parties {
    padding: 0 48px !important;
    margin-bottom: 32px !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 24px !important;
}

.template-modern .invoice-party {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 16px !important;
    padding: 24px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02) !important;
    transition: all 0.2s ease !important;
}

.template-modern .invoice-party:hover {
    border-color: var(--primary-light) !important;
    transform: translateY(-2px) !important;
}

.template-modern .invoice-party label {
    font-size: 10px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 1.5px !important;
    color: var(--primary) !important;
    margin-bottom: 8px !important;
    display: block !important;
}

.template-modern .table-container {
    padding: 0 48px !important;
    margin-bottom: 24px !important;
}

.template-modern table.table {
    border-collapse: separate !important;
    border-spacing: 0 8px !important;
    width: 100% !important;
}

.template-modern table.table thead tr {
    background: transparent !important;
}

.template-modern table.table th {
    background: #f1f5f9 !important;
    color: #475569 !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 1.2px !important;
    border: none !important;
    padding: 14px 18px !important;
}

.template-modern table.table th:first-child {
    border-radius: 10px 0 0 10px !important;
}

.template-modern table.table th:last-child {
    border-radius: 0 10px 10px 0 !important;
}

.template-modern table.table tbody tr {
    background: #ffffff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02) !important;
    transition: all 0.2s ease !important;
}

.template-modern table.table tbody tr:hover {
    background: #f8fafc !important;
    transform: scale(1.005) !important;
}

.template-modern table.table td {
    padding: 16px 18px !important;
    border: none !important;
    border-top: 1px solid #f1f5f9 !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

.template-modern table.table td:first-child {
    border-left: 1px solid #f1f5f9 !important;
    border-radius: 10px 0 0 10px !important;
}

.template-modern table.table td:last-child {
    border-right: 1px solid #f1f5f9 !important;
    border-radius: 0 10px 10px 0 !important;
}

.template-modern .invoice-totals {
    padding: 24px 48px !important;
    background: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
    display: flex !important;
    justify-content: flex-end !important;
}

.template-modern .invoice-totals table {
    width: 340px !important;
}

.template-modern .invoice-totals td {
    padding: 12px 0 !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

.template-modern .invoice-totals .total-row td {
    border-top: 2px solid var(--primary) !important;
    border-bottom: none !important;
    padding-top: 20px !important;
    color: var(--primary-dark) !important;
}

.template-modern .invoice-totals .total-row td:last-child {
    font-size: 26px !important;
    font-weight: 900 !important;
}

.template-modern .invoice-footer-section {
    padding: 32px 48px !important;
    background: #ffffff !important;
    margin-top: 0 !important;
    border-top: 1px solid #e2e8f0 !important;
}

/* Modern UPI & Bank details styles */
.template-modern #upiQRSection {
    border-top: 2px dashed #cbd5e1 !important;
    background: #faf5ff !important;
    border-radius: 16px !important;
    padding: 24px !important;
    margin: 24px 48px !important;
}

.template-modern #bankDetailsSection {
    background: #f0fdf4 !important;
    border: 1px solid #bbf7d0 !important;
    border-radius: 16px !important;
    padding: 20px !important;
    margin: 20px 48px !important;
}


/* ============================================
   2. MINIMAL TEMPLATE (.template-minimal)
   ============================================ */
.template-minimal {
    background: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
    font-family: 'Inter', sans-serif !important;
    color: #000000 !important;
    padding: 40px !important;
    max-width: 850px !important;
    border-radius: 0 !important;
}

.template-minimal .invoice-header-section {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-end !important;
    border-bottom: 2px solid #000000 !important;
    padding-bottom: 24px !important;
    margin-bottom: 36px !important;
}

.template-minimal .company-name {
    color: #000000 !important;
    font-size: 32px !important;
    font-weight: 900 !important;
    letter-spacing: -1.5px !important;
    text-transform: uppercase !important;
}

.template-minimal .invoice-meta {
    text-align: right !important;
}

.template-minimal .invoice-meta .invoice-number {
    font-size: 24px !important;
    font-weight: 800 !important;
    color: #000000 !important;
    margin-bottom: 6px !important;
}

.template-minimal .invoice-meta .invoice-date {
    font-size: 12px !important;
    color: #475569 !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.template-minimal .invoice-parties {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 40px !important;
    margin-bottom: 40px !important;
}

.template-minimal .invoice-party {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

.template-minimal .invoice-party label {
    font-size: 11px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 1.5px !important;
    color: #000000 !important;
    border-bottom: 1px solid #000000 !important;
    padding-bottom: 4px !important;
    margin-bottom: 12px !important;
    display: inline-block !important;
}

.template-minimal .invoice-party .party-name {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #000000 !important;
    margin-bottom: 4px !important;
}

.template-minimal .table-container {
    margin-bottom: 32px !important;
}

.template-minimal table.table th {
    background: transparent !important;
    color: #000000 !important;
    border-top: 1px solid #000000 !important;
    border-bottom: 1px solid #000000 !important;
    border-radius: 0 !important;
    text-transform: uppercase !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    letter-spacing: 1.5px !important;
    padding: 12px 8px !important;
}

.template-minimal table.table td {
    border-bottom: 1px solid #e2e8f0 !important;
    padding: 14px 8px !important;
    font-size: 13px !important;
}

.template-minimal .invoice-totals {
    display: flex !important;
    justify-content: flex-end !important;
    margin-top: 24px !important;
}

.template-minimal .invoice-totals table {
    width: 300px !important;
    font-weight: 500 !important;
}

.template-minimal .invoice-totals td {
    padding: 10px 8px !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

.template-minimal .invoice-totals .total-row td {
    border-top: 2px solid #000000 !important;
    border-bottom: 4px double #000000 !important;
    color: #000000 !important;
    font-size: 20px !important;
    font-weight: 800 !important;
}

.template-minimal .invoice-footer-section {
    margin-top: 48px !important;
    padding-top: 24px !important;
    border-top: 1px solid #e2e8f0 !important;
    text-align: left !important;
    font-size: 12px !important;
    color: #64748b !important;
}

/* Minimal UPI & Bank details styles */
.template-minimal #upiQRSection {
    border-top: 1px solid #000000 !important;
    border-bottom: 1px solid #000000 !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding: 16px 0 !important;
    margin-top: 32px !important;
}

.template-minimal #bankDetailsSection {
    background: transparent !important;
    border: 1px solid #000000 !important;
    border-radius: 0 !important;
    padding: 16px !important;
    margin-top: 24px !important;
}


/* ============================================
   3. CLASSIC TEMPLATE (.invoice-preview ENHANCEMENTS)
   ============================================ */
/* Refine default classic design lines and table borders */
.invoice-preview:not(.template-modern):not(.template-minimal) {
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    box-shadow: 0 15px 35px rgba(0,0,0,0.06) !important;
}
.invoice-preview:not(.template-modern):not(.template-minimal) .invoice-header-section {
    border-bottom: 2px solid var(--primary-50) !important;
}
.invoice-preview:not(.template-modern):not(.template-minimal) .invoice-party {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
}
.invoice-preview:not(.template-modern):not(.template-minimal) table.table th {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    font-weight: 700 !important;
    border-bottom: 2px solid var(--border-color) !important;
}

/* Dark Mode explicit overrides to force high contrast paper style */
[data-theme="dark"] .invoice-preview {
    background: #ffffff !important;
    color: #1e293b !important;
}
[data-theme="dark"] .invoice-preview label {
    color: #64748b !important;
}
[data-theme="dark"] .invoice-preview td {
    color: #475569 !important;
}
[data-theme="dark"] .invoice-preview th {
    color: #334155 !important;
}
[data-theme="dark"] .invoice-preview tr:hover {
    background: #f1f5f9 !important;
}
[data-theme="dark"] .template-minimal * {
    color: #000000 !important;
    border-color: #000000 !important;
}
[data-theme="dark"] .template-modern .invoice-party {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
}
[data-theme="dark"] .template-modern table.table tbody tr {
    background: #ffffff !important;
}
[data-theme="dark"] .template-modern table.table tbody tr:hover {
    background: #f8fafc !important;
}

/* ============================================
   4. EXECUTIVE TEMPLATE (.template-executive)
   Navy/Gold corporate style
   ============================================ */
.template-executive {
    background: #ffffff !important;
    border: 2px solid #1e3a5f !important;
    box-shadow: 0 10px 30px rgba(30,58,95,0.1) !important;
    font-family: 'Georgia', serif !important;
    padding: 0 !important;
    border-radius: 4px !important;
    overflow: hidden;
}
.template-executive::before {
    content: '';
    display: block;
    height: 6px;
    background: linear-gradient(90deg, #1e3a5f, #c8a45a, #1e3a5f);
}
.template-executive .invoice-header-section {
    background: linear-gradient(135deg, #1e3a5f, #2d5a8e) !important;
    padding: 36px 40px !important;
    border-bottom: 3px solid #c8a45a !important;
    margin-bottom: 0 !important;
}
.template-executive .company-name {
    color: #ffffff !important;
    font-size: 28px !important;
    font-weight: 700 !important;
    letter-spacing: 1px !important;
}
.template-executive .invoice-header-section div[style] {
    color: #bfcfe0 !important;
}
.template-executive .invoice-meta .invoice-number {
    color: #c8a45a !important;
    font-size: 28px !important;
    font-weight: 700 !important;
    font-family: 'Georgia', serif !important;
}
.template-executive .invoice-meta .invoice-date {
    color: #ffffff !important;
    font-size: 12px !important;
    opacity: 0.85;
}
.template-executive .invoice-parties {
    padding: 28px 40px !important;
    margin-bottom: 0 !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 24px !important;
    background: #f7f8fa !important;
}
.template-executive .invoice-party {
    background: #ffffff !important;
    border: 1px solid #d4dae3 !important;
    border-left: 3px solid #c8a45a !important;
    border-radius: 4px !important;
    padding: 20px !important;
}
.template-executive .invoice-party label {
    color: #1e3a5f !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 2px !important;
    font-family: 'Inter', sans-serif !important;
}
.template-executive .table-container {
    padding: 0 40px !important;
    margin-bottom: 0 !important;
}
.template-executive table.table th {
    background: #1e3a5f !important;
    color: #ffffff !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    padding: 14px 16px !important;
    border: none !important;
    font-family: 'Inter', sans-serif !important;
}
.template-executive table.table td {
    padding: 14px 16px !important;
    border-bottom: 1px solid #e8ecf0 !important;
    font-size: 13px !important;
}
.template-executive table.table tbody tr:nth-child(even) {
    background: #f7f8fa !important;
}
.template-executive .invoice-totals {
    padding: 24px 40px !important;
    display: flex !important;
    justify-content: flex-end !important;
    border-top: 1px solid #e8ecf0 !important;
}
.template-executive .invoice-totals table { width: 320px !important; }
.template-executive .invoice-totals td {
    padding: 10px 8px !important;
    border-bottom: 1px solid #e8ecf0 !important;
}
.template-executive .invoice-totals .total-row td {
    background: #1e3a5f !important;
    color: #c8a45a !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    border: none !important;
    padding: 16px !important;
}
.template-executive .invoice-footer-section {
    padding: 28px 40px !important;
    background: #f7f8fa !important;
    border-top: 1px solid #e8ecf0 !important;
    font-size: 12px !important;
    color: #64748b !important;
}

/* ============================================
   5. CREATIVE TEMPLATE (.template-creative)
   Gradient coral/pink artistic style
   ============================================ */
.template-creative {
    background: #ffffff !important;
    border: none !important;
    box-shadow: 0 20px 60px rgba(236,72,153,0.08), 0 4px 16px rgba(0,0,0,0.04) !important;
    font-family: 'Inter', sans-serif !important;
    padding: 0 !important;
    border-radius: 24px !important;
    overflow: hidden;
    position: relative;
}
.template-creative::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 200px;
    background: linear-gradient(135deg, #ec4899, #f97316, #eab308) !important;
    opacity: 0.06;
    pointer-events: none;
}
.template-creative .invoice-header-section {
    background: linear-gradient(135deg, #ec4899, #f97316) !important;
    padding: 36px 40px !important;
    border-bottom: none !important;
    margin-bottom: 0 !important;
    border-radius: 0 0 32px 32px !important;
    position: relative;
}
.template-creative .company-name {
    color: #ffffff !important;
    font-size: 28px !important;
    font-weight: 900 !important;
    letter-spacing: -0.5px !important;
}
.template-creative .invoice-header-section div[style] {
    color: rgba(255,255,255,0.8) !important;
}
.template-creative .invoice-meta .invoice-number {
    color: #ffffff !important;
    font-size: 32px !important;
    font-weight: 900 !important;
    text-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.template-creative .invoice-meta .invoice-date {
    color: rgba(255,255,255,0.85) !important;
    font-size: 12px !important;
    background: rgba(255,255,255,0.2) !important;
    padding: 4px 12px !important;
    border-radius: 20px !important;
    display: inline-block !important;
    margin-top: 4px !important;
}
.template-creative .invoice-parties {
    padding: 28px 36px !important;
    margin-bottom: 0 !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 20px !important;
}
.template-creative .invoice-party {
    background: linear-gradient(135deg, #fdf2f8, #fef3c7) !important;
    border: none !important;
    border-radius: 16px !important;
    padding: 20px !important;
    box-shadow: 0 2px 8px rgba(236,72,153,0.06) !important;
}
.template-creative .invoice-party label {
    color: #ec4899 !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 1.5px !important;
}
.template-creative .table-container {
    padding: 0 36px !important;
    margin-bottom: 0 !important;
}
.template-creative table.table {
    border-collapse: separate !important;
    border-spacing: 0 6px !important;
}
.template-creative table.table th {
    background: linear-gradient(135deg, #fdf2f8, #fff7ed) !important;
    color: #9d174d !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    padding: 12px 16px !important;
    border: none !important;
}
.template-creative table.table th:first-child { border-radius: 12px 0 0 12px !important; }
.template-creative table.table th:last-child { border-radius: 0 12px 12px 0 !important; }
.template-creative table.table tbody tr {
    background: #ffffff !important;
    transition: all 0.2s !important;
}
.template-creative table.table tbody tr:hover {
    background: #fdf2f8 !important;
    transform: scale(1.005) !important;
}
.template-creative table.table td {
    padding: 14px 16px !important;
    border: none !important;
    border-top: 1px solid #fce7f3 !important;
    border-bottom: 1px solid #fce7f3 !important;
}
.template-creative table.table td:first-child { border-left: 1px solid #fce7f3 !important; border-radius: 12px 0 0 12px !important; }
.template-creative table.table td:last-child { border-right: 1px solid #fce7f3 !important; border-radius: 0 12px 12px 0 !important; }
.template-creative .invoice-totals {
    padding: 24px 36px !important;
    display: flex !important;
    justify-content: flex-end !important;
}
.template-creative .invoice-totals table { width: 320px !important; }
.template-creative .invoice-totals td {
    padding: 10px 8px !important;
    border-bottom: 1px solid #fce7f3 !important;
}
.template-creative .invoice-totals .total-row td {
    background: linear-gradient(135deg, #ec4899, #f97316) !important;
    color: #ffffff !important;
    font-size: 22px !important;
    font-weight: 900 !important;
    border: none !important;
    padding: 16px !important;
    border-radius: 12px !important;
}
.template-creative .invoice-footer-section {
    padding: 28px 36px !important;
    background: #fdf2f8 !important;
    font-size: 12px !important;
    color: #9d174d !important;
    border-top: none !important;
}

/* Dark mode for new templates */
[data-theme="dark"] .template-executive .invoice-header-section { background: linear-gradient(135deg, #1e3a5f, #2d5a8e) !important; }
[data-theme="dark"] .template-executive .invoice-parties { background: #f7f8fa !important; }
[data-theme="dark"] .template-creative .invoice-header-section { background: linear-gradient(135deg, #ec4899, #f97316) !important; }
