@page {
    size: A4 portrait;
    margin: 1.35cm 1.25cm;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    color: #000;
    background: #e9e9e9;
    font-family: "TH Sarabun New", "Sarabun", "Kanit", sans-serif;
    font-size: 16px;
    line-height: 1.45;
}

.print-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #111;
    color: #fff;
    font-family: "Sarabun", sans-serif;
}

.print-toolbar a,
.print-toolbar button,
.print-toolbar select {
    min-height: 34px;
    border: 1px solid #bbb;
    border-radius: 4px;
    padding: 6px 10px;
    font: inherit;
}

.print-toolbar a {
    color: #fff;
    text-decoration: none;
}

.print-toolbar button {
    background: #fff;
    color: #111;
    cursor: pointer;
}

.toolbar-form {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 0 auto;
}

.paper-sheet {
    width: 210mm;
    min-height: 297mm;
    margin: 12px auto;
    padding: 0;
    background: #fff;
    box-shadow: 0 0 8px rgba(0, 0, 0, .18);
}

.paper-header {
    display: grid;
    grid-template-columns: 108px 1fr;
    gap: 12px;
    align-items: stretch;
    margin-bottom: 12px;
}

.paper-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 94px;
    border: 1.5px solid #000;
    text-align: center;
    font-weight: 700;
    line-height: 1.2;
}

.paper-logo img,
.report-header img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    margin-bottom: 4px;
}

.paper-title-box {
    min-height: 94px;
    padding: 10px 12px;
    border: 1.5px solid #000;
    text-align: center;
    font-size: 17px;
    line-height: 1.55;
}

.paper-intro {
    margin: 8px 0 12px;
}

.paper-intro p,
.paper-lines p {
    margin: 5px 0;
}

.employment-paper-header {
    grid-template-columns: 82px 1fr;
    gap: 0;
    margin-bottom: 26px;
}

.employment-paper-header .paper-logo {
    min-height: 76px;
    border-right: 0;
}

.employment-paper-header .paper-logo img {
    width: 52px;
    height: 52px;
    margin-bottom: 0;
}

.employment-paper-header .paper-logo div {
    display: none;
}

.employment-paper-header .paper-title-box {
    display: flex;
    min-height: 76px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    font-size: 16px;
    line-height: 1.8;
}

.employment-paper-intro {
    line-height: 1.9;
}

.employment-paper-intro p {
    margin: 9px 0;
}

.employment-section-line {
    margin: 16px 0 10px;
    font-weight: 400;
}

.employment-first-lines p {
    margin: 6px 0;
}

.indent {
    padding-left: 28px;
}

.paper-section-title {
    margin: 12px 0 8px;
    padding: 5px 8px;
    border: 1.5px solid #000;
    font-weight: 700;
    background: #fff;
}

.paper-topic-title {
    margin: 10px 0 6px;
    padding: 4px 8px;
    border-left: 4px solid #000;
    font-weight: 700;
}

.line-value {
    display: inline-block;
    min-height: 20px;
    padding: 0 5px 1px;
    vertical-align: baseline;
    border-bottom: 1px dotted #000;
    word-break: break-word;
}

.line-value.blank::after {
    content: "\00a0";
}

.long-line {
    display: block;
    min-height: 23px;
    border-bottom: 1px dotted #000;
    padding: 0 4px 1px;
}

.long-line.filled {
    white-space: normal;
}

.option-row {
    display: inline;
}

.option-item {
    display: inline-block;
    margin-right: 13px;
    white-space: nowrap;
}

.paper-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 13px;
    height: 13px;
    margin-right: 4px;
    border: 1.2px solid #000;
    font-size: 13px;
    line-height: 1;
    vertical-align: -1px;
}

.score-note {
    margin: 4px 0 7px;
    font-size: 14px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

.quality-print-table th,
.quality-print-table td,
.report-table th,
.report-table td {
    border: 1px solid #000;
    padding: 4px 5px;
    vertical-align: top;
}

.quality-print-table th {
    text-align: center;
    font-weight: 700;
}

.quality-print-table .quality-name {
    width: 62%;
}

.quality-print-table th:not(.quality-name),
.quality-print-table .score-cell {
    width: 7.6%;
    text-align: center;
    vertical-align: middle;
}

.quality-group td {
    font-weight: 700;
    background: #f3f3f3;
}

.signature-grid {
    display: grid;
    grid-template-columns: 210px 1fr;
    gap: 24px;
    align-items: end;
    margin-top: 14px;
}

.stamp-box {
    height: 118px;
    border: 1.5px solid #000;
    padding: 8px;
    text-align: center;
}

.stamp-box div {
    margin-top: 22px;
}

.signature-box {
    text-align: center;
}

.signature-box p {
    margin: 8px 0;
}

.thank-text {
    margin-top: 16px;
    text-align: center;
    font-weight: 700;
}

.report-sheet h1,
.report-sheet h2,
.report-sheet p {
    margin-top: 0;
}

.report-header {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 12px;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #000;
    text-align: center;
}

.report-header h1 {
    margin-bottom: 4px;
    font-size: 20px;
    line-height: 1.35;
}

.report-header p {
    margin-bottom: 2px;
}

.report-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 12px 0;
}

.report-meta div {
    border: 1px solid #000;
    padding: 8px;
    text-align: center;
}

.report-sheet h2 {
    margin: 12px 0 7px;
    font-size: 17px;
}

.report-table th {
    text-align: center;
    background: #f3f3f3;
}

.report-table .num {
    width: 96px;
    text-align: right;
}

.total-row td {
    font-weight: 700;
}

.chart-print-box {
    height: 260px;
    border: 1px solid #000;
    padding: 10px;
}

.item-average-table {
    font-size: 14px;
}

.suggestion-list li {
    margin-bottom: 8px;
}

.page-break {
    break-before: page;
    page-break-before: always;
}

@media screen {
    .paper-sheet {
        padding: 1.35cm 1.25cm;
    }
}

@media print {
    html,
    body {
        width: 210mm;
        background: #fff;
        font-size: 15px;
    }

    .no-print,
    .print-toolbar,
    nav,
    aside,
    footer,
    .app-navbar,
    .admin-sidebar,
    .app-footer {
        display: none !important;
    }

    .paper-sheet {
        width: auto;
        min-height: auto;
        margin: 0;
        padding: 0;
        box-shadow: none;
        break-after: page;
        page-break-after: always;
    }

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

    .paper-section-title,
    table,
    tr,
    .signature-grid,
    .stamp-box {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .chart-print-box {
        height: 250px;
    }
}
