:root {
    --app-primary: #176b87;
    --app-primary-dark: #0f4052;
    --app-accent: #2d8f73;
    --app-bg: #eef3f7;
    --app-text: #172033;
    --app-muted: #667085;
    --app-border: #d9e2ea;
}

body {
    background: var(--app-bg);
    color: var(--app-text);
    font-family: Arial, Helvetica, sans-serif;
}

.app-navbar {
    background: linear-gradient(90deg, var(--app-primary-dark), var(--app-primary));
    box-shadow: 0 8px 24px rgba(15, 64, 82, 0.18);
}

.page-heading {
    max-width: 720px;
}

.app-card {
    border-radius: 8px;
    overflow: hidden;
}

.form-label {
    color: #27364a;
    font-weight: 600;
}

.form-control,
.form-select {
    border-color: var(--app-border);
    border-radius: 6px;
    min-height: 44px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 0.2rem rgba(23, 107, 135, 0.16);
}

.readonly-field {
    background: #f6f8fb;
    color: #9b1c1c;
    font-weight: 700;
}

.btn {
    border-radius: 6px;
    font-weight: 600;
}

.btn-primary {
    background: var(--app-primary);
    border-color: var(--app-primary);
}

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

.app-table thead th {
    background: #f7fafc;
    color: #43536a;
    font-size: 0.82rem;
    letter-spacing: 0;
    text-transform: uppercase;
    white-space: nowrap;
}

.app-table td {
    white-space: nowrap;
}

.action-buttons .btn {
    min-width: 58px;
}

.receipt-body {
    background: #e8eef4;
}

.receipt-wrapper {
    max-width: 840px;
}

.receipt-paper {
    position: relative;
    overflow: hidden;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #d7dee8;
    box-shadow: 0 14px 34px rgba(23, 32, 51, 0.1);
    padding: 24px;
}

.receipt-top-band {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: #182153;
}

.receipt-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding-top: 8px;
    padding-bottom: 16px;
    border-bottom: 1px solid #dce4ee;
}

.receipt-logo {
    width: 82px;
    height: 82px;
    object-fit: contain;
    border-radius: 50%;
    border: 2px solid #f3b61f;
    background: #ffffff;
    padding: 3px;
    flex: 0 0 auto;
}

.receipt-company {
    min-width: 0;
}

.receipt-company-name {
    color: #182153;
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.12;
}

.receipt-tagline {
    color: #7b9d19;
    font-weight: 700;
    font-size: 0.9rem;
}

.company-meta {
    display: grid;
    gap: 2px;
}

.company-meta span {
    color: var(--app-muted);
    font-size: 0.82rem;
    line-height: 1.35;
}

.receipt-meta-card {
    flex: 0 0 220px;
    border: 1px solid #d7e0ea;
    border-top: 3px solid #182153;
    border-radius: 8px;
    padding: 12px;
    background: #fbfcfe;
}

.receipt-title {
    display: inline-block;
    background: #fff4cf;
    color: #182153;
    border: 1px solid #ead089;
    border-radius: 6px;
    padding: 6px 10px;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.78rem;
}

.receipt-meta-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border-top: 1px dashed #cbd6e2;
    padding-top: 8px;
    margin-top: 8px;
    font-size: 0.9rem;
}

.receipt-meta-row span {
    color: var(--app-muted);
}

.receipt-meta-row strong {
    color: #182153;
}

.receipt-section-title {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0 10px;
}

