/* ============================================================
   A4 DOCUMENTS — High-fidelity A4 Layouts for Invoices & Receipts
   ============================================================ */

.a4-document-sheet {
    box-sizing: border-box;
    width: 210mm;
    min-height: 297mm;
    max-width: 100%;
    margin: 1.5rem auto 3rem auto;
    padding: 14mm 16mm;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    position: relative;
}

.a4-header-grid {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding-bottom: 0.5rem;
}

.a4-logo-wrap img {
    width: 76px;
    height: 76px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 4px;
    background: #ffffff;
}

.a4-institution-details {
    flex: 1;
}

.a4-school-name {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.a4-school-tagline {
    font-size: 0.78rem;
    color: #64748b;
    font-weight: 500;
    margin-top: 3px;
}

.a4-school-address,
.a4-school-contact {
    font-size: 0.75rem;
    color: #475569;
    margin-top: 2px;
    line-height: 1.35;
}

.a4-doc-badge-wrap {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
}

.a4-doc-type-badge {
    background: #0f172a;
    color: #ffffff;
    font-weight: 800;
    font-size: 0.78rem;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: inline-block;
    white-space: nowrap;
}

.a4-session-badge {
    font-size: 0.75rem;
    color: #475569;
    background: #f1f5f9;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
}

.a4-divider-strip {
    height: 3px;
    background: linear-gradient(90deg, #15803d, #2563eb, #15803d);
    border-radius: 2px;
    margin: 0.5rem 0 1rem 0;
}

.a4-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.a4-meta-col {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.a4-meta-item {
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #334155;
}

.a4-meta-item span {
    color: #64748b;
    font-weight: 500;
}

.a4-meta-item strong {
    color: #0f172a;
}

.a4-meta-item code {
    background: #e2e8f0;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.82rem;
    color: #0f172a;
}

.a4-table-wrapper {
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.a4-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.a4-data-table th {
    background: #f1f5f9;
    color: #1e293b;
    padding: 0.55rem 0.75rem;
    font-weight: 700;
    border-bottom: 2px solid #cbd5e1;
}

.a4-data-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    color: #1e293b;
}

.a4-data-table tbody tr:last-child td {
    border-bottom: none;
}

.a4-totals-section {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.a4-words-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.a4-words-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.5px;
}

.a4-words-text {
    font-size: 0.82rem;
    font-weight: 700;
    color: #0f172a;
    font-style: italic;
    margin: 0.25rem 0 0.5rem 0;
}

.a4-instructions-box {
    font-size: 0.72rem;
    color: #64748b;
    border-top: 1px dashed #cbd5e1;
    padding-top: 0.5rem;
    line-height: 1.4;
}

.a4-totals-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.a4-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #334155;
}

.a4-grand-total {
    border-top: 2px solid #cbd5e1;
    padding-top: 0.4rem;
    font-size: 0.95rem;
    font-weight: 800;
    color: #0f172a;
}

.a4-footer-strip {
    margin-top: auto;
    padding-top: 1rem;
}

.a4-disclaimer {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.a4-signatures-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
    text-align: center;
}

.a4-sig-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.72rem;
    color: #475569;
    font-weight: 600;
}

.a4-sig-line {
    width: 75%;
    height: 1px;
    background: #475569;
    margin-bottom: 0.4rem;
}

/* Responsive view adjustments — screen only, never deform print */
@media screen and (max-width: 768px) {
    .a4-document-sheet {
        padding: 1rem;
        margin: 0.5rem auto;
        box-shadow: none;
        border: 1px solid #e2e8f0;
    }
    .a4-header-grid {
        flex-direction: column;
        text-align: center;
    }
    .a4-doc-badge-wrap {
        align-items: center;
        text-align: center;
    }
    .a4-meta-grid {
        grid-template-columns: 1fr;
    }
    .a4-totals-section {
        grid-template-columns: 1fr;
    }
    .a4-signatures-row {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .a4-table-wrapper {
        overflow-x: auto;
    }
}

