/* 문의창 스타일 — 모바일 웹뷰 기준(가로 100%·터치 타깃 44px 이상) */
:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e3e6ea;
  --text: #1c1f23;
  --muted: #6b7280;
  --primary: #2f6fed;
  --danger: #d64545;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* ★display를 지정한 규칙(.field 등)이 hidden 속성을 이겨 조건부 필드가 그대로 보인다.
   [hidden]을 명시적으로 눌러 둔다. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  word-break: break-word;
}

/* ─── 상단바 ─── */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center;
  height: 52px; padding: 0 8px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 17px; font-weight: 600; }
.back {
  width: 44px; height: 44px;
  border: 0; background: none;
  font-size: 28px; line-height: 1; color: var(--text);
  cursor: pointer;
}

#main { padding: 12px 16px 40px; max-width: 720px; margin: 0 auto; }

/* ─── 공통 ─── */
.center { text-align: center; padding: 40px 16px; }
.muted { color: var(--muted); font-size: 13px; }
.big { font-size: 17px; font-weight: 600; margin: 0 0 6px; }
.lead { font-size: 16px; font-weight: 600; margin: 4px 0 14px; }
.error { color: var(--danger); font-size: 13px; margin: 8px 0 0; }
.list { list-style: none; margin: 0; padding: 0; }

button.primary {
  display: block; width: 100%; min-height: 48px;
  margin-top: 16px; padding: 12px;
  border: 0; border-radius: 10px;
  background: var(--primary); color: #fff;
  font-size: 16px; font-weight: 600; font-family: inherit;
  cursor: pointer;
}
button.primary:disabled { opacity: .55; }

.badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
  background: #eef1f5; color: var(--muted);
}
.status-open { background: #e8f0fe; color: #1a56c4; }
.status-pending { background: #fff4e0; color: #a86200; }
.status-answered { background: #e6f6ec; color: #1c7a41; }
.status-closed { background: #eef1f5; color: var(--muted); }

.dot {
  display: inline-block; width: 7px; height: 7px; margin-left: 6px;
  border-radius: 50%; background: var(--danger); vertical-align: middle;
}

/* ─── 탭 ─── */
.tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.tab {
  flex: 1; min-height: 44px;
  border: 0; border-bottom: 2px solid transparent;
  background: none; color: var(--muted);
  font-size: 15px; font-family: inherit; cursor: pointer;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ─── FAQ ─── */
.faq { background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.faq-q {
  display: flex; align-items: flex-start; gap: 8px;
  width: 100%; min-height: 48px; padding: 12px 14px;
  border: 0; background: none; text-align: left;
  font-size: 15px; font-family: inherit; color: var(--text); cursor: pointer;
}
.faq-mark { color: var(--primary); font-weight: 700; flex: none; }
.faq-text { flex: 1; }
.faq-q.open { font-weight: 600; }
.faq-a {
  padding: 0 14px 14px 34px;
  color: #3a4048; font-size: 14px;
  white-space: pre-wrap;
  border-top: 1px solid var(--line);
  padding-top: 12px; margin-top: 0;
}

.cta { margin-top: 24px; text-align: center; }

/* ─── 카테고리 ─── */
.category { margin-bottom: 8px; }
.category-btn {
  display: block; width: 100%; min-height: 56px; padding: 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); text-align: left;
  font-family: inherit; cursor: pointer;
}
.category-name { display: block; font-size: 15px; font-weight: 600; color: var(--text); }
.category-desc { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); }

/* ─── 내 문의 ─── */
.ticket { margin-bottom: 8px; }
.ticket-btn {
  display: block; width: 100%; padding: 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); text-align: left;
  font-family: inherit; cursor: pointer;
}
.ticket-head { display: flex; align-items: center; }
.ticket-title { flex: 1; font-size: 15px; font-weight: 600; color: var(--text); }
.ticket-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; }

/* ─── 폼 ─── */
.field { display: block; margin-bottom: 16px; }
.label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.label.req::after { content: " *"; color: var(--danger); }
.help { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

input[type="text"], input[type="number"], input[type="date"], textarea, select {
  width: 100%; min-height: 46px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--text);
  font-size: 16px;   /* ★16px 미만이면 iOS 웹뷰가 포커스 시 화면을 확대한다 */
  font-family: inherit;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

.options { display: flex; flex-wrap: wrap; gap: 8px; }
.option {
  display: flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); font-size: 14px;
}
.option input { width: 18px; height: 18px; margin: 0; }

/* ─── 첨부 ─── */
.file-input {
  width: 100%; padding: 10px;
  border: 1px dashed var(--line); border-radius: 8px;
  background: var(--card); font-size: 14px; font-family: inherit;
}
.attachments {
  margin: 14px 0; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
}
.attach-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.attach-list { list-style: none; margin: 0; padding: 0; }
.attach { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.attach-link { color: var(--primary); font-size: 14px; text-decoration: none; word-break: break-all; }
.attach-by {
  padding: 1px 6px; border-radius: 4px;
  background: #eef1f5; color: var(--muted); font-size: 11px; font-weight: 600;
}

/* ─── 상세 ─── */
.detail-head { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.detail-head h2 { margin: 0 0 8px; font-size: 17px; }
.detail-head .meta { display: flex; align-items: center; gap: 8px; }

.form-data { margin: 14px 0; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.form-data dt { font-size: 12px; color: var(--muted); }
.form-data dd { margin: 2px 0 10px; font-size: 14px; }
.form-data dd:last-child { margin-bottom: 0; }

.messages { list-style: none; margin: 16px 0 0; padding: 0; }
.msg { padding: 12px 14px; margin-bottom: 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.msg-agent { background: #f0f5ff; border-color: #d6e2fb; }
.msg-who { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.msg-agent .msg-who { color: var(--primary); }
.msg-body { font-size: 15px; white-space: pre-wrap; }
.msg-time { margin-top: 6px; font-size: 11px; }
