/* ─────────────────────────────────────────────────────────────
   감귤 주문 시스템 — 공통 스타일
   휴대폰 세로 화면이 기준이다. PC 는 가운데 정렬로 같은 폭을 쓴다.
   입력 글꼴은 16px 이상으로 둔다 — iOS 는 그보다 작으면 화면을 확대한다.
   ───────────────────────────────────────────────────────────── */

:root {
  --brand:        #ea7317;
  --brand-dark:   #c25a0d;
  --brand-light:  #fff4e8;
  --brand-ring:   rgba(234, 115, 23, .22);

  --bg:           #fffdfa;
  --surface:      #ffffff;
  --surface-2:    #faf8f5;
  --line:         #ece7e0;
  --line-strong:  #d9d2c9;

  --text:         #22201d;
  --text-2:       #6b645c;
  --text-3:       #9a938a;

  --ok:           #1f8a4c;
  --ok-bg:        #eaf7ef;
  --warn:         #b4521a;
  --warn-bg:      #fdf0e7;
  --err:          #c0392b;
  --err-bg:       #fdeceb;

  --radius:       12px;
  --radius-lg:    16px;
  --shadow:       0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
  --shadow-up:    0 -2px 14px rgba(0,0,0,.07);

  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard",
          "Malgun Gothic", "맑은 고딕", "Noto Sans KR", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand:        #ff8c38;
    --brand-dark:   #ffa45e;
    --brand-light:  #2a1e14;
    --brand-ring:   rgba(255, 140, 56, .26);

    --bg:           #16140f;
    --surface:      #1f1c17;
    --surface-2:    #262219;
    --line:         #332e26;
    --line-strong:  #453f35;

    --text:         #f2eee8;
    --text-2:       #b5ada2;
    --text-3:       #857d72;

    --ok:           #4cc97e;
    --ok-bg:        #16281d;
    --warn:         #ffb074;
    --warn-bg:      #2b1e13;
    --err:          #ff7a6b;
    --err-bg:       #2c1715;

    --shadow:       0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.35);
    --shadow-up:    0 -2px 14px rgba(0,0,0,.45);
  }
}

:root[data-theme="dark"] {
  --brand:        #ff8c38;
  --brand-dark:   #ffa45e;
  --brand-light:  #2a1e14;
  --brand-ring:   rgba(255, 140, 56, .26);
  --bg:           #16140f;
  --surface:      #1f1c17;
  --surface-2:    #262219;
  --line:         #332e26;
  --line-strong:  #453f35;
  --text:         #f2eee8;
  --text-2:       #b5ada2;
  --text-3:       #857d72;
  --ok:           #4cc97e;
  --ok-bg:        #16281d;
  --warn:         #ffb074;
  --warn-bg:      #2b1e13;
  --err:          #ff7a6b;
  --err-bg:       #2c1715;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

body { overflow-x: hidden; }

.wrap {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 0 16px 120px;
}

/* ───────────────────────── 머리말 ───────────────────────── */

.top {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  padding: 26px 16px 22px;
  text-align: center;
}
.top h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.3px;
}
.top p {
  margin: 7px 0 0;
  font-size: 13.5px;
  opacity: .92;
}
.top .tel { font-weight: 700; }

/* 로고 — 흰 배경 선화라 주황 헤더 위에 그냥 얹으면 흰 네모가 박힌 것처럼 보인다.
   흰 원 안에 담아 테두리까지 들어가게 한다(그림 자체가 원형 구도다). */
.top .logo {
  display: block;
  width: 112px;
  height: 112px;
  margin: 0 auto 12px;
  padding: 5px;
  box-sizing: border-box;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .16);
}
/* 조회 화면 — 본문이 정보 위주라 로고가 주인공이 되면 안 된다 */
.top .logo-sm { width: 76px; height: 76px; padding: 4px; margin-bottom: 10px; }

/* 가격 안내 — '모든 가격은 택배비 포함' 같은 한 줄.
   값이 아니라 조건이므로 가격 **바로 옆**에 붙어 있어야 읽힌다.
   아래쪽에 모아 두면 결제 금액을 다 보고 난 뒤에 읽게 된다. */
.pnote {
  margin: 10px 0 0;
  padding: 8px 11px;
  border-radius: var(--radius-sm, 8px);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.55;
}
.pnote::before { content: 'ⓘ '; opacity: .75; }
.pnote-pay {
  margin: 8px 0 0;
  background: transparent;
  padding: 0 2px;
  font-size: 12px;
}
/* 금액 행 아래에 붙는 가격 조건.
   .dl .dl-row 는 '82px 1fr' 2열 그리드다. dt 를 숨기면 그리드 아이템이 하나
   줄어들어 **dd 가 82px 칸으로 들어간다** — 문구가 다섯 줄로 쪼개진다
   (2026-11-04 조회 화면에서 실측). 그래서 이 행만 그리드에서 뺀다. */
