/* Formal document sheet — compact layout */
.doc-sheet {
    background: #fff;
    color: #0f172a;
    font-size: .82rem;
    line-height: 1.35;
}
.doc-sheet-print {
    padding: 10mm 10mm;
    min-height: 277mm;
    box-shadow: 0 4px 24px rgba(15, 23, 42, .12);
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}
.doc-sheet-print .doc-sheet-items-wrap {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 6rem;
}
.doc-sheet-print .doc-sheet-table {
    flex: 1 1 auto;
    height: 100%;
    width: 100%;
    margin: 0 !important;
}
.doc-sheet-print .doc-sheet-table tbody {
    height: 100%;
}
.doc-sheet-print .doc-sheet-table-filler {
    height: 100%;
}
.doc-sheet-print .doc-sheet-table-filler td {
    height: 100%;
    min-height: 2rem;
    padding: 0 !important;
    vertical-align: top;
    border-top: none !important;
    background: #fff;
}
.doc-sheet-print .doc-sheet-bottom {
    flex-shrink: 0;
    margin-top: .45rem;
}
.doc-sheet-print .doc-sheet-bottom .doc-sheet-summary {
    margin-top: 0;
}
.demo-doc-preview .doc-sheet {
    border: none;
    padding: 0;
}
.doc-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .75rem;
    border-bottom: 2px solid #1e3a5f;
    padding-bottom: .55rem;
    margin-bottom: .65rem;
}
.doc-sheet-logo {
    max-height: 44px;
    max-width: 180px;
    object-fit: contain;
    margin-bottom: .35rem;
    display: block;
}
.doc-sheet-issuer-name {
    font-size: .95rem;
    font-weight: 700;
    color: #0f172a;
}
.doc-sheet-issuer-line {
    font-size: .74rem;
    color: #475569;
    margin-top: .1rem;
    line-height: 1.3;
}
.doc-sheet-title { text-align: right; min-width: 168px; flex-shrink: 0; }
.doc-sheet-type {
    font-size: 1.12rem;
    font-weight: 800;
    color: #1e3a5f;
    margin: 0 0 .2rem;
    letter-spacing: .02em;
}
.doc-sheet-meta-row {
    font-size: .76rem;
    display: flex;
    justify-content: flex-end;
    gap: .35rem;
    line-height: 1.35;
}
.doc-sheet-subject {
    margin-bottom: .45rem;
    padding: .35rem .55rem;
    background: #f8fafc;
    border-radius: 4px;
    font-size: .78rem;
}
.doc-sheet-parties { margin-bottom: .45rem; }
.doc-sheet-parties--compact {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .15rem .35rem;
    padding: .35rem .55rem;
    background: #fafbfc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: .78rem;
}
.doc-sheet-parties--compact .doc-sheet-party-label {
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
    font-size: .74rem;
}
.doc-sheet-parties--compact .doc-sheet-party-name {
    font-size: .84rem;
}
.doc-sheet-parties--compact .doc-sheet-party-meta {
    font-size: .72rem;
    color: #64748b;
}
.doc-sheet-parties--compact .doc-sheet-party-extra {
    width: 100%;
    font-size: .72rem;
    color: #64748b;
    line-height: 1.3;
}
.doc-sheet-party-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    margin-bottom: .15rem;
}
.doc-sheet-party-name { font-weight: 700; font-size: .88rem; }
.doc-sheet-party-line { font-size: .76rem; color: #475569; }
.doc-sheet-table {
    font-size: .76rem;
    margin: .45rem 0 !important;
}
.doc-sheet-table thead th {
    background: #f1f5f9;
    font-weight: 600;
    border-color: #cbd5e1 !important;
    padding: .28rem .4rem !important;
    font-size: .72rem;
}
.doc-sheet-table td {
    border-color: #e2e8f0 !important;
    vertical-align: top;
    padding: .28rem .4rem !important;
}
.doc-item-detail {
    font-size: .7rem;
    color: #64748b;
    margin-top: .1rem;
    line-height: 1.3;
    white-space: pre-wrap;
    word-break: break-word;
}
.doc-sheet-summary {
    display: flex;
    justify-content: flex-end;
    margin-top: .45rem;
}
.doc-sheet-summary-box {
    min-width: 220px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: .4rem .6rem;
    background: #fafbfc;
}
.doc-sheet-sum-row {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    padding: .12rem 0;
    font-size: .78rem;
}
.doc-sheet-sum-grand {
    margin-top: .25rem;
    padding-top: .3rem;
    border-top: 2px solid #1e3a5f;
    font-size: .88rem;
    color: #1e3a5f;
}
.doc-sheet-sum-thai {
    margin-top: .45rem;
    padding: .35rem .55rem;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #f8fafc;
    font-size: .74rem;
    line-height: 1.4;
}
.doc-sheet-sum-thai-label {
    font-weight: 600;
    color: #475569;
    margin-right: .35rem;
    white-space: nowrap;
}
.doc-sheet-sum-thai-text {
    color: #0f172a;
}
.doc-sheet-notes {
    margin-top: .45rem;
    font-size: .74rem;
    color: #334155;
    line-height: 1.35;
}
.doc-sheet-notes + .doc-sheet-notes {
    margin-top: .25rem;
}
.doc-sheet-signatures {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
    margin-top: 1.25rem;
    padding-top: .65rem;
    page-break-inside: avoid;
}
.doc-sig-block { text-align: center; min-height: 108px; }
.doc-sig-space {
    height: 40px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    margin-bottom: .15rem;
}
.doc-sig-img { max-height: 38px; max-width: 140px; object-fit: contain; }
.doc-sig-line {
    border-bottom: 1px solid #334155;
    margin: 0 auto .35rem;
    width: 85%;
}
.doc-sig-label { font-weight: 600; font-size: .76rem; }
.doc-sig-name { font-size: .74rem; margin-top: .1rem; }
.doc-sig-title { font-size: .7rem; color: #64748b; }
.doc-sig-date { font-size: .7rem; color: #64748b; margin-top: .25rem; }
.doc-sheet-footer {
    margin-top: .75rem;
    padding-top: .35rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    font-size: .65rem;
    color: #94a3b8;
    letter-spacing: .01em;
}
.issuer-sig-pad canvas {
    display: block;
    width: 100%;
    height: 120px;
    cursor: crosshair;
    touch-action: none;
}
@media print {
    .doc-sheet-print {
        padding: 8mm 8mm;
        min-height: calc(297mm - 16mm);
        box-shadow: none;
        border: none;
    }
    .doc-sheet-signatures { margin-top: .85rem; }
    .doc-sheet-sum-thai { background: #fff; }
}
