/* ============================================
   QUOTE GENERATOR - Dedicated Stylesheet
   Ray2Volt Solar Toolbox - Brutalist/Minimalist Design
   Matches Invoice & Warranty Card styling
   ============================================ */

/* Google Sans Flex for UI elements */
@import url('https://fonts.googleapis.com/css2?family=Google+Sans+Flex:wght@400;500;600;700&display=swap');

/* ============================================
   FORM SECTION - BRUTALIST STYLING
   ============================================ */

/* --- Page Header --- */
.qg-page-header {
    margin-bottom: 1.5rem;
}

/* Keep the quote generator form comfortably centered */
.no-print-area {
    max-width: 1100px;
    margin: 0 auto;
}

.qg-page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.qg-page-header p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Mobile-first header rhythm */
@media screen and (max-width: 768px) {
    .qg-page-header {
        margin-bottom: 1rem;
    }

    .qg-page-header h1 {
        font-size: 1.4rem;
        line-height: 1.2;
    }

    .qg-page-header p {
        font-size: 0.9rem;
        line-height: 1.4;
    }
}

/* --- Form Cards --- */
.qg-form-grid {
    display: grid;
    /* Mobile-first: stack by default */
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.qg-form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: 2px;
    /* Mobile-first: tighter spacing */
    padding: 1rem;
    margin-bottom: 0;
}

.qg-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qg-section-title .icon {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

/* --- Input Groups --- */
.qg-input-group {
    margin-bottom: 1.25rem;
}

.qg-input-group:last-child {
    margin-bottom: 0;
}

.qg-input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* --- Input Fields --- */
.qg-input-field {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-family: 'Google Sans Flex', 'Google Sans', sans-serif;
    border: 1px solid var(--border-medium);
    border-radius: 2px;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all 0.1s ease;
    box-sizing: border-box;
}

.qg-input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: #fff;
}

textarea.qg-input-field {
    resize: vertical;
    min-height: 70px;
}

select.qg-input-field {
    cursor: pointer;
}

/* --- Components Card --- */
.qg-components-card {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: 2px;
    /* Mobile-first: tighter spacing */
    padding: 1rem;
    margin-bottom: 1rem;
}

.qg-components-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

@media screen and (max-width: 768px) {
    .no-print-area {
        max-width: none;
    }

    .qg-section-title {
        margin-bottom: 0.9rem;
        padding-bottom: 0.6rem;
        font-size: 0.95rem;
    }

    .qg-input-group {
        margin-bottom: 1rem;
    }

    .qg-components-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}

.qg-components-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.qg-components-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* --- Component Sections --- */
.qg-component-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px dashed var(--border-light);
}

