/* S1 고객 웹앱 (휴대폰 우선 반응형) — 가격은 어디에도 표시하지 않음 */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --fg: #0f172a;
  --fg-sub: #334155;
  --mut: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --card: #f1f5f9;
  --card-hover: #e2e8f0;
  --acc: #e11d48;
  --acc-hover: #be123c;
  --acc-soft: #ffe4e6;
  --acc-text: #9f1239;
  --onacc: #ffffff;
  --sec: #0f172a;
  --onsec: #ffffff;
  --ok: #059669;
  --okbg: #ecfdf5;
  --okborder: #a7f3d0;
  --warn: #d97706;
  --warnbg: #fffbeb;
  --bad: #dc2626;
  --badbg: #fef2f2;
  --zalo: #0068ff;
  --kakao: #fee500;
  --kakao-fg: #191919;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.16);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #090d16;
    --surface: #111827;
    --fg: #f1f5f9;
    --fg-sub: #cbd5e1;
    --mut: #94a3b8;
    --line: #1e293b;
    --line-strong: #334155;
    --card: #1e293b;
    --card-hover: #334155;
    --acc: #f43f5e;
    --acc-hover: #fb7185;
    --acc-soft: rgba(244, 63, 94, 0.16);
    --acc-text: #fda4af;
    --onacc: #ffffff;
    --sec: #334155;
    --onsec: #f8fafc;
    --ok: #34d399;
    --okbg: rgba(16, 185, 129, 0.14);
    --okborder: rgba(52, 211, 153, 0.35);
    --warn: #fbbf24;
    --warnbg: rgba(245, 158, 11, 0.15);
    --bad: #f87171;
    --badbg: rgba(239, 68, 68, 0.15);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.65);
  }
}

:root[data-theme="dark"] {
  --bg: #090d16;
  --surface: #111827;
  --fg: #f1f5f9;
  --fg-sub: #cbd5e1;
  --mut: #94a3b8;
  --line: #1e293b;
  --line-strong: #334155;
  --card: #1e293b;
  --card-hover: #334155;
  --acc: #f43f5e;
  --acc-hover: #fb7185;
  --acc-soft: rgba(244, 63, 94, 0.16);
  --acc-text: #fda4af;
  --onacc: #ffffff;
  --sec: #334155;
  --onsec: #f8fafc;
  --ok: #34d399;
  --okbg: rgba(16, 185, 129, 0.14);
  --okborder: rgba(52, 211, 153, 0.35);
  --warn: #fbbf24;
  --warnbg: rgba(245, 158, 11, 0.15);
  --bad: #f87171;
  --badbg: rgba(239, 68, 68, 0.15);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.65);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Pretendard", "Noto Sans KR", sans-serif;
}

button {
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-weight: 500;
}

button:hover {
  border-color: var(--line-strong);
}

button:active {
  transform: scale(0.98);
}

.pri {
  background: var(--acc);
  color: var(--onacc);
  border-color: var(--acc);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(225, 29, 72, 0.25);
}

.pri:hover {
  background: var(--acc-hover);
  border-color: var(--acc-hover);
}

.sec-cta {
  background: var(--sec);
  color: var(--onsec);
  border-color: var(--sec);
  font-weight: 600;
}

input, textarea {
  font: inherit;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 3px var(--acc-soft);
}

/* App Shell */
.app {
  max-width: 720px;
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  position: relative;
}

/* Header */
header.top-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface);
  z-index: 4;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #e11d48, #f97316);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(225, 29, 72, 0.25);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

header b#mk {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--okbg);
  color: var(--ok);
  border: 1px solid var(--okborder);
  flex-shrink: 0;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}

.brand-sub {
  font-size: 11px;
  color: var(--mut);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hdr-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.sns-link {
  text-decoration: none;
}

.sns-btn {
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  border: none;
}

.zalo-btn {
  background: var(--zalo);
  color: #fff;
}

.kakao-btn {
  background: var(--kakao);
  color: var(--kakao-fg);
}

.hdr-chip {
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  height: 32px;
}

.lang-chip {
  min-width: 36px;
  font-weight: 700;
  color: var(--acc);
}

.ico-chip {
  width: 32px;
  padding: 0;
  font-size: 14px;
}

.mut {
  color: var(--mut);
  font-size: 12px;
}

.err {
  color: var(--bad);
  font-size: 13px;
  font-weight: 500;
}

.err:not(:empty) {
  background: var(--badbg);
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(220, 38, 38, 0.25);
}

/* Messages Area */
.msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
  scroll-behavior: smooth;
}