.dl .dl-row.dl-note {
  display: block;
  border-bottom: 0;
  padding: 0 0 9px;
}
.dl .dl-row.dl-note dt { display: none; }
.dl .dl-row.dl-note dd { font-weight: 400; }

/* ───────────────────────── 카드 ───────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-top: 16px;
}
.card > h2 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 7px;
}
.card > h2::before {
  content: "";
  width: 3px;
  height: 15px;
  background: var(--brand);
  border-radius: 2px;
}
.card > h2 .opt {
  font-weight: 500;
  font-size: 12.5px;
  color: var(--text-3);
}

/* ───────────────────────── 입력 ───────────────────────── */

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 6px;
}
.field label .req { color: var(--brand); margin-left: 2px; }

input[type="text"], input[type="tel"], input[type="password"],
input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 16px;
  color: var(--text);
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-height: 48px;
}
textarea { min-height: 84px; resize: vertical; line-height: 1.55; }

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px var(--brand-ring);
  background: var(--surface);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:disabled, textarea:disabled, select:disabled { opacity: .55; }

.hint {
  font-size: 12.5px;
  color: var(--text-3);
  margin: 6px 0 0;
}
.field-err {
  font-size: 12.5px;
  color: var(--err);
  margin: 6px 0 0;
  font-weight: 600;
}
input.bad, textarea.bad { border-color: var(--err); }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-zip { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

/* 봇 차단용 — 사람에게는 보이지 않는다 */
.hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  opacity: 0;
}

/* ───────────────────────── 상품 선택 ───────────────────────── */

.plist { display: flex; flex-direction: column; gap: 9px; }

.p-item { position: relative; display: block; }
.p-item input { position: absolute; opacity: 0; pointer-events: none; }

.p-box {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.p-item input:checked + .p-box {
  border-color: var(--brand);
  background: var(--brand-light);
}
.p-item input:focus-visible + .p-box { box-shadow: 0 0 0 3.5px var(--brand-ring); }

.p-dot {
  flex: 0 0 auto;
  width: 20px; height: 20px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  position: relative;
  transition: border-color .15s;
}
.p-item input:checked + .p-box .p-dot { border-color: var(--brand); }
.p-item input:checked + .p-box .p-dot::after {
  content: "";
  position: absolute;
  inset: 3px;
  background: var(--brand);
  border-radius: 50%;
}

.p-main { flex: 1 1 auto; min-width: 0; }
.p-name {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  word-break: keep-all;
  line-height: 1.4;
}
.p-note {
  display: block;
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 2px;
  line-height: 1.45;
  word-break: keep-all;
}
.p-price {
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 800;
  color: var(--brand);
  white-space: nowrap;
}

/* ───────────────────────── 수량 ───────────────────────── */

.qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}
.qty-row > span { font-size: 13px; font-weight: 700; color: var(--text-2); }

.stepper {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.stepper button {
  width: 46px; height: 46px;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
}
.stepper button:active { background: var(--brand-light); }
.stepper button:disabled { color: var(--text-3); cursor: default; }
.stepper input {
  width: 52px;
  min-height: 46px;
  text-align: center;
  font-size: 17px;
  font-weight: 800;
  border: 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  padding: 0;
}
.stepper input:focus { box-shadow: none; }

.total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 2px solid var(--brand);
}
.total .lb { font-size: 14px; font-weight: 700; color: var(--text-2); }
.total .val { font-size: 25px; font-weight: 800; color: var(--brand); letter-spacing: -.5px; }
.total .val small { font-size: 15px; font-weight: 700; margin-left: 1px; }

/* ───────────────────────── 선택 버튼 묶음 ───────────────────────── */

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg label { position: relative; display: block; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg .box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s;
}
.seg input:checked + .box {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand);
}
.seg input:focus-visible + .box { box-shadow: 0 0 0 3.5px var(--brand-ring); }

/* ───────────────────────── 체크박스 ───────────────────────── */

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
  min-height: 40px;
}
.check input { width: 20px; height: 20px; accent-color: var(--brand); margin: 0; flex: 0 0 auto; }
.check span { font-size: 14px; font-weight: 600; color: var(--text-2); }

/* ───────────────────────── 버튼 ───────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-height: 52px;
  padding: 14px 18px;
  border: 0;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: opacity .15s, transform .08s;
  text-decoration: none;
  line-height: 1.2;
}
.btn:active:not(:disabled) { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: default; }

.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 2px 10px var(--brand-ring); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }

.btn-sub {
  background: var(--surface-2);
  color: var(--text);
  border: 1.5px solid var(--line-strong);
}
.btn-ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn-zip {
  width: auto;
  min-height: 48px;
  padding: 0 16px;
  font-size: 14px;
  white-space: nowrap;
  background: var(--text-2);
  color: #fff;
}
.btn-sm { min-height: 42px; font-size: 14px; padding: 9px 14px; width: auto; }
.btn-danger { background: var(--err-bg); color: var(--err); border: 1.5px solid var(--err); }

.btn-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: var(--shadow-up);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  z-index: 40;
}
.btn-bar .inner { max-width: 520px; margin: 0 auto; }

/* ───────────────────────── 알림 ───────────────────────── */

