/* ===== PREMIUM INVOICE MANAGEMENT STYLING ===== */
/* Enhanced Alignment, Professional Layout & Darker Text */

@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300;400;600;700&family=Roboto:wght@300;400;500&display=swap');

:root {
    /* Modern Color Palette */
    --primary-blue: #2563eb;
    --secondary-blue: #3b82f6;
    --light-blue: #60a5fa;
    --dark-blue: #1e40af;
    --success-green: #10b981;
    --warning-orange: #f59e0b;
    --error-red: #ef4444;
    --info-cyan: #06b6d4;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Typography */
    --font-primary: 'Times New Roman', Times, serif;
    --font-secondary: 'Source Sans Pro', sans-serif;
    --font-ui: 'Roboto', sans-serif;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-2xl: 16px;
}

/* ===== BASE RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== INVOICE SUMMARY COUNTER TEXT FIX ===== */
.card.bg-primary.text-white .card-body,
.card.bg-success.text-white .card-body,
.card.bg-warning.text-white .card-body,
.card.bg-secondary.text-white .card-body,
.card.bg-primary.text-white .card-title,
.card.bg-primary.text-white .card-text,
.card.bg-success.text-white .card-title,
.card.bg-success.text-white .card-text,
.card.bg-warning.text-white .card-title,
.card.bg-warning.text-white .card-text,
.card.bg-secondary.text-white .card-title,
.card.bg-secondary.text-white .card-text,
.card.bg-primary.text-white .fs-1,
.card.bg-success.text-white .fs-1,
.card.bg-warning.text-white .fs-1,
.card.bg-secondary.text-white .fs-1,
.card.bg-primary.text-white i,
.card.bg-success.text-white i,
.card.bg-warning.text-white i,
.card.bg-secondary.text-white i {
    color: #ffffff !important;
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden !important;
    margin: 0;
    padding: 0;
    font-family: var(--font-primary);
    background: linear-gradient(135deg, #f6f8fa 0%, #f1f5f9 100%);
    color: var(--gray-800);
    line-height: 1.5;
    letter-spacing: 0.025em;
}

/* ===== INVOICE ITEM ENTRY AND MODAL ===== */
.invoice-item-entry {
    border: 1px solid var(--gray-200) !important;
    border-radius: var(--radius-lg);
    position: relative;
    z-index: 20;
    overflow: visible;
}

.invoice-item-entry:focus-within {
    z-index: 1300;
}

.invoice-item-entry .form-label {
    margin-bottom: 0.3rem;
}

.invoice-item-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
    z-index: 1400 !important;
    max-height: 260px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.invoice-item-entry .position-relative {
    z-index: 1;
}

.invoice-item-entry .position-relative:focus-within {
    z-index: 1400;
}

.suggestion-item {
    padding: 0.65rem 0.8rem;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
}

.suggestion-item:hover {
    background: var(--gray-50);
}

.invoice-item-modal-content {
    width: min(960px, calc(100vw - 32px));
    max-width: 960px;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.invoice-item-modal-body {
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
}

.invoice-item-modal-content .custom-modal-header,
.invoice-item-modal-content .custom-modal-footer {
    flex: 0 0 auto;
}

.invoice-item-modal-content .kit-section {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

@media (max-width: 768px) {
    .invoice-item-modal-content {
        width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
    }

    .invoice-item-modal-body {
        padding: 1rem;
    }
}

/* ===== Signature toggle alignment fixes ===== */
.form-check.form-switch {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    margin-bottom: 0 !important;
}

.form-check.form-switch .form-check-input {
    margin-top: 0 !important;
    margin-right: 0.4rem !important;
    width: 2.6rem !important;
    height: 1.4rem !important;
}

.form-check.form-switch .form-check-label {
    margin: 0 !important;
    line-height: 1 !important;
    font-weight: 600 !important;
}

.action-buttons-premium .form-check,
.card-header .form-check,
.bg-white .form-check {
    display: flex !important;
    align-items: center !important;
}

.form-control.form-control-sm {
    vertical-align: middle !important;
}

[ng\:cloak], [ng-cloak], .ng-cloak {
    display: none !important;
}

/* ===== MODERN SIDEBAR ===== */
.sidebar {
    width: 280px;
    height: 100vh;
    position: fixed;
    background: linear-gradient(180deg, var(--gray-900) 0%, var(--gray-800) 100%);
    color: white;
    padding: 2rem 1.5rem;
    box-shadow: var(--shadow-xl);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
    z-index: 1000;
    top: 0;
    left: 0;
}

.sidebar .nav-link {
    color: var(--gray-400);
    padding: 0.75rem 1rem;
    margin: 0.25rem 0;
    border-radius: var(--radius-md);
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    border-radius: 0;
    white-space: nowrap;
}

.sidebar .nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

.sidebar .nav-link.active {
    color: white;
    background: rgba(37, 99, 235, 0.15);
    border-left: 3px solid var(--primary-blue);
}

.sidebar .nav-link i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    min-height: 100vh;
    margin-left: 280px;
    padding: 2rem;
    overflow-x: hidden;
}

/* ===== PREMIUM INVOICE DESIGN - ENHANCED ALIGNMENT ===== */
:root {
    --premium-ink: #000000;
    --premium-paper: #ffffff;
    --premium-accent: #2563eb;
    --premium-accent-light: #93c5fd;
    --premium-accent-pale: #eff6ff;
    --premium-rule: #cbd5e1;
    --premium-muted: #000000;
    --premium-white: #ffffff;
    --premium-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 8px rgba(0, 0, 0, 0.04);
}

.premium-invoice {
    font-family: 'Times New Roman', Times, serif;
    background: var(--premium-paper);
    color: #000000;
    max-width: 794px;
    margin: 0 auto 30px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--premium-shadow);
    border-radius: 0;
}

.premium-stripe {
    position: absolute;
    top: 0;
    left: 0;
    width: 8px;
    height: 100%;
    background: linear-gradient(180deg, #1e3a8a 0%, #3b82f6 100%);
    z-index: 10;
}

/* ===== HEADER SECTION - IMPROVED ALIGNMENT ===== */
.premium-header {
    padding: 28px 40px 24px 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;  /* CHANGE: from flex-start to center */
    border-bottom: 2px solid var(--premium-rule);
    background: white;
}

.header-left {
    display: flex;
    align-items: center;  /* CHANGE: from flex-start to center */
    gap: 28px;
    flex: 2;
}

.company-logo-wrapper {
    flex-shrink: 0;
    width: 90px;  /* CHANGE: from 100px to 90px */
    height: 90px; /* CHANGE: from 100px to 90px */
    background: var(--premium-white);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--premium-rule);
    padding: 8px;
}

.company-logo-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.company-text {
    flex: 1;
    line-height: 1.3;  /* ADD THIS */
}

.brand-name {
    font-family: 'Times New Roman', Times, serif;
    font-size: 26px;  /* CHANGE: from 28px to 26px */
    font-weight: 800;
    color: #000000;
    letter-spacing: 1px;
    line-height: 1.2;
    margin-bottom: 6px;  /* CHANGE: from 8px to 6px */
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;  /* ADD THIS */
}

.brand-name span {
    color: var(--premium-accent);
    font-size: 14px;  /* CHANGE: from 18px to 14px */
    font-weight: 600;  /* CHANGE: from 700 to 600 */
}

.brand-meta {
    font-size: 10px;  /* CHANGE: from 11px to 10px */
    color: #1f2937;
    line-height: 1.4;  /* CHANGE: from 1.5 to 1.4 */
    font-weight: 500;  /* CHANGE: from 600 to 500 */
}

.brand-meta strong {
    font-weight: 700;
    color: #000000;
}

.header-right {
    text-align: right;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;  /* ADD THIS */
    gap: 8px;  /* ADD THIS */
}

.invoice-label {
    font-family: 'Times New Roman', Times, serif;
    font-size: 10px;  /* CHANGE: from 11px to 10px */
    font-weight: 700;  /* CHANGE: from 800 to 700 */
    letter-spacing: 2px;
    color: var(--premium-accent);
    text-transform: uppercase;
    margin-bottom: 2px;  /* CHANGE: from 6px to 2px */
}

.invoice-title {
    font-family: 'Times New Roman', Times, serif;
    font-size: 22px;  /* CHANGE: from 26px to 22px */
    font-weight: 900;
    color: #000000;
    letter-spacing: 1.5px;  /* CHANGE: from 2px to 1.5px */
    text-transform: uppercase;
    line-height: 1.2;  /* ADD THIS */
}

.original-tag {
    display: inline-block;
    margin-top: 6px;  /* CHANGE: from 10px to 6px */
    font-family: 'Times New Roman', Times, serif;
    font-size: 9px;  /* CHANGE: from 10px to 9px */
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--premium-white);
    background: var(--premium-accent);
    padding: 3px 10px;  /* CHANGE: from 4px 12px to 3px 10px */
    border-radius: 4px;
    font-weight: 700;
}
/* ===== META ROW - IMPROVED ALIGNMENT ===== */
.premium-meta-row {
    padding: 16px 40px 16px 48px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    background: #f8fafc;
    border-bottom: 1px solid var(--premium-rule);
}

