/* 자사몰 고객센터 — 모바일 우선. 단순/큰글씨/터치 친화. */
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1d2330;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #2563eb;
  --brand-ink: #ffffff;
  --ok: #16a34a;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
/* hidden 속성은 항상 우선(.field 등이 display 를 지정해도 숨김이 이기도록). */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic",
    "Noto Sans KR", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* ① 상단바 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--brand);
  color: var(--brand-ink);
  padding: env(safe-area-inset-top) 0 0;
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 16px;
}
.logo {
  font-weight: 800;
  letter-spacing: .5px;
  background: rgba(255, 255, 255, .18);
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 14px;
}
.topbar h1 { margin: 0; font-size: 18px; font-weight: 700; }

/* 레이아웃 */
.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
}
.section-title { margin: 0 0 14px; font-size: 17px; font-weight: 700; }
.notice h2 { margin: 0 0 6px; font-size: 17px; }
.notice p { margin: 0; color: var(--muted); }

.hint { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.hint b { color: var(--ink); }
.empty { margin: 12px 0 0; color: var(--muted); font-size: 14px; }

/* 검색 */
.search-row { display: flex; gap: 8px; }
.search-row input {
  flex: 1;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 16px;
}
.search-row input:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.search-row button {
  flex: 0 0 auto;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 16px;
  font-weight: 600;
}

/* 결과 카드 */
.results { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.order-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  background: #fff;
  text-align: left;
  width: 100%;
  display: block;
}
button.order-card { cursor: pointer; }
button.order-card:active { background: #f8fafc; }
.order-card .ono { font-weight: 700; font-size: 15px; }
.order-card .prod { margin: 4px 0 2px; font-size: 14px; }
.order-card .meta { color: var(--muted); font-size: 13px; }
.order-card .status {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--brand);
  background: #eff6ff;
  border-radius: 999px;
  padding: 2px 10px;
}
.order-card.selected { border-color: var(--brand); background: #f8fbff; }
.order-card.active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(37,99,235,.18); }

/* 접수 폼 헤더(검색 결과 아래로 펼쳐짐) */
.claim-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0 10px;
}
.claim-head strong { font-size: 15px; }

/* 대상 상품 선택(다품목) */
.item-list { display: flex; flex-direction: column; gap: 8px; }
.item-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  cursor: pointer;
}
.item-row input { margin-top: 2px; accent-color: var(--brand); flex: 0 0 auto; }
.item-row:has(input:checked) { border-color: var(--brand); background: #eff6ff; }

/* 접수 폼 */
.link-back {
  border: 0;
  background: none;
  color: var(--brand);
  font-size: 14px;
  padding: 4px 0;
  margin-bottom: 8px;
}
.claim-form { display: flex; flex-direction: column; gap: 16px; margin-top: 14px; }
.group { border: 0; padding: 0; margin: 0; }
.group legend { padding: 0; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.group legend em { color: var(--muted); font-weight: 400; font-style: normal; font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
}
.chip input { accent-color: var(--brand); }
.chip.active, .chip:has(input:checked) {
  border-color: var(--brand);
  background: #eff6ff;
  color: var(--brand);
  font-weight: 600;
}

.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.field > span { font-weight: 600; }
.field > span em { color: var(--muted); font-weight: 400; }
.field .req { color: var(--danger); }
.field input, .field textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 13px;
  font-size: 16px;
  font-family: inherit;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.field textarea { resize: vertical; }

.identity { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fafbfc; }
.identity legend { padding: 0 6px; }
.identity .field { margin-top: 10px; }
.identity .field:first-of-type { margin-top: 0; }

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 10px 12px;
}

.primary {
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 17px;
  font-weight: 700;
  padding: 15px;
  width: 100%;
}
.primary:active { filter: brightness(.95); }
.primary:disabled { opacity: .6; }

/* 완료 */
.done { text-align: center; padding: 20px 0 6px; }
.done-mark {
  width: 64px; height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #dcfce7;
  color: var(--ok);
  font-size: 34px;
  line-height: 64px;
  font-weight: 700;
}
.done h3 { margin: 0 0 6px; font-size: 18px; }
.done p { margin: 0 0 18px; color: var(--muted); }

/* AI 상담 */
.chat-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 220px;
  max-height: 360px;
  overflow-y: auto;
  padding: 4px 2px 10px;
}
.chat-msg {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg.ai { align-self: flex-start; background: #f1f5f9; border-bottom-left-radius: 4px; }
.chat-msg.me {
  align-self: flex-end;
  background: var(--brand);
  color: var(--brand-ink);
  border-bottom-right-radius: 4px;
}
.chat-msg.staff { background: #e0ecff; color: #1e3a8a; }   /* 상담사(직원) — AI와 구분 */
.chat-sys {       /* 안내(상담사 연결/종료 등) — 가운데 회색 */
  align-self: center;
  color: #94a3b8;
  font-size: 12px;
  text-align: center;
  padding: 2px 4px;
}
.chat-form { display: flex; gap: 8px; margin-top: 4px; }
.chat-form input {
  flex: 1;
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 16px;
}
.chat-form input:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.chat-form button {
  flex: 0 0 auto;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 600;
}
.chat-form button:disabled { opacity: .6; }

/* 진행상황 패널 */
.muted { color: var(--muted); font-size: 14px; }
.progress-panel { display: flex; flex-direction: column; gap: 12px; }
.prog-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  background: #fafbfc;
}
.prog-block.cs { background: #eff6ff; border-color: #bfdbfe; }
.prog-block h4 { margin: 0 0 8px; font-size: 14px; }
.prog-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 3px 0; }
.prog-row span { color: var(--muted); flex: 0 0 auto; }
.prog-row b { text-align: right; }
.prog-items { margin-top: 8px; font-size: 13px; color: var(--ink); }
.prog-items div { padding: 2px 0; }

/* 토스트 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow);
  z-index: 50;
  max-width: 90vw;
}
