#document-preview-wrapper {
  display: flex;
  flex-direction: column; /* [추가] 자식 요소들을 세로로 쌓도록 변경 */
  justify-content: flex-start; /* [수정] 세로 정렬(주축)은 위에서부터 시작 */
  align-items: center; /* [수정] 수평 정렬(교차축)을 중앙으로 맞춤 */
  padding-top: 20px;
  width: 100%;
  overflow-x: auto;
}

/* --- 문서 공통 스타일 --- */
.document-container {
  position: relative;
  width: 210mm;
  min-height: 297mm;
  padding: 15mm;
  background: white;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
  color: #333;
  font-size: 10pt;
  font-family: "Pretendard", "Malgun Gothic", sans-serif;
  transform-origin: top center;
  flex-shrink: 0; /* <-- [추가] Flexbox 환경에서 아이템이 줄어드는 것을 방지 */
}

.doc-main {
  flex-grow: 1;
}
.action-buttons {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  background: rgba(255, 255, 255, 0.95);
  padding: 10px 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  gap: 10px;
}
.action-buttons button {
  padding: 8px 15px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  margin: 0;
  background-color: #333;
  color: white;
}
.action-buttons button:hover {
  background-color: #555;
}

#zoom-controls-container {
  display: none !important;
}

/* --- 공통 푸터 및 서명란 스타일 --- */
.doc-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.notes {
  font-size: 0.8em;
  color: #888;
  white-space: pre-line;
  width: 60%;
}
.signature-area {
  width: 35%;
  text-align: center;
  position: relative;
}
.signature-area .company-name-sign {
  font-size: 1.4em;
  font-weight: bold;
  margin: 0;
  padding-right: 30px;
  white-space: nowrap;
}
.signature-area .seal-image {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  opacity: 0.85;

  /* --- 핵심 수정 --- */
  /* 가로/세로 크기를 고정하는 대신, 최대 크기만 제한하여 비율 유지 */
  width: auto;
  height: auto;
  max-width: 70px;
  max-height: 70px;
}

/* --- 공통 테이블 스타일 (전체 레이아웃 적용) --- */
.item-table {
  font-size: 10.5pt;
}
.item-table th,
.item-table td {
  text-align: center;
  vertical-align: middle;
  padding: 12px 8px;
}
.item-table .item-name {
  text-align: left;
}

/* --- [레이아웃 1] 기본 양식 --- */
.default-layout .doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #333;
  padding-bottom: 20px;
  margin-bottom: 20px;
}
.default-layout .logo-area {
  width: 35%;
}
.default-layout .logo-area img {
  max-width: 100%;
  max-height: 120px;
  height: auto;
  object-fit: contain;
}
.default-layout .doc-title-area {
  display: none;
}
.default-layout .supplier-info-simple {
  width: 60%;
  text-align: right;
  font-size: 0.9em;
  line-height: 1.6;
}
.default-layout .supplier-info-simple p {
  margin: 0;
}
.default-layout .doc-meta-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin: 20px 0;
}
.default-layout .client-info {
  font-size: 1.1em;
  font-weight: bold;
}
.default-layout .client-info .to {
  margin-bottom: 10px;
}
.default-layout .quote-info {
  border: 1px solid #ddd;
  padding: 10px;
  font-size: 0.9em;
}
.default-layout .quote-info p {
  margin: 5px 0;
  display: flex;
  justify-content: space-between;
}
.default-layout .quote-info p strong {
  margin-right: 20px;
}
.default-layout .doc-subject {
  text-align: center;
  font-size: 1.5em;
  margin: 40px 0 25px 0;
}
.default-layout .item-table {
  width: 100%;
  border-collapse: collapse;
}
.default-layout .item-table th,
.default-layout .item-table td {
  border-bottom: 1px solid #ddd;
}
.default-layout .item-table th {
  border-top: 2px solid #333;
  border-bottom-width: 2px;
  background-color: #f8f8f8;
}
.default-layout .doc-summary {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
  align-items: flex-start;
}
.default-layout .payment-info {
  font-size: 0.9em;
  color: #555;
  white-space: pre-line;
}
.default-layout .total-info {
  width: 45%;
}
.default-layout .total-info p {
  display: flex;
  justify-content: space-between;
  margin: 8px 0;
}
.default-layout .total-info .grand-total {
  font-weight: bold;
  font-size: 1.1em;
  border-top: 1px solid #ccc;
  padding-top: 10px;
}
.default-layout .grand-total-box {
  background-color: #f2f2f2;
  padding: 20px;
  text-align: right;
  font-size: 1.3em;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
}
.default-layout .doc-footer {
  position: relative;
  min-height: 80px;
}

