/* ============================================================
   삼성아이앤비 폼닥터 Web - 공통 스타일
   ============================================================ */
:root {
    --hw-primary: #1b4f8a;
    --hw-primary-dark: #143c69;
    --hw-primary-light: #eaf1f9;
    --hw-accent: #2e9e6b;
    --hw-bg: #f4f6f9;
    --hw-border: #dde3ea;
    --hw-text: #2b3440;
    --hw-text-dim: #7b8794;
    --hw-danger: #c0392b;
    --sidebar-width: 265px;
    --header-height: 56px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: "Malgun Gothic", "맑은 고딕", "Segoe UI", sans-serif;
    font-size: 14px;
    color: var(--hw-text);
    background: var(--hw-bg);
}

h1:focus { outline: none; }

/* ---------- 전체 골격 ---------- */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.app-body {
    display: flex;
    flex: 1;
    min-height: 0; /* 사이드바 내부 스크롤을 위해 필요 */
}

/* ---------- 헤더 ---------- */
.app-header {
    height: var(--header-height);
    background: linear-gradient(90deg, var(--hw-primary-dark), var(--hw-primary));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 12px; }

.sidebar-toggle {
    background: rgba(255,255,255,.12);
    border: none;
    color: #fff;
    font-size: 17px;
    border-radius: 6px;
    padding: 5px 11px;
    cursor: pointer;
}

.sidebar-toggle:hover { background: rgba(255,255,255,.25); }

.brand-logo {
    background: #fff;
    color: var(--hw-primary);
    font-weight: 800;
    border-radius: 8px;
    padding: 6px 9px;
    font-size: 15px;
    letter-spacing: 1px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-title { font-size: 16px; font-weight: 700; }
.brand-sub { font-size: 11px; opacity: .75; }

.header-right { display: flex; align-items: center; gap: 18px; font-size: 13px; }
.header-date { opacity: .85; }
.header-user { background: rgba(255,255,255,.15); padding: 5px 12px; border-radius: 16px; }

/* ---------- 사이드바 ---------- */
.sidebar {
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid var(--hw-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: margin-left .18s ease;
}

.sidebar.collapsed {
    margin-left: calc(-1 * var(--sidebar-width));
    visibility: hidden;
}

.menu-search { padding: 12px 12px 8px; }

.menu-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--hw-border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
}

.menu-search input:focus {
    outline: none;
    border-color: var(--hw-primary);
    box-shadow: 0 0 0 2px rgba(27,79,138,.12);
}

.menu-groups { flex: 1; overflow-y: auto; padding: 4px 8px 8px; }

.menu-group { margin-bottom: 2px; }

.menu-group-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    padding: 9px 10px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    color: var(--hw-text);
    cursor: pointer;
    border-radius: 6px;
    text-align: left;
}

.menu-group-header:hover { background: var(--hw-primary-light); }
.menu-group.open .menu-group-header { background: var(--hw-primary-light); color: var(--hw-primary); }

.menu-icon { font-size: 15px; }
.menu-group-name { flex: 1; }

.menu-count {
    font-size: 11px;
    color: var(--hw-text-dim);
    background: var(--hw-bg);
    border-radius: 10px;
    padding: 1px 7px;
}

.menu-chevron { font-size: 11px; color: var(--hw-text-dim); }

.menu-items { list-style: none; margin: 2px 0 6px; padding: 0 0 0 30px; }

.menu-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: 13px;
    color: var(--hw-text);
    text-decoration: none;
    border-radius: 5px;
    border-left: 2px solid transparent;
}

.menu-item:hover { background: var(--hw-primary-light); color: var(--hw-primary); }

.menu-item.active {
    background: var(--hw-primary);
    color: #fff;
    font-weight: 600;
}

.menu-item.pending { color: var(--hw-text-dim); }

.badge-pending {
    font-size: 10px;
    color: #b58900;
    background: #fdf6e3;
    border: 1px solid #eee1b3;
    border-radius: 8px;
    padding: 0 5px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 10px 14px;
    border-top: 1px solid var(--hw-border);
    font-size: 12px;
    color: var(--hw-text-dim);
    text-align: center;
}

/* ---------- 본문 ---------- */
.content-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* 탭이 많아져도 그리드가 밀리지 않게 */
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
}

