/* 견적한방: 제안서와 같은 베이지·브라운 톤 */
:root {
  color-scheme: only light;
  --bg: #F6F2EC;
  --paper: #FFFFFF;
  --ink: #2B2622;
  --ink-2: #5E554D;
  --muted: #8F857B;
  --line: #E4DBCF;
  --line-2: #EFE8DE;
  --accent: #9C7B5B;
  --accent-ink: #7A5C40;
  --accent-soft: #F1EBE3;
  --danger: #B5483B;
  --ok: #4F7A55;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(43, 38, 34, .06), 0 4px 16px rgba(43, 38, 34, .05);
  font-family: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); font-size: 15px; line-height: 1.5; min-height: 100vh; }
a { color: inherit; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 16px; margin: 0 0 12px; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 9px 11px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); cursor: pointer; }
label.check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--danger); font-size: 14px; min-height: 1em; }
.grow { flex: 1; }
.pre { white-space: pre-wrap; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--paper); cursor: pointer; text-decoration: none; font-size: 14px; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #000; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger, .icon.danger { color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.tiny { padding: 1px 8px; font-size: 12px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.icon { border: 0; background: none; cursor: pointer; padding: 4px 6px; border-radius: 6px; color: var(--muted); }
.icon:hover { background: var(--accent-soft); color: var(--ink); }
.chip { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-ink); white-space: nowrap; }