.qg-component-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.qg-component-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* --- Component Row --- */
.qg-component-row {
    background: var(--bg-body);
    border: 1px solid var(--border-light);
    border-radius: 2px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.qg-component-row:last-child {
    margin-bottom: 0;
}

.qg-component-fields {
    display: grid;
    /* Mobile-first */
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: end;
}

.qg-component-fields .qg-input-group {
    margin-bottom: 0;
}

.qg-component-fields .qg-input-group label {
    font-size: 0.8rem;
    font-weight: 500;
}

/* Additional fields grid (7 columns) */
.qg-additional-fields {
    /* Mobile-first */
    grid-template-columns: 1fr;
}

/* --- Editable BOM Input Table --- */
.qg-bom-table-container {
    overflow-x: auto;
}

.qg-bom-input-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.qg-bom-input-table th,
.qg-bom-input-table td {
    padding: 12px 15px;
    /* More padding */
    border: 1px solid var(--border-medium);
    font-size: 0.95rem;
    /* Larger font */
    vertical-align: middle;
}

.qg-bom-input-table th {
    background: #E8F4FA;
    font-weight: 700;
    color: var(--text-primary);
    text-align: left;
    white-space: nowrap;
    border-bottom: 2px solid var(--border-medium);
}

/* ... headers ... */

/* Editable inputs inside BOM table */
.qg-bom-input-table input.bom-item,
.qg-bom-input-table input.bom-qty,
.qg-bom-input-table input.bom-unit,
.qg-bom-input-table input.bom-make {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.95rem;
    font-family: 'Google Sans Flex', 'Google Sans', sans-serif;
    border: 1px solid var(--border-light);
    /* Subtle border to show editability */
    background: #fafafa;
    /* Light background */
    color: var(--text-primary);
    border-radius: 4px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.qg-bom-input-table input.bom-item:hover,
.qg-bom-input-table input.bom-qty:hover,
.qg-bom-input-table input.bom-unit:hover,
.qg-bom-input-table input.bom-make:hover {
    background: #fff;
    border-color: var(--border-medium);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.qg-bom-input-table input.bom-item:focus,
.qg-bom-input-table input.bom-qty:focus,
.qg-bom-input-table input.bom-unit:focus,
.qg-bom-input-table input.bom-make:focus {
    outline: none;
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.qg-bom-input-table input.bom-qty {
    text-align: center;
    width: 70px;
}

.qg-bom-input-table input.bom-unit {
    text-align: center;
    width: 70px;
}

.qg-bom-input-table td:has(input.bom-qty),
.qg-bom-input-table td:has(input.bom-unit) {
    text-align: center;
}


/* --- Action Buttons --- */
.qg-actions {
    display: flex;
    justify-content: center;
    /* Mobile-first: stacked, full-width buttons */
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 1.25rem;
    margin-bottom: 1.25rem;
}

/* If cards are in a grid, spacing should come from the grid gap */
.qg-form-grid .qg-form-card {
    margin-bottom: 0;
}

.qg-btn-primary {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Google Sans Flex', 'Google Sans', sans-serif;
    border: 1px solid var(--primary);
    border-radius: 2px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    transition: all 0.1s ease;
    width: 100%;
}

.qg-btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.qg-btn-secondary {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Google Sans Flex', 'Google Sans', sans-serif;
    border: 1px solid var(--primary);
    border-radius: 2px;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.1s ease;
    width: 100%;
}

.qg-btn-secondary:hover {
    background: var(--primary);
    color: #fff;
}

/* ============================================
   QUOTE PREVIEW - 5 Page A4 Document
   Minimalist, Print-Friendly, Clean
   ============================================ */

#quotePreview {
    display: none;
    margin: 2rem auto;
    font-family: 'Google Sans Flex', Arial, sans-serif;
    color: #1a1a1a;
}

#quotePreview.visible {
    display: block;
}

/* --- Page Layout --- */
.quote-page {
    /* Mobile-first preview: fluid, readable on small screens */
    width: 100%;
    min-height: auto;
    height: auto;
    margin: 10px auto;
    padding: 15px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 2px;
    font-size: 10pt;
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
    page-break-after: always;
    page-break-inside: avoid;
}

.quote-page:last-child {
    page-break-after: auto;
}

/* --- Page 1 Hero Header --- */
.qp-page1 {
    border-top: 4px solid #2980b9;
}

.qp-page1 .qp-header {
    padding-top: 5px;
    padding-bottom: 15px;
    margin-bottom: 10px;
}

.qp-pre-title {
    font-size: 7pt;
    font-weight: 600;
    color: #2980b9;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    display: block;
    margin-bottom: 4px;
}

.qp-title-light {
    font-weight: 400;
    font-size: 14pt;
    color: #666;
    letter-spacing: 0.5px;
}

/* --- Header --- */
.qp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #1a1a1a;
}

.qp-logo {
    width: 250px;
    height: auto;
}

.qp-title-section {
    flex: 1;
}

.qp-title-section h1 {
    font-size: 16pt;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: 1px;
    margin: 0;
    text-transform: uppercase;
}

.qp-subtitle {
    font-size: 10pt;
    font-weight: 400;
    color: #666;
    margin: 2px 0 0 0;
    letter-spacing: 0.5px;
}

/* --- Banner (Quote No / Date) --- */
.qp-banner {
    display: flex;
    justify-content: space-between;
    background: #E8F4FA;
    border: 1px solid #d0d0d0;
    border-radius: 2px;
    padding: 8px 15px;
    margin-bottom: 15px;
    font-size: 9pt;
    color: #1a1a1a;
}

.qp-banner strong {
    font-weight: 700;
    color: #1a1a1a;
}

/* --- Sections --- */
.qp-section {
    margin-bottom: 10px;
}

.qp-section h3 {
    font-size: 10pt;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #d0d0d0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Info Grid (Page 1) --- */
.qp-info-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 4px 12px;
    font-size: 9.5pt;
    line-height: 1.5;
}

.qp-info-label {
    font-weight: 600;
    color: #555;
}

.qp-info-value {
    color: #1a1a1a;
    font-weight: 500;
}

/* --- Specs Table --- */
.qp-specs-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
    border: 1px solid #d0d0d0;
}

.qp-specs-table th,
.qp-specs-table td {
    padding: 6px 10px;
    text-align: left;
    font-size: 9.5pt;
    border: 1px solid #d0d0d0;
}

.qp-specs-table th {
    background-color: #E8F4FA;
    font-weight: 600;
    color: #1a1a1a;
    width: 40%;
}

.qp-specs-table td {
    background-color: #fff;
    color: #1a1a1a;
}

/* --- About Text --- */
.qp-about-text {
    line-height: 1.55;
    font-size: 9pt;
    color: #444;
    margin: 0;
}

/* --- Mission Grid --- */
.qp-mission-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 5px;
}

.qp-mission-item {
    padding: 10px;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 2px;
}

.qp-mission-item strong {
    display: block;
    font-size: 9.5pt;
    margin-bottom: 3px;
}

.qp-mission-item p {
    font-size: 8.5pt;
    color: #444;
    margin: 0;
    line-height: 1.45;
}