/* Welcome Hero (Scene ①) */
.welcome {
  margin: auto 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  padding: 22px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.av-wrap {
  position: relative;
  display: inline-flex;
}

.av {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e11d48, #fb7185);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(225, 29, 72, 0.25);
}

.av-status {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid var(--surface);
}

.welcome b {
  font-size: 18px;
  letter-spacing: -0.2px;
}

.welcome-sub {
  color: var(--mut);
  font-size: 13.5px;
  line-height: 1.55;
  max-width: 420px;
}

.guide-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 480px;
  margin: 4px 0;
}

.step-pill {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 6px;
  font-size: 11.5px;
  color: var(--fg-sub);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-weight: 600;
}

.step-pill span {
  font-size: 15px;
}

.quick-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--mut);
  margin-top: 2px;
}

.quick {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 520px;
}

.quick button {
  border-radius: 999px;
  font-size: 13px;
  padding: 7px 13px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--fg);
  box-shadow: var(--shadow-sm);
}

.quick button:hover {
  border-color: var(--acc);
  color: var(--acc);
  background: var(--acc-soft);
}

/* Chat Bubbles (Scene ③) */
.m {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.m.user {
  align-self: flex-end;
  background: var(--acc);
  color: var(--onacc);
  border-bottom-right-radius: 4px;
}

.m.assistant {
  align-self: flex-start;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.m.staff {
  align-self: flex-start;
  background: var(--okbg);
  color: var(--fg);
  border: 1px solid var(--okborder);
  border-bottom-left-radius: 4px;
}

.m.system {
  align-self: center;
  max-width: 92%;
  background: var(--okbg);
  color: var(--ok);
  border: 1px solid var(--okborder);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  border-radius: 12px;
  padding: 10px 14px;
}

.typing-bubble {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 8px 13px;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  font-size: 12.5px;
  color: var(--mut);
}

.typing-dots {
  display: inline-flex;
  gap: 3px;
}

.typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--acc);
  animation: pulseDot 1.2s infinite ease-in-out;
}

.typing-dots i:nth-child(2) { animation-delay: 0.2s; }
.typing-dots i:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulseDot {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.1); }
}

/* Product Cards in Chat (Scene ④ — 가격 절대 표시 없음) */
.cards {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scroll-snap-type: x mandatory;
}

.p {
  min-width: 168px;
  max-width: 168px;
  scroll-snap-align: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.p:hover {
  border-color: var(--acc);
}

.ph {
  height: 64px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--card), var(--line));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--acc);
  font-weight: 800;
  font-size: 22px;
  position: relative;
}

.p-cat {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--mut);
  border: 1px solid var(--line);
}

.p-title {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 35px;
}

.k {
  font-size: 11.5px;
  color: var(--mut);
  font-weight: 500;
}

.p button {
  margin-top: auto;
  width: 100%;
  padding: 7px 8px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 8px;
  background: var(--acc-soft);
  color: var(--acc-text);
  border-color: transparent;
}

.p button:hover {
  background: var(--acc);
  color: var(--onacc);
}

/* Selected Products Tray (Scene ⑥) */
.tray {
  border-top: 2px solid var(--acc);
  background: var(--surface);
  padding: 10px 14px;
  display: none;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
  z-index: 3;
}

.tray.on {
  display: block;
}

.tray-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.tray-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
}

.tray-clear-btn {
  padding: 3px 8px;
  font-size: 12px;
  border-radius: 6px;
  color: var(--mut);
}

