.quote-workflow { margin: 0 0 20px; padding: 16px; border: 1px solid #cbd5e1; border-radius: 14px; background: #fff; color: #1e293b; }
.quote-workflow-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.quote-workflow-heading strong { font-size: var(--fs-title); }
.quote-workflow-heading p { margin: 4px 0 0; color: #64748b; font-size: var(--fs-meta); }
.quote-workflow-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.quote-workflow-steps button { border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc; padding: 10px 8px; font-size: var(--fs-base); font-weight: 700; text-align: left; color: #475569; }
.quote-workflow-steps button[aria-current] { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.quote-workflow-steps button:hover { border-color: #93c5fd; }
#quoteEditArea #quotePricingControls { position: static; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 12px; padding: 10px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: var(--fs-base); }
#quoteEditArea #quotePricingControls select { font-size: 16px; max-width: 100%; }
#quoteEditArea #quoteGrandTotal { margin-top: 24px; }
#quoteEditArea[data-quote-locked="true"] :is(.quote-paper, .quote-pricing-card) :is(input, select, textarea) { color: #334155; opacity: 1; -webkit-text-fill-color: #334155; cursor: default; }
#quoteEditArea[data-quote-locked="true"] :is(.quote-paper, .quote-pricing-card) button:disabled { opacity: .45; cursor: not-allowed; }
.quote-review-section { margin: 24px 0 0; padding: 20px; border: 1px solid #cbd5e1; border-radius: 14px; background: #fff; }
.quote-review-section h2 { margin: 0 0 16px; font-size: var(--fs-title); font-weight: 800; }
.quote-review-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: var(--fs-title); }
.quote-review-heading strong { overflow-wrap: anywhere; }
.quote-review-status { font-size: var(--fs-meta); color: #475569; background: #f1f5f9; border-radius: 6px; padding: 4px 8px; }
.quote-review-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; margin: 16px 0; }
.quote-review-details div { min-width: 0; }
.quote-review-details dt { font-size: var(--fs-meta); color: #64748b; margin-bottom: 3px; }
.quote-review-details dd { font-size: var(--fs-body); font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.quote-review-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 16px; border-radius: 10px; background: #f8fafc; margin: 16px 0; }
.quote-review-totals dt { font-size: var(--fs-meta); color: #475569; }
.quote-review-totals dd { margin: 5px 0 0; font-size: var(--fs-title); font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.quote-review-totals div:last-child { color: #1d4ed8; }
.quote-review-note { font-size: var(--fs-meta); line-height: 1.7; color: #475569; }
.quote-review-warnings { padding: 12px 12px 12px 28px; border: 1px solid #fde68a; border-radius: 8px; background: #fffbeb; color: #92400e; font-size: var(--fs-base); list-style: disc; line-height: 1.7; }
.quote-review-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.quote-review-actions .btn { font-size: var(--fs-base); min-height: 40px; white-space: normal; }
.quote-review-modal { line-height: 1.5; }
@media (max-width: 600px) {
    .quote-workflow-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .quote-review-section { padding: 16px; }
    .quote-review-details { grid-template-columns: 1fr; }
    .quote-review-totals { grid-template-columns: 1fr; gap: 10px; }
    .quote-review-totals div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
    .quote-review-totals dd { margin: 0; }
    .quote-review-actions .btn { flex: 1 1 140px; }
}
@media print { .quote-workflow, .quote-review-section { display: none !important; } }

/* 📐 PC 2열 (2026-10-12) — 편집 종이 옆에 단계·도구·최종 확인·출력을 따라오는 패널로 붙인다.
   기준은 화면이 아니라 견적 영역 폭(사이드바가 접혔는지에 따라 같은 화면에서도 다르다): 종이 최소 800 + 24 + 패널 최소 360.
   종이는 남는 폭을 먼저 받아 최대 1200px, 패널은 그 뒤에 360→440px — 출력물(PDF)은 화면 종이를 찍지 않고 데이터로 따로 그려 영향이 없다.
   좁으면 두 묶음을 풀어(display: contents) 종전 순서 그대로 한 줄 — DOM 은 종이가 먼저라 order 로 되돌린다. */
#quoteEditArea { container: quote-edit / inline-size; }
/* 폰의 하단 결재 띠는 문서가 아닌 화면에 고정한다. PC 컨테이너 쿼리는 유지. */
@media screen and (max-width: 768px) {
    #quoteEditArea { container-type: normal; }
}
.quote-layout { display: flex; flex-direction: column; }
.quote-layout-main, .quote-layout-side { display: contents; }
.quote-layout .quote-workflow { order: 1; }
#quoteAuxActions { order: 2; }
#quoteApprovalPanel { order: 3; }
.quote-layout-main > .overflow-x-auto { order: 4; }
#quotePricingCard { order: 5; }
#quoteReviewSection { order: 6; }
#quoteFooterActions { order: 7; }
/* 💰 할인·부가세 — 견적서 내용이 아니라 작성 설정(종이 밖). 결과 줄은 종이에 남는다. */
.quote-pricing-card { margin: 24px 0 0; padding: 16px; border: 1px solid #cbd5e1; border-radius: 14px; background: #fff; }
.quote-pricing-card h2 { margin: 0 0 12px; font-size: var(--fs-title); font-weight: 800; }
.quote-pricing-card .quote-pricing-row { justify-content: flex-start; }
.quote-review-more > summary { min-height: 44px; padding: 10px 0; cursor: pointer; font-size: var(--fs-base); font-weight: 700; color: #475569; }   /* 기본 ▶ 표시는 남긴다(견적 도구와 같은 모양) */
.quote-review-more > summary:hover { color: #1d4ed8; }
.quote-review-more[open] > .quote-review-details { margin-top: 4px; }
@container quote-edit (min-width: 1184px) {
    .quote-layout { display: grid; grid-template-columns: minmax(800px, 1200px) clamp(360px, calc(100cqi - 1224px), 440px); gap: 24px; align-items: start; }
    .quote-layout-main { display: block; min-width: 0; }
    .quote-layout-main .quote-paper { max-width: none; }
    .quote-layout-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 16px; max-height: calc(100vh - 96px); overflow-y: auto; overscroll-behavior: contain; }
    .quote-layout-side .quote-workflow { margin: 0; padding: 14px; }
    .quote-layout-side .quote-workflow-heading .btn { display: none; }   /* 같은 패널 아래 «내용 확인 후 승인·출력»과 같은 동작 */
    .quote-layout-side .quote-workflow-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .quote-layout-side #quoteAuxActions { margin: 0; }
    .quote-layout-side #quoteAuxActions > .flex:last-child { width: 100%; align-items: flex-start; }   /* 견적 도구를 펼쳐도 «다음 단계»가 따라 늘지 않게 */
    .quote-layout-side #quoteAuxActions .workspace-tools { flex: 1 1 auto; }
    .quote-layout-side .quote-pricing-card { margin: 0; padding: 14px 16px; }
    .quote-layout-side .quote-review-section { margin: 0; padding: 16px; }
    .quote-layout-side .quote-review-section h2 { margin-bottom: 8px; }
    .quote-layout-side .quote-review-totals { grid-template-columns: 1fr; gap: 6px; padding: 12px; margin: 12px 0; }
    .quote-layout-side .quote-review-totals div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
    .quote-layout-side .quote-review-totals dd { margin: 0; }
    .quote-layout-side #quoteReviewSection > .btn { width: 100%; }
    .quote-layout-side #quoteFooterActions { margin: 0; }
    .quote-layout-side #quoteFooterActions .btn { flex: 1 1 0; }
}

/* 📊 편집 표 (2026-10-12) — 12칸에 칸 여백 10px 이면 «단 위»처럼 띄어 쓴 머리글이 세로로 쪼개지고 단가·규격이 잘린다
   (사장님 «세부항목들이 뭉개지는»). 폰은 patches-extracted.css 의 전용 규칙(칸 숨김·!important 여백)이 따로 있어 PC 만. */
@media (min-width: 769px) {
    #quoteEditTable th, #quoteEditTable td { padding-left: 4px; padding-right: 4px; }
    #quoteEditTable thead th { white-space: nowrap; }
    #quoteEditTable .input-no-border { padding-left: 3px; padding-right: 3px; }   /* 금액칸은 오른쪽 12px(.text-right-input)까지 먹어 «46,200,000»이 잘렸다 */
}

@media screen {
    /* size는 쉼표를 포함한 금액 길이다. 입력 중에도 할인·단가 열이 함께 커진다. */
    #quoteEditTable :is(.qi-price, .qi-discount) { width: auto; max-width: none; }
    #quoteEditTable .qi-total { white-space: nowrap; overflow: visible; }
    #quoteGrandRow { flex-wrap: wrap; overflow: visible; }
    #quoteGrandWord { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
}
@media screen and (max-width: 900px) {
    .quote-layout-main > .overflow-x-auto { min-width: 0; max-width: 100%; overflow-x: auto; }
    .quote-layout-main .quote-paper { min-width: 800px; }
}
@media screen and (max-width: 768px) {
    #quoteEditTable td input { font-size: var(--fs-meta) !important; }
}

/* 이전 승인본 비교: 긴 품목명·큰 금액도 패널 폭 안에서 줄을 바꾼다. */
.quote-revision-diff { min-width:0; margin:12px 0; padding:12px; border:1px solid #cbd5e1; border-radius:8px; background:#f8fafc; color:#334155; font-size:var(--fs-base); word-break:keep-all; overflow-wrap:break-word; }
.quote-revision-diff summary { min-height:44px; padding:10px 0; cursor:pointer; font-weight:700; }
.quote-revision-totals { margin:12px 0; }
.quote-revision-totals div { margin:8px 0; }
.quote-revision-totals dt { font-weight:700; }
.quote-revision-totals dd { margin:2px 0 0; font-variant-numeric:tabular-nums; }
.quote-revision-rows { margin:0; padding:0; list-style:none; }
.quote-revision-rows li { padding:10px 0; border-top:1px solid #e2e8f0; }
.quote-revision-rows p { margin:4px 0 0; line-height:1.7; white-space:normal; }

.est-link-box { min-width: 0; margin-bottom: 12px; border: 1px solid; border-radius: 10px; padding: 12px 14px; font-size: var(--fs-base); overflow-wrap: anywhere; }
.est-link-box p { margin: 3px 0; font-size: var(--fs-meta); }
.est-link-same { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.est-link-diff { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.est-link-missing, .est-link-acked { background: #f8fafc; border-color: #cbd5e1; color: #475569; }
.est-link-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.est-link-box summary { cursor: pointer; font-weight: 700; font-size: var(--fs-meta); }
.est-link-acked details:not([open]) { display: inline-block; margin-left: 8px; }
.est-link-scroll { overflow-x: auto; margin-top: 5px; }
#quoteEstLinkBanner table { display: table !important; min-width: 540px; width: 100%; border-collapse: collapse; background: white; color: #334155; font-size: var(--fs-meta); }
#quoteEstLinkBanner thead { display: table-header-group !important; }
#quoteEstLinkBanner tbody { display: table-row-group !important; }
#quoteEstLinkBanner tr { display: table-row !important; }
#quoteEstLinkBanner :is(th, td) { padding: 6px 8px; border-bottom: 1px solid #e2e8f0; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
#quoteEstLinkBanner :is(th, td):first-child { width: 38%; text-align: left; white-space: normal !important; word-break: keep-all; overflow-wrap: anywhere; }
#quoteEstLinkBanner th { background: #f8fafc; font-weight: 700; }
#estQuoteLinkChip { max-width: min(45%, 24rem); flex-shrink: 1; white-space: normal; overflow-wrap: anywhere; }
/* 📱 폰 차이 표 — 4칸 가로 스크롤이면 정작 «차이»가 화면 밖이었다(2026-11-25). 줄마다 두 줄 카드:
   1줄 «항목 … 차이», 2줄 «산출 ○○ · 견적 ○○». 읽기 전용 표라 카드로 바꾼다(패턴: tbody 를 block 으로 명시). */
@media (max-width: 768px) {
  #quoteEstLinkBanner .est-link-scroll { overflow-x: visible; }
  #quoteEstLinkBanner .est-link-scroll table { display: block !important; min-width: 0; }
  #quoteEstLinkBanner .est-link-scroll thead { display: block !important; position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  #quoteEstLinkBanner .est-link-scroll tbody { display: block !important; }
  #quoteEstLinkBanner .est-link-scroll tr {
    display: grid !important; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; row-gap: 2px;
    padding: 8px 10px; border-bottom: 1px solid #e2e8f0;
  }
  #quoteEstLinkBanner .est-link-scroll td { padding: 0; border: 0; white-space: normal; }
  #quoteEstLinkBanner .est-link-scroll td:nth-child(1) { grid-column: 1; grid-row: 1; width: auto; font-weight: 700; color: #1e293b; }
  #quoteEstLinkBanner .est-link-scroll td:nth-child(4) { grid-column: 2; grid-row: 1; font-weight: 800; white-space: nowrap; }
  #quoteEstLinkBanner .est-link-scroll td:nth-child(2) { grid-column: 1; grid-row: 2; text-align: left; color: #64748b; }
  #quoteEstLinkBanner .est-link-scroll td:nth-child(3) { grid-column: 2; grid-row: 2; color: #64748b; white-space: nowrap; }
  #quoteEstLinkBanner .est-link-scroll td:nth-child(2)::before { content: "산출 "; }
  #quoteEstLinkBanner .est-link-scroll td:nth-child(3)::before { content: "견적 "; }
}