/* --- Benefits Grid (Why Go Solar) --- */
.qp-benefits-grid {
    display: grid;
    /* Mobile-first */
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 5px;
}

.qp-benefit-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 2px;
}

.qp-benefit-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.qp-benefit-item strong {
    display: block;
    font-size: 8.5pt;
    color: #1a1a1a;
    margin-bottom: 1px;
}

.qp-benefit-item p {
    font-size: 7.5pt;
    color: #666;
    margin: 0;
    line-height: 1.35;
}

/* --- Comparison Cards (Before vs After) --- */
.qp-comparison-container {
    /* Mobile-first */
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 30px;
    margin-top: 15px;
}

.qp-comparison-card {
    flex: 1;
    border: 1px solid #d0d0d0;
    border-radius: 2px;
    overflow: hidden;
    text-align: center;
    background: #fff;
}

.qp-comparison-card .qp-card-header {
    padding: 10px;
    font-weight: 700;
    font-size: 10pt;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.qp-card-before .qp-card-header {
    background-color: #ffebee;
    color: #c62828;
}

.qp-card-after .qp-card-header {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.qp-card-body {
    padding: 10px;
}

.qp-card-label {
    font-size: 9pt;
    color: #666;
    margin: 0 0 2px 0;
}

.qp-card-value {
    font-size: 18pt;
    font-weight: 700;
    margin: 0 0 5px 0;
}

.qp-text-red {
    color: #d32f2f;
}

.qp-text-green {
    color: #2e7d32;
}

.qp-bill-bar-container {
    height: 8px;
    background: #f5f5f5;
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto;
    width: 80%;
}

.qp-bill-bar {
    height: 100%;
    border-radius: 4px;
}

.qp-bar-red {
    background: #ef5350;
}

.qp-bar-green {
    background: #66bb6a;
}

.qp-savings-badge {
    margin-top: 8px;
    display: inline-block;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 4px 12px;
    border-radius: 2px;
    font-size: 9pt;
    font-weight: 600;
    border: 1px solid #c8e6c9;
}

.qp-comparison-arrow {
    font-size: 18pt;
    color: #bdbdbd;
    font-weight: bold;
}

/* --- Page 3: Address Grid --- */
.qp-address-grid {
    /* Mobile-first */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 15px;
}

.qp-addr-card {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    font-size: 9pt;
}

.qp-addr-header {
    background: #f5f5f5;
    padding: 6px 12px;
    font-weight: 700;
    color: #666;
    font-size: 8pt;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 1px solid #e0e0e0;
}

.qp-addr-body {
    padding: 10px;
    line-height: 1.4;
    min-height: 90px;
}

.qp-addr-body strong {
    font-size: 10pt;
    color: #333;
    display: block;
    margin-bottom: 4px;
}

.qp-addr-body p {
    margin: 0;
    color: #555;
}

.qp-addr-meta {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #e0e0e0;
    color: #777;
    font-size: 8.5pt;
}

.qp-addr-icon {
    align-self: center;
    color: #ccc;
    font-size: 16pt;
    transform: rotate(90deg);
}

/* --- Page 3: Financial Strip --- */
.qp-financial-strip {
    /* Mobile-first */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    background: #fafafa;
    border: 1px solid #d0d0d0;
    padding: 12px 15px;
    border-radius: 2px;
    margin: 15px 0;
}

.qp-fin-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.qp-fin-label {
    font-size: 8.5pt;
    color: #777;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.qp-fin-value {
    font-size: 14pt;
    font-weight: 700;
    color: #333;
    line-height: 1.2;
}

.qp-fin-sublabel {
    font-size: 7.5pt;
    color: #999;
    margin-top: 2px;
    font-style: italic;
}

/* Emphasis on Project Cost */
.qp-fin-total .qp-fin-value {
    font-size: 16pt;
    color: #2c3e50;
}

.qp-fin-subsidy .qp-fin-value {
    color: #2e7d32;
    font-size: 13pt;
}



.qp-fin-net .qp-fin-value {
    font-size: 13pt;
    /* Reduced from 16pt */
    color: #2980b9;
}

.qp-fin-divider {
    display: none;
}

.qp-amount-words {
    background: #fafafa;
    border: 1px solid #d0d0d0;
    padding: 6px 12px;
    border-radius: 2px;
    font-size: 9pt;
    font-style: italic;
    color: #555;
    margin-top: -2px;
    margin-bottom: 10px;
}

/* --- Page 3: Payment Steps --- */
.qp-payment-steps {
    /* Mobile-first */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    position: relative;
    padding: 10px 0;
}

.qp-step {
    flex: 1;
    display: flex;
    gap: 15px;
    z-index: 2;
}

.qp-step-badge {
    width: 32px;
    height: 32px;
    background: #2980b9;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11pt;
    flex-shrink: 0;
}

.qp-step-content {
    flex: 1;
}

.qp-step-content strong {
    display: block;
    color: #333;
    font-size: 10pt;
    margin-bottom: 2px;
}

.qp-step-amount {
    font-size: 11pt;
    font-weight: 700;
    color: #2980b9;
    margin-bottom: 2px;
}

.qp-step-desc {
    font-size: 8.5pt;
    color: #666;
    display: block;
    line-height: 1.3;
}

.qp-step-line {
    position: absolute;
    top: 26px;
    /* Center with badge */
    left: 32px;
    right: 50%;
    /* Go roughly halfway - simpler than calc */
    height: 0;
    display: none;
    /* Hidden for now, spacing acts as separation */
}

/* --- Page 3: Bank Card --- */
.qp-bank-card {
    border: 1px solid #d0d0d0;
    background: #fff;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 15px;
}

.qp-bank-header {
    background: #E8F4FA;
    color: #1a1a1a;
    padding: 8px 15px;
    font-size: 9pt;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    letter-spacing: 1px;
    border-bottom: 1px solid #d0d0d0;
}

.qp-bank-body {
    padding: 10px;
    font-size: 9pt;
    color: #333;
}

.qp-bank-row {
    margin-bottom: 6px;
}

.qp-bank-flex {
    /* Mobile-first */
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 0px;
}

.qp-bank-body span {
    display: block;
    font-size: 8pt;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.qp-mono {
    font-family: 'Courier New', monospace;
    font-size: 11pt;
    letter-spacing: 1px;
    color: #000;
}

/* --- Cover Footer --- */
.qp-cover-footer {
    position: absolute;
    bottom: 20mm;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 8pt;
    color: #777;
    padding: 6px 15mm;
    border-top: 1px solid #d0d0d0;
}

/* --- Page Footer --- */
.qp-page-footer {
    position: absolute;
    bottom: 8mm;
    left: 15mm;
    right: 15mm;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #d0d0d0;
    padding-top: 6px;
    font-size: 8pt;
    color: #666;
}

/* --- BOM Table (Page 2) --- */
.qp-bom-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #d0d0d0;
}

.qp-bom-table th,
.qp-bom-table td {
    padding: 6px 10px;
    text-align: left;
    font-size: 9.5pt;
    border: 1px solid #d0d0d0;
}

.qp-bom-table thead th {
    background-color: #E8F4FA;
    font-weight: 600;
    color: #1a1a1a;
}

.qp-bom-table td {
    background-color: #fff;
    color: #1a1a1a;
}

.qp-bom-table .bom-section-header td {
    background-color: #f5f5f5;
    font-weight: 700;
    font-size: 10pt;
    text-align: center;
    color: #1a1a1a;
    padding: 8px;
}

/* --- Note Box --- */
.qp-note-box {
    background: #fafafa;
    border: 1px solid #d0d0d0;
    border-left: 4px solid #1a1a1a;
    border-radius: 2px;
    padding: 10px 15px;
    margin-top: 15px;
    font-size: 9pt;
    color: #555;
    line-height: 1.5;
}

/* --- Unified Info Table (Page 3 - Receipt-style) --- */
.qp-unified-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #d0d0d0;
    margin-bottom: 0;
}

.qp-info-header-row .qp-info-header-cell {
    background-color: #E8F4FA;
    padding: 8px 12px;
    font-weight: 700;
    font-size: 10.5pt;
    color: #1a1a1a;
    border: 1px solid #d0d0d0;
}

.qp-info-content-row td {
    padding: 10px 12px;
    vertical-align: top;
    font-size: 9.5pt;
    line-height: 1.6;
    border: 1px solid #d0d0d0;
}

.qp-from-cell,
.qp-to-cell {
    width: 50%;
}

.qp-info-lbl {
    font-weight: 600;
    color: #555;
}

/* --- Pricing Table --- */
.qp-pricing-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #d0d0d0;
    margin-top: 5px;
}

