body,
input,
textarea,
select,
button {
    font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans KR",
        "Malgun Gothic", Arial, sans-serif;
}

.preview-frame {
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 12px;
    background: #f8fafc;
    overflow: auto;
    max-height: 70vh;
}

.page {
    display: flex;
    flex-direction: column;
    background: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 12px;
    box-sizing: border-box;
    break-inside: avoid;
    page-break-after: always;
}

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

.page-header,
.page-footer {
    flex: 0 0 auto;
    color: #475569;
    text-align: center;
    font-size: 12px;
}

.page-body {
    flex: 1 1 auto;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-size: 12px;
}

/* 기존 .lines는 컨테이너 역할만 */
.lines {
    display: block; /* grid → block 로 단순화 */
}

/* 한 줄(줄번호+내용)을 감싸는 행 */
.line-row {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 8px;
    align-items: start;

    /* 페이지 분리 금지 (html2pdf가 인식) */
    break-inside: avoid;
    page-break-inside: avoid;
}

/* 줄번호/내용 기본 스타일 */
.line-row .ln {
    color: #94a3b8;
    text-align: right;
    user-select: none;
    padding-right: 4px;
}
.line-row .lt {
    min-width: 0; /* 긴 단어 줄바꿈 안전장치 */
    overflow-wrap: anywhere;
    word-break: break-word;
}