.alert {
  border-radius: var(--radius);
  padding: 13px 15px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 14px;
  line-height: 1.55;
  word-break: break-word;
}
.alert-err  { background: var(--err-bg);  color: var(--err);  border: 1px solid currentColor; }
.alert-ok   { background: var(--ok-bg);   color: var(--ok);   border: 1px solid currentColor; }
.alert-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid currentColor; }
.alert-info { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translate(-50%, 14px);
  background: var(--text);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 700;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  max-width: calc(100vw - 40px);
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ───────────────────────── 로딩 ───────────────────────── */

.spin {
  width: 17px; height: 17px;
  border: 2.5px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex: 0 0 auto;
}
.spin-dark { border-color: var(--line); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

.loading {
  text-align: center;
  padding: 54px 20px;
  color: var(--text-3);
  font-size: 14px;
}
.loading .spin { margin: 0 auto 14px; }

/* ───────────────────────── 배지·꼬리표 ───────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: -.1px;
}
.b-new   { background: var(--warn-bg); color: var(--warn); }
.b-ship  { background: var(--ok-bg);   color: var(--ok); }
.b-cancel{ background: var(--surface-2); color: var(--text-3); }
.b-kakao { background: #fef3c7; color: #8a6100; }
.b-sms   { background: #e0edff; color: #1d4ed8; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .b-kakao { background: #3a2f10; color: #ffd964; }
  :root:not([data-theme="light"]) .b-sms   { background: #15233d; color: #8fb6ff; }
}

/* ───────────────────────── 정보 표 ───────────────────────── */

.dl { margin: 0; }
.dl .dl-row {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.dl .dl-row:last-child { border-bottom: 0; }
.dl dt { color: var(--text-3); font-weight: 600; }
.dl dd { margin: 0; color: var(--text); font-weight: 600; word-break: break-word; }
.dl dd.strong { font-weight: 800; }
.dl dd.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  letter-spacing: .2px;
}

/* ───────────────────────── 기타 ───────────────────────── */

.foot {
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  padding: 26px 16px 10px;
  line-height: 1.7;
}
.sep { height: 1px; background: var(--line); margin: 16px 0; border: 0; }
.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb0 { margin-bottom: 0; }
.nowrap { white-space: nowrap; }
.sr {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.msgbox {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 13.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  max-height: 260px;
  overflow-y: auto;
  font-family: var(--font);
}

@media (min-width: 560px) {
  .top { border-radius: 0 0 20px 20px; }
}

/* ───────────── 입금 안내 ─────────────
   고객이 주문 직후 보는 블록이다. 금액과 계좌번호가 한눈에 들어와야 하고,
   계좌번호는 숫자를 하나씩 확인할 수 있게 자간을 벌린다. */
.pay {
  margin-top: 18px;
  padding: 16px 14px 14px;
  border: 1.5px solid var(--brand);
  border-radius: 12px;
  background: var(--brand-light);
  text-align: left;
}
.pay-notice {
  margin: 0 0 12px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-2);
}
.pay-amt {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line-strong);
}
.pay-amt > span {
  font-size: 13.5px;
  color: var(--text-2);
}
.pay-amt > b {
  font-size: 21px;
  font-weight: 700;
  color: var(--brand-dark);
  white-space: nowrap;
}
.pay-acct { padding: 12px 0 14px; }
.pay-bank {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.pay-holder {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-2);
  margin-left: 4px;
}
.pay-no {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .5px;
  word-break: break-all;
  line-height: 1.35;
}
.pay .btn { width: 100%; }

/* ───────────── 우편번호 검색 레이어 ─────────────
   새 팝업 창 대신 이 레이어 안에서 연다. 카카오톡 인앱 브라우저가
   팝업을 막거나 about:blank 빈 창으로 띄우기 때문이다(2026-11-04 실측).
   화면 전체를 덮어 주소 입력에 집중하게 한다. */
.pc-layer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.pc-layer[hidden] { display: none; }
.pc-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: var(--brand);
  /* 노치·상태바를 피한다 */
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
}
.pc-close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.pc-close:active { background: rgba(255, 255, 255, .3); }
.pc-box {
  flex: 1 1 auto;
  min-height: 0;        /* 이게 없으면 iframe 이 레이어 밖으로 넘친다 */
  overflow: hidden;
}
.pc-box > div,
.pc-box iframe {
  width: 100% !important;
  height: 100% !important;
  border: 0;
}