.qp-pricing-table td {
    padding: 7px 12px;
    font-size: 10pt;
    border: 1px solid #d0d0d0;
}

.qp-pricing-table td:first-child {
    width: 65%;
    color: #333;
}

.qp-pricing-table td:last-child {
    text-align: right;
    font-weight: 600;
    color: #1a1a1a;
}

.qp-grand-total-row td {
    background-color: #E8F4FA;
    font-size: 10.5pt;
}



/* --- Subsidy Box --- */
.qp-subsidy-box {
    background: #fff;
    border: 1px solid #d0d0d0;
    border-left: 4px solid #2ecc71;
    border-radius: 2px;
    padding: 10px 15px;
    margin: 15px 0;
    font-size: 9.5pt;
    color: #1a1a1a;
}

.qp-subsidy-box h4 {
    font-size: 10.5pt;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: #1a1a1a;
}

/* --- Bank Section --- */
.qp-bank-section {
    border: 1px solid #d0d0d0;
    border-radius: 2px;
    margin-top: 15px;
    padding: 12px;
}

.qp-bank-section h4 {
    font-size: 10.5pt;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #1a1a1a;
    border-bottom: 1px solid #d0d0d0;
    padding-bottom: 6px;
}

.qp-bank-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 3px 10px;
    font-size: 9.5pt;
}