/* --- [레이아웃 2] 모던 세로형 --- */
.modern-layout {
  --modern-accent-color: #2c3e50;
  --modern-bg-color: #f8f9fa;
}
.modern-layout .doc-header {
  text-align: center;
  margin-bottom: 40px;
  border-bottom: 1px solid #eee;
  padding-bottom: 20px;
}
.modern-layout h1 {
  font-size: 2.5em;
  color: var(--modern-accent-color);
  margin: 10px 0 20px 0;
  font-weight: 600;
  letter-spacing: 2px;
}
.modern-layout .logo-area img {
  max-height: 50px;
  object-fit: contain;
  margin-bottom: 10px;
}
/* 견적서 미리보기 모달(#quote-preview-body) 안의 모던 레이아웃에만 한정하여 스타일을 강제로 적용 */
#quote-preview-body .modern-layout .doc-meta-info {
  display: block !important; /* grid 대신 block으로 강제 변경하여 세로로 쌓이도록 함 */
}

#quote-preview-body .modern-layout .info-block {
  margin-bottom: 15px;
}
.modern-layout .info-block {
  background: var(--modern-bg-color);
  padding: 15px;
  border-radius: 8px;
}
.modern-layout .info-block h3 {
  font-size: 1em;
  color: var(--modern-accent-color);
  border-bottom: 1px solid #ddd;
  padding-bottom: 8px;
  margin-bottom: 10px;
  font-weight: 600;
}
.modern-layout .info-block p {
  margin: 5px 0;
  font-size: 0.95em;
  line-height: 1.6;
}
.modern-layout .item-table {
  border: none;
  border-radius: 8px;
  overflow: hidden;
}
.modern-layout .item-table th {
  background: var(--modern-accent-color);
  color: white;
  border: none;
  font-weight: 500;
}
.modern-layout .item-table td {
  border-bottom: 1px solid #eee;
}
.modern-layout .total-info {
  width: 50%;
  margin-left: auto;
  margin-top: 30px;
}
.modern-layout .total-info p {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  margin: 0;
}
.modern-layout .grand-total {
  font-size: 1.4em;
  font-weight: bold;
  color: var(--modern-accent-color);
  border-top: 2px solid var(--modern-accent-color);
  margin-top: 10px;
  padding-top: 10px;
}
.modern-layout .doc-footer {
  justify-content: center;
  text-align: center;
}
.modern-layout .notes {
  width: 100%;
  margin-bottom: 20px;
}
.modern-layout .signature-area {
  width: auto;
}

/* --- [레이아웃 3] 클래식 가로형 --- */
.classic-layout {
  font-family: "KoPub Batang", "바탕", serif;
}
.classic-layout h1 {
  text-align: center;
  font-weight: bold;
  font-size: 2.2em;
  letter-spacing: 5px;
  padding: 15px 0;
  margin-bottom: 30px;
}
.classic-layout .doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin: 30px 0;
  font-size: 1em;
  padding-bottom: 15px;
  border-bottom: 2px double #333;
}
.classic-layout .logo-area img {
  max-height: 45px;
  object-fit: contain;
}
.classic-layout .item-table {
  border-top: 1px solid #333;
  border-bottom: 1px solid #333;
}
.classic-layout .item-table th,
.classic-layout .item-table td {
  border: none;
  border-bottom: 1px solid #eee;
}
.classic-layout .item-table th {
  background: none;
  font-weight: bold;
}
.classic-layout .doc-summary {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}
.classic-layout .total-info {
  width: 50%;
  background: #fdfdfd;
  padding: 15px;
  border: 1px solid #eee;
}
.classic-layout .doc-footer {
  display: block;
  text-align: right;
}
.classic-layout .signature-area {
  display: inline-block;
  width: auto;
  margin-top: 40px;
}