/* 상단 */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 0 20px; height: 54px;
  background: var(--ink); color: #fff;
}
.brand { font-size: 18px; text-decoration: none; letter-spacing: -.02em; font-weight: 500; }
.brand b { color: #D9BE9C; }
.topbar nav { display: flex; gap: 2px; overflow-x: auto; }
.topbar nav a { text-decoration: none; padding: 6px 12px; border-radius: 8px; color: #CFC6BC; font-size: 14px; white-space: nowrap; }
.topbar nav a.on, .topbar nav a:hover { color: #fff; background: rgba(255, 255, 255, .1); }

.page { max-width: 1100px; margin: 0 auto; padding: 24px 20px 100px; }
.page.narrow { max-width: 760px; }
.page.wide { max-width: 1400px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.card { background: var(--paper); border: 1px solid var(--line-2); border-radius: 14px; padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .span2 { grid-column: span 2; }
.row-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.row-form input, .row-form select { flex: 1 1 160px; width: auto; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }
.notice { background: #FFF8EC; border: 1px solid #F0DDBB; padding: 10px 14px; border-radius: 10px; display: flex; align-items: center; gap: 10px; justify-content: space-between; }

/* 로그인 */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #EFE6DA, #F6F2EC); }
.auth-card { width: 100%; max-width: 380px; background: var(--paper); padding: 32px 28px; border-radius: 18px; box-shadow: var(--shadow); }
.auth-card form { display: grid; gap: 14px; margin-top: 20px; }
.auth-brand { font-size: 28px; letter-spacing: -.03em; }
.auth-brand b { color: var(--accent); }

/* 검색 */
.search { padding: 11px 14px; font-size: 15px; border-radius: 10px; }
.search.small { max-width: 240px; font-size: 14px; }
.search-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.search-bar > .search-wrap { flex: 1 1 320px; }
.search-wrap { position: relative; }
.dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--paper); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .12); max-height: 380px; overflow-y: auto; padding: 4px;
}
.dd-row { display: flex; gap: 8px; align-items: baseline; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.dd-row.on, .dd-row:hover { background: var(--accent-soft); }
.dd-name { font-weight: 600; }
.dd-row .muted { font-size: 13px; margin-left: auto; text-align: right; }
.dd-tag { font-size: 11px; padding: 1px 6px; border-radius: 5px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; flex: none; }
.dd-tag.mat { background: #E6EFE6; color: var(--ok); }
.dd-empty { padding: 10px; margin: 0; font-size: 14px; }
.hint { margin: 0 0 8px; }

/* 목록 */
.est-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.est-list li { display: flex; align-items: center; gap: 12px; background: var(--paper); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; }
.est-main { flex: 1; text-decoration: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.est-main .muted { width: 100%; font-size: 13px; }
.est-total { font-weight: 700; white-space: nowrap; }
.est-actions { display: flex; gap: 4px; }
.simple-list { list-style: none; padding: 0; margin: 0 0 8px; }
.simple-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.logo-box { grid-column: span 2; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* 로고: 투명한 부분이 보이게 체크무늬 위에 */
.logo-preview { min-width: 160px; min-height: 60px; display: grid; place-items: center; padding: 8px; border-radius: 8px;
  background: repeating-conic-gradient(#EEE 0 25%, #fff 0 50%) 0 0 / 14px 14px; border: 1px solid var(--line-2); }
.logo-preview img { max-height: 56px; max-width: 220px; display: block; }
.logo-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: 1; }
.logo-box { outline: none; border-radius: 10px; padding: 6px; border: 2px dashed transparent; }
.logo-box.drop-on, .logo-box:focus { border-color: var(--accent); }

/* 새 견적 체크리스트 */
.check-group { border: 0; padding: 0; margin: 0 0 18px; }
.check-group legend { font-weight: 700; margin-bottom: 6px; color: var(--accent-ink); }
.check-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border-radius: 10px; }
.check-row.on { background: var(--accent-soft); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--paper); }
.seg button { border: 0; background: none; padding: 4px 10px; font-size: 13px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--ink); color: #fff; }
.counts { display: inline-flex; gap: 10px; }
.stepper { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 2px 6px; }
.stepper button { border: 0; background: var(--line-2); width: 24px; height: 24px; border-radius: 6px; cursor: pointer; }
.sticky-actions {
  position: sticky; bottom: 0; display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 12px 0;
  background: linear-gradient(transparent, var(--bg) 30%);
}

/* 편집기 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chips button { border: 1px solid var(--line); background: var(--paper); border-radius: 99px; padding: 4px 12px; cursor: pointer; font-size: 13px; }
.chips button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.sheet-wrap { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; overflow: auto; }
.sheet { border-collapse: collapse; width: 100%; font-size: 14px; }
.sheet th, .sheet td { border-bottom: 1px solid var(--line-2); padding: 0; text-align: left; }
.sheet thead th { position: sticky; top: 0; background: #FAF7F3; font-size: 12px; color: var(--ink-2); font-weight: 600; padding: 8px 6px; z-index: 1; white-space: nowrap; }
.sheet tr.sec th { background: var(--accent-soft); padding: 7px 8px; font-size: 13px; color: var(--accent-ink); position: static; }
.sheet tr.sec th.c-num { text-align: right; font-weight: 700; }
.sheet input, .sheet select { border: 0; border-radius: 0; background: transparent; padding: 8px 6px; }
.sheet input:focus, .sheet select:focus { background: #FFFDF8; outline: 2px solid var(--accent); outline-offset: -2px; }
.sheet .c-name { min-width: 180px; }
.sheet .c-spec { min-width: 150px; }
.sheet .c-unit { width: 64px; }
.sheet .c-qty { width: 72px; }
.sheet .c-num { width: 120px; text-align: right; }
.sheet .c-num input, .sheet .c-qty input { text-align: right; }
.sheet .amt { padding: 0 8px; font-weight: 600; white-space: nowrap; }
.sheet .c-act { width: 86px; white-space: nowrap; text-align: center; }
.sheet .c-fav { width: 36px; text-align: center; }
.sheet tbody tr:hover td { background: #FCFAF7; }
.star { border: 0; background: none; cursor: pointer; font-size: 16px; color: var(--line); }
.star.on { color: #D19A2A; }

.totals-bar {
  position: sticky; bottom: 0; z-index: 10; margin-top: 16px; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline;
  background: var(--ink); color: #E8E1D8; padding: 12px 18px; border-radius: 12px; font-size: 13px;
}
.totals-bar b { color: #fff; font-size: 14px; }
.totals-bar .grand { margin-left: auto; font-size: 14px; }
.totals-bar .grand b { font-size: 19px; color: #F3DDBE; }

.mat-rows { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.mat-rows li { display: flex; gap: 12px; align-items: center; background: var(--paper); border: 1px solid var(--line-2); border-radius: 12px; padding: 8px; }
.thumb { width: 72px; height: 72px; border-radius: 8px; background: #fff; border: 1px solid var(--line-2); display: grid; place-items: center; overflow: hidden; flex: none; font-size: 11px; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.mat-fields { flex: 1; display: grid; grid-template-columns: auto 1fr 1.4fr 1fr; gap: 6px; align-items: center; min-width: 0; }
.mat-fields input { padding: 6px 8px; }
.mat-fields .strong { font-weight: 600; }
.mat-act { display: flex; }

.mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.mat-card { border: 1px solid var(--line-2); background: var(--paper); border-radius: 12px; overflow: hidden; padding: 0; cursor: pointer; text-align: left; display: flex; flex-direction: column; }
.mat-card:hover { border-color: var(--accent); }
.photo { aspect-ratio: 1; background: #fff; border-bottom: 1px solid var(--line-2); display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo, .p-photo { position: relative; }
.photo > img { position: absolute; inset: 0; }
/* 사진 출처: 사진 오른쪽 아래에 작게 */
.photo-src { position: absolute; right: 4px; bottom: 3px; font-size: 9px; line-height: 1.3; color: #8F857B; background: rgba(255, 255, 255, .7); padding: 0 4px; border-radius: 3px; max-width: calc(100% - 8px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-photo .photo-src { font-size: 5.5pt; right: 2mm; bottom: 1.5mm; }
.mat-card .meta { padding: 10px 12px; display: grid; gap: 2px; }

/* 대화상자 */
.modal { border: 0; border-radius: 16px; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal::backdrop { background: rgba(30, 26, 22, .45); }
.modal-body { padding: 20px; display: grid; gap: 16px; }
.modal-head, .modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.modal-head h2 { margin: 0; }
.photo-edit { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.photo.big { border-radius: 12px; overflow: hidden; gap: 8px; align-content: center; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; align-content: flex-start; }
.photo-actions p { margin: 0; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; transition: .2s; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 핸드폰 ---------- */
@media (max-width: 720px) {
  body { font-size: 14px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .brand { font-size: 16px; }
  .topbar nav a { padding: 6px 8px; font-size: 13px; }
  .page { padding: 16px 12px 110px; }
  .form-grid, .two-col { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: auto; }
  .logo-box { grid-column: auto; }
  .est-list li { flex-wrap: wrap; }
  .est-actions { width: 100%; justify-content: flex-end; }
  .search.small { max-width: none; flex: 1 1 100%; }
  .photo-edit { grid-template-columns: 1fr; }
  .photo.big { max-width: 260px; }
  .mat-fields { grid-template-columns: 1fr; }
  .mat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .totals-bar { border-radius: 0; margin: 16px -12px 0; padding: 10px 12px; }
  .totals-bar span:not(.grand) { display: none; }

  /* 견적 표 → 카드 */
  .editor .sheet thead { display: none; }
  .editor .sheet, .editor .sheet tbody { display: block; }
  .editor .sheet tr.sec { display: flex; justify-content: space-between; background: var(--accent-soft); }
  .editor .sheet tr.sec th { display: block; border: 0; }
  .editor .sheet tr.sec th:empty { display: none; }
  .editor .sheet tr[data-id] {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 6px; padding: 8px 10px; border-bottom: 1px solid var(--line);
    grid-template-areas: "name name name" "spec spec spec" "unit qty amt" "mat lab act";
  }
  .editor .sheet tr[data-id] td { border: 0; display: block; width: auto; min-width: 0; }
  .editor .sheet td.c-name { grid-area: name; }
  .editor .sheet td.c-name input { font-weight: 600; font-size: 15px; }
  .editor .sheet td.c-spec { grid-area: spec; }
  .editor .sheet td.c-unit { grid-area: unit; }
  .editor .sheet td.c-qty { grid-area: qty; }
  .editor .sheet td.amt { grid-area: amt; align-self: center; text-align: right; }
  .editor .sheet td.c-num:nth-child(6) { grid-area: mat; }
  .editor .sheet td.c-num:nth-child(7) { grid-area: lab; }
  .editor .sheet td.c-act { grid-area: act; align-self: center; }
  .editor .sheet td.c-unit::before { content: '단위'; }
  .editor .sheet td.c-qty::before { content: '수량'; }
  .editor .sheet td.c-num:nth-child(6)::before { content: '자재비 단가'; }
  .editor .sheet td.c-num:nth-child(7)::before { content: '노무비 단가'; }
  .editor .sheet td::before { display: block; font-size: 11px; color: var(--muted); padding-left: 6px; }
  .editor .sheet input { background: #FAF7F3; border-radius: 6px; margin-top: 2px; }
  .hint { display: none; }
  .sheet.items { font-size: 13px; }
}

/* ---------- 인쇄 화면 ---------- */
.print-bar {
  position: sticky; top: 54px; z-index: 15; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--paper); border-bottom: 1px solid var(--line);
}
.paper-wrap { padding: 20px 8px 80px; display: flex; justify-content: center; }
.paper { display: grid; gap: 20px; }
.a4 {
  width: 297mm; min-height: 210mm; background: #fff; padding: 14mm 18mm; box-shadow: var(--shadow); position: relative;
  font-size: 10.5pt; color: #222; display: flex; flex-direction: column;
}
.ed { border-radius: 3px; outline: none; min-width: 1em; display: inline-block; }
.ed:hover { background: #FFF6E5; box-shadow: 0 0 0 1px #F0D9AC; }
.ed:focus { background: #FFF6E5; box-shadow: 0 0 0 2px var(--accent); }

.doc-title { text-align: center; font-size: 22pt; letter-spacing: .2em; margin: 0 0 7mm; }
.doc-title.small { font-size: 15pt; margin-bottom: 5mm; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 10.5pt; }
.doc-table .name-c { text-align: center; }
.doc-table tr.gap td { border-left: 0; border-right: 0; height: 4mm; padding: 0; background: #fff; }
.doc-table th, .doc-table td { border: 1px solid #A9A9A9; padding: 5px 8px; vertical-align: middle; }
.doc-table thead th { background: #EFE6DA; text-align: center; font-weight: 600; height: 9mm; }
.doc-table .num { text-align: right; white-space: nowrap; }
/* 표 머리글(수량·단가·금액 등)은 가운데 */
.doc-table thead th, .doc-table thead th.num, .doc-table thead th.qty, .doc-table thead th.unit { text-align: center; }
.doc-table .no { width: 10mm; text-align: center; }
.doc-table .unit { width: 12mm; text-align: center; }
.doc-table .qty { width: 13mm; text-align: right; }
.doc-table tr.sub td { background: #F7F3EE; font-weight: 600; }
.doc-table tr.total td { background: #EFE6DA; font-weight: 700; font-size: 11.5pt; }
.doc-table tr.sec td { background: #F7F3EE; font-weight: 700; }
.detail-table { font-size: 9pt; }
.detail-table td { padding: 4px 6px; }
.detail-table thead { display: table-header-group; }
/* 공정 하나(제목·줄·소계)는 되도록 한 장에 — 넘치면 통째로 다음 장으로 (한 장보다 길면 그때만 나뉨) */
.detail-table tbody { break-inside: avoid; }
.detail-table tr { break-inside: avoid; }
.doc-notes { font-size: 10pt; color: #444; }
.doc-notes p { margin: 2px 0; }
.doc-sign { margin-top: auto; text-align: right; font-weight: 600; padding-top: 6mm; }

/* ---------- 마감재 제안서 (A4 가로) ---------- */
.proposal .a4 { padding: 14mm 16mm 12mm; }
.p-cover { background: #EFE6DA; padding: 22mm 24mm !important; display: grid !important; grid-template-columns: 1.3fr 1fr; column-gap: 16mm; }
.p-cover-main { display: flex; flex-direction: column; justify-content: center; }
.p-eyebrow { letter-spacing: .35em; font-size: 9pt; color: #6D6259; margin: 0 0 14mm; }
.p-cover h1 { font-size: 50pt; line-height: 1.15; margin: 0 0 9mm; letter-spacing: -.02em; }
.p-cover h1 em { font-style: normal; color: var(--accent); }
.p-cover hr { width: 36mm; border: 0; border-top: 2px solid var(--accent); margin: 0 0 9mm; }
.p-sub { font-size: 12pt; color: #4A423B; line-height: 1.8; margin: 0; }
.p-cover-side { display: flex; flex-direction: column; justify-content: flex-end; gap: 14mm; }
.p-meta { margin: 0; padding-top: 7mm; border-top: 1px solid #CDBFAE; display: grid; grid-template-columns: 24mm 1fr; gap: 4mm 0; font-size: 11pt; }
.p-meta dt { color: #6D6259; }
.p-meta dd { margin: 0; }
.p-co { font-size: 12pt; font-weight: 600; text-align: right; }
.p-co img { max-height: 13mm; max-width: 55mm; }
.p-page { background: #FBF9F6 !important; }
.p-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid #2B2622; padding-bottom: 3mm; margin-bottom: 5mm; }
.p-head h2 { font-size: 15pt; margin: 0; }
.p-head h2 span { color: var(--accent); margin-right: 3mm; font-weight: 800; }
.p-head > span { font-size: 8.5pt; color: #8F857B; }
/* 총괄표: 줄이 많으면 왼쪽·오른쪽 2단 */
.p-summary.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10mm; align-items: start; }
.p-table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
.p-summary.two .p-table { font-size: 8.5pt; }
.p-table th { text-align: left; font-weight: 600; color: #6D6259; border-bottom: 1px solid #CDBFAE; padding: 5px 4px; }
.p-table td { padding: 4px 4px; height: 6.4mm; border-bottom: 1px solid #EAE2D7; }
.p-table td:first-child { color: #6D6259; width: 22mm; }
.p-group td { font-weight: 700; padding-top: 7px !important; border-bottom: 0 !important; color: #2B2622 !important; }
.p-group span { color: var(--accent); margin-right: 2mm; }
/* 사진 카드: 분류를 이어서 채운다 */
.p-gblock { margin-bottom: 1mm; }
.p-col .p-notes-block { margin-top: 8mm; }
.p-ghead { font-size: 11pt; margin: 0 0 1.5mm; padding-bottom: 1mm; border-bottom: 1px solid #CDBFAE; height: 6mm; line-height: 6mm; box-sizing: content-box; }
.p-ghead span { color: var(--accent); margin-right: 2mm; font-weight: 800; }
/* 사진 카드 한 줄: 4칸 그리드에 분류(묶음)가 칸 수만큼 차지한다. 안쪽 칸 간격을 바깥과 같게 해서 카드 폭이 모두 같다 */
.p-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 4mm; margin-bottom: 4mm; }
.p-seg { min-width: 0; }
.p-cards { display: grid; gap: 4mm; }
.p-card { background: #fff; border: 1px solid #EAE2D7; border-radius: 2.5mm; overflow: hidden; break-inside: avoid; height: 72mm; }
.p-photo { height: 49mm; background: #fff; border-bottom: 1px solid #EFE8DE; display: grid; place-items: center; color: #A79B8E; font-size: 8pt; }
/* 그리드 안에서는 높이 100% 가 먹지 않으므로 칸에 딱 붙여 채운다 */
.p-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 1.5mm; box-sizing: border-box; }
.p-info { padding: 3mm 5mm 4mm; }
.p-info p { margin: 0; font-size: 8pt; color: #8F857B; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-kind { background: #F1EBE3; color: var(--accent-ink); padding: 0 4px; border-radius: 3px; margin: 0 2px 0 -4px; }
.p-info h3 { font-size: 11.5pt; margin: 1.5mm 0 1mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-info .p-spec { font-size: 9pt; color: #5E554D; }
.p-notes { list-style: none; padding: 0; margin: 0; font-size: 10pt; line-height: 1.9; color: #4A423B; }
.p-notes li::before { content: '· '; }
.p-foot { margin-top: auto; padding-top: 3mm; display: flex; justify-content: space-between; font-size: 8pt; color: #A79B8E; }

@page { size: 297mm 210mm; margin: 0; }   /* A4 가로 */
/* 세부 내역은 길어서 여러 장으로 넘어가므로, 넘어간 장에도 위아래 여백이 생기게 여백 있는 용지로 찍는다 */
@page flow { size: 297mm 210mm; margin: 14mm 0 12mm; }
@media print {
  html, body { background: #fff; }
  .no-print, .topbar, #toast { display: none !important; }
  .paper-wrap { padding: 0; display: block; }
  .paper { display: block; zoom: 1 !important; }
  .a4 { box-shadow: none; break-after: page; min-height: 209mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .a4.detail { min-height: 0; page: flow; padding-top: 0; padding-bottom: 0; }
  .a4:last-child { break-after: auto; }
  .ed:hover, .ed:focus { background: none; box-shadow: none; }
}

/* ---------- 편집기: 공정 접기, 줄 옮김 표시 ---------- */
.sheet-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.sheet-tools .hint { margin: 0; }
.fold { border: 0; background: none; padding: 2px 6px 2px 0; font: inherit; font-weight: 700; color: var(--accent-ink); cursor: pointer; }
.fold:hover { text-decoration: underline; }
.sheet tr.sec th .btn { margin-left: 4px; }
.sheet tbody.folded tr.sec th { opacity: .85; }
.sheet tr.flash td { background: #FFF3D6 !important; transition: background .6s; }
.sheet select { border: 0; background: transparent; padding: 8px 4px; border-radius: 0; }
.sheet .c-trade { min-width: 110px; }

/* 단가표에서 넣기 */
.wide-modal { width: min(760px, calc(100vw - 24px)); }
.pick-list { max-height: 52vh; overflow-y: auto; display: grid; gap: 4px; }
.pick-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; text-align: left; border: 1px solid var(--line-2); background: var(--paper); border-radius: 8px; padding: 9px 12px; cursor: pointer; }
.pick-row:hover { border-color: var(--accent); background: #FFFDF8; }
.pick-main { flex: 1 1 260px; }
.pick-price { font-size: 13px; color: var(--ink-2); }

/* 마감재: 분류별 묶음, 순서 버튼 */
.mat-group { font-size: 15px; margin: 22px 0 10px; color: var(--accent-ink); }
.mat-group:first-child { margin-top: 4px; }
.mat-card { position: relative; }
.card-mv { position: absolute; top: 6px; right: 6px; display: flex; gap: 2px; background: rgba(255, 255, 255, .9); border-radius: 8px; }

/* 설정: 공정·단위·분류 목록 */
.lists-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; margin-bottom: 10px; }
.lists-grid h3 { font-size: 14px; margin: 0 0 8px; }
.list-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.list-row input { padding: 7px 9px; }
.row-btns { display: flex; flex: none; }
.unit-chips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 10px; }
@media (max-width: 720px) {
  .lists-grid { grid-template-columns: 1fr; }
  .sheet.items .c-trade { min-width: 120px; }
  .sheet.items select, .sheet.items input { min-width: 0; }
  .editor .sheet td.c-unit select { background: #FAF7F3; border-radius: 6px; margin-top: 2px; width: 100%; padding: 8px 6px; }
  .editor .sheet tr.sec th { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
  .card-mv { top: 4px; right: 4px; }
}

/* ---------- 끌어서 옮기기 ---------- */
.drag { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 28px; cursor: grab; color: var(--muted); touch-action: none; user-select: none; border-radius: 6px; font-size: 15px; vertical-align: middle; }
.drag:hover { background: var(--accent-soft); color: var(--ink); }
.dragging { opacity: .55; outline: 2px dashed var(--accent); outline-offset: -2px; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; }
.mat-rows li > .drag { flex: none; }
.site-group { margin-top: 18px; }
.site-name { font-size: 16px; margin: 0 0 6px; }
.site-group .est-list { margin-top: 0; }
@media (max-width: 720px) {
  .drag { width: 32px; height: 34px; font-size: 18px; }
  .est-actions { flex-wrap: wrap; }
}

/* 견적 줄: 맨 왼쪽 끌기 손잡이 */
.sheet .c-drag { width: 30px; text-align: center; padding: 0; }
.sheet .c-sel { width: 34px; text-align: center; }
.sheet .c-sel input { width: 17px; height: 17px; accent-color: var(--accent); }
.sheet.items tr.selected td { background: #FFF6E5; }
/* 단가표: 고르면 나타나는 버튼 창 */
.bulk-bar {
  position: sticky; bottom: 12px; z-index: 12; margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}
.bulk-bar .btn { background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(255, 255, 255, .2); }
.bulk-bar .btn.danger { color: #FFB4A8; }
.bulk-move { flex-direction: row; align-items: center; gap: 6px; color: #E8E1D8; font-size: 13px; }
.bulk-move select { width: auto; padding: 5px 8px; color: var(--ink); }
@media (max-width: 720px) {
  .editor .sheet tr[data-id] { position: relative; padding-left: 40px; }
  .editor .sheet td.c-drag { position: absolute; left: 4px; top: 10px; }
  .bulk-bar { bottom: 8px; }
}

/* ---------- 공사내역서 (일반 견적서 양식, A4 가로) ---------- */
.quote .doc-title { font-size: 19pt; margin-bottom: 4.5mm; }
.quote-head { display: grid; grid-template-columns: 1fr 1.25fr; gap: 8mm; align-items: start; }
.q-info, .q-supplier { width: 100%; border-collapse: collapse; font-size: 10pt; }
.q-info th, .q-info td, .q-supplier th, .q-supplier td { border: 1px solid #9A9A9A; padding: 0 8px; height: 7mm; text-align: center; }
.q-info th, .q-supplier th { background: #F3EEE8; font-weight: 600; white-space: nowrap; width: 24mm; text-align: center; }
.q-supplier .q-vert { width: 9mm; line-height: 1.5; letter-spacing: 0; }
.q-lead { margin: 5mm 0 2mm; font-size: 10pt; color: #444; }
.q-total {
  display: flex; align-items: center; gap: 6mm; border: 2px solid #222; background: #FAF7F3;
  padding: 0 7mm; height: 13mm; margin: 4.5mm 0;
}
.q-total-label { font-weight: 700; font-size: 11pt; display: flex; flex-direction: column; line-height: 1.25; }
.q-total-label small { font-weight: 400; font-size: 8pt; color: #666; }
.q-total-words { font-size: 14pt; font-weight: 700; letter-spacing: .02em; }
.q-total-num { margin-left: auto; font-size: 14pt; font-weight: 700; }
/* 공종표: 칸 높이는 정해 두고(내용이 길면 그만큼만 늘어남), 남는 곳은 아래 여백으로 둔다 */
.q-table { font-size: 10pt; }
.q-table th, .q-table td { height: 7mm; padding: 0 8px; }
.q-table thead th { height: 8mm; }
.q-table .w-no { width: 12mm; }
.q-table .w-num { width: 34mm; }
.q-table .w-note { width: 58mm; }
.q-table td.note { font-size: 8.5pt; color: #555; }
.quote { padding-top: 12mm !important; padding-bottom: 10mm !important; }
.q-notes { margin-top: auto; border: 1px solid #9A9A9A; padding: 2mm 6mm; font-size: 9pt; color: #333; display: flex; gap: 6mm; align-items: baseline; }
.q-notes h3 { font-size: 10pt; margin: 0; white-space: nowrap; }
.q-notes ul { margin: 0; padding-left: 4mm; line-height: 1.6; }
.q-notes + * { margin-top: 0; }

/* ================= 견적서 디자인 6가지 ================= */
/* 공사내역서·세부내역에 쓰는 색·글꼴 (디자인마다 바뀜) */
.paper {
  /* 포인트 색(--t-accent)은 설정에서 고른 색이 .paper 의 style 로 들어온다. 표 색은 그 색을 흰색에 옅게 섞어 만든다 */
  --t-ink: #222; --t-accent: #9e5a24;
  --t-head: color-mix(in srgb, var(--t-accent) 14%, white);
  --t-sub: color-mix(in srgb, var(--t-accent) 6%, white);
  --t-total: color-mix(in srgb, var(--t-accent) 22%, white);
  --t-page: #fff;
}

.paper .a4.quote, .paper .a4.detail { background: var(--t-page); }
.paper .doc-title { font-family: inherit; color: var(--t-ink); }
.paper .doc-table thead th { background: var(--t-head); color: var(--t-ink); }
.paper .doc-table tr.sub td, .paper .doc-table tr.sec td { background: var(--t-sub); }
.paper .doc-table tr.total td { background: var(--t-total); color: var(--t-ink); }
.paper .q-info th, .paper .q-supplier th { background: var(--t-head); }
.paper .q-total { border-color: var(--t-accent); }
.paper .q-total-words, .paper .q-total-num { color: var(--t-ink); }
.paper .q-total { background: var(--t-sub); }
.paper.theme-5 .q-total-num, .paper.theme-5 .doc-title { color: var(--t-accent); }

/* 표지 공통 */
.cover { padding: 0 !important; overflow: hidden; }
/* 첫 페이지 상표 (상호명 또는 로고) — 네 귀퉁이 중 하나 */
.cv-brand { position: absolute; z-index: 2; }
.cv-brand.pos-tl { top: 16mm; left: 22mm; }
.cv-brand.pos-tr { top: 16mm; right: 22mm; text-align: right; }
.cv-brand.pos-bl { bottom: 16mm; left: 22mm; }
.cv-brand.pos-br { bottom: 16mm; right: 22mm; text-align: right; }
/* 로고의 흰 바탕이 비치지 않게: 곱하기로 겹치면 흰색은 투명하게 보인다 */
.cv-brand img { display: block; max-width: 70mm; max-height: 24mm; object-fit: contain; }
.cv-brand-name { font-size: 15pt; font-weight: 700; letter-spacing: .06em; color: #333; }
/* 상표 크기: 작게 / 보통 / 크게 */
.cv-brand.size-s img { max-width: 48mm; max-height: 15mm; }
.cv-brand.size-l img { max-width: 100mm; max-height: 36mm; }
.cv-brand-name.size-s { font-size: 11pt; }
.cv-brand-name.size-l { font-size: 21pt; }

/* A. 클래식: 견적 내역서 / ESTIMATE | CLIENT·PROJECT·DATE·SIZE */
.cv1 { display: flex !important; flex-direction: column; justify-content: center; padding: 0 22mm !important; }
.cv1-main { display: grid; grid-template-columns: 1fr 1fr; align-items: center; margin-top: -10mm; }
.cv1-title { padding-left: 18mm; }
.cv1-title h1 { font-size: 46pt; font-weight: 800; letter-spacing: -.02em; margin: 0; line-height: 1.15; }
.cv1-title p { font-size: 22pt; letter-spacing: .5em; color: var(--t-accent); margin: 5mm 0 0 1mm; }
.cv1-meta { margin: 0; display: grid; grid-template-columns: 34mm 1fr; gap: 7mm 0; font-size: 14pt; border-left: 2px solid #222; padding: 4mm 0 4mm 12mm; }
.cv1-meta dt { font-weight: 700; letter-spacing: .08em; }
.cv1-meta dd { margin: 0; }
.cv1-line { position: absolute; left: 22mm; right: 22mm; bottom: 38mm; border: 0; border-top: 1px solid #DDD; margin: 0; }

/* B. 모던 포인트: 인테리어 공사 / 견적서 */
.cv5 { background: #fff; padding: 0 30mm !important; display: flex !important; flex-direction: column; position: relative; }
.cv5 > :not(.cv-brand) { position: relative; }
.cv5-title { margin-top: 30mm; }
.cv5-sub1 { font-size: 46pt; font-weight: 800; color: #444; margin: 0; letter-spacing: -.03em; line-height: 1.2; }
.cv5-title h1 { font-size: 84pt; font-weight: 900; color: var(--t-accent); margin: 2mm 0 0; line-height: 1.05; letter-spacing: -.03em; }
.cv5-en { font-size: 14pt; color: #555; margin: 7mm 0 0; }
.cv5-list { display: grid; grid-template-columns: max-content 1fr; gap: 3.2mm 4mm; margin: auto 0 22mm; border-left: 1.2mm solid var(--t-accent); padding: 1mm 0 1mm 6mm; font-size: 12.5pt; }
.cv5-list dt { font-weight: 800; }
.cv5-list dd { margin: 0; color: #444; }
.cv5.brand-bl .cv5-list { margin-bottom: 46mm; }

/* 설정: 디자인 고르기 */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 10px 0; }
.theme-card { border: 2px solid var(--line-2); border-radius: 12px; overflow: hidden; background: #fff; cursor: pointer; text-align: left; padding: 0; }
.theme-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(156, 123, 91, .2); }
.theme-thumb { height: 150px; overflow: hidden; position: relative; background: #eee; }
.theme-thumb > .paper { pointer-events: none; display: block; }
.theme-thumb .a4 { box-shadow: none; }
.theme-card .tc-meta { padding: 8px 12px 10px; display: grid; gap: 2px; }
.theme-card .tc-meta b { font-size: 14px; }
.theme-card .tc-meta span { font-size: 12px; color: var(--muted); }

.brand-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 6px; }
.bp-label { font-size: 14px; font-weight: 600; }
.seg button:disabled { opacity: .4; cursor: default; }

/* 포인트 색 고르기 */
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { display: inline-flex; align-items: center; justify-content: center; border: 2px solid transparent; background: #fff; border-radius: 50%; padding: 3px; cursor: pointer; }
.swatch i { width: 24px; height: 24px; border-radius: 50%; background: var(--c); display: block; }
.swatch.on { border-color: var(--c); }

/* 위쪽 막대: 이름·로그아웃 */
.top-user { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 12px; color: #CFC6BC; white-space: nowrap; }
.top-user button { border: 1px solid rgba(255, 255, 255, .25); background: none; color: #fff; border-radius: 7px; padding: 4px 10px; cursor: pointer; font-size: 12px; }
.top-user button:hover { background: rgba(255, 255, 255, .1); }
@media (max-width: 720px) { #topUser { display: none; } }

/* 견적서 목록: 완료, ⋮ 메뉴, 이름 고치기 연필 */
.done-chip { background: #E6F0E7; color: #3F6B46; font-weight: 700; }
.est-list li.is-done { background: #FBFCFA; }
.est-title { display: inline-flex; align-items: center; gap: 4px; }
.est-label { font-weight: 700; text-decoration: none; }
.est-label:hover { text-decoration: underline; }
.pencil { border: 0; background: none; color: var(--muted); padding: 2px 4px; border-radius: 6px; cursor: pointer; opacity: 0; transition: opacity .15s; display: inline-flex; }
.site-name:hover .pencil, .est-title:hover .pencil, .pencil:focus { opacity: 1; }
.pencil:hover { color: var(--ink); background: var(--accent-soft); }
@media (hover: none) { .pencil { opacity: .6; } }
.inline-edit { width: auto; min-width: 200px; padding: 4px 8px; font: inherit; font-weight: 700; }
.kebab-wrap { position: relative; }
.kebab { font-size: 20px; line-height: 1; padding: 4px 8px; }
.kebab-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .12); padding: 4px; display: grid; min-width: 190px; }
.kebab-menu[hidden] { display: none; }
.kebab-menu button { border: 0; background: none; text-align: left; padding: 9px 12px; border-radius: 7px; cursor: pointer; font-size: 14px; }
.kebab-menu button:hover { background: var(--accent-soft); }
.kebab-menu button.danger { color: var(--danger); }
.wide-seg { display: flex; }
.wide-seg button { flex: 1; padding: 8px 10px; }
.mat-group.warn { color: var(--danger); }
.warn-note { font-size: 12px; font-weight: 400; margin-left: 8px; }
.mat-grid.empty-zone { min-height: 70px; border: 2px dashed var(--line); border-radius: 12px; }
.mat-grid.empty-zone::before { content: '여기로 끌어다 놓을 수 있어요'; color: var(--muted); font-size: 13px; padding: 24px; grid-column: 1 / -1; }

/* 총괄표: 분류 사이 빈 줄 */
.p-table tr.p-gap td { height: 4mm; border-bottom: 0; padding: 0; }

/* 마감재 총괄표 마지막 장 아래 바닥글: 안내 사항 */
.p-notes-foot { margin-top: auto; padding-top: 3mm; border-top: 1px solid #CDBFAE; }
.p-notes-foot .p-notes { font-size: 8.5pt; line-height: 1.7; color: #6D6259; }
.p-notes-foot + .p-foot { margin-top: 0; }

/* 마감재 탭: 빠진 즐겨찾기 마감재 골라 넣기 */
.notice.suggest { display: block; }
.suggest-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.suggest-list { display: grid; gap: 4px; margin: 10px 0 6px; max-height: 320px; overflow-y: auto; }
.suggest-item { flex-direction: row; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 10px; cursor: pointer; color: var(--ink); font-size: 14px; }
.suggest-item input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.thumb.small { width: 40px; height: 40px; }
.suggest-foot { display: flex; align-items: center; gap: 6px; }

/* [PDF 받기]: 화면 밖에서 원래 크기로 펼쳐 놓고 한 장씩 찍는다 */
.pdf-build { position: fixed; left: -100000px; top: 0; display: block; zoom: 1 !important; }
.pdf-build .a4.pdf-page { box-shadow: none; width: 297mm; height: 210mm; min-height: 0; overflow: hidden; margin: 0; }
.pdf-build .a4.detail.pdf-page { padding-top: 14mm; padding-bottom: 12mm; }
.pdf-build .ed:hover, .pdf-build .ed:focus { background: none; box-shadow: none; }

/* 현장 앱 상담에서 넘어온 내용 */
.handoff { border-left: 4px solid var(--accent, #555); }
.handoff-hist { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
.auto-note { margin-top: 10px; padding: 8px 10px; background: #f3f6ef; border-radius: 8px; font-size: 14px; }
/* 견적서 비교 */
.head-btns { display: inline-flex; gap: 8px; }
.cmp-hint { margin: 6px 0 10px; padding: 8px 12px; background: #fff7e0; border-radius: 8px; font-size: 14px; }
.cmp-pick { display: inline-flex; align-items: center; margin-right: 8px; }
.cmp-pick input { width: 20px; height: 20px; }
.cmp-head { display: grid; gap: 10px; }
.cmp-total { font-size: 20px; font-weight: 700; }
.cmp-total.up, td.up { color: #b2452f; }
.cmp-total.down, td.down { color: #2f6fb3; }
table.cmp { width: 100%; border-collapse: collapse; font-size: 14px; }
table.cmp td { padding: 8px 6px; border-top: 1px solid #eee; vertical-align: top; }
table.cmp td.r { text-align: right; white-space: nowrap; }
.cmp-tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 6px; background: #eee; margin-right: 4px; vertical-align: 2px; }
.cmp-tag.up { background: #fbe9e5; color: #b2452f; }
.cmp-tag.down { background: #e6eef8; color: #2f6fb3; }

/* ---------- 가입 · 이용 요금 · 관리자 · 앱 설치 (2026-10) ---------- */
[hidden] { display: none !important; }
.accent { color: var(--accent-ink); }
.center { text-align: center; }
.eyebrow { font-family: 'Cormorant Garamond', serif; letter-spacing: .25em; font-size: 13px; color: var(--accent); margin: 0 0 6px; }
.btn.kakao { background: #FEE500; border-color: #FEE500; color: #191919; }

/* 로그인 · 가입 */
.auth-card.wide-card { max-width: 520px; }
.auth-join { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-2); display: grid; gap: 10px; text-align: center; }
.auth-join p { margin: 0; font-size: 14px; color: var(--ink-2); }
.auth-card #install { margin-top: 10px; }
.auth-forgot { margin: -4px 0 0; text-align: center; font-size: 14px; }
.auth-forgot a { color: var(--ink-2); }
.auth-card h2 { margin: 18px 0 6px; font-size: 19px; }
.auth-card #sent { margin-top: 18px; }
.auth-card > .muted.small { margin: 18px 0 12px; }
.plan-pick { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.plan-pick legend { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; padding: 0; }
.plan-opt { flex-direction: row; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; color: var(--ink); font-size: 14px; }
.plan-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.plan-opt input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.plan-opt > span:nth-child(2) { display: grid; gap: 2px; flex: 1; }
.plan-opt .price { text-align: right; font-weight: 700; white-space: nowrap; }

/* 둘러보기 */
.welcome-hero { padding: 18px 0 8px; }
.welcome-hero h1 { font-size: 26px; margin-bottom: 8px; }
.tour { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 10px; }
.tour a { display: flex; align-items: center; gap: 16px; background: var(--paper); border: 1px solid var(--line-2); border-radius: 14px; padding: 18px; text-decoration: none; box-shadow: var(--shadow); }
.tour a:hover { border-color: var(--accent); }
.tour .n { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.tour div { flex: 1; }
.tour p { margin: 4px 0 0; font-size: 14px; }
.tour .go { color: var(--accent-ink); font-weight: 600; font-size: 14px; white-space: nowrap; }
.card.tip p { margin: 6px 0 12px; }

/* 이용 요금 */
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge.trial { background: #E8F0FB; color: #2F5C9A; }
.badge.paid { background: #E6EFE6; color: var(--ok); }
.badge.expired { background: #F7E3E0; color: var(--danger); }
.badge.exempt { background: var(--accent-soft); color: var(--accent-ink); }
.status-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.status-card .big { font-size: 18px; margin: 0 0 6px; }
.status-card.expired { border-color: #F0C9C2; }
.plan-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.plan-card { display: grid; gap: 4px; text-align: left; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); cursor: pointer; }
.plan-card.on { border-color: var(--accent); background: var(--accent-soft); }
.plan-card:disabled { cursor: default; }
.plan-card .chip { justify-self: start; margin-top: 4px; }
.bank { font-size: 18px; font-weight: 700; letter-spacing: .01em; padding: 12px 14px; background: var(--accent-soft); border-radius: 10px; margin: 0 0 12px; user-select: all; }
.pay-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.pay-opt { flex-direction: row; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; color: var(--ink); font-size: 15px; }
.pay-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pay-opt input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.chip.pending { background: #FFF1D6; color: #8A5A00; }
.chip.confirmed { background: #E6EFE6; color: var(--ok); }
.chip.canceled { background: var(--line-2); color: var(--muted); }
.billing-sum { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 14px 18px; }
.bill-banner { background: #FFF1D6; color: #6B4A00; text-align: center; padding: 9px 14px; font-size: 14px; }
.bill-banner a { font-weight: 700; margin-left: 6px; }

/* 알림 창 */
.notice-dlg { border: 0; border-radius: 16px; padding: 24px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.notice-dlg::backdrop { background: rgba(43, 38, 34, .45); }
.notice-dlg .msg { font-size: 17px; line-height: 1.6; margin: 0 0 18px; }
.notice-dlg h2 { margin: 0; }

/* 관리자 */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--paper); border: 1px solid var(--line-2); border-radius: 12px; padding: 14px 16px; display: grid; gap: 4px; }
.kpi span { font-size: 12px; color: var(--muted); }
.kpi strong { font-size: 22px; }
.kpi.warn strong { color: var(--danger); }
.kpi.alert { border-color: #F0C46B; background: #FFF8EC; }
.alert-card { border-color: #F0C46B; }
.admin .seg button, .list-tools .seg button { padding: 6px 12px; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-table td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.admin-table .actions { white-space: nowrap; text-align: right; }
.admin-table .actions .btn { margin-left: 4px; }

/* 앱 설치 */
.install-sheet { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 60; max-width: 480px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
  transform: translateY(140%); transition: transform .3s; }
.install-sheet.show { transform: none; }
.install-sheet img { border-radius: 12px; flex: none; }
.install-sheet .tx { flex: 1; display: grid; gap: 2px; font-size: 14px; }
.install-sheet .acts { display: flex; gap: 4px; flex: none; }

@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .plan-cards, .pay-opts { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .tour a { padding: 14px; gap: 12px; }
  .tour .go { display: none; }
}
@media print { .bill-banner, .install-sheet { display: none !important; } }

/* 샘플 견적서 안내 */
.sample-card { width: 100%; display: grid; gap: 6px; text-align: left; margin-top: 18px; padding: 20px; border-radius: 14px; cursor: pointer;
  background: linear-gradient(135deg, #2B2622, #4A3F36); color: #fff; border: 0; box-shadow: var(--shadow); }
.sample-card .chip { justify-self: start; background: #D9BE9C; color: #2B2622; }
.sample-card strong { font-size: 18px; }
.sample-card .muted { color: #D8CFC5; }
.sample-card .go { color: #D9BE9C; font-weight: 700; margin-top: 4px; }
.est-list li.sample { border-style: dashed; }

/* ---------- 상담 (2026-10 통합 1단계) ---------- */
.back-link { display: inline-block; font-size: 13px; color: var(--muted); text-decoration: none; margin-bottom: 8px; }
.consult-link { color: var(--accent-ink); text-decoration: none; font-weight: 600; }
.consult-link:hover { text-decoration: underline; }
.site-name .consult-link { margin-left: auto; font-size: 12px; }
.ver-no { display: inline-block; font-size: 12px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); border-radius: 6px; padding: 0 6px; margin-right: 2px; }
.list-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 4px 0 12px; }
.list-tools .search { flex: 1 1 260px; }
.upcoming h2 { margin-bottom: 8px; }
.sched-list { list-style: none; padding: 0; margin: 0; }
.sched-list a { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line-2); text-decoration: none; font-size: 14px; }
.sched-list li:last-child a { border-bottom: 0; }
.sched-list a:hover { background: var(--accent-soft); }
.sched-list .when { font-weight: 700; min-width: 112px; white-space: nowrap; }
.sched-list .when.today { color: var(--danger); }
.sched-list .what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; flex: none; }
.tag.k-office { background: #E8F0FB; color: #2F5C9A; }
.tag.k-measure { background: #E6EFE6; color: var(--ok); }
.tag.k-material { background: #F6EBDD; color: #8A5A2B; }
.tag.k-estimate { background: var(--ink); color: #fff; }
.tag.k-new { background: #F1EBE3; color: var(--accent-ink); }
.tag.k-close, .tag.k-reopen { background: #EEE; color: #666; }
.chip.next { background: #FFF1D6; color: #8A5A00; }
.chip.muted-chip { color: var(--muted); }
.consult-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.consult-list a { display: flex; gap: 12px; justify-content: space-between; align-items: center; background: var(--paper); border: 1px solid var(--line-2); border-radius: 12px; padding: 14px 16px; text-decoration: none; }
.consult-list a:hover { border-color: var(--accent); }
.c-main { display: grid; gap: 2px; min-width: 0; }
.c-main strong { font-size: 16px; }
.c-work { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.c-total { font-weight: 700; font-size: 14px; }
.consult .page-head h1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.version-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.version-list li { display: flex; align-items: center; gap: 8px; background: var(--paper); border: 1px solid var(--line-2); border-radius: 12px; padding: 4px 8px 4px 4px; }
.version-list li.sent { border-color: #CFE0D1; }
.v-main { flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px; text-decoration: none; min-width: 0; flex-wrap: wrap; }
.v-no { font-weight: 800; font-size: 18px; min-width: 42px; }
.v-label { font-weight: 600; }
.v-total { margin-left: auto; font-weight: 700; white-space: nowrap; }
.new-est h2 { margin-bottom: 10px; }
.new-est .head-actions { margin-bottom: 8px; }
.ev-form { display: grid; gap: 10px; }
.ev-form .kinds { display: inline-flex; flex-wrap: wrap; }
.ev-form .kinds label { display: block; }
.ev-form .kinds input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ev-form .kinds span { display: block; padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--ink); }
.ev-form .kinds label + label span { border-left: 1px solid var(--line); }
.ev-form .kinds input:checked + span { background: var(--ink); color: #fff; }
.ev-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ev-row input[type=date] { flex: 0 0 160px; }
.ev-row input[type=time] { flex: 0 0 120px; }
.ev-row input[name=title] { flex: 1 1 200px; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); margin-left: 8px; }
.timeline li { position: relative; display: grid; grid-template-columns: 150px auto 1fr auto; gap: 4px 10px; align-items: start; padding: 12px 8px 12px 18px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 17px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--line); }
.timeline li.future::before { border-color: #E0A12E; background: #FFF1D6; }
.timeline li.k-estimate::before { border-color: var(--ink); background: var(--ink); }
.timeline .t-when { font-size: 13px; font-weight: 700; color: var(--ink-2); white-space: nowrap; padding-top: 2px; }
.timeline .t-body p { margin: 4px 0 0; font-size: 14px; color: var(--ink-2); }
.timeline .t-acts { display: flex; gap: 2px; }
.timeline .t-acts .icon { font-size: 12px; }
@media (max-width: 600px) {
  .consult-list a { flex-direction: column; align-items: stretch; }
  .c-side { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .c-total { margin-left: auto; }
  .timeline li { grid-template-columns: 1fr auto; }
  .timeline .t-when { grid-column: 1; }
  .timeline .tag { grid-column: 2; grid-row: 1; justify-self: end; }
  .timeline .t-body { grid-column: 1 / -1; }
  .timeline .t-acts { grid-column: 1 / -1; }
  .sched-list .when { min-width: 92px; }
}

/* ---------- 고객 화면 (통합 2단계) ---------- */
.share-card { padding: 14px 16px; }
.share-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.share-url { flex: 1 1 220px; min-width: 0; font-size: 13px; padding: 6px 8px; }
.share-card p { margin: 8px 0 0; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-ink); text-decoration: underline; cursor: pointer; }
.linkish.danger { color: var(--danger); }
.portal-co { margin: 0 0 4px; font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--accent-ink); }
.portal-title { font-size: 22px; margin: 0 0 6px; }
.auth-card .pin { font-size: 28px; letter-spacing: .5em; text-align: center; padding: 10px; }
.portal-head { padding: 8px 0 14px; }
.portal-head h1 { margin: 0 0 4px; font-size: 24px; }
.portal-head p { margin: 2px 0; }
.sched-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.sched-list li:last-child .sched-row { border-bottom: 0; }
.portal-versions li { flex-wrap: wrap; }
.portal-versions .v-total { text-align: right; }
.v-acts { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 6px 6px; }
.portal-foot { text-align: center; padding: 18px 0 40px; display: grid; gap: 4px; }
.portal-foot p { margin: 0; }
@media (max-width: 600px) {
  .portal-versions .v-acts { width: 100%; justify-content: flex-end; }
}