.meta-item {
    flex: 1;
    min-width: 140px;
    padding-right: 20px;
}

.meta-item:last-child {
    padding-right: 0;
}

.meta-key {
    font-family: 'Times New Roman', Times, serif;
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #374151;
    margin-bottom: 4px;
    font-weight: 700;
}

.meta-val {
    font-family: 'Times New Roman', Times, serif;
    font-size: 14px;
    font-weight: 800;
    color: #000000;
}

/* ===== PARTIES SECTION - IMPROVED ALIGNMENT ===== */
.premium-parties {
    padding: 28px 40px 28px 48px;
    display: flex;
    gap: 48px;
    border-bottom: 1px solid var(--premium-rule);
}

.party-col {
    flex: 1;
}

.party-label {
    font-family: 'Times New Roman', Times, serif;
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--premium-accent);
    margin-bottom: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.party-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.party-name {
    font-family: 'Times New Roman', Times, serif;
    font-size: 16px;
    font-weight: 800;
    color: #000000;
    margin-bottom: 8px;
}

.party-address {
    font-size: 12px;
    color: #1f2937;
    line-height: 1.5;
    font-weight: 500;
}

.gstin-chip {
    display: inline-block;
    margin-top: 12px;
    font-family: 'Times New Roman', Times, serif;
    font-size: 11px;
    font-weight: 700;
    color: #1e3a8a;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 4px 12px;
    border-radius: 4px;
}