/* --- [레이아웃 4] 심플 리스트형 --- */
.simple-layout {
  --simple-accent-color: #008080;
  border-top: 5px solid var(--simple-accent-color);
}
.simple-layout .doc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 50px;
}
.simple-layout h1 {
  font-size: 2.5em;
  margin: 0;
  color: var(--simple-accent-color);
  font-weight: 300;
}
.simple-layout .logo-area img {
  max-height: 50px;
}
.simple-layout .item-table th,
.simple-layout .item-table td {
  border: none;
  border-bottom: 1px solid #eee;
}
.simple-layout .item-table thead {
  border-bottom: 2px solid #333;
}
.simple-layout .doc-summary {
  margin-top: 30px;
}
.simple-layout .total-info {
  float: right;
  width: 45%;
}
.simple-layout .doc-footer {
  clear: both;
  padding-top: 50px;
}
.simple-layout .signature-area {
  width: 40%;
  float: right;
}

/* --- [레이아웃 5] 컴팩트 절약형 --- */
.compact-layout {
  font-size: 9.5pt;
  padding: 12mm;
  --compact-header-bg: #4a4a4a;
}
.compact-layout .doc-header {
  display: none;
}
.compact-layout h1 {
  font-size: 1.5em;
  text-align: center;
  background: var(--compact-header-bg);
  color: white;
  padding: 12px;
  margin: -12mm -12mm 20px -12mm;
  font-weight: 400;
  letter-spacing: 1px;
}
.compact-layout .doc-meta-info {
  font-size: 0.95em;
}
.compact-layout .logo-area img {
  max-height: 35px;
  object-fit: contain;
}
.compact-layout .item-table th {
  background-color: #f5f5f5;
}
.compact-layout .total-info {
  width: 100%;
  margin-top: 20px;
}
.compact-layout .grand-total-box {
  padding: 12px 15px;
  background-color: var(--compact-header-bg);
  color: white;
}
.compact-layout .doc-footer {
  border: none;
  margin-top: 20px;
}

/* --- Flexbox 중앙 정렬 (화면용) --- */
.modern-layout .doc-main,
.classic-layout .doc-main,
.simple-layout .doc-main,
.compact-layout .doc-main {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.modern-layout .doc-main > *,
.classic-layout .doc-main > *,
.simple-layout .doc-main > *,
.compact-layout .doc-main > * {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.simple-layout .doc-header {
  max-width: 100%;
}
.simple-layout .doc-footer {
  max-width: 95%;
  width: 100%;
  margin: 40px auto 0 auto;
  padding-top: 20px;
}
.compact-layout h1 {
  max-width: none;
  width: auto;
}

/* --- 미리보기 하단 버튼 바 스타일 --- */
.bottom-action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(240, 242, 245, 0.95);
  padding: 15px;
  padding-bottom: calc(15px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  z-index: 3000;
  box-sizing: border-box;
}
body {
  padding-bottom: 120px;
}
.bottom-action-bar button {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 500;
  margin: 0;
}
.bottom-action-bar .btn-primary {
  background-color: #1877f2;
  color: white;
}
.bottom-action-bar .btn-primary:hover {
  background-color: #166fe5;
}
.bottom-action-bar .btn-secondary {
  background-color: #6c757d;
  color: white;
}
.bottom-action-bar .btn-secondary:hover {
  background-color: #5a6268;
}
.bottom-action-bar .btn-kakao {
  background-color: #fee500;
  color: #191919;
  font-weight: bold;
}
.bottom-action-bar .btn-kakao:hover {
  background-color: #f2da00;
}

/* --- 모바일 반응형 (view-quote.html) --- */
@media (max-width: 768px) {
  .bottom-action-bar button {
    padding: 10px 5px;
    font-size: 0.8em;
    flex-grow: 1;
    min-width: 80px;
    white-space: nowrap;
  }
}
#action-buttons-container {
  padding: 15px;
  text-align: center;
  background-color: #e9ecef;
  border-bottom: 1px solid #dee2e6;
}
#action-buttons-container .bottom-action-bar {
  position: static;
  background: none;
  box-shadow: none;
  padding: 0;
  justify-content: center;
}