.qp-bank-label {
    font-weight: 600;
    color: #555;
}

.qp-bank-value {
    color: #1a1a1a;
}

/* --- Savings Table (Page 4) --- */
.qp-savings-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #d0d0d0;
}

.qp-savings-table th,
.qp-savings-table td {
    padding: 5px 10px;
    text-align: right;
    font-size: 9pt;
    border: 1px solid #d0d0d0;
}

.qp-savings-table th:first-child,
.qp-savings-table td:first-child {
    text-align: center;
}

.qp-savings-table thead th {
    background-color: #E8F4FA;
    font-weight: 600;
    color: #1a1a1a;
    text-align: center;
}

/* --- Highlight Box --- */
.qp-highlight-box {
    background: #E8F4FA;
    border: 1px solid #d0d0d0;
    border-radius: 2px;
    padding: 15px;
    margin: 15px 0;
    text-align: center;
}

.qp-highlight-label {
    font-size: 10pt;
    color: #555;
    margin-bottom: 4px;
}

.qp-highlight-value {
    font-size: 18pt;
    font-weight: 700;
    color: #1a1a1a;
}

/* ============================================
   PAGE 5: Terms & Conditions
   ============================================ */

/* Flex layout for Page 5 — pushes signature to bottom */
.qp-page-flex {
    display: flex;
    flex-direction: column;
}

.qp-page5-content {
    flex: 1 1 auto;
}

.qp-page5-bottom {
    margin-top: auto;
    padding-bottom: 5mm;
}