.gstin-chip.not-registered {
    color: #374151;
    border-color: #d1d5db;
    background: #f9fafb;
}

/* ===== VEHICLE SECTION ===== */
.premium-vehicle {
    padding: 0 40px 20px 48px;
}

.vehicle-info {
    background: #f1f5f9;
    border-left: 4px solid var(--premium-accent);
    padding: 10px 20px;
    font-size: 13px;
    color: #1e3a8a;
    border-radius: 8px;
    font-weight: 600;
}

.vehicle-info i {
    color: var(--premium-accent);
    margin-right: 8px;
}

.vehicle-info strong {
    color: #000000;
    font-weight: 800;
}

.vehicle-type {
    background: var(--premium-accent);
    color: white;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    margin-left: 12px;
    font-weight: 600;
}

.vehicle-owner {
    margin-left: 16px;
    color: #2d3748;
    font-weight: 600;
}

/* ===== TABLE SECTION - ENHANCED ALIGNMENT ===== */
.premium-table-wrap {
    padding: 24px 40px 0 48px;
}

.section-title {
    font-family: 'Times New Roman', Times, serif;
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #2d3748;
    margin-bottom: 16px;
    font-weight: 700;
}

.premium-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.premium-table thead tr {
    background: #1e293b;
}

.premium-table thead th {
    font-family: 'Times New Roman', Times, serif;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: white;
    padding: 12px 12px;
    text-align: left;
    border-right: 1px solid #334155;
}

.premium-table thead th:last-child {
    border-right: none;
    text-align: right;
}

.premium-table thead th:nth-child(4),
.premium-table thead th:nth-child(5) {
    text-align: center;
}

.premium-table tbody tr {
    border-bottom: 1px solid var(--premium-rule);
}

.premium-table tbody td {
    padding: 12px 12px;
    font-size: 13px;
    color: #000000;
    vertical-align: top;
    font-weight: 600;
    border-right: 1px solid #f1f5f9;
}

.premium-table tbody td:last-child {
    border-right: none;
    text-align: right;
    font-weight: 800;
}