.tray-list {
  max-height: 165px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.tray .row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.tray .row-info {
  flex: 1;
  min-width: 0;
}

.tray .row-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qty-box {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}

.qty-step {
  width: 28px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  font-weight: 700;
  font-size: 14px;
}

.tray .row input[type=number] {
  width: 54px;
  height: 30px;
  padding: 2px 4px;
  border: none;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-radius: 0;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  background: var(--surface);
}

.row-del {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  color: var(--mut);
  border-color: transparent;
  background: transparent;
}

.row-del:hover {
  color: var(--bad);
  background: var(--badbg);
}

.tray-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.tray-cta {
  flex: 1;
  padding: 10px 12px;
  font-size: 14px;
  border-radius: 10px;
}

/* Bottom Input Bar (Scene ⑤) */
.bar {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
  display: flex;
  gap: 7px;
  align-items: center;
  z-index: 3;
}

.input-wrap {
  flex: 1;
  display: flex;
}

.bar input[type=text] {
  border-radius: 999px;
  padding: 10px 15px;
  background: var(--card);
  border-color: var(--line);
  font-size: 14.5px;
}

.bar input[type=text]:focus {
  background: var(--surface);
  border-color: var(--acc);
}

.ico {
  width: 40px;
  height: 40px;
  padding: 0;
  flex: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
}

.tool-btn {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--fg-sub);
  transition: all 0.15s ease;
}

.tool-btn:hover {
  border-color: var(--acc);
  color: var(--acc);
  background: var(--acc-soft);
}

.send-btn {
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.3);
}

/* Modals / Bottom Sheets (Scenes ②, ⑤, ⑦) */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(3px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
}

.modal.on {
  display: flex;
}

.sheet {
  background: var(--surface);
  width: 100%;
  max-width: 720px;
  border-radius: 20px 20px 0 0;
  padding: 14px 18px calc(18px + env(safe-area-inset-bottom));
  display: grid;
  gap: 11px;
  max-height: 90dvh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
  border-top: 1px solid var(--line);
}

.sheet-handle {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: var(--line-strong);
  margin: 0 auto 2px;
}

.sheet-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.sheet-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--acc-soft);
  color: var(--acc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}

.sheet-title {
  display: block;
  font-size: 16.5px;
  font-weight: 700;
}

.sheet-desc {
  display: block;
  margin-top: 2px;
  line-height: 1.4;
}

.sheet-close {
  margin-left: auto;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  border-color: transparent;
  background: var(--card);
  color: var(--mut);
  flex-shrink: 0;
}

.form-group {
  display: grid;
  gap: 4px;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-sub);
}

.mono-textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  letter-spacing: 0.5px;
}

.req-preview {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 12.5px;
  color: var(--fg-sub);
  max-height: 110px;
  overflow-y: auto;
}

.sheet-submit {
  padding: 12px;
  font-size: 15px;
  border-radius: 12px;
  margin-top: 2px;
}

.sheet-btn-row {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.btn-cancel {
  flex: 1;
  padding: 11px;
  border-radius: 11px;
  background: var(--card);
}

.btn-confirm {
  flex: 2;
  padding: 11px;
  border-radius: 11px;
  font-size: 14.5px;
}

@media (min-width: 720px) {
  body {
    padding: 0;
  }
  .modal {
    align-items: center;
    padding: 16px;
  }
  .sheet {
    border-radius: 18px;
    max-width: 440px;
    padding: 20px;
    border: 1px solid var(--line);
  }
  .sheet-handle {
    display: none;
  }
}

@media (max-width: 400px) {
  header.top-header {
    padding: 8px 10px;
  }
  .brand-logo {
    width: 32px;
    height: 32px;
    font-size: 11px;
  }
  header b#mk {
    font-size: 14px;
  }
  .guide-steps {
    gap: 4px;
  }
  .step-pill {
    font-size: 10.5px;
    padding: 6px 4px;
  }
}

/* ---- 11/19 Claude 추가: 혜택 배지·문구, 말풍선 번역 버튼 (금액 표시 없음) ---- */
.p-badge { align-self: flex-start; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: var(--acc-soft); color: var(--acc-text); }
.p-badge.b-임박, .p-badge.b-덤, .p-badge.b-할인 { background: var(--warnbg); color: var(--warn); }
.p-badge.b-신상품 { background: var(--okbg); color: var(--ok); }
.p-benefit { font-size: 12px; font-weight: 700; color: var(--warn); line-height: 1.35; }
.p-note { font-size: 11px; color: var(--mut); line-height: 1.35; }
.tr-btn { display: block; margin-top: 6px; padding: 2px 8px; font-size: 11px; font-weight: 600; border-radius: 999px;
  background: transparent; color: var(--mut); border: 1px solid var(--line); cursor: pointer; }
.tr-btn:disabled { opacity: .5; }
.m.staff .tr-btn { border-color: var(--okborder); }
