
/* =========================================
   CNC COST PRO — KOMPAKTOWY WYDRUK A4
   Wersja jednostronicowa
   ========================================= */

@page {
    size: A4 portrait;
    margin: 7mm;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: #ffffff;
    color: #202b3c;
    font-family: Arial, Helvetica, sans-serif;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.pdf-document {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: #ffffff;
    color: #202b3c;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 9pt;
    line-height: 1.3;
}

/* NAGŁÓWEK */

.pdf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin: 0 0 4mm;
    padding: 0 0 3mm;
    border-bottom: 2pt solid #1769e0;
}

.pdf-brand {
    margin: 0;
    color: #17243a;
    font-size: 19pt;
    font-weight: 800;
    letter-spacing: -0.5pt;
    line-height: 1.1;
}

.pdf-brand span {
    color: #1769e0;
}

.pdf-brand small {
    display: block;
    margin-top: 1mm;
    color: #64748b;
    font-size: 7pt;
    font-weight: 700;
    letter-spacing: 1pt;
}

.pdf-date {
    color: #64748b;
    font-size: 7pt;
    text-align: right;
}

/* TYTUŁ */

.pdf-title {
    margin: 0 0 1mm;
    color: #17243a;
    font-size: 18pt;
    font-weight: 800;
    line-height: 1.15;
}

.pdf-subtitle {
    margin: 0 0 3.5mm;
    color: #64748b;
    font-size: 8pt;
}

/* SEKCJE */

.pdf-section {
    display: block;
    width: 100%;
    margin: 3mm 0 0;
    padding: 0;
}

.pdf-section h2 {
    margin: 0 0 1.5mm;
    padding: 0 0 1mm;
    border-bottom: 0.6pt solid #dce3ed;
    color: #1769e0;
    font-size: 8pt;
    font-weight: 700;
    letter-spacing: 0.3pt;
    text-transform: uppercase;
}

/* KARTY INFORMACYJNE */

.pdf-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5mm;
    width: 100%;
}

.pdf-info {
    min-width: 0;
    margin: 0;
    padding: 2mm 2.5mm;
    border: 0.6pt solid #e3e9f1;
    border-radius: 1.5mm;
    background: #f4f7fb !important;
    overflow-wrap: anywhere;
}

.pdf-info span {
    display: block;
    margin: 0 0 0.5mm;
    color: #64748b;
    font-size: 6.5pt;
    letter-spacing: 0.2pt;
    text-transform: uppercase;
}

.pdf-info strong {
    display: block;
    color: #17243a;
    font-size: 8pt;
}

/* TABELA KOSZTÓW */

.pdf-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 8pt;
}

.pdf-table th {
    padding: 1.7mm 2.5mm;
    background: #17243a !important;
    color: #ffffff !important;
    font-size: 7pt;
    text-align: left;
    text-transform: uppercase;
}

.pdf-table th:first-child,
.pdf-table td:first-child {
    width: 70%;
}

.pdf-table th:last-child,
.pdf-table td:last-child {
    width: 30%;
    text-align: right;
}

.pdf-table td {
    padding: 1.5mm 2.5mm;
    border-bottom: 0.5pt solid #e3e9f1;
    color: #263449;
}

.pdf-table tbody tr:nth-child(even) td {
    background: #f6f8fb !important;
}

.pdf-table tbody tr.total td {
    background: #edf3fc !important;
    font-weight: 700;
}

/* CENA KOŃCOWA */

.pdf-final {
    display: block;
    width: 100%;
    margin: 4mm 0 0;
    padding: 3.5mm 4mm;
    border-radius: 1.5mm;
    background: #17243a !important;
    color: #ffffff !important;
    break-inside: avoid;
    page-break-inside: avoid;
}

.pdf-final-label {
    color: #cbd5e1;
    font-size: 7pt;
    letter-spacing: 0.4pt;
    text-transform: uppercase;
}

.pdf-final-price {
    margin: 1mm 0;
    color: #ffffff;
    font-size: 19pt;
    font-weight: 800;
    line-height: 1.1;
}

.pdf-final-total {
    color: #dbeafe;
    font-size: 8pt;
}

/* UWAGA I STOPKA */

.pdf-note {
    margin: 3mm 0 0;
    padding: 2mm 2.5mm;
    border-left: 2pt solid #1769e0;
    background: #f4f7fb !important;
    color: #64748b;
    font-size: 6.5pt;
    line-height: 1.3;
    break-inside: avoid;
    page-break-inside: avoid;
}

.pdf-footer {
    margin: 3mm 0 0;
    padding: 2mm 0 0;
    border-top: 0.6pt solid #dce3ed;
    color: #94a3b8;
    font-size: 6.5pt;
    text-align: center;
}

/* PODGLĄD NA EKRANIE */

@media screen {
    body {
        padding: 8mm;
    }

    .pdf-document {
        max-width: 196mm;
        margin: 0 auto;
    }
}

/* WYDRUK — JEDNA STRONA */

@media print {
    html,
    body {
        width: auto;
        height: auto;
        margin: 0;
        padding: 0;
    }

    .pdf-document {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .pdf-section,
    .pdf-info-grid,
    .pdf-table {
        break-inside: auto;
        page-break-inside: auto;
    }

    .pdf-info,
    .pdf-final,
    .pdf-note,
    .pdf-footer {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