.premium-table tbody td:nth-child(4),
.premium-table tbody td:nth-child(5) {
    text-align: center;
}

.sno {
    font-family: 'Times New Roman', Times, serif;
    font-size: 13px;
    color: #000000;
    font-weight: 600;
}

.hsn {
    font-family: monospace;
    font-size: 12px;
    color: #1f2937;
    font-weight: 600;
}

.goods-name {
    font-weight: 700;
    display: block;
    color: #000000;
    font-size: 13px;
}

.item-code {
    font-size: 10px;
    color: #4b5563;
    margin-top: 4px;
    font-weight: 500;
}

.uom-chip {
    display: inline-block;
    font-family: 'Times New Roman', Times, serif;
    font-size: 10px;
    letter-spacing: 0.5px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #1f2937;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.rate-cell {
    font-family: 'Times New Roman', Times, serif;
    font-size: 13px;
    font-weight: 700;
    color: #000000;
}

/* ===== TOTALS SECTION - ENHANCED ALIGNMENT ===== */
.premium-totals-section {
    padding: 20px 40px 24px 48px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 32px;
    flex-wrap: wrap;
}

.amount-words {
    flex: 1.5;
}

.amount-words-label {
    font-family: 'Times New Roman', Times, serif;
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #374151;
    margin-bottom: 6px;
    font-weight: 700;
}

.amount-words-text {
    font-family: 'Times New Roman', Times, serif;
    font-size: 14px;
    font-weight: 800;
    color: #000000;
    font-style: italic;
    line-height: 1.4;
    max-width: 320px;
}

.totals-card {
    flex: 1;
    min-width: 260px;
    border: 1px solid var(--premium-rule);
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.totals-row:last-child {
    border-bottom: none;
}

.totals-row.grand {
    background: #1e293b;
    margin-top: 0;
    border-radius: 0;
}

.t-label {
    font-family: 'Times New Roman', Times, serif;
    font-size: 12px;
    letter-spacing: 0.5px;
    color: #1f2937;
    font-weight: 700;
}

.t-value {
    font-family: 'Times New Roman', Times, serif;
    font-size: 13px;
    font-weight: 800;
    color: #000000;
}

.totals-row.grand .t-label,
.totals-row.grand .t-value {
    color: white;
    font-weight: 800;
}

/* ===== BOTTOM SECTION - IMPROVED ALIGNMENT ===== */
.premium-bottom-section {
    padding: 24px 40px 32px 48px;
    display: flex;
    justify-content: space-between;
    gap: 48px;
    border-top: 1px solid var(--premium-rule);
    margin-top: 8px;
}

.bank-col {
    flex: 1;
}

.bank-label {
    font-family: 'Times New Roman', Times, serif;
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--premium-accent);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
}

.bank-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.bank-row {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 12px;
    line-height: 1.4;
}

.bank-key {
    font-family: 'Times New Roman', Times, serif;
    font-size: 11px;
    color: #374151;
    min-width: 80px;
    font-weight: 700;
}

.bank-val {
    color: #000000;
    font-weight: 600;
    font-size: 12px;
}

.sign-col {
    flex: 1;
    text-align: right;
}

.sign-label {
    font-family: 'Times New Roman', Times, serif;
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--premium-accent);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    font-weight: 800;
}

.sign-label::before {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.sign-label.small {
    font-size: 10px;
    margin-top: 24px;
}

.sign-box {
    display: inline-block;
    text-align: center;
    min-width: 200px;
}

.sign-for {
    font-size: 12px;
    color: #1f2937;
    font-weight: 600;
    margin-bottom: 32px;
    border-bottom: 1px dashed #cbd5e1;
    padding-bottom: 8px;
}

.sign-line {
    width: 160px;
    height: 1px;
    background: #6b7280;
    margin: 0 auto 6px;
}

.sign-role {
    font-family: 'Times New Roman', Times, serif;
    font-size: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #374151;
    font-weight: 600;
}

.sign-role.small {
    font-size: 9px;
}

.customer-sign-area {
    margin-top: 24px;
    text-align: left;
}

.customer-sign-line {
    height: 1px;
    background: #e2e8f0;
    margin-top: 32px;
    width: 160px;
}

/* ===== FOOTER BAR ===== */
.premium-footer-bar {
    background: #f1f5f9;
    padding: 12px 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--premium-rule);
}

