/* 마감재 견적서 (quote.html) */
.q-hero { padding-bottom: 28px; }
.q-section { padding-top: 28px; }
.print-only { display: none; }

.q-banner { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: #fff7ef; border: 1px solid #efd3bd; border-radius: 14px; padding: 14px 18px; margin-bottom: 18px; }
.q-banner p { margin: 0; font-size: 14.5px; }
.q-banner--ai { background: #f3f6f1; border-color: #d4e0cf; }
.q-banner-act { display: flex; gap: 8px; flex-wrap: wrap; }

.q-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 28px; align-items: start; }
.q-side { position: sticky; top: calc(var(--header-h, 72px) + 16px); display: grid; gap: 14px; }
.q-panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.q-panel-h { font-size: 15.5px; margin: 0 0 12px; font-weight: 800; }
details.q-panel > summary { cursor: pointer; list-style: none; margin: 0; }
details.q-panel > summary::-webkit-details-marker { display: none; }
details.q-panel > summary::after { content: "+"; float: right; color: var(--muted); font-weight: 700; }
details.q-panel[open] > summary::after { content: "−"; }
details.q-panel[open] > summary { margin-bottom: 10px; }
.q-field { display: grid; gap: 6px; margin-bottom: 10px; font-size: 13px; font-weight: 700; color: var(--ink-3, #3a3f47); }
.q-num { display: inline-flex; align-items: center; gap: 6px; }
.q-num input, .q-qty input { width: 96px; height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; font: inherit; font-weight: 700; text-align: right; background: #fff; }
.q-num em, .q-qty em { font-style: normal; color: var(--muted); font-size: 13px; }
.q-help { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; line-height: 1.55; }
.q-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.q-seg .opt { min-height: 38px; }
.q-tiers { display: grid; gap: 8px; }
.q-tier { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: baseline; text-align: left; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font: inherit; color: var(--ink); cursor: pointer; transition: border-color .2s, background .2s; }
.q-tier span { font-size: 13px; font-weight: 700; }
.q-tier b { font-size: 14px; text-align: right; }
.q-tier small { grid-column: 2; text-align: right; font-size: 12px; color: var(--accent); font-weight: 700; }
.q-tier:hover:not([aria-disabled="true"]) { border-color: var(--accent); background: #fffaf5; }
.q-tier[aria-disabled="true"] { cursor: default; opacity: .6; }
.q-tier[aria-disabled="true"] small { color: var(--muted); }
.q-tier.is-cur { background: var(--paper); cursor: default; }
.q-room { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 10px 0; border-top: 1px dashed var(--line); }
.q-room:first-child { border-top: 0; }
.q-room b { font-size: 14px; }
.q-room label { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.q-room input { width: 84px; height: 36px; }
.q-link { background: none; border: 0; padding: 8px 0 0; color: var(--accent); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: underline; }
.q-actions { display: grid; gap: 8px; }
.q-actions .btn[disabled] { opacity: .45; pointer-events: none; }

.q-empty { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 36px; }
.q-empty h2 { font-size: 24px; margin-bottom: 6px; }
.q-empty > p { color: var(--muted); }
.q-empty-steps { list-style: none; counter-reset: qs; display: grid; gap: 12px; margin: 20px 0 0; padding: 0; }
.q-empty-steps li { counter-increment: qs; display: grid; grid-template-columns: 36px 1fr auto; gap: 4px 14px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.q-empty-steps li::before { content: counter(qs); grid-row: span 2; width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 800; }
.q-empty-steps b { font-size: 16px; }
.q-empty-steps span { grid-column: 2; font-size: 14px; color: var(--muted); }
.q-empty-steps .btn { grid-column: 3; grid-row: 1 / span 2; }
.q-empty-ai { font-size: 13px !important; color: var(--accent) !important; }

/* ---------- 견적서 문서 ---------- */
.q-doc { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 40px 44px; box-shadow: var(--shadow-s, 0 2px 10px rgba(0,0,0,.04)); }
.q-doc-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; padding-bottom: 20px; border-bottom: 3px solid var(--ink); }
.q-doc-kicker { font-size: 12px; letter-spacing: .24em; font-weight: 800; color: var(--accent); margin: 0 0 6px; }
.q-doc-head h2 { font-size: 34px; letter-spacing: .3em; margin: 0; }
.q-doc-sub { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }
.q-doc-meta { display: grid; grid-template-columns: auto auto; gap: 4px 14px; margin: 0; font-size: 13.5px; }
.q-doc-meta dt { color: var(--muted); }
.q-doc-meta dd { margin: 0; font-weight: 700; text-align: right; }
.q-doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 20px 0; }
.q-doc-parties section { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.q-doc-parties h3 { font-size: 13px; letter-spacing: .1em; color: var(--muted); margin: 0 0 8px; }
.q-doc-parties dl { display: grid; grid-template-columns: 76px 1fr; gap: 4px 10px; margin: 0; font-size: 13.5px; }
.q-doc-parties dt { color: var(--muted); }
.q-doc-parties dd { margin: 0; font-weight: 600; word-break: keep-all; }
.q-blank { color: var(--muted); font-weight: 500 !important; }
.q-total { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; align-items: center; background: var(--paper); border-radius: 14px; padding: 18px 22px; margin-bottom: 18px; }
.q-total-main small { display: block; font-size: 12.5px; color: var(--muted); font-weight: 700; }
.q-total-main b { display: block; font-size: 28px; letter-spacing: -.03em; color: var(--accent); }
.q-total-main span { font-size: 13.5px; font-weight: 700; }
.q-total-kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 13px; }
.q-total-kv dt { color: var(--muted); }
.q-total-kv dd { margin: 0; text-align: right; font-weight: 700; }
.q-warn { border: 1px solid #efd3bd; background: #fffaf5; border-radius: 12px; padding: 12px 16px; font-size: 13px; margin-bottom: 18px; }
.q-warn ul { margin: 6px 0 0; padding-left: 18px; color: var(--ink-3, #3a3f47); }
.q-sec-h { font-size: 16px; margin: 26px 0 10px; }
.q-table-wrap { overflow-x: auto; }
.q-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.q-table th, .q-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.q-table thead th { font-size: 12.5px; color: var(--muted); font-weight: 700; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.q-table .num { text-align: right; white-space: nowrap; }
.q-table .c-el { width: 14%; } .q-table .c-mat { width: 32%; } .q-table .c-qty { width: 15%; } .q-table .c-unit { width: 15%; } .q-table .c-amt { width: 17%; } .q-table .c-act { width: 64px; }
.q-grp th, .q-grp td { background: #f6f2ec; font-weight: 800; font-size: 14px; border-bottom: 1px solid #e3dbcf; }
.q-grp small { font-weight: 600; color: var(--muted); font-size: 12px; margin-left: 6px; }
.q-src { display: block; font-size: 11.5px; color: var(--accent); font-weight: 700; margin-top: 2px; }
.q-mat { display: flex; gap: 10px; align-items: flex-start; }
.q-mat i { flex: 0 0 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0,0,0,.08); margin-top: 1px; }
.q-mat b { display: block; font-size: 14px; }
.q-mat small { display: block; color: var(--muted); font-size: 12px; }
.q-qty { display: inline-flex; gap: 4px; align-items: center; justify-content: flex-end; }
.q-qty input { width: 76px; height: 34px; }
.q-how { display: block; color: var(--muted); font-size: 11.5px; margin-top: 3px; white-space: normal; }
.q-act { text-align: right; }
.q-x { white-space: nowrap; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 4px 9px; font: inherit; font-size: 12px; color: var(--muted); cursor: pointer; }
.q-x:hover { border-color: #c44; color: #b33; }
.is-unpriced td { color: var(--muted); }
.q-common td { font-size: 13px; }
.q-sum th, .q-sum td { font-size: 15px; font-weight: 800; border-bottom: 0; padding-top: 14px; }
.q-sum td b { color: var(--accent); }
.q-sum--vat th, .q-sum--vat td { font-size: 13.5px; padding-top: 4px; color: var(--ink-3, #3a3f47); }
.q-sum--vat td b { color: inherit; }
.q-sched td, .q-sched th { padding: 8px; }
.q-chip { display: inline-block; width: 26px; height: 18px; border-radius: 5px; border: 1px solid rgba(0,0,0,.1); vertical-align: middle; }
.q-notes { font-size: 13px; color: var(--ink-3, #3a3f47); padding-left: 18px; display: grid; gap: 4px; }
.q-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 26px; }
.q-sign div { border-top: 1px solid var(--ink); padding-top: 10px; display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.q-sign span { color: var(--muted); }
.q-sign-line { display: inline-block; min-width: 120px; border-bottom: 1px solid var(--line); height: 1.2em; }

@media (max-width: 1080px) {
  .q-layout { grid-template-columns: 1fr; }
  .q-side { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .q-actions { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .q-side { grid-template-columns: 1fr; }
  .q-doc { padding: 22px 16px; border-radius: 14px; }
  .q-doc-head { flex-direction: column; align-items: flex-start; }
  .q-doc-head h2 { font-size: 26px; }
  .q-doc-meta dd { text-align: left; }
  .q-doc-parties { grid-template-columns: 1fr; }
  .q-total { grid-template-columns: 1fr; padding: 16px; }
  .q-total-main b { font-size: 23px; }
  .q-empty { padding: 22px 16px; }
  .q-empty-steps li { grid-template-columns: 32px 1fr; }
  .q-empty-steps .btn { grid-column: 2; grid-row: auto; justify-self: start; margin-top: 6px; }
  /* 표 → 카드 */
  .q-table thead, .q-table colgroup { display: none; }
  .q-table, .q-table tbody, .q-table tr, .q-table td, .q-table th { display: block; width: 100%; }
  .q-table tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .q-table td, .q-table th { border: 0; padding: 4px 0; }
  .q-table td[data-th] { display: grid; grid-template-columns: 64px 1fr; gap: 8px; text-align: left; white-space: normal; }
  .q-table td[data-th]::before { content: attr(data-th); color: var(--muted); font-size: 12px; font-weight: 700; padding-top: 2px; }
  .q-table td[data-th] > * { grid-column: 2; }
  .q-grp small { display: block; margin: 2px 0 0; }
  .q-table td.num { text-align: left; }
  .q-qty { justify-content: flex-start; }
  .q-act { text-align: left; padding-top: 6px !important; }
  .q-grp { display: flex !important; justify-content: space-between; gap: 8px; background: #f6f2ec; padding: 10px !important; border-radius: 10px; margin-top: 10px; }
  .q-grp th, .q-grp td { background: none; padding: 0; width: auto; }
  .q-sum { display: flex !important; justify-content: space-between; gap: 8px; border: 0 !important; }
  .q-sum th, .q-sum td { width: auto; padding: 4px 0; }
  .q-sign { grid-template-columns: 1fr; }
}

/* ---------- 인쇄 (A4) ---------- */
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  .page-hero, .q-side, .q-banner, .q-empty, #jnBtn, #jnDrawer, .tg-progress, .toast { display: none !important; }
  .q-section { padding: 0 !important; }
  .q-layout { display: block; }
  .q-doc { border: 0; box-shadow: none; padding: 0; border-radius: 0; }
  .q-doc-head h2 { font-size: 26px; }
  .print-only { display: inline; }
  .q-table { font-size: 10.5px; }
  .q-table th, .q-table td { padding: 5px 6px; }
  .q-table tr { break-inside: avoid; }
  .q-grp th, .q-grp td, .q-total, .q-mat i, .q-chip { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .q-how { font-size: 9px; }
  .q-sec-h { break-after: avoid; font-size: 13px; }
  .q-sched { break-before: auto; }
  .q-total-main b { font-size: 22px; }
  .q-table td.no-print, .q-table th.no-print, .q-table col.no-print { display: none !important; }
  .q-mat b { font-size: 11px; }
  .q-notes { font-size: 10.5px; }
  .q-src { display: none; }
}

#quoteApp [hidden], .mtd-quote[hidden] { display: none !important; }

.q-ai-more { margin: 6px 0 4px; font-size: 14px; }
.q-ai-more summary { cursor: pointer; color: var(--accent-2); font-weight: 700; }
.q-ai-more pre { white-space: pre-wrap; font: inherit; color: var(--muted); margin: 8px 0 0; line-height: 1.6; }