/* --- 계약서 서명란 모바일 크기 자동 조정 스타일 --- */
@media (max-width: 768px) {
  .document-container table:last-of-type {
    font-size: 0.8em;
  }
  .document-container table:last-of-type td {
    padding: 10px;
    line-height: 1.4;
  }
  .document-container table:last-of-type td p {
    margin: 2px 0;
  }
  .document-container table:last-of-type td div[style*="min-height"] {
    min-height: 60px !important;
  }
  .document-container table:last-of-type td img {
    max-height: 50px !important;
  }
  #agreement-info {
    max-width: 90%;
    margin: 0 auto;
  }
}

/* ===================================================================
   [유료] 프리미엄 레이아웃
   =================================================================== */

/* --- [레이아웃 6] 프레스티지 (Prestige) --- */
.prestige-layout {
  --prestige-accent: #0d47a1;
  font-family: "KoPub Batang", "바탕", serif;
}
.prestige-layout .doc-header {
  flex-direction: column;
  align-items: flex-start;
  border-bottom: 1px solid #ddd;
  padding-bottom: 25px;
  margin-bottom: 30px;
}
.prestige-layout .doc-title-area {
  display: none;
}
.prestige-layout .logo-area img {
  max-height: 50px;
  width: auto;
}
.prestige-layout .supplier-info-simple {
  text-align: left;
  margin-top: 20px;
  font-size: 0.9em;
  line-height: 1.7;
}
.prestige-layout .doc-subject {
  text-align: left;
  margin: 50px 0;
}
.prestige-layout .doc-subject h3 {
  font-size: 2em;
  color: var(--prestige-accent);
  font-weight: 600;
}
.prestige-layout .item-table {
  border: none;
}
.prestige-layout .item-table th {
  background: none;
  border-top: 2px solid var(--prestige-accent);
  border-bottom: 1px solid var(--prestige-accent);
  font-weight: bold;
}
.prestige-layout .item-table td {
  border-bottom: 1px solid #f0f0f0;
}
.prestige-layout .doc-summary {
  justify-content: flex-end;
}
.prestige-layout .grand-total-box {
  display: none;
}
.prestige-layout .total-info .grand-total {
  font-size: 1.2em;
  color: var(--prestige-accent);
}

/* --- [레이아웃 7] 코퍼레이트 (Corporate) --- */
.corporate-layout {
  --corp-accent: #1c3e5e;
  padding: 0;
}
.corporate-layout .doc-header {
  background-color: var(--corp-accent);
  color: white;
  padding: 15mm;
  margin-bottom: 20px;
  justify-content: space-between;
  align-items: center;
}
.corporate-layout .doc-header .doc-title-area {
  display: block;
}
.corporate-layout .doc-header .doc-title-area h1 {
  font-size: 2.5em;
  color: white;
  letter-spacing: 3px;
  margin: 0;
}
.corporate-layout .doc-header .supplier-info-simple {
  text-align: right;
  color: #ccc;
  font-size: 0.9em;
}
.corporate-layout .logo-area img {
  max-height: 50px;
  width: auto;
}
.corporate-layout .doc-main {
  padding: 0 15mm;
}
.corporate-layout .item-table {
  border: 1px solid #e0e0e0;
}
.corporate-layout .item-table th {
  background-color: #f7f9fc;
}
.corporate-layout .doc-summary {
  margin-top: 40px;
}
.corporate-layout .total-info {
  width: 50%;
}
.corporate-layout .grand-total-box {
  background-color: #f7f9fc;
  border-top: 2px solid var(--corp-accent);
  color: var(--corp-accent);
}
.corporate-layout .doc-footer {
  padding: 20px 15mm 15mm 15mm;
}