.receipt-section-title span {
    color: #182153;
    border-left: 4px solid #182153;
    padding: 0 0 0 8px;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.receipt-section-title::after {
    content: "";
    height: 1px;
    flex: 1;
    background: #d8e1eb;
}

.receipt-details-table {
    position: relative;
    z-index: 1;
    border: 1px solid #d8e1eb;
    margin-bottom: 0;
    table-layout: fixed;
    font-size: 0.9rem;
}

.receipt-details-table th,
.receipt-details-table td {
    border: 1px solid #d8e1eb;
    padding: 8px 10px;
    vertical-align: middle;
}

.receipt-details-table th {
    width: 18%;
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
}

.receipt-details-table td {
    width: 32%;
    color: var(--app-text);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.receipt-table {
    position: relative;
    z-index: 1;
    border: 1px solid #d8e1eb;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0;
    font-size: 0.9rem;
}

.receipt-table th {
    background: #f3f6fa;
    color: #182153;
    padding: 8px 10px;
}

.receipt-table td {
    padding: 8px 10px;
}

.receipt-balance-row td {
    background: #fff1ed;
    color: #9b1c1c;
    font-size: 0.98rem;
    font-weight: 700;
}

.receipt-footer {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #dce4ee;
}

.signature-line {
    width: 170px;
    border-bottom: 2px solid #182153;
    margin-top: 28px;
}

.receipt-note {
    max-width: 360px;
    text-align: right;
}

.receipt-note strong,
.receipt-note span {
    display: block;
}

.receipt-note span {
    color: var(--app-muted);
    font-size: 0.82rem;
    margin-top: 4px;
}

@media (max-width: 767.98px) {
    .receipt-paper {
        padding: 22px;
    }

    .receipt-header,
    .receipt-footer {
        display: block;
    }

    .receipt-company {
        display: block !important;
        text-align: center;
    }

    .receipt-logo {
        margin-bottom: 14px;
    }

    .receipt-meta-card {
        margin-top: 20px;
    }

    .receipt-note {
        margin-top: 24px;
        text-align: left;
    }

    .receipt-footer .text-secondary {
        margin-top: 24px;
    }
}

@media print {
    @page {
        size: A4;
        margin: 10mm;
    }

    body {
        background: #ffffff;
        font-size: 12px;
        line-height: 1.25;
    }

    .no-print,
    .app-navbar {
        display: none !important;
    }

    .container,
    main.container {
        width: 100%;
        max-width: 100%;
        padding: 0 !important;
        margin: 0 auto !important;
    }

    .receipt-paper {
        box-shadow: none;
        border-radius: 0;
        border: 1px solid #d7dee8;
        width: 190mm;
        max-width: 190mm;
        min-height: auto;
        padding: 7mm;
        page-break-inside: avoid;
        break-inside: avoid;
        overflow: hidden;
    }

    .receipt-logo {
        width: 56px;
        height: 56px;
    }

    .receipt-company-name {
        font-size: 1rem;
        margin-bottom: 2px !important;
    }

    .receipt-tagline {
        font-size: 0.72rem;
        margin-bottom: 2px !important;
    }

    .company-meta span {
        font-size: 0.66rem;
        line-height: 1.2;
    }

    .receipt-meta-card {
        flex-basis: 176px;
        padding: 7px;
    }

    .receipt-header {
        padding-top: 6px;
        padding-bottom: 8px;
        gap: 10px;
    }

    .receipt-section-title {
        margin: 9px 0 5px;
    }

    .receipt-section-title span {
        font-size: 0.7rem;
    }

    .receipt-details-table {
        font-size: 0.72rem;
    }

    .receipt-details-table th,
    .receipt-details-table td {
        padding: 5px 6px;
    }

    .receipt-table {
        font-size: 0.74rem;
    }

    .receipt-table th,
    .receipt-table td {
        padding: 5px 6px;
    }

    .receipt-footer {
        margin-top: 10px;
        padding-top: 8px;
    }

    .signature-line {
        width: 145px;
        margin-top: 18px;
    }

    .receipt-note {
        max-width: 290px;
    }

    .receipt-note strong,
    .receipt-note span {
        font-size: 0.7rem;
    }

    .receipt-top-band {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .receipt-title,
    .receipt-section-title span,
    .receipt-table th,
    .receipt-balance-row td {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .receipt-wrapper {
        max-width: 100%;
    }
}