.footer-note {
    font-family: 'Times New Roman', Times, serif;
    font-size: 10px;
    color: #2d3748;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.footer-contact {
    font-family: 'Times New Roman', Times, serif;
    font-size: 10px;
    color: #1f2937;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* ===== E-WAY BILL SECTION ===== */
.premium-ewaybill {
    padding: 16px 48px;
    background: #f8fafc;
    margin: 16px 48px 24px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    border: 1px solid var(--premium-rule);
}

.ewaybill-info {
    font-size: 12px;
    color: #1e3a8a;
    font-weight: 700;
}

.ewaybill-info strong {
    color: #000000;
    font-weight: 800;
}

.ewaybill-info i {
    color: var(--premium-accent);
    margin-right: 8px;
}

.eway-qrcode {
    width: 80px;
    height: 80px;
    background: white;
    padding: 6px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* ===== PAGE BREAK ===== */
.page-break-premium {
    page-break-before: always;
    margin-top: 0;
    height: 0;
}

/* ===== ACTION BUTTONS ===== */
.action-buttons-premium {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    gap: 12px;
    z-index: 1000;
    background: white;
    padding: 12px 20px;
    border-radius: 60px;
    box-shadow: var(--premium-shadow);
    border: 1px solid #e2e8f0;
}

.btn-premium {
    font-family: 'Times New Roman', Times, serif;
    padding: 8px 20px;
    border: none;
    border-radius: 40px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-download {
    background: #1e293b;
    color: white;
}

.btn-download:hover {
    background: #0f172a;
    transform: translateY(-1px);
}

.btn-print {
    background: white;
    color: #2563eb;
    border: 1px solid #2563eb;
}

.btn-print:hover {
    background: #eff6ff;
}

.btn-edit {
    background: white;
    color: #3b82f6;
    border: 1px solid #3b82f6;
}

.btn-edit:hover {
    background: #eff6ff;
}

.btn-close {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.btn-close:hover {
    background: #e2e8f0;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    
    .premium-header {
        padding: 20px;
        flex-direction: column;
        gap: 20px;
    }
    
    .header-left {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-right {
        text-align: left;
    }
    
    .premium-meta-row {
        padding: 12px 20px;
        flex-direction: column;
        gap: 12px;
    }
    
    .premium-parties {
        padding: 20px;
        flex-direction: column;
        gap: 24px;
    }
    
    .premium-table-wrap {
        padding: 20px;
    }
    
    .premium-totals-section {
        padding: 20px;
        flex-direction: column;
    }
    
    .premium-bottom-section {
        padding: 20px;
        flex-direction: column;
        gap: 32px;
    }
    
    .sign-col {
        text-align: left;
    }
    
    .sign-label {
        justify-content: flex-start;
    }
    
    .sign-label::before {
        display: none;
    }
    
    .premium-footer-bar {
        padding: 12px 20px;
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .premium-ewaybill {
        margin: 16px 20px;
        padding: 16px;
    }
    
    .action-buttons-premium {
        bottom: 10px;
        right: 10px;
        padding: 8px 12px;
    }
    
    .btn-premium {
        padding: 6px 12px;
        font-size: 10px;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    @page {
        size: A4;
        margin: 0;
    }
    
    body, html {
        margin: 0;
        padding: 0;
        background: white;
    }
    
    .no-print, .sidebar, .action-buttons-premium, .btn, nav, .alert, .card, .bg-white:not(.premium-invoice *) {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
        background: white;
    }
    
    .premium-invoice {
        margin: 0;
        box-shadow: none;
        border: none;
        max-width: 100%;
    }
    
    .premium-header, .premium-meta-row, .premium-parties, 
    .premium-table-wrap, .premium-totals-section, .premium-bottom-section {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .premium-ewaybill {
        margin-left: 0;
        margin-right: 0;
    }
    
    .premium-stripe {
        width: 4px;
    }
    
    /* Darker text for print */
    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        color-adjust: exact;
    }
    
    .brand-name, .invoice-title, .party-name, .meta-val,
    .goods-name, .t-value, .amount-words-text, .bank-val,
    .premium-table tbody td, .rate-cell, .sno {
        color: #000000 !important;
        font-weight: 800 !important;
    }
    
    .brand-meta, .party-address, .bank-key, .t-label,
    .meta-key, .section-title, .footer-note, .footer-contact {
        color: #1f2937 !important;
        font-weight: 600 !important;
    }
}

/* ================================================================
   NEXGEN TEMPLATE — Static overrides (v4 Pure White)
   Primary CSS lives in getNexgenTemplate() in invoiceController.js
   Palette: Dark Blue #003B6F, Pure Black #111111, White #FFFFFF
   Font: Times New Roman
   ================================================================ */

.premium-invoice.nexgen-template .premium-stripe { display: none !important; }

/* Thin blue rule at top - Dark Blue */
.premium-invoice.nexgen-template::before {
    content: '' !important;
    display: block !important;
    position: absolute !important;
    top: 0 !important; left: 0 !important; right: 0 !important;
    height: 4px !important;
    background: linear-gradient(90deg, #003B6F 0%, #004C8C 60%, #005EA6 100%) !important;
    z-index: 10 !important;
}

/* Logo - BIG, no background container, clean and clear */
.premium-invoice.nexgen-template .company-logo-wrapper {
    width: auto !important;
    height: auto !important;
    min-width: auto !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.premium-invoice.nexgen-template .company-logo-img {
    max-width: 280px !important;
    max-height: 140px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
}

/* All text overrides - Times New Roman */
.premium-invoice.nexgen-template {
    font-family: 'Times New Roman', Times, serif !important;
}

.premium-invoice.nexgen-template .brand-name { 
    color: #111111 !important; 
    font-family: 'Times New Roman', Times, serif !important;
    font-weight: 700 !important;
}
.premium-invoice.nexgen-template .invoice-title { 
    color: #111111 !important; 
    font-family: 'Times New Roman', Times, serif !important;
    font-weight: 700 !important;
}
.premium-invoice.nexgen-template .invoice-label { 
    color: #003B6F !important; 
    display: block !important;
    font-family: 'Times New Roman', Times, serif !important;
}
/* Change ALL gray/light black text to pure black (#000000) */

/* Meta values */
.premium-invoice.nexgen-template .meta-val {
    color: #000000 !important;  /* Already set */
}

/* Party address - change from gray to black */
.premium-invoice.nexgen-template .party-address {
    color: #000000 !important;  /* CHANGE: from #4B5563 to #000000 */
    font-weight: 500 !important;
}

/* Table body text */
.premium-invoice.nexgen-template .premium-table tbody td {
    color: #000000 !important;  /* CHANGE: from #1F2937 to #000000 */
}

/* HSN code - keep blue but make darker */
.premium-invoice.nexgen-template .hsn {
    color: #1B4FD8 !important;  /* Keep blue */
    font-weight: 700 !important;
}

/* UOM chip text */
.premium-invoice.nexgen-template .uom-chip {
    color: #1B4FD8 !important;  /* Keep blue */
}

/* Bank keys (labels) */
.premium-invoice.nexgen-template .bank-key {
    color: #000000 !important;  /* CHANGE: from #6B7280 to #000000 */
    font-weight: 600 !important;
}

/* Bank values */
.premium-invoice.nexgen-template .bank-val {
    color: #000000 !important;  /* Already set */
}

/* Terms list text */
.premium-invoice.nexgen-template .terms-list li {
    color: #000000 !important;  /* CHANGE: from #1F2937 to #000000 */
}

/* Payment labels */
.premium-invoice.nexgen-template .payment-label {
    color: #1B4FD8 !important;  /* Keep blue for labels */
}

/* Payment values */
.premium-invoice.nexgen-template .payment-value {
    color: #000000 !important;  /* Already set */
}

/* Footer note */
.premium-invoice.nexgen-template .footer-note {
    color: #000000 !important;  /* CHANGE: from #9CA3AF to #000000 */
}

/* S.No text */
.premium-invoice.nexgen-template .sno {
    color: #1B4FD8 !important;  /* Keep blue */
    font-weight: 700 !important;
}

/* Item code text */
.premium-invoice.nexgen-template .item-code {
    color: #000000 !important;  /* CHANGE: from #6B7280 to #000000 */
    font-weight: 500 !important;
}

/* Rate cell */
.premium-invoice.nexgen-template .rate-cell {
    color: #000000 !important;
    font-weight: 700 !important;
}

/* GSTIN chip text */
.premium-invoice.nexgen-template .gstin-chip {
    color: #1B4FD8 !important;
    font-weight: 700 !important;
}

/* Vehicle owner text */
.premium-invoice.nexgen-template .vehicle-owner {
    color: #000000 !important;  /* CHANGE: from #6B7280 to #000000 */
    font-weight: 500 !important;
}
.premium-invoice.nexgen-template .meta-key { 
    color: #003B6F !important; 
    font-family: 'Times New Roman', Times, serif !important;
}
.premium-invoice.nexgen-template .premium-table thead th { 
    color: #FFFFFF !important;
    font-family: 'Times New Roman', Times, serif !important;
    background: #003B6F !important;
}
.premium-invoice.nexgen-template .totals-row.grand .t-label { 
    color: #BFDBFE !important; 
    font-family: 'Times New Roman', Times, serif !important;
}
.premium-invoice.nexgen-template .totals-row.grand .t-value { 
    color: #FFFFFF !important; 
    font-family: 'Times New Roman', Times, serif !important;
}
.premium-invoice.nexgen-template .totals-row.grand td,
.premium-invoice.nexgen-template .totals-row.grand .t-label,
.premium-invoice.nexgen-template .totals-row.grand .t-value { 
    color: #FFFFFF !important; 
    font-family: 'Times New Roman', Times, serif !important;
}
.premium-invoice.nexgen-template .footer-note { 
    color: #6B7280 !important; 
    font-family: 'Times New Roman', Times, serif !important;
}
.premium-invoice.nexgen-template .footer-contact { 
    color: #003B6F !important; 
    font-family: 'Times New Roman', Times, serif !important;
}

/* Section labels - Dark Blue background with white text */
.premium-invoice.nexgen-template .party-label,
.premium-invoice.nexgen-template .bank-label {
    color: #FFFFFF !important;
    font-family: 'Times New Roman', Times, serif !important;
    font-weight: 700 !important;
    background: #003B6F !important;
    display: inline-block !important;
    padding: 4px 12px !important;
    border-radius: 2px !important;
    letter-spacing: 0.5px !important;
}

/* All other text - Times Roman */
.premium-invoice.nexgen-template .brand-meta,
.premium-invoice.nexgen-template .party-name,
.premium-invoice.nexgen-template .party-address,
.premium-invoice.nexgen-template .gstin-chip,
.premium-invoice.nexgen-template .vehicle-info,
.premium-invoice.nexgen-template .vehicle-info strong,
.premium-invoice.nexgen-template .premium-table tbody td,
.premium-invoice.nexgen-template .goods-name,
.premium-invoice.nexgen-template .item-code,
.premium-invoice.nexgen-template .rate-cell,
.premium-invoice.nexgen-template .amount-words-text,
.premium-invoice.nexgen-template .t-value:not(.totals-row.grand .t-value),
.premium-invoice.nexgen-template .bank-val,
.premium-invoice.nexgen-template .sign-for,
.premium-invoice.nexgen-template .sign-role,
.premium-invoice.nexgen-template .sno,
.premium-invoice.nexgen-template .hsn,
.premium-invoice.nexgen-template .uom-chip,
.premium-invoice.nexgen-template .section-title,
.premium-invoice.nexgen-template .t-label:not(.totals-row.grand .t-label) {
    color: #111111 !important;
    font-family: 'Times New Roman', Times, serif !important;
    font-weight: 500 !important;
}

/* Table header - Dark Blue */
.premium-invoice.nexgen-template .premium-table thead tr {
    background: #003B6F !important;
}

.premium-invoice.nexgen-template .premium-table thead th {
    color: #FFFFFF !important;
    font-family: 'Times New Roman', Times, serif !important;
    font-weight: 700 !important;
}

/* Grand total row - Dark Blue */
.premium-invoice.nexgen-template .totals-row.grand {
    background: #003B6F !important;
}

/* Keep footer contact dark blue */
.premium-invoice.nexgen-template .footer-contact {
    color: #003B6F !important;
}

/* Icons - dark blue */
.premium-invoice.nexgen-template i,
.premium-invoice.nexgen-template .fas,
.premium-invoice.nexgen-template .far {
    color: #003B6F !important;
}

/* E-way bill icon - dark blue */
.premium-invoice.nexgen-template .ewaybill-info i {
    color: #003B6F !important;
}

/* Responsive logo size for mobile */
@media (max-width: 768px) {
    .premium-invoice.nexgen-template .company-logo-img {
        max-width: 200px !important;
        max-height: 100px !important;
    }
}

@media print {
    .premium-invoice.nexgen-template .premium-header {
        background: #FFFFFF !important;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .premium-invoice.nexgen-template .premium-meta-row {
        background: #FFFFFF !important;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .premium-invoice.nexgen-template .premium-table thead tr {
        background: #003B6F !important;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .premium-invoice.nexgen-template .totals-row.grand {
        background: #003B6F !important;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .premium-invoice.nexgen-template .premium-footer-bar {
        background: #FFFFFF !important;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .premium-invoice.nexgen-template .party-label,
    .premium-invoice.nexgen-template .bank-label {
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
        color: #FFFFFF !important;
        background: #003B6F !important;
    }
    .premium-invoice.nexgen-template .brand-name,
    .premium-invoice.nexgen-template .invoice-title,
    .premium-invoice.nexgen-template .meta-val,
    .premium-invoice.nexgen-template .party-name,
    .premium-invoice.nexgen-template .goods-name,
    .premium-invoice.nexgen-template .t-value,
    .premium-invoice.nexgen-template .bank-val {
        color: #111111 !important;
        font-family: 'Times New Roman', Times, serif !important;
    }
    .premium-invoice.nexgen-template .invoice-label,
    .premium-invoice.nexgen-template .meta-key,
    .premium-invoice.nexgen-template .footer-contact {
        color: #003B6F !important;
    }
    
    /* Larger logo for print */
    .premium-invoice.nexgen-template .company-logo-img {
        max-width: 280px !important;
        max-height: 140px !important;
    }
}
/* ===== TERMS & CONDITIONS SECTION ===== */
.premium-terms-section {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin: 20px 40px 20px 48px;
    padding: 0;
}

.terms-container {
    flex: 1.2;
    background: #f8fafc;
    border-left: 4px solid var(--premium-accent);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.terms-header {
    background: var(--premium-accent);
    color: white;
    padding: 10px 16px;
    font-family: 'Times New Roman', Times, serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.terms-header i {
    margin-right: 8px;
}

.terms-content {
    padding: 12px 16px;
}

.terms-list {
    margin: 0;
    padding-left: 20px;
    list-style-type: none;
}

.terms-list li {
    font-family: 'Times New Roman', Times, serif;
    font-size: 10px;
    color: #1f2937;
    margin-bottom: 6px;
    line-height: 1.4;
    position: relative;
    padding-left: 16px;
}

.terms-list li:before {
    content: "•";
    color: var(--premium-accent);
    font-weight: bold;
    font-size: 12px;
    position: absolute;
    left: 0;
    top: 0;
}

.terms-list li:last-child {
    margin-bottom: 0;
}

/* ===== PAYMENT TERMS SECTION ===== */
.payment-terms-container {
    flex: 1;
    background: #f8fafc;
    border-left: 4px solid var(--premium-accent);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.payment-terms-header {
    background: var(--premium-accent);
    color: white;
    padding: 10px 16px;
    font-family: 'Times New Roman', Times, serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.payment-terms-header i {
    margin-right: 8px;
}

.payment-terms-content {
    padding: 12px 16px;
}

.payment-terms-table {
    width: 100%;
    border-collapse: collapse;
}

.payment-terms-table tr {
    border-bottom: 1px solid #e2e8f0;
}

.payment-terms-table tr:last-child {
    border-bottom: none;
}

.payment-label {
    font-family: 'Times New Roman', Times, serif;
    font-size: 10px;
    font-weight: 700;
    color: #374151;
    padding: 6px 8px 6px 0;
    width: 110px;
    vertical-align: top;
}

.payment-value {
    font-family: 'Times New Roman', Times, serif;
    font-size: 10px;
    font-weight: 500;
    color: #000000;
    padding: 6px 0;
    vertical-align: top;
}

/* Responsive for Terms */
@media (max-width: 768px) {
    .premium-terms-section {
        flex-direction: column;
        margin: 16px 20px;
        gap: 16px;
    }
    
    .terms-container,
    .payment-terms-container {
        flex: auto;
    }
}

