/* 영업 CRM — 휴대폰 우선. 폭 390px 기준으로 만들고 넓은 화면은 가운데 정렬로 늘린다. */
:root {
  --green: #1d4d3c;
  --green-2: #2f6b55;
  --green-soft: #e8f1ec;
  --ink: #1b1f1d;
  --ink-2: #4a524e;
  --line: #d7ddd9;
  --bg: #f6f7f6;
  --card: #ffffff;
  --red: #b42318;
  --red-soft: #fdecea;
  --amber: #9a5b00;
  --amber-soft: #fff4dc;
  --blue: #1f5ea8;
  --blue-soft: #e7f0fb;
  --radius: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  font-size: 15px; line-height: 1.5; word-break: keep-all; overflow-wrap: anywhere;
}
a { color: var(--green-2); }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 20px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }

/* 상단 바 */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--green); color: #fff;
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
}
.topbar .brand { font-weight: 800; font-size: 16px; color: #fff; text-decoration: none; white-space: nowrap; }
.topbar .who { margin-left: auto; font-size: 13px; opacity: .9; white-space: nowrap; }
.topbar .who a { color: #fff; }
.topnav { display: none; gap: 4px; }
.topnav a { color: #fff; text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 14px; white-space: nowrap; }
.topnav a.on, .topnav a:hover { background: rgba(255, 255, 255, .16); }

/* 하단 탭(휴대폰) */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: #fff; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a {
  text-align: center; text-decoration: none; color: var(--ink-2); font-size: 12px; padding: 8px 2px 9px; min-width: 0;
}
.bottomnav a .ic { display: block; font-size: 18px; line-height: 1.2; font-weight: 700; }
.bottomnav a.on { color: var(--green); font-weight: 700; }

main { max-width: 980px; margin: 0 auto; padding: 14px 16px 96px; min-width: 0; }

@media (min-width: 900px) {
  .topnav { display: flex; }
  .bottomnav { display: none; }
  main { padding-bottom: 40px; }
}

/* 카드·섹션 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 12px; min-width: 0; }
.card > h2, .card > h3 { margin-bottom: 10px; }
.sec-title { display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; }
.sec-title h2 { font-size: 16px; }
.sec-title .num { background: var(--green); color: #fff; border-radius: 6px; padding: 1px 7px; font-size: 13px; font-weight: 700; }
.muted { color: var(--ink-2); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }
.spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 900px) { .grid2 { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; } }

/* 단계 칩 */
.stages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
@media (min-width: 640px) { .stages { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.stage {
  display: block; text-decoration: none; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 10px; color: var(--ink); min-width: 0;
}
.stage .n { font-size: 22px; font-weight: 800; display: block; line-height: 1.2; }
.stage .l { font-size: 12.5px; color: var(--ink-2); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage.on { border-color: var(--green); background: var(--green-soft); }
.stage.on .n { color: var(--green); }

/* 목록 */
.list { list-style: none; margin: 0; padding: 0; }
.item {
  display: block; text-decoration: none; color: inherit; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 11px 12px; margin-bottom: 8px; min-width: 0;
}
.item .top { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.item .name { font-weight: 700; font-size: 15.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.item .meta { color: var(--ink-2); font-size: 13px; margin-top: 3px; }
.item.overdue { border-left: 4px solid var(--red); }
.item.today { border-left: 4px solid var(--amber); }
.item.soon { border-left: 4px solid var(--blue); }

/* 배지 */
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; white-space: nowrap; background: #eef0ef; color: var(--ink-2); }
.badge.green, .badge.s-합의 { background: var(--green-soft); color: var(--green); }
.badge.s-제안 { background: var(--blue-soft); color: var(--blue); }
.badge.s-확인필요, .badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red, .badge.overdue { background: var(--red-soft); color: var(--red); }
.badge.today { background: var(--amber-soft); color: var(--amber); }
.badge.soon { background: var(--blue-soft); color: var(--blue); }

/* 알림 상자 */
.alert { border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }
.alert.ok { background: var(--green-soft); color: var(--green); }
.alert.error { background: var(--red-soft); color: var(--red); }
.alert.warn { background: var(--amber-soft); color: var(--amber); }

/* 폼 */
label.f { display: block; font-size: 13px; color: var(--ink-2); margin: 10px 0 4px; font-weight: 600; }
input[type=text], input[type=tel], input[type=number], input[type=date], input[type=password], input[type=search], select, textarea {
  width: 100%; min-width: 0; font: inherit; font-size: 16px; padding: 9px 10px; border: 1px solid #b9c2bd;
  border-radius: 8px; background: #fff; color: var(--ink);
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green-2); outline-offset: 0; border-color: var(--green-2); }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
.fgrid > div { min-width: 0; }
.fgrid .full { grid-column: 1 / -1; }
@media (min-width: 640px) { .fgrid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.unit { display: flex; align-items: center; gap: 6px; min-width: 0; }
.unit input { flex: 1; }
.unit span { color: var(--ink-2); font-size: 14px; white-space: nowrap; }

/* 탭 버튼(체크박스·라디오) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span {
  display: inline-block; padding: 8px 12px; border: 1px solid #b9c2bd; border-radius: 999px; background: #fff;
  font-size: 14px; cursor: pointer; user-select: none; min-height: 38px; line-height: 20px;
}
.chip input:checked + span { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.chip input:focus-visible + span { outline: 2px solid var(--green-2); outline-offset: 2px; }

/* 버튼 */
.btn {
  display: inline-block; font: inherit; font-size: 15px; font-weight: 700; padding: 10px 16px; border-radius: 8px;
  border: 1px solid var(--green); background: var(--green); color: #fff; text-decoration: none; cursor: pointer;
  text-align: center; white-space: nowrap;
}
.btn.light { background: #fff; color: var(--green); }
.btn.small { font-size: 13.5px; padding: 6px 11px; }
.btn.block { display: block; width: 100%; }
.btn.danger { background: #fff; color: var(--red); border-color: var(--red); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.stickybar {
  position: sticky; bottom: 64px; z-index: 10; background: rgba(246, 247, 246, .96); padding: 10px 0;
  border-top: 1px solid var(--line); display: flex; gap: 8px;
}
.stickybar .btn { flex: 1; }
@media (min-width: 900px) { .stickybar { bottom: 0; } }

/* 키-값 */
dl.kv { display: grid; grid-template-columns: minmax(0, 7.5em) minmax(0, 1fr); gap: 4px 10px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--ink-2); }
dl.kv dd { margin: 0; min-width: 0; }

/* 현재 조건 */
.terms-now { border: 2px solid var(--green); }
.price-big { font-size: 24px; font-weight: 800; color: var(--green); }
.who-when { font-size: 12.5px; color: var(--ink-2); }

/* 차이 */
.diff { font-size: 13.5px; margin: 4px 0 0; padding-left: 0; list-style: none; }
.diff li { margin: 2px 0; }
.diff .old { color: var(--red); text-decoration: line-through; }
.diff .new { color: var(--green); font-weight: 700; }

/* 타임라인 */
.tl { list-style: none; margin: 0; padding: 0; }
.tl > li { border-left: 3px solid var(--line); padding: 2px 0 12px 12px; margin-left: 4px; position: relative; min-width: 0; }
.tl > li::before { content: ""; position: absolute; left: -7px; top: 6px; width: 11px; height: 11px; border-radius: 50%; background: var(--line); }
.tl > li.k-통화::before, .tl > li.k-방문::before, .tl > li.k-문자·카톡::before, .tl > li.k-메모::before { background: var(--green); }
.tl > li.k-조건기록::before, .tl > li.k-견적서::before { background: var(--blue); }
.tl > li.k-단계변경::before { background: var(--amber); }
.tl .h { font-size: 12.5px; color: var(--ink-2); }
.tl .b { white-space: pre-wrap; }

/* 표 */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 7px 6px; text-align: left; vertical-align: top; }
.tbl th { color: var(--ink-2); font-weight: 600; font-size: 13px; }
.tbl td.num, .tbl th.num { text-align: right; white-space: nowrap; }
.scroll-x { overflow-x: auto; min-width: 0; }

/* 계산 결과 */
.calc-out { background: var(--green-soft); border-radius: var(--radius); padding: 12px; }
.calc-out .big { font-size: 26px; font-weight: 800; color: var(--green); }
.calc-out dl.kv { grid-template-columns: minmax(0, 8.5em) minmax(0, 1fr); }
.warns { margin: 8px 0 0; padding-left: 18px; color: var(--amber); font-size: 13px; }

/* 할 일 */
.task { display: flex; gap: 22px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.task form { margin: 0; }
.task .chk {
  width: 44px; height: 44px; border-radius: 10px; border: 3px solid var(--green); background: #fff; cursor: pointer;
  font-size: 26px; line-height: 1; color: #fff; padding: 0; flex: none;
}
.task .chk.done { background: var(--green); }
.task .t { flex: 1; min-width: 0; }
.task.done .t .title { text-decoration: line-through; color: var(--ink-2); }

details > summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.searchbar { display: flex; gap: 8px; margin-bottom: 12px; }
.searchbar input { flex: 1; }
.empty { color: var(--ink-2); text-align: center; padding: 18px 0; font-size: 14px; }
.login-wrap { max-width: 380px; margin: 40px auto; }

/* 빠른 상담 기록(현장 기본 입력) — 390×844 휴대폰에서 스크롤 없이 한 화면 */
.quick { max-width: 560px; margin: 0 auto; }
.quick label.f { margin: 8px 0 3px; }
.quick input[type=text], .quick input[type=tel], .quick input[type=date], .quick textarea { min-height: 44px; }
.q-head { display: flex; align-items: center; gap: 8px; }
.q-head h1 { font-size: 19px; }
.req { color: var(--red); font-size: 12px; font-weight: 700; }
.q-name { position: relative; }
.q-found {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 30; list-style: none; margin: 2px 0 0; padding: 4px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
}
.q-found button {
  display: block; width: 100%; text-align: left; font: inherit; font-size: 15px; background: none; border: 0;
  padding: 10px 8px; border-radius: 6px; cursor: pointer; min-height: 44px;
}
.q-found button:hover, .q-found button:focus { background: var(--green-soft); }
.q-found .muted { margin-left: 6px; }
.q-line { display: flex; gap: 8px; align-items: center; min-width: 0; }
.q-grow { flex: 1; min-width: 0; }
.q-date { flex: 1; min-width: 0; }
.q-tight { flex-wrap: nowrap; gap: 4px; }
.q-tight .chip span { padding: 8px 10px; min-height: 44px; line-height: 26px; }
.chip.sm span { padding: 6px 10px; font-size: 13.5px; min-height: 36px; line-height: 22px; }
.q-tight .chip.sm span { min-height: 44px; line-height: 30px; padding: 6px 8px; }
.q-comp { margin-top: 6px; align-items: center; }
.q-comp-hint { font-size: 12px; flex-basis: 100%; }
.q-memo { min-height: 56px; height: 56px; }
.q-photo { margin-top: 10px; min-height: 46px; line-height: 24px; }
.q-save { margin-top: 8px; min-height: 50px; font-size: 17px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

/* 사진·판독 */
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.thumb { position: relative; display: block; width: 84px; text-decoration: none; }
.thumb img { width: 84px; height: 110px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.thumb .badge { position: absolute; left: 4px; bottom: 4px; font-size: 11px; }
a.review-cta { display: block; text-decoration: none; }
.rv-photo { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 6px; }
.rv-photo img { width: 96px; border-radius: 6px; border: 1px solid var(--line); }
.rv { border-top: 1px solid var(--line); padding: 8px 0; min-width: 0; }
.rv-h { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-weight: 700; font-size: 14px; margin-bottom: 3px; }
.rv-now { margin-bottom: 3px; }
.rv-line { display: flex; gap: 6px; align-items: center; min-width: 0; }
.rv-line > input { flex: 1; min-width: 0; min-height: 44px; }
.rv-fixed { flex: 1; min-width: 0; font-size: 15px; }.tl > li.k-상담메모::before { background: var(--green); }
.tl > li.k-사진::before, .tl > li.k-사진판독::before { background: var(--amber); }

/* 「수정 요청」 버튼(feedback_kit) — 하단 메뉴 위에 뜬다. 저장 막대(stickybar)가 있는 화면은 그 위로 올린다. */
body { --fbk-bottom: 70px; }  /* :root 가 아니라 body — 나중에 읽히는 feedback.css 의 :root 기본값보다 가깝게 */
body:has(.stickybar) { --fbk-bottom: 136px; }
main { padding-bottom: 120px; }
@media (min-width: 900px) {
  main { padding-bottom: 72px; }
  body:has(.stickybar) { --fbk-bottom-wide: 84px; }
}