/* --- Scope & Exclusions Grid --- */
.qp-terms-grid {
    display: grid;
    /* Mobile-first */
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.qp-terms-card {
    border: 1px solid #d0d0d0;
    border-radius: 2px;
    background: #fff;
    page-break-inside: avoid;
}

.qp-scope-card {
    border-top: 3px solid #3498db;
}

.qp-exclusion-card {
    border-top: 3px solid #e74c3c;
}

.qp-responsibility-card {
    border-top: 3px solid #27ae60;
    margin-bottom: 12px;
}

.qp-general-terms {
    margin-bottom: 12px;
    border-top: 3px solid #2c3e50;
    page-break-inside: avoid;
}

/* --- Section Headers --- */
.qp-terms-header {
    background-color: #f8f9fa;
    padding: 6px 12px;
    font-size: 9pt;
    font-weight: 700;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Section Content --- */
.qp-terms-content {
    padding: 8px 12px;
    font-size: 8.5pt;
    line-height: 1.45;
    color: #333;
}

/* --- Custom Checklists --- */
.qp-checklist {
    list-style: none;
    padding: 0;
    margin: 0;
}

.qp-checklist li {
    position: relative;
    padding-left: 16px;
    margin-bottom: 4px;
}

.qp-checklist li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #3498db;
    font-weight: bold;
    font-size: 0.9em;
}

.qp-exclusion-card .qp-checklist li::before {
    color: #e74c3c;
    content: "✗";
}

/* --- Customer Responsibilities Grid --- */
.qp-resp-grid {
    display: grid;
    /* Mobile-first */
    grid-template-columns: 1fr;
    gap: 10px;
}

.qp-resp-item strong {
    display: block;
    font-size: 8.5pt;
    color: #1a1a1a;
    margin-bottom: 1px;
}

.qp-resp-item p {
    margin: 0;
    color: #555;
    font-size: 8pt;
    line-height: 1.35;
}

/* --- Ordered Terms List --- */
.qp-terms-ol {
    margin: 0;
    padding-left: 18px;
}

.qp-terms-ol li {
    margin-bottom: 4px;
    font-size: 8.5pt;
    line-height: 1.4;
    color: #333;
}

.qp-terms-ol li strong {
    color: #1a1a1a;
}

/* --- After-Sales Note Box --- */
.qp-aftersales-box {
    background: #f0f7fa;
    border: 1px solid #d0e4ed;
    border-left: 3px solid #3498db;
    border-radius: 2px;
    padding: 8px 12px;
    margin-bottom: 0;
}

.qp-aftersales-box p {
    margin: 0;
    font-size: 8.5pt;
    line-height: 1.4;
    color: #333;
}

/* --- Signature --- */
.qp-signature-section {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px dashed #ccc;
}

.qp-signature-block {
    width: 40%;
    text-align: center;
}

.qp-signature-box {
    height: 45px;
    border-bottom: 1px solid #333;
    margin-bottom: 6px;
}

.qp-sig-name {
    font-weight: 700;
    font-size: 9pt;
    color: #1a1a1a;
}

.qp-sig-title {
    font-size: 8.5pt;
    color: #666;
}

/* --- Thank You Section --- */
.qp-thankyou-section {
    text-align: center;
    padding: 20px 15px 10px;
    border-top: 1px dashed #ccc;
}

.qp-thankyou-icon {
    font-size: 28pt;
    margin-bottom: 6px;
}

.qp-thankyou-title {
    font-size: 13pt;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 8px 0;
}

.qp-thankyou-text {
    font-size: 9pt;
    color: #555;
    line-height: 1.5;
    max-width: 480px;
    margin: 0 auto 12px;
}

.qp-thankyou-contact {
    /* Mobile-first */
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    font-size: 8.5pt;
    color: #333;
    margin-bottom: 10px;
}

.qp-thankyou-tagline {
    font-size: 9.5pt;
    font-weight: 700;
    color: #2980b9;
    font-style: italic;
    margin: 0;
}

/* --- Disclaimer --- */
.qp-disclaimer {
    padding: 8px 0 0;
    font-size: 7.5pt;
    color: #999;
    text-align: center;
}


/* ============================================
   RESPONSIVE STYLES
   ============================================ */

/* Global mobile-first safeguards */
.qg-input-field {
    font-size: 16px;
    /* prevent iOS zoom */
}

.qp-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.qp-logo {
    width: 150px;
    order: -1;
}

.qp-banner {
    flex-direction: column;
    gap: 5px;
}

.qp-info-grid {
    grid-template-columns: 1fr;
    gap: 5px;
}

.qp-info-label {
    color: #777;
    font-size: 8.5pt;
}

.qp-mission-grid {
    grid-template-columns: 1fr;
}

/* Tables: stack simple 2-col table rows on mobile */
.qp-specs-table th,
.qp-specs-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.qp-specs-table th {
    background: #f0f0f0;
    padding: 5px 10px;
}

.qp-specs-table td {
    padding: 8px 10px;
    border-top: none;
}

.qg-bom-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.qg-bom-input-table {
    min-width: 600px;
    /* keep table usable; scroll on small screens */
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    display: block;
}

/* Footer / Signature: avoid overlapping on small screens */
.qp-page-footer {
    position: static;
    margin-top: 20px;
    text-align: center;
    flex-direction: column;
    gap: 5px;
}

/* Progressive enhancements */
@media screen and (min-width: 600px) {
    .qg-actions {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 1rem;
    }

    .qg-btn-primary,
    .qg-btn-secondary {
        width: auto;
    }
}

@media screen and (min-width: 769px) {
    .qg-page-header {
        margin-bottom: 1.5rem;
    }

    .qg-page-header h1 {
        font-size: 1.75rem;
    }

    .qg-form-card,
    .qg-components-card {
        padding: 1.5rem;
        margin-bottom: 2rem;
    }

    .qg-input-field {
        font-size: 0.95rem;
    }

    .qg-component-fields {
        grid-template-columns: repeat(2, 1fr);
    }

    .qg-additional-fields {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Restore more "document-like" preview on larger screens */
    .quote-page {
        width: 210mm;
        min-height: 297mm;
        height: 297mm;
        margin: 0 auto 20px auto;
        padding: 12mm 15mm 25mm 15mm;
        border: none;
    }

    .qp-header {
        flex-direction: row;
        align-items: center;
    }

    .qp-logo {
        width: 250px;
        order: 0;
    }

    .qp-banner {
        flex-direction: row;
    }

    .qp-info-grid {
        grid-template-columns: 140px 1fr;
    }

    .qp-specs-table th,
    .qp-specs-table td {
        display: table-cell;
        width: auto;
    }

    .qp-specs-table th {
        background-color: #E8F4FA;
    }

    .qp-specs-table td {
        border-top: 1px solid #d0d0d0;
    }

    .qp-mission-grid {
        grid-template-columns: 1fr 1fr;
    }

    .qp-benefits-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .qp-address-grid {
        flex-direction: row;
        gap: 20px;
    }

    .qp-addr-icon {
        transform: none;
    }

    .qp-financial-strip {
        flex-direction: row;
        align-items: center;
        gap: 0;
    }

    .qp-fin-divider {
        display: block;
        width: 1px;
        height: 40px;
        background: #e0e0e0;
        margin: 0 10px;
    }

    .qp-payment-steps {
        flex-direction: row;
        gap: 0;
    }

    .qp-bank-flex {
        flex-direction: row;
        gap: 40px;
    }

    .qp-comparison-container {
        flex-direction: row;
        align-items: center;
        gap: 20px;
    }

    .qp-comparison-arrow {
        transform: none;
    }

    .qp-terms-grid {
        grid-template-columns: 1fr 1fr;
    }

    .qp-resp-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px 20px;
    }

    .qp-thankyou-contact {
        flex-direction: row;
        gap: 25px;
    }

    /* On larger screens, keep footer pinned inside A4 preview */
    .qp-page-footer {
        position: absolute;
        bottom: 8mm;
        left: 15mm;
        right: 15mm;
        text-align: left;
        flex-direction: row;
        gap: 0;
        margin-top: 0;
    }
}

@media screen and (min-width: 1025px) {
    .qg-form-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        margin-bottom: 2rem;
    }

    .qg-component-fields {
        grid-template-columns: repeat(4, 1fr);
    }

    .qg-additional-fields {
        grid-template-columns: repeat(7, 1fr);
    }

    .qp-benefits-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}