/* ---------- 열린 화면 탭 바 ---------- */
.tab-bar {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    background: #e8edf3;
    border-bottom: 1px solid var(--hw-border);
    padding: 6px 10px 0;
    overflow-x: auto;
    flex-shrink: 0;
}

.tab {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #f3f6f9;
    border: 1px solid var(--hw-border);
    border-bottom: none;
    border-radius: 7px 7px 0 0;
    padding: 7px 12px;
    font-size: 12.5px;
    color: var(--hw-text-dim);
    cursor: pointer;
    white-space: nowrap;
    max-width: 190px;
}

.tab:hover { background: #fff; color: var(--hw-text); }

.tab.active {
    background: var(--hw-bg);
    color: var(--hw-primary-dark);
    font-weight: 700;
    border-color: var(--hw-border);
    position: relative;
}

.tab.active::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 2px;
    background: var(--hw-bg);
}

.tab-title { overflow: hidden; text-overflow: ellipsis; }

.tab-close {
    font-size: 10px;
    color: var(--hw-text-dim);
    border-radius: 50%;
    width: 16px; height: 16px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.tab-close:hover { background: var(--hw-danger); color: #fff; }

.page-header { margin-bottom: 20px; }
.page-header h1 { margin: 0 0 6px; font-size: 22px; color: var(--hw-primary-dark); }
.page-desc { margin: 0; color: var(--hw-text-dim); font-size: 13.5px; }

/* ---------- 홈 대시보드 ---------- */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.dash-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid var(--hw-border);
    border-radius: 10px;
    padding: 16px;
    transition: box-shadow .15s, transform .15s;
}

.dash-card:hover {
    box-shadow: 0 4px 14px rgba(27,79,138,.13);
    transform: translateY(-2px);
}

.dash-card-icon {
    font-size: 26px;
    background: var(--hw-primary-light);
    border-radius: 10px;
    width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.dash-card-title { font-weight: 700; font-size: 14.5px; }
.dash-card-sub { font-size: 12px; color: var(--hw-text-dim); margin-top: 2px; }

.info-panel {
    background: #fff;
    border: 1px solid var(--hw-border);
    border-left: 4px solid var(--hw-accent);
    border-radius: 8px;
    padding: 16px 20px;
}

.info-title { font-weight: 700; margin-bottom: 8px; }
.info-panel ul { margin: 0; padding-left: 20px; line-height: 1.9; }

/* ---------- 자리표시(미구현) 화면 ---------- */
.placeholder-box {
    background: #fff;
    border: 1px dashed var(--hw-border);
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    max-width: 640px;
    margin: 40px auto;
}

.placeholder-icon { font-size: 44px; margin-bottom: 12px; }
.placeholder-title { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.placeholder-desc { color: var(--hw-text-dim); line-height: 1.8; margin-bottom: 24px; }

.btn-home {
    display: inline-block;
    background: var(--hw-primary);
    color: #fff;
    text-decoration: none;
    padding: 9px 22px;
    border-radius: 6px;
    font-size: 13.5px;
}

.btn-home:hover { background: var(--hw-primary-dark); }

/* ---------- 업무화면 공통: 툴바 / 버튼 / 입력 ---------- */
.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--hw-border);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.toolbar-spacer { flex: 1; }

.input {
    padding: 3px 8px;
    height: 27px;
    box-sizing: border-box;
    border: 1px solid var(--hw-border);
    border-radius: 5px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
}

textarea.input { height: auto; }

.input:focus {
    outline: none;
    border-color: var(--hw-primary);
    box-shadow: 0 0 0 2px rgba(27,79,138,.12);
}

.input:disabled { background: var(--hw-bg); color: var(--hw-text-dim); }

.select-narrow { width: 100px; }

.btn {
    padding: 4px 14px;
    height: 27px;
    box-sizing: border-box;
    border: 1px solid transparent;
    border-radius: 5px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary { background: var(--hw-primary); color: #fff; }
.btn-primary:hover { background: var(--hw-primary-dark); }

.btn-secondary { background: #fff; color: var(--hw-text); border-color: var(--hw-border); }
.btn-secondary:hover { background: var(--hw-primary-light); border-color: var(--hw-primary); color: var(--hw-primary); }

.btn-danger { background: #fff; color: var(--hw-danger); border-color: #e5b6b0; }
.btn-danger:hover { background: #fdf0ee; }

.alert {
    padding: 9px 14px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 13.5px;
}

.alert-ok { background: #eef8f1; border: 1px solid #bfe3cc; color: #1e7a43; }
.alert-error { background: #fdf0ee; border: 1px solid #eec5bf; color: var(--hw-danger); }

/* ---------- 업무화면 공통: 그리드 + 입력폼 분할 ---------- */
.split-panel {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.grid-panel {
    flex: 1;
    background: #fff;
    border: 1px solid var(--hw-border);
    border-radius: 8px;
    overflow: auto;
    max-height: calc(100vh - 290px);
    min-height: 200px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    background: var(--hw-primary-light);
    color: var(--hw-primary-dark);
    font-weight: 700;
    padding: 9px 8px;
    border-bottom: 2px solid var(--hw-border);
    position: sticky;
    top: 0;
    white-space: nowrap;
}

.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { background: #d4e4f3; }

/* 날짜 입력 오류 표시 (DateBox) */
.input.date-invalid { border-color: var(--hw-danger); background: #fff5f5; }

/* DateBox 달력 버튼 */
.datebox-btn {
    height: 27px;
    padding: 0 5px;
    border: 1px solid var(--hw-border);
    border-radius: 6px;
    background: #f6f8fb;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
}
.datebox-btn:hover { background: #e8eef6; }

/* 당일 목록(조회) 영역 — 입력(작성) 영역과 색으로 구분 (녹색 계열) */
.grid-panel.panel-day { border-left: 4px solid #6da34d; }
.grid-panel.panel-day > .form-panel-title {
    background: #eaf3e2;
    color: #3e6b2f;
    border-bottom-color: #cfe3bf;
}
.grid-panel.panel-day .data-table th { background: #eef5e8; color: #3e6b2f; }

/* 입력(작성) 영역 강조 — 파란 좌측 띠 */
.grid-panel.panel-input { border-left: 4px solid var(--hw-primary); }

.data-table td {
    padding: 7px 8px;
    border-bottom: 1px solid #eef1f5;
    white-space: nowrap;
}

.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: var(--hw-primary-light); }
.data-table tbody tr.selected { background: var(--hw-primary); color: #fff; }

.data-table .center { text-align: center; }
.data-table .right { text-align: right; }
.empty-row { color: var(--hw-text-dim); padding: 30px 0 !important; cursor: default; }

.grid-footer {
    padding: 8px 12px;
    font-size: 12.5px;
    color: var(--hw-text-dim);
    border-top: 1px solid var(--hw-border);
    position: sticky;
    bottom: 0;
    background: #fff;
}

.form-panel {
    width: 300px;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid var(--hw-border);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-panel .input { width: 100%; margin-bottom: 4px; }

/* 넓은 편집 폼 — 다단 그리드 (거래처/수주 등 필드 많은 화면용) */
.form-panel.wide { width: auto; flex-shrink: 1; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 2px 14px;
    align-items: end;
}
.form-grid .span2 { grid-column: span 2; }
.form-grid .span3 { grid-column: span 3; }
.form-grid .input { margin-bottom: 4px; }

/* 라벨 좌측 + 입력 우측 가로 배치 (거래처/자재/상품 등록 등) */
.form-grid.labels-left > div { display: flex; align-items: center; gap: 8px; }
.form-grid.labels-left > div > .form-label { margin: 0; min-width: 88px; flex-shrink: 0; }
.form-grid.labels-left > div > .input,
.form-grid.labels-left > div > div { flex: 1; min-width: 0; }
.form-grid.labels-left .input { margin-bottom: 3px; }

.form-panel-title {
    font-weight: 700;
    font-size: 14.5px;
    color: var(--hw-primary-dark);
    border-bottom: 2px solid var(--hw-primary-light);
    padding-bottom: 8px;
    margin-bottom: 10px;
}

.form-label { font-size: 12px; color: var(--hw-text-dim); font-weight: 600; margin-top: 2px; }
.form-label .req { color: var(--hw-danger); }

.form-check {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13.5px;
    margin-top: 6px;
    cursor: pointer;
}

.form-check input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--hw-primary); }

/* ---------- 와이드 입력폼 (거래처/제품 등 대형 화면) ---------- */
.wide-form {
    background: #fff;
    border: 1px solid var(--hw-border);
    border-radius: 8px;
    padding: 14px 16px 18px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}

.form-section {
    border: 1px solid var(--hw-border);
    border-radius: 8px;
    padding: 10px 14px 12px;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px 12px;
}

.form-section legend {
    font-size: 13px;
    font-weight: 700;
    color: var(--hw-primary);
    padding: 0 6px;
}

.form-section .field { display: flex; flex-direction: column; gap: 3px; }
.form-section .field label { font-size: 12px; color: var(--hw-text-dim); font-weight: 600; }
.form-section .field .input { width: 100%; margin: 0; }
.form-section .field.span2 { grid-column: span 2; }
.form-section .field.span3 { grid-column: span 3; }
.form-section .req { color: var(--hw-danger); }
.input.right { text-align: right; }

@media (max-width: 1100px) {
    .wide-form { grid-template-columns: 1fr; }
}

/* ---------- 조회화면 요약 바 ---------- */
.summary-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.summary-item {
    background: #fff;
    border: 1px solid var(--hw-border);
    border-radius: 8px;
    padding: 9px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 130px;
}

.summary-item span { font-size: 11.5px; color: var(--hw-text-dim); font-weight: 600; }
.summary-item b { font-size: 16px; color: var(--hw-text); text-align: right; }
.summary-item.accent { border-color: var(--hw-primary); background: var(--hw-primary-light); }
.summary-item.accent b { color: var(--hw-primary-dark); }

.ledger-opening td { background: #fbf7ea; font-weight: 600; }
.ledger-opening:hover td { background: #fbf7ea; }

/* ---------- 권한 그리드 그룹 행 ---------- */
.perm-group-row td {
    background: #f0f4f9;
    font-weight: 700;
    color: var(--hw-primary-dark);
    cursor: default;
}

.perm-group-row:hover td { background: #f0f4f9; }

/* ---------- 코드 조회 (입력 + 조회버튼) ---------- */
.lookup-row { display: flex; gap: 6px; margin-bottom: 8px; }
.lookup-row .input { margin-bottom: 0; }
.btn-lookup { padding: 7px 12px; flex-shrink: 0; }

/* ---------- 조회 팝업(모달) ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 30, 45, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-box {
    background: #fff;
    border-radius: 10px;
    width: 480px;
    max-width: 92vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,.25);
}

.modal-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 15px;
    color: var(--hw-primary-dark);
    padding: 14px 18px 10px;
    border-bottom: 2px solid var(--hw-primary-light);
}

.modal-close {
    background: none;
    border: none;
    font-size: 15px;
    cursor: pointer;
    color: var(--hw-text-dim);
}

.modal-close:hover { color: var(--hw-danger); }

.modal-search { display: flex; gap: 8px; padding: 12px 18px 8px; }

.modal-grid { flex: 1; overflow-y: auto; padding: 0 18px; min-height: 180px; }

.modal-footer {
    padding: 10px 18px;
    font-size: 12.5px;
    color: var(--hw-text-dim);
    border-top: 1px solid var(--hw-border);
}

/* ---------- 폼 검증(기본) ---------- */
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }

/* ---------- 인쇄용 보고서 머리글 (화면에서는 숨김) ---------- */
.print-header { display: none; }

/* ---------- 인쇄 스타일 (Crystal Reports 대체) ---------- */
@media print {
    @page { size: A4 landscape; margin: 12mm 10mm; }

    /* 화면 전용 요소 숨김 */
    .app-header, .sidebar, .tab-bar, .toolbar, .alert,
    .btn, .modal-backdrop, #blazor-error-ui, .page-header { display: none !important; }

    html, body { background: #fff; font-size: 10.5px; }
    .app-shell, .app-body, .content-col { display: block; height: auto; }
    .content { overflow: visible; padding: 0; }

    /* 보고서 머리글 표시 */
    .print-header {
        display: block;
        border-bottom: 2px solid #000;
        margin-bottom: 8px;
        padding-bottom: 6px;
    }

    .print-company { font-size: 10px; color: #555; }
    .print-title { font-size: 18px; font-weight: 800; text-align: center; margin: 2px 0 4px; }
    .print-meta { display: flex; justify-content: space-between; font-size: 10px; color: #333; }

    /* 요약 카드 → 인쇄용 한 줄 요약 */
    .summary-bar { gap: 6px; margin-bottom: 6px; }
    .summary-item { border: 1px solid #999; border-radius: 0; padding: 3px 8px; min-width: auto; }
    .summary-item span { font-size: 8.5px; color: #333; }
    .summary-item b { font-size: 11px; color: #000; }
    .summary-item.accent { background: #eee; border-color: #000; }

    /* 그리드 전체 출력 (스크롤 해제) + 표 인쇄 서식 */
    .grid-panel { max-height: none !important; overflow: visible !important; border: none; border-radius: 0; }
    .grid-footer { position: static; border-top: 1px solid #000; font-size: 9.5px; color: #000; padding: 4px 0; }

    .data-table { font-size: 9.5px; }
    .data-table th {
        position: static;
        background: #e8e8e8 !important;
        color: #000;
        border: 1px solid #666;
        padding: 3px 4px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    /* 셀 내용은 한 줄로 인쇄 (VB6 그리드 인쇄와 동일) — 품명 등 줄바꿈 방지 */
    .data-table td { border: 1px solid #999; padding: 2.5px 4px; white-space: nowrap; }
    .data-table tbody tr:hover { background: none; }
    .data-table tbody tr { break-inside: avoid; }
    thead { display: table-header-group; }  /* 페이지마다 헤더 반복 */
}

/* ---------- 조회 중 로딩 오버레이 ---------- */
.busy-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 30, 45, .35);
    backdrop-filter: blur(1.5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    cursor: progress;
}

.busy-card {
    background: #fff;
    border-radius: 14px;
    padding: 28px 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-shadow: 0 12px 44px rgba(0, 0, 0, .28);
    animation: busy-pop .18s ease-out;
}

@keyframes busy-pop {
    from { transform: scale(.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.busy-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--hw-primary-light);
    border-top-color: var(--hw-primary);
    border-radius: 50%;
    animation: busy-spin .8s linear infinite;
}

@keyframes busy-spin {
    to { transform: rotate(360deg); }
}

.busy-text { font-size: 15px; font-weight: 700; color: var(--hw-primary-dark); }
.busy-sub { font-size: 12px; color: var(--hw-text-dim); }

@media print { .busy-overlay { display: none !important; } }

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: .6rem 1.25rem .7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: .75rem;
    top: .5rem;
}

/* 등록화면 가로 폼 행 (수금등록 등) */
.form-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.form-row .form-label { margin: 0; white-space: nowrap; }

/* ===== 발행업무 양식 출력 (거래명세표/세금계산서/배송표/봉투) ===== */
.form-doc { background:#fff; border:1px solid #999; margin:0 auto 18px; padding:10mm 8mm; max-width:210mm; color:#000; font-size:12px; }
.form-doc .doc-title { text-align:center; font-size:20px; font-weight:800; letter-spacing:14px; margin-bottom:8px; }
.form-doc table { width:100%; border-collapse:collapse; table-layout:fixed; }
.form-doc th, .form-doc td { border:1px solid #444; padding:3px 5px; font-size:11.5px; word-break:break-all; }
.form-doc th { background:#f2f2f2; font-weight:600; text-align:center; }
.form-doc .noborder td, .form-doc .noborder th { border:none; }
.form-doc .amt { text-align:right; }
.form-doc .ctr { text-align:center; }
.doc-parties { display:flex; gap:8px; margin-bottom:6px; }
.doc-parties > div { flex:1; }
.doc-party-label { writing-mode:vertical-rl; text-align:center; background:#f2f2f2; border:1px solid #444; padding:2px; font-weight:700; }
.envelope-doc { border:1px solid #999; margin:0 auto 16px; padding:18mm 15mm; max-width:190mm; min-height:90mm; font-size:16px; background:#fff; color:#000; }
.envelope-doc .env-zip { font-size:14px; color:#333; }
.envelope-doc .env-addr { font-size:18px; margin:8px 0; }
.envelope-doc .env-name { font-size:24px; font-weight:800; margin-top:10px; }

@media print {
    /* 양식 출력 모드: 양식 문서만 인쇄 */
    body.print-forms .print-header, body.print-forms .summary-bar,
    body.print-forms .grid-panel, body.print-forms .form-panel, body.print-forms h3 { display:none !important; }
    body.print-forms .form-doc, body.print-forms .envelope-doc { display:block !important; border:none; margin:0; max-width:none; }
    .form-doc, .envelope-doc { page-break-after:always; }
    .form-doc:last-child, .envelope-doc:last-child { page-break-after:auto; }
}
