/* 기본 스타일 */
@media print {
    body { margin: 0; padding: 0; display: block !important; }
    .container, .tab, .print-btn, .save-btn, .no-print, #historyPanel, #historyOverlay, #versionModal, .history-btn { display: none !important; }
    .tabcontent { display: none !important; }
    .tabcontent.active { display: block !important; }
    .print-page { page-break-after: always; margin: 0; padding: 10mm; }
    .print-page:last-child { page-break-after: auto; }
}

* { box-sizing: border-box; mso-style-parent: style0; }

body {
    font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;
    font-size: 10pt;
    margin: 0;
    padding: 0;
    background-color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.container {
    width: 100%;
    max-width: none;
    margin: 0;
    background: white;
    padding: 10px;
    box-shadow: none;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.print-page {
    width: 210mm;
    min-height: 297mm;
    padding: 10mm;
    margin: 20px;
    background: white;
    box-shadow: none;
    display: flex;
    justify-content: center;
    page-break-after: always;
    break-after: page;
}

.print-page table {
    page-break-inside: avoid;
    break-inside: avoid;
}

.print-page .table-container {
    max-width: 100%;
    overflow-x: auto;
}

.print-page table {
    table-layout: fixed;
    width: 100% !important;
}

.tab {
    overflow: hidden;
    border: 1px solid #ccc;
    background: #f1f1f1;
    margin-bottom: 20px;
}

.tab button {
    background: inherit;
    float: left;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 14px 16px;
    font-size: 14px;
}

.tab button:hover { background: #ddd; }
.tab button.active { background: #007bff; color: white; }

.tabcontent { display: none; }
.tabcontent.active { display: block; }

.print-btn {
    background: #007bff;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
.print-btn:hover { background: #0056b3; }

.save-btn {
    background: #28a745;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
.save-btn:hover { background: #218838; }
.save-btn:disabled { background: #6c757d; cursor: not-allowed; }

.no-data { text-align: center; color: #666; padding: 20px; }

/* 엑셀 테이블 스타일 오버라이드 */
.excel-table {
    border-collapse: collapse;
    width: 100%;
}

/* 모든 테이블 td 에 padding 적용 - 계획서, 일지, 평가서 공통 */
table td {
    color: black;
    font-size: 9pt;
    white-space: normal;
    vertical-align: top;
    overflow: visible;
    padding: 2px 6px !important;
    line-height: 1.2;
}

/* 문서 제목 - 크게 and 굵게 */
td.xl147 {
    font-size: 18pt !important;
    font-weight: bold !important;
}

/* 라벨 셀 상하, 좌우 가운데 정렬 */
td.xl80, td.xl82, td.xl66, td.xl76, td.xl74, td.xl75, td.xl90 {
    text-align: center !important;
    vertical-align: middle !important;
    font-weight: normal !important;
}

/* 데이터 셀 */
.data-cell {
    color: black;
    font-size: 10pt;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 테이블 행 높이 강제 초기화 */
table tr {
    height: auto !important;
    min-height: 0 !important;
}

/* 제목 스타일 */
.doc-title {
    font-size: 18pt;
    font-weight: bold;
    text-align: center;
    margin: 0 0 10px 0;
}

/* 만족도조사 테이블 */
.survey-table {
    width: 100%;
    border-collapse: collapse;
}

.survey-table td {
    border: 1px solid black;
    padding: 8px 10px;
    font-size: 10pt;
}

.survey-table td.label {
    background: #f0f0f0;
    text-align: center;
    font-weight: bold;
    width: 50px;
}

/* 입력 textarea 스타일 */
.editable-cell {
    width: 100%;
    min-height: 1em;
    border: none;
    background: transparent;
    font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;
    font-size: 9pt;
    resize: none;
    padding: 0 4px;
    margin: 0;
    overflow: hidden;
    line-height: 1.2;
    box-sizing: border-box;
}
.editable-cell:focus {
    background: #f8f8f8;
    outline: 1px solid #007bff;
}

/* 서명 칸 고정 높이 - tr 에 적용 */
tr.signature-row {
    height: 40pt !important;
    min-height: 40pt !important;
    max-height: 40pt !important;
}

tr.signature-row td {
    height: 40pt !important;
    min-height: 40pt !important;
    max-height: 40pt !important;
}