/* ============================================
   PRINT STYLES
   ============================================ */
@media print {

    /* --- Global print color preservation --- */
    *,
    *::before,
    *::after {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* --- Page size (A4 with zero browser margins) --- */
    @page {
        size: A4;
        margin: 0;
    }

    /* --- Hide all non-preview areas --- */
    .no-print-area,
    .sidebar,
    .mobile-header,
    .overlay,
    .qg-form-section,
    .qg-actions,
    .app-container>header,
    .app-container>aside {
        display: none !important;
    }

    /* --- Reset body/html for print --- */
    html,
    body {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        background: white !important;
    }

    .app-container {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .main-content {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: none !important;
    }

    .content-section {
        padding: 0 !important;
        margin: 0 !important;
    }

    /* --- Quote preview container --- */
    #quotePreview {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        background: white !important;
    }

    /* --- Each page = one printed page --- */
    .quote-page {
        width: 100% !important;
        height: 100vh !important;
        min-height: 100vh !important;
        margin: 0 !important;
        padding: 12mm 15mm 20mm 15mm !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        overflow: visible !important;
        page-break-after: always !important;
        page-break-inside: avoid !important;
        box-sizing: border-box !important;
        position: relative !important;
    }

    .quote-page:last-child {
        page-break-after: auto !important;
    }

    /* --- Page 1 top accent bar --- */
    .qp-page1 {
        border-top: 4px solid #2980b9 !important;
    }

    /* --- Header (restore desktop row layout for print) --- */
    .qp-header {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 20px !important;
        border-bottom: 2px solid #1a1a1a !important;
    }

    .qp-logo {
        width: 220px !important;
        height: auto !important;
        order: 0 !important;
    }

    /* --- Banner (restore row layout for print) --- */
    .qp-banner {
        flex-direction: row !important;
        background-color: #E8F4FA !important;
        color: #1a1a1a !important;
        border: 1px solid #d0d0d0 !important;
    }

    .qp-banner strong {
        color: #1a1a1a !important;
    }

    /* --- Section headers --- */
    .qp-section h3 {
        border-bottom: 1px solid #d0d0d0 !important;
    }

    /* --- Info grid (Page 1) --- */
    .qp-info-grid {
        display: grid !important;
        grid-template-columns: 140px 1fr !important;
    }

    /* --- Mission grid (Page 1) --- */
    .qp-mission-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
    }

    .qp-mission-item {
        border: 1px solid #d0d0d0 !important;
    }

    /* --- Benefits grid (Page 1 + 4) --- */
    .qp-benefits-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr 1fr !important;
    }

    .qp-benefit-item {
        display: flex !important;
        border: 1px solid #d0d0d0 !important;
    }

    .qp-benefit-icon {
        font-size: 14px !important;
    }

    /* --- Tables: restore table-cell display and backgrounds --- */
    .qp-specs-table th,
    .qp-specs-table td {
        display: table-cell !important;
        width: auto !important;
    }

    .qp-specs-table th {
        background-color: #E8F4FA !important;
        padding: 6px 10px !important;
    }

    .qp-specs-table td {
        background-color: #fff !important;
        border-top: 1px solid #d0d0d0 !important;
    }

    .qp-bom-table thead th {
        background-color: #E8F4FA !important;
    }

    .qp-bom-table td {
        background-color: #fff !important;
    }

    .qp-bom-table .bom-section-header td {
        background-color: #f5f5f5 !important;
    }

    .qp-grand-total-row td {
        background-color: #E8F4FA !important;
    }

    .qp-savings-table thead th {
        background-color: #E8F4FA !important;
    }

    .qp-pricing-table td {
        border: 1px solid #d0d0d0 !important;
    }

    .qp-info-header-row .qp-info-header-cell {
        background-color: #E8F4FA !important;
    }

    /* --- Note boxes --- */
    .qp-note-box {
        background: #fafafa !important;
        border: 1px solid #d0d0d0 !important;
        border-left: 4px solid #1a1a1a !important;
    }

    .qp-subsidy-box {
        border-left: 4px solid #2ecc71 !important;
    }

    /* --- Highlight box --- */
    .qp-highlight-box {
        background: #E8F4FA !important;
        border: 1px solid #d0d0d0 !important;
    }

    /* --- Page 3: Address grid (restore row layout) --- */
    .qp-address-grid {
        display: flex !important;
        flex-direction: row !important;
        gap: 20px !important;
    }

    .qp-addr-card {
        border: 1px solid #e0e0e0 !important;
    }

    .qp-addr-header {
        background: #f5f5f5 !important;
        border-bottom: 1px solid #e0e0e0 !important;
    }

    .qp-addr-icon {
        transform: none !important;
    }

    /* --- Page 3: Financial strip (restore row layout) --- */
    .qp-financial-strip {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 0 !important;
        background: #fafafa !important;
        border: 1px solid #d0d0d0 !important;
    }

    .qp-fin-divider {
        display: block !important;
        width: 1px !important;
        height: 40px !important;
        background: #e0e0e0 !important;
        margin: 0 10px !important;
    }

    /* --- Page 3: Amount in words --- */
    .qp-amount-words {
        background: #fafafa !important;
        border: 1px solid #d0d0d0 !important;
    }

    /* --- Page 3: Payment steps (restore row layout) --- */
    .qp-payment-steps {
        display: flex !important;
        flex-direction: row !important;
        gap: 0 !important;
    }

    .qp-step {
        display: flex !important;
    }

    .qp-step-badge {
        background: #2980b9 !important;
        color: white !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50% !important;
    }

    /* --- Page 3: Bank card (restore row layout) --- */
    .qp-bank-card {
        border: 1px solid #d0d0d0 !important;
    }

    .qp-bank-header {
        background: #E8F4FA !important;
        color: #1a1a1a !important;
        border-bottom: 1px solid #d0d0d0 !important;
    }

    .qp-bank-flex {
        display: flex !important;
        flex-direction: row !important;
        gap: 40px !important;
    }

    /* --- Page 4: Comparison cards (restore row layout) --- */
    .qp-comparison-container {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 20px !important;
    }

    .qp-comparison-card {
        border: 1px solid #d0d0d0 !important;
    }

    .qp-card-before .qp-card-header {
        background-color: #ffebee !important;
        color: #c62828 !important;
    }

    .qp-card-after .qp-card-header {
        background-color: #e8f5e9 !important;
        color: #2e7d32 !important;
    }

    .qp-savings-badge {
        background: #e8f5e9 !important;
        color: #2e7d32 !important;
        border: 1px solid #c8e6c9 !important;
    }

    .qp-bill-bar-container {
        background: #f5f5f5 !important;
    }

    .qp-bar-red {
        background: #ef5350 !important;
    }

    .qp-bar-green {
        background: #66bb6a !important;
    }

    /* --- Page 5: Terms section --- */
    .qp-terms-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
    }

    .qp-terms-card {
        border: 1px solid #d0d0d0 !important;
        page-break-inside: avoid !important;
    }

    .qp-terms-header {
        background-color: #f8f9fa !important;
    }

    .qp-scope-card {
        border-top: 3px solid #3498db !important;
    }

    .qp-exclusion-card {
        border-top: 3px solid #e74c3c !important;
    }

    .qp-responsibility-card {
        border-top: 3px solid #27ae60 !important;
    }

    .qp-general-terms {
        border-top: 3px solid #2c3e50 !important;
    }

    .qp-resp-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
    }

    /* --- Page 5: After-sales box --- */
    .qp-aftersales-box {
        background: #f0f7fa !important;
        border: 1px solid #d0e4ed !important;
        border-left: 3px solid #3498db !important;
    }

    /* --- Page 5: Signature section --- */
    .qp-signature-section {
        display: flex !important;
        justify-content: space-between !important;
    }

    .qp-signature-box {
        border-bottom: 1px solid #333 !important;
    }

    /* --- Page 5: Thank you section --- */
    .qp-thankyou-section {
        border-top: 1px dashed #ccc !important;
    }

    .qp-thankyou-contact {
        display: flex !important;
        flex-direction: row !important;
        gap: 25px !important;
    }

    .qp-disclaimer {
        background: transparent !important;
    }

    /* --- Page 5: Flex layout (push content to bottom) --- */
    .qp-page-flex {
        display: flex !important;
        flex-direction: column !important;
        height: calc(100vh - 32mm) !important;
    }

    .qp-page5-content {
        flex: 1 1 auto !important;
    }

    .qp-page5-bottom {
        margin-top: auto !important;
    }

    /* --- Checklist markers --- */
    .qp-checklist li::before {
        color: #3498db !important;
    }

    .qp-exclusion-card .qp-checklist li::before {
        color: #e74c3c !important;
    }

    /* --- Footer positioning (matches desktop preview layout) --- */
    .qp-page-footer {
        position: absolute !important;
        bottom: 8mm !important;
        left: 15mm !important;
        right: 15mm !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        text-align: left !important;
        gap: 0 !important;
        margin-top: 0 !important;
        border-top: 1px solid #d0d0d0 !important;
        padding-top: 6px !important;
        font-size: 8pt !important;
        color: #666 !important;
    }

    .qp-cover-footer {
        position: absolute !important;
        bottom: 18mm !important;
        left: 0 !important;
        right: 0 !important;
        border-top: 1px solid #d0d0d0 !important;
    }
}