/* --- [레이아웃 8] 엘레강트 (Elegant) --- */
.elegant-layout {
  --elegant-accent: #5d4037;
  position: relative;
}
.elegant-layout::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 8mm;
  height: 100%;
  background-color: var(--elegant-accent);
}
.elegant-layout .doc-header,
.elegant-layout .doc-main,
.elegant-layout .doc-footer {
  padding-left: 15mm;
}
.elegant-layout .logo-area img {
  max-height: 50px;
  width: auto;
}
.elegant-layout h1 {
  color: var(--elegant-accent);
  text-align: left;
}
.elegant-layout .item-table tr:nth-child(even) {
  background-color: #f8f6f5;
}
.elegant-layout .total-info .grand-total span {
  color: var(--elegant-accent);
}
.elegant-layout .signature-area .company-name-sign {
  color: var(--elegant-accent);
  font-size: 1.6em;
}

/* --- [레이아웃 9] 블루프린트 (Blueprint) --- */
.blueprint-layout {
  --blueprint-accent: #0277bd;
  background-image: linear-gradient(#eee 1px, transparent 1px),
    linear-gradient(to right, #eee 1px, transparent 1px);
  background-size: 20px 20px;
}
.blueprint-layout .document-container-inner {
  background: white;
  padding: 15mm;
  height: 100%;
  box-sizing: border-box;
}
.blueprint-layout .logo-area img {
  max-height: 50px;
  width: auto;
}
.blueprint-layout .doc-header {
  border-bottom: 2px solid var(--blueprint-accent);
}
.blueprint-layout .quote-info {
  border: 1px solid var(--blueprint-accent);
}
.blueprint-layout .item-table,
.blueprint-layout .item-table th,
.blueprint-layout .item-table td {
  border: 1px solid #ccc;
}
.blueprint-layout .item-table th {
  background-color: var(--blueprint-accent);
  color: white;
}
.blueprint-layout .item-table td:nth-of-type(2),
.blueprint-layout .item-table td:nth-of-type(3),
.blueprint-layout .item-table td:nth-of-type(4) {
  font-family: "Roboto Mono", monospace;
}

/* --- [레이아웃 10] 크리에이티브 (Creative) --- */
.creative-layout {
  --creative-accent: #d81b60;
  overflow: hidden;
}
.creative-layout::after {
  content: "";
  position: absolute;
  bottom: -50px;
  right: -50px;
  width: 200px;
  height: 200px;
  background: var(--creative-accent);
  border-radius: 50%;
  opacity: 0.1;
}
.creative-layout .doc-header {
  align-items: center;
  margin-bottom: 40px;
}
.creative-layout .doc-title-area h1 {
  font-size: 3em;
  color: var(--creative-accent);
  text-align: center;
  line-height: 1;
}
.creative-layout .logo-area img {
  max-height: 50px;
  width: auto;
}
.creative-layout .doc-meta-info {
  background-color: #fef4f8;
  padding: 15px;
  border-left: 4px solid var(--creative-accent);
}
.creative-layout .grand-total-box {
  background-color: var(--creative-accent);
  color: white;
  margin-top: 30px;
  border-radius: 5px;
}
.creative-layout .doc-footer {
  border: none;
  margin-top: 50px;
}

/* --- [레이아웃 11] 미니멀리스트 (Minimalist) --- */
.minimalist-layout {
  --minimalist-accent: #1a73e8;
  font-family: "Pretendard", sans-serif;
  font-weight: 300;
}

.minimalist-layout .logo-area img {
  max-height: 45px;
}
.minimalist-layout .doc-header {
  border-bottom: 1px solid #eee;
  padding-bottom: 15px;
  align-items: center;
}
.minimalist-layout .doc-title-area h1 {
  display: block;
  font-size: 1.5em;
  font-weight: 400;
  text-align: left;
  color: #333;
}
.minimalist-layout .supplier-info-simple {
  text-align: right;
  font-size: 0.85em;
  line-height: 1.5;
}
.minimalist-layout .item-table {
  border-top: 1px solid #eee;
}
.minimalist-layout .item-table th,
.minimalist-layout .item-table td {
  border: none;
  border-bottom: 1px solid #f5f5f5;
  text-align: left;
  padding: 14px 10px;
}
.minimalist-layout .item-table th {
  font-weight: 500;
  color: var(--minimalist-accent);
  background: none;
}
.minimalist-layout .item-table td:not(:first-child) {
  text-align: right;
}
.minimalist-layout .grand-total-box {
  display: none;
}
.minimalist-layout .doc-summary {
  justify-content: flex-end;
  margin-top: 40px;
}
.minimalist-layout .total-info {
  width: 50%;
}
.minimalist-layout .total-info .grand-total {
  color: var(--minimalist-accent);
}

/* --- [레이아웃 12] 테크 (Tech) --- */
.tech-layout {
  --tech-accent: #00bfff;
  --tech-bg: #f8f9fa;
  background-image: linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  border: 1px solid #ddd;
}
.tech-layout .logo-area img {
  max-height: 50px;
}
.tech-layout .doc-main,
.tech-layout .doc-header,
.tech-layout .doc-footer {
  background: white;
  padding: 15mm;
  width: 100%;
  box-sizing: border-box;
}
.tech-layout .doc-header {
  border-bottom: 3px solid var(--tech-accent);
}
.tech-layout h1 {
  font-family: "Roboto Mono", monospace;
  font-size: 2.5em;
  color: #333;
  text-transform: uppercase;
}
.tech-layout .item-table th {
  background-color: #343a40;
  color: var(--tech-accent);
  font-weight: 500;
  border-bottom: 2px solid var(--tech-accent);
}
.tech-layout .item-table td {
  font-family: "Roboto Mono", monospace;
  border-bottom: 1px solid #444;
}
.tech-layout .total-info {
  background: var(--tech-bg);
  padding: 15px;
  border: 1px solid #ddd;
}
.tech-layout .grand-total span:last-child {
  color: var(--tech-accent);
}

/* --- [레이아웃 13] 인보이스 (Invoice) --- */
.invoice-layout {
  font-family: "Times New Roman", Times, serif;
}
.invoice-layout .logo-area img {
  max-height: 60px;
}
.invoice-layout .doc-header {
  flex-direction: column;
  align-items: flex-start;
  display: block !important;
}
.invoice-layout .doc-title-area {
  display: block;
  width: 100%;
  text-align: right;
  margin-bottom: 20px;
}
.invoice-layout .doc-title-area h1 {
  font-size: 3em;
  color: #333;
}
.invoice-layout .supplier-info-simple {
  border: 1px solid #999;
  padding: 15px;
  width: 50%;
  text-align: left;
}
.invoice-layout .item-table,
.invoice-layout .item-table th,
.invoice-layout .item-table td {
  border: 1px solid #666;
}
.invoice-layout .item-table th {
  background-color: #e9ecef;
}
.invoice-layout .doc-summary {
  justify-content: flex-end;
  display: block !important;
}
.invoice-layout .total-info {
  width: 50%;
  border: 1px solid #666;
}
.invoice-layout .total-info p {
  padding: 8px;
}
.invoice-layout .total-info p:not(:last-child) {
  border-bottom: 1px solid #ccc;
}
.invoice-layout .grand-total-box {
  display: none;
}

/* --- [레이아웃 14] 얼씨 (Earthy) --- */
.earthy-layout {
  --earthy-accent: #a95c44;
  --earthy-text: #4a4441;
  --earthy-bg: #f5f1e9;
  background-color: var(--earthy-bg);
  color: var(--earthy-text);
}
.earthy-layout .logo-area img {
  max-height: 55px;
}
.earthy-layout h1,
.earthy-layout h3 {
  color: var(--earthy-accent);
}
.earthy-layout .doc-header {
  text-align: center;
  border: none;
}
.earthy-layout .doc-title-area {
  display: block;
}
.earthy-layout .item-table {
  border: none;
}
.earthy-layout .item-table th {
  background: none;
  border-bottom: 2px solid var(--earthy-accent);
  font-weight: 600;
}
.earthy-layout .item-table td {
  border-bottom: 1px solid #e0d9cc;
}
.earthy-layout .grand-total-box {
  background-color: var(--earthy-accent);
  color: white;
}
.earthy-layout .doc-footer {
  border-top: 1px solid #dcd3c3;
}
.earthy-layout .signature-area .company-name-sign {
  color: var(--earthy-accent);
}

/* --- [레이아웃 15] 느와르 (Noir) --- */
.noir-layout {
  --noir-bg: #ffffff;
  --noir-text: #222222;
  --noir-accent: #b8860b;
  --noir-border: #dddddd;
  background: var(--noir-bg) !important;
  color: var(--noir-text);
}
.noir-layout h1,
.noir-layout h3,
.noir-layout .grand-total span,
.noir-layout .company-name-sign {
  color: var(--noir-accent);
}
.noir-layout .doc-header,
.noir-layout .doc-footer {
  border-color: var(--noir-border);
}
.noir-layout .quote-info {
  border: 1px solid var(--noir-border);
}
.noir-layout .logo-area img {
  max-height: 50px;
}
.noir-layout .item-table th {
  background-color: #2c2c2c;
  color: var(--noir-accent);
  border-color: #444;
  border-top-width: 2px;
}
.noir-layout .item-table td {
  border-color: var(--noir-border);
}
.noir-layout .grand-total-box {
  background-color: var(--noir-accent);
  color: #fff;
}
.noir-layout .supplier-info-simple,
.noir-layout .notes {
  color: #555555;
}

@media (max-width: 768px) {
  /* --- 모바일에서 제목 글자 깨짐 방지 --- */
  .classic-layout h1 {
    font-size: 1.8em;
    letter-spacing: 2px;
    white-space: nowrap;
  }
  .simple-layout h1 {
    font-size: 2em;
    white-space: nowrap;
  }
}

/* ===================================================================
   PDF 출력 및 인쇄 전용 스타일 (최종版)
   =================================================================== */
@media print {
  body,
  html {
    background: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* 1. 화면용 UI 요소 숨기기 */
  #zoom-controls-container,
  #action-buttons-container,
  .action-buttons,
  #agreement-section,
  .bottom-action-bar {
    display: none !important;
  }

  /* 2. PDF 안정성 확보 (페이지 나눔 방지) */
  .document-container {
    height: auto !important;
    min-height: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }
  .doc-footer {
    margin-top: 15px !important;
    padding-top: 15px !important;
    page-break-inside: avoid !important;
  }
  .document-container .item-table {
    width: 100% !important;
  }

  /* 3. [핵심] PDF에서 디자인이 사라지는 문제 해결 */

  /* 기본 양식 테이블 헤더 디자인 강제 적용 */
  .default-layout .item-table th {
    background-color: #f8f8f8 !important;
    border-top: 2px solid #333 !important;
    border-bottom-width: 2px !important;
  }

  /* 모던 레이아웃 테이블 헤더 디자인 강제 적용 */
  .modern-layout .item-table th {
    background-color: #2c3e50 !important;
    color: white !important;
  }

  /* 테크 레이아웃 테이블 헤더 디자인 강제 적용 */
  .tech-layout .item-table th {
    background-color: #343a40 !important;
    color: var(--tech-accent) !important;
    border-bottom: 2px solid var(--tech-accent) !important;
  }

  /* 특정 레이아웃의 PDF 오류 유발 요소 제거 */
  .tech-layout {
    background-image: none !important;
  }
  .creative-layout::after {
    display: none !important;
  }
}
