/* 미수캐치 디자인 토큰 — UI 지침 v3.3 + 디자인 보고서 2026-11-25 */
:root {
  --brand: #175B4B;
  --brand-hover: #12493C;
  --heading: #182E2A;
  --text: #273A36;
  --muted: #586963;
  --bg: #FAFBF8;
  --surface: #FFFFFF;
  --line: #D7DFDA;
  --soft: #EDF3EF;
  --focus: #397CBA;
  --blue: #295A87;
  --blue-bg: #EDF2F7;
  --green: #175B4B;
  --green-bg: #EDF3EF;
  --amber: #805817;
  --amber-bg: #F6F0E4;
  --red: #A23F38;
  --red-bg: #F7ECEB;
  --radius-control: 6px;
  --radius-panel: 8px;
  --control-h: 48px;
  --control-h-sm: 44px;
  --space-page: 20px;
  --content-max: 1160px;
  --reading-max: 720px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", "Noto Sans KR", "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", sans-serif;
  line-height: 1.7;
  font-size: 16px;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a { color: var(--brand); text-underline-offset: 4px; }
a:hover { text-decoration-thickness: 1px; }
h1, h2, h3, h4 { color: var(--heading); line-height: 1.4; letter-spacing: -0.02em; }
h1 { font-size: 36px; letter-spacing: -0.04em; margin: 0 0 16px; }
h2 { font-size: 20px; margin: 0 0 12px; }
h3 { font-size: 17px; margin: 0 0 8px; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; }
:is(a, button, input, select, textarea, summary):focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.mono, .business-number { font-variant-numeric: tabular-nums; }

/* ---------- 레이아웃 ---------- */
.wrap { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--space-page); }
main.wrap { min-height: 60vh; padding-top: 24px; padding-bottom: 72px; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
form.row:has(> input[type=search], > input[type=text]) { align-items: stretch; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 13px; color: var(--muted); }
.xsmall { font-size: 12px; color: var(--muted); }
.center { text-align: center; }

/* ---------- 헤더 ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .inner { display: flex; align-items: center; gap: 18px; height: 64px; }
.logo { color: var(--heading); font-weight: 800; font-size: 19px; letter-spacing: -0.03em; display: flex; align-items: center; gap: 8px; text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo .dot { width: 16px; height: 16px; border: 3px solid var(--brand); border-radius: 3px; position: relative; background: transparent; box-shadow: none; }
.logo .dot::after { content: ''; position: absolute; left: 3px; top: 0; width: 7px; height: 4px; border-left: 2px solid var(--brand); border-bottom: 2px solid var(--brand); transform: rotate(-45deg); }
.main-nav { display: flex; gap: 4px; margin-left: 6px; }
.main-nav a { color: var(--muted); padding: 8px 10px; border-radius: var(--radius-control); font-size: 14px; text-decoration: none; }
.main-nav a:hover { color: var(--heading); background: var(--soft); }
.main-nav a.active { color: var(--brand); font-weight: 700; background: var(--soft); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pill { color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-control); padding: 7px 14px; font-size: 13.5px; text-decoration: none; background: var(--surface); min-height: 36px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.pill:hover { background: var(--soft); text-decoration: none; }
.pill.solid { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pill.solid:hover { background: var(--brand-hover); }
.site-header:has(.admin-shortcut) .inner { height: auto; min-height: 56px; flex-wrap: wrap; padding-block: 6px; }
.header-right:has(.admin-shortcut) { flex-wrap: wrap; justify-content: flex-end; }
.admin-shortcut { white-space: nowrap; min-height: 44px; }
.pill.points b { color: var(--brand); }

/* ---------- 하단 내비(모바일 4탭) ---------- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  z-index: 60;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav .inner { display: flex; }
.bottom-nav a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 7px;
  font-size: 11px;
  color: var(--muted);
  min-height: 56px;
  justify-content: center;
  text-decoration: none;
}
.bottom-nav a.active { color: var(--brand); font-weight: 700; }
.bottom-nav svg { width: 22px; height: 22px; }

/* ---------- 홈 히어로 ---------- */
.home-hero { padding: 44px 0 40px; border-bottom: 1px solid var(--line); }
.home-eyebrow { font-size: 12.5px; color: var(--brand); font-weight: 700; letter-spacing: 0.04em; margin-bottom: 12px; }
.home-hero h1 { font-size: clamp(28px, 4vw, 36px); margin-bottom: 10px; }
.home-hero .lead { font-size: 16px; color: var(--muted); max-width: var(--reading-max); margin: 0 0 24px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 36px; align-items: start; }
.search-label { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 6px; color: var(--heading); }
.search-form { display: flex; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius-control); padding: 7px; background: var(--surface); }
.search-form input[type=search] { flex: 1; border: 0; outline: 0; font-size: 16px; padding: 9px 10px; background: transparent; min-width: 0; font-variant-numeric: tabular-nums; }
.search-form .btn { min-height: 48px; white-space: nowrap; }
.search-help { font-size: 12.5px; color: var(--muted); margin: 10px 0 14px; }
.example-link { font-size: 13.5px; color: var(--brand); text-decoration: underline; text-underline-offset: 4px; }
.sample-sheet { padding: 18px; background: var(--soft); border: 1px solid var(--line); border-top: 3px solid var(--brand); border-radius: var(--radius-panel); font-size: 12.5px; }
.sample-sheet h4 { font-size: 15px; margin: 10px 0; }
.sheet-row { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; }
.sheet-row:last-child { border-bottom: 0; }
.sheet-row b { font-weight: 600; }
.home-section { padding: 28px 0 8px; }
.home-section + .home-section { border-top: 1px solid var(--line); margin-top: 8px; }
.home-three { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.home-three article { padding: 4px 0; }
.home-three h4 { font-size: 14.5px; margin-bottom: 4px; }
.home-three p { font-size: 13px; color: var(--muted); margin: 0; }
.home-links { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13.5px; padding-top: 18px; margin-top: 20px; border-top: 1px solid var(--line); }
.home-note { font-size: 12.5px; color: var(--muted); padding: 18px 0; }

/* ---------- 카드 ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 22px; margin-bottom: 14px; }
.card h2, .card h3 { margin-top: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tile { border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 16px; background: var(--surface); }
.tile b { display: block; color: var(--heading); margin-bottom: 5px; }
.tile p { margin: 0; font-size: 13.5px; color: var(--muted); }

/* ---------- 검색 결과 ---------- */
.result-item { display: block; border-bottom: 1px solid var(--line); padding: 16px 2px; background: transparent; margin-bottom: 0; text-decoration: none; }
.result-item:hover { text-decoration: none; }
.result-item:hover .name { color: var(--brand); }
.result-item .name { font-size: 17px; font-weight: 700; color: var(--heading); }
.result-item .meta { font-size: 13px; color: var(--muted); margin-top: 6px; display: flex; gap: 14px; flex-wrap: wrap; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 4px; font-size: 12px; font-weight: 700; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.gray { background: #EFF1EF; color: var(--muted); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.sample { background: #F6F0E4; color: var(--amber); }

/* ---------- 상세 ---------- */
.detail-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.detail-head h1 { margin: 0 0 6px; font-size: 28px; }
.breadcrumb { font-size: 12.5px; color: var(--muted); margin-bottom: 16px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--muted); margin: 0; }
.kv dd { margin: 0; }
.record-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 10px; font-size: 16px; font-weight: 700; color: var(--heading); }
.record-row { display: grid; grid-template-columns: 1fr 140px 110px; gap: 15px; border-bottom: 1px solid var(--line); padding: 14px 0; font-size: 13.5px; }
.record-row strong { display: block; margin-bottom: 3px; color: var(--heading); }
.record-row small { font-size: 12px; }
.report-record { border: 1px solid var(--line); border-radius: var(--radius-control); padding: 16px; margin: 12px 0; font-size: 13.5px; background: var(--surface); }
.report-record h4 { margin: 10px 0 6px; font-size: 15px; }
.record-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.detail-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); margin-top: 22px; font-size: 13.5px; }
.detail-tabs a, .detail-tabs span { padding: 12px 0; color: var(--muted); text-decoration: none; }
.detail-tabs .active { border-bottom: 2px solid var(--brand); font-weight: 700; color: var(--heading); }
.timeline { border-left: 2px solid var(--line); padding-left: 16px; }
.timeline .t-item { position: relative; padding: 4px 0 14px; }
.timeline .t-item::before { content: ''; position: absolute; left: -21px; top: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.timeline .t-date { font-size: 12.5px; color: var(--muted); }

/* ---------- 폼 ---------- */
label { display: block; font-size: 13.5px; font-weight: 600; color: var(--heading); margin: 14px 0 5px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=tel], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-control);
  font-size: 15px; font-family: inherit; background: var(--surface); color: var(--text); min-height: 44px;
}
input[type=file] { min-height: 44px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23, 91, 75, 0.12); }
.quantity-field { display: inline-grid; width: 100%; max-width: 100%; min-width: 0; vertical-align: middle; }
.row > .quantity-field { width: auto; }
.quantity-field > * { grid-area: 1 / 1; }
.quantity-field > span { display: none; pointer-events: none; align-self: center; padding-inline: 13px; font-size: 15px; color: var(--text); }
.quantity-field.grouped:not(:focus-within) > input { color: transparent; }
.quantity-field.grouped:not(:focus-within) > span { display: block; }
@media (forced-colors: active) {
  .quantity-field.grouped:not(:focus-within) > input { color: FieldText; }
  .quantity-field.grouped:not(:focus-within) > span { display: none; }
}
textarea { min-height: 140px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; font-size: 13.5px; color: var(--text); }
.check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--brand); }
.form-card { max-width: 520px; margin: 26px auto; }
.form-hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.search-row { display: flex; gap: 8px; flex-wrap: wrap; }
.search-row input { flex: 1; min-width: 0; }
.search-row .btn { white-space: nowrap; }
.field-error { color: var(--red); font-size: 12.5px; margin-top: 4px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--radius-control); cursor: pointer;
  font-size: 14.5px; font-weight: 650; padding: 10px 18px; text-align: center;
  background: var(--brand); color: #fff; text-decoration: none; min-height: var(--control-h-sm);
}
.btn:hover { background: var(--brand-hover); text-decoration: none; }
.btn.block { display: flex; width: 100%; }
.btn.ghost { background: var(--surface); color: var(--brand); border-color: var(--line); }
.btn.ghost:hover { background: var(--soft); }
.btn.danger { background: var(--red); } .btn.danger:hover { background: #8A3630; }
.btn.gray { background: var(--muted); } .btn.gray:hover { background: #485852; }
.btn.sm { padding: 6px 13px; font-size: 13px; min-height: var(--control-h-sm); border-radius: var(--radius-control); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 알림 ---------- */
.alert { border-radius: var(--radius-control); padding: 12px 14px; margin: 12px 0; font-size: 14px; border: 1px solid; }
.alert.success { background: var(--green-bg); border-color: #C8DED2; color: var(--green); }
.alert.error { background: var(--red-bg); border-color: #E6C4C1; color: var(--red); }
.alert.info { background: var(--blue-bg); border-color: #CBD9E6; color: var(--blue); }
.alert.warn { background: var(--amber-bg); border-color: #E8DCC0; color: var(--amber); }

/* ---------- 게시판 ---------- */
.post-row { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.post-row .title { font-weight: 600; color: var(--heading); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-row.block { display: block; }
.comment { border-top: 1px solid var(--line); padding: 12px 2px; font-size: 14px; }
.comment .who { font-weight: 700; color: var(--heading); font-size: 13.5px; }
.rich-content { font-size: 15px; line-height: 1.8; }
.rich-content p { margin: 0 0 10px; }

/* ---------- 표 ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; vertical-align: top; }
.tbl th { background: var(--soft); color: var(--heading); font-weight: 700; }
.table-wrap { max-width: 100%; }
.points-table { container-type: inline-size; }
@container (max-width: 560px) {
  .points-table table.tbl { display: block; min-width: 0; }
  .points-table tbody, .points-table tr { display: block; }
  .points-table tr:has(th) { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  .points-table td { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 8px; overflow-wrap: anywhere; }
  .points-table td::before { content: attr(data-label); color: var(--muted); }
  .points-table td > form { flex: 1 1 12rem; min-width: 0; }
}

@media (max-width: 640px) {
  .table-wrap { overflow-x: auto; }
  .table-wrap table { min-width: 560px; }
  h1 { font-size: 24px; }
  .detail-head h1 { font-size: 22px; }
  .card { padding: 16px; }
  .header-right .pill:not(.points):not(.solid) { display: none; }
  .search-form { flex-wrap: wrap; }
  .search-form .btn { flex: 1; }
}

/* ---------- 보드 탭·미수업체 검색 ---------- */
.board-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.unpaid-search { flex-wrap: wrap; }
.unpaid-search select { flex: 1; min-width: 130px; }
.unpaid-row .title { flex: 1 1 100%; white-space: normal; }
.unpaid-meta { font-size: 14px; }
.evidence { background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 14px; font-size: 13.5px; }

/* ---------- 관리자 ---------- */
.admin-body { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 18px; align-items: start; }
.admin-nav { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 12px; position: sticky; top: 80px; }
.admin-nav a { display: block; padding: 8px 10px; border-radius: var(--radius-control); color: var(--text); font-size: 14px; text-decoration: none; }
.admin-nav a:hover { background: var(--soft); text-decoration: none; }
.admin-nav a.active { background: var(--soft); color: var(--brand); font-weight: 700; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 14px; }
.stat b { display: block; font-size: 22px; color: var(--heading); }
.stat span { font-size: 12.5px; color: var(--muted); }

/* ---------- 푸터 ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 26px 0 calc(26px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 13px; }
.site-footer .cols { display: flex; gap: 32px; flex-wrap: wrap; }
.site-footer h4 { margin: 0 0 8px; font-size: 13.5px; color: var(--heading); }
.site-footer a { color: var(--text); display: block; padding: 3px 0; text-decoration: none; }
.site-footer a:hover { color: var(--brand); }

/* ---------- 유틸 ---------- */
.empty { text-align: center; padding: 44px 16px; color: var(--muted); }
.empty h3 { color: var(--heading); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: var(--soft); padding: 2px 6px; border-radius: 5px; word-break: break-all; }
.pre-wrap { white-space: pre-wrap; word-break: break-word; }
.divider { border-top: 1px solid var(--line); margin: 18px 0; }
.pagination { display: flex; gap: 6px; justify-content: center; margin: 18px 0; }
.pagination a, .pagination span { padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--radius-control); font-size: 13.5px; background: var(--surface); text-decoration: none; min-height: 36px; display: inline-flex; align-items: center; }
.pagination .cur { background: var(--brand); border-color: var(--brand); color: #fff; }
.hidden { display: none; }
[data-editor] .editor-mount { border: 1px solid var(--line); border-radius: var(--radius-control); overflow: hidden; min-height: 180px; }
[data-editor-readonly] { font-size: 15px; }
[data-editor-readonly] .pre-wrap { padding: 2px 0; }
[data-editor-readonly] .cde-toolbar,
[data-editor-readonly] .cde-statusbar { display: none; }
[data-editor-readonly] .cde-content { padding: 14px 16px; }

@media (max-width: 860px) {
  body { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
  .bottom-nav { display: block; }
  .grid2, .grid3, .home-three { grid-template-columns: 1fr; }
  .home-grid { grid-template-columns: 1fr; gap: 24px; }
  .sample-sheet { display: none; }
  .admin-body { display: block; }
  .admin-nav { position: static; display: flex; overflow-x: auto; gap: 2px; }
  .admin-nav a { white-space: nowrap; }
  .main-nav { display: none; }
  .site-header .inner { height: 56px; gap: 10px; }
  .home-hero { padding: 32px 0 30px; }
  .home-hero h1 { font-size: 28px; }
  .record-row { grid-template-columns: 1fr; }
  h1 { font-size: 28px; }
  main.wrap { padding-bottom: 56px; }
}
@media (min-width: 861px) {
  .bottom-nav { display: none; }
}


/* 홈 최근 조회 업체 칩 */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--heading); text-decoration: none; background: var(--surface); }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.stat-box { min-width: 96px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); display: flex; flex-direction: column; gap: 2px; }

/* 알림 벨 배지 */
.bell { position: relative; }
.bell-badge { position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: #d33; color: #fff; font-size: 11px; line-height: 16px; text-align: center; }

/* 좁은 화면에서도 전화번호·증빙 파일 입력란을 폼 너비 안에 맞춘다. */
.form-card input:is([type=tel], [type=file], [type=date], [type=datetime-local]) { max-inline-size: 100%; min-inline-size: 0; }

.form-card.case-form { max-width: 60rem; }
.case-fields { min-inline-size: 0; margin: 1rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-control); }
.case-form [hidden] { display: none !important; }
.case-fields legend { font-weight: 700; }
.case-search, .case-candidates { display: flex; gap: .5rem; flex-wrap: wrap; }
.case-search input { flex: 1 1 14rem; min-width: 0; }
.case-candidates { margin-top: .5rem; }
.case-candidates .btn { white-space: normal; overflow-wrap: anywhere; }
.case-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.case-form .cde-toolbar, .case-form .cde-tb-row, .case-form .cde-tb-group {
  box-sizing: border-box; min-inline-size: 0; max-inline-size: 100%; flex-wrap: wrap;
}
.case-form .cde-toolbar { overflow: visible; }
.case-form .cde-tb-row { flex: 1 1 100%; }
.case-form .cde-toolbar select, .case-form .cde-status-label { box-sizing: border-box; max-inline-size: 100%; min-inline-size: 0; }
.case-form .cde-status-label { white-space: normal; overflow-wrap: anywhere; }
.case-form .cde-catalog-btn[data-tb-key="catalog"] { display: none; }

/* 사업자회원 신청 */
.business-conversion form { max-width: 36rem; }
.business-field { display: grid; gap: 0.35rem; margin-block: 1rem; }
.business-field input { width: 100%; min-width: 0; }
.business-field .form-hint { margin: 0; }
