/* 우리동네 당원가게 — mobile-first app shell: header / view / bottom tabs */
:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --fg: #16202e;
  --muted: #5b6677;
  --line: #dde2ea;
  --primary: #1f4fa8;
  --primary-ink: #ffffff;
  --primary-soft: #e4ecfa;
  --warm: #f2b233;
  --ok: #1d8a56;
  --danger: #c23b3b;
  --font-display: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-body: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --nav-h: 60px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141c; --surface: #18202c; --fg: #e8edf4; --muted: #9aa6b8; --line: #2a3546;
    --primary: #7fa8f0; --primary-ink: #0f141c; --primary-soft: #1f2d45; --warm: #f2c25e; --ok: #5cc28f; --danger: #f07a7a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--font-body); font-size: 15px; line-height: 1.55;
  display: flex; flex-direction: column; height: 100dvh; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; }
h3 { font-size: 16px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
[hidden] { display: none !important; }
ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; }

/* header */
.top { flex: none; background: var(--surface); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); padding-left: var(--gutter-l); padding-right: var(--gutter-r); z-index: 5; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 52px; max-width: 720px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--fg); font-family: var(--font-display); font-size: 18px; }
.brand b { color: var(--primary); }
.top-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: var(--muted); }
.icon-btn svg { width: 22px; height: 22px; }
.filters { display: flex; gap: 8px; padding-bottom: 10px; max-width: 720px; margin: 0 auto; }
.filters input { flex: 1; min-width: 0; height: 40px; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 0 12px; }
.filters select { height: 40px; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 0 8px; max-width: 42%; }

/* views */
main { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; }
.view.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.wrap { max-width: 720px; margin: 0 auto; padding-left: var(--gutter-l); padding-right: var(--gutter-r); padding-block: 16px 24px; }
.stack { display: grid; gap: 12px; min-width: 0; }
.section-title { display: grid; gap: 4px; }
.section-title h2 { font-size: 20px; }
.section-title p { margin: 0; color: var(--muted); font-size: 14px; }
.meta-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }

/* map */
.map { position: absolute; inset: 0; background: var(--primary-soft); }
.map-tools { position: absolute; right: var(--gutter-r); top: 12px; display: grid; gap: 8px; z-index: 3; }
.fab { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); display: grid; place-items: center; box-shadow: 0 2px 8px rgb(0 0 0 / .15); cursor: pointer; }
.fab svg { width: 22px; height: 22px; }
.map-count { position: absolute; left: var(--gutter-l); top: 12px; z-index: 3; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13px; box-shadow: 0 2px 8px rgb(0 0 0 / .12); }
.map-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; z-index: 4; background: var(--bg); color: var(--muted); }
.map-msg > div { max-width: 340px; display: grid; gap: 10px; justify-items: center; }
.map-msg strong { color: var(--fg); font-family: var(--font-display); font-size: 17px; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; padding: 0 var(--gutter-r) 12px var(--gutter-l); }
.sheet .card { max-width: 720px; margin: 0 auto; box-shadow: 0 -4px 24px rgb(0 0 0 / .18); max-height: 55dvh; overflow-y: auto; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; min-width: 0; }
.store { display: grid; gap: 8px; }
.store-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.store h3 { font-size: 17px; overflow-wrap: anywhere; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; margin-top: 4px; }
.badge { background: var(--primary-soft); border-radius: 6px; padding: 1px 8px; }
.badge.pending { background: color-mix(in srgb, var(--warm) 35%, var(--surface)); }
.badge.approved { background: color-mix(in srgb, var(--ok) 22%, var(--surface)); }
.badge.rejected { background: color-mix(in srgb, var(--danger) 22%, var(--surface)); }
.dist { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.intro { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 14px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.reason { font-size: 14px; background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border-radius: 8px; padding: 8px 10px; }
.close-x { border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; padding: 0 4px; cursor: pointer; }

/* buttons */
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); text-decoration: none; font-size: 14px; cursor: pointer; white-space: nowrap; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-weight: 700; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 700; }
.btn.kakao { background: #fee500; border-color: #fee500; color: #191600; font-weight: 700; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }

/* chips + segmented */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: none; border-radius: 9px; padding: 8px 4px; font-size: 14px; cursor: pointer; font-variant-numeric: tabular-nums; }
.seg button[aria-selected="true"] { background: var(--primary); color: var(--primary-ink); font-weight: 700; }

/* form */
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 500; }
.field label em { color: var(--danger); font-style: normal; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 12px; min-height: 44px; }
.field textarea { min-height: 110px; resize: vertical; }
.field small, .pick-map-wrap small { color: var(--muted); font-size: 12px; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; min-width: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 380px) { .row2 { grid-template-columns: 1fr; } }
.pick-map-wrap { display: grid; gap: 6px; }
.pick-map { height: 220px; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; }
.consent { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 14px; }
.consent input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.msg { font-size: 14px; min-height: 1.4em; }
.msg.err { color: var(--danger); }
.notice { background: var(--primary-soft); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.notice.warn { background: color-mix(in srgb, var(--warm) 25%, var(--surface)); }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); display: grid; gap: 10px; justify-items: center; }
.empty strong { color: var(--fg); font-family: var(--font-display); font-size: 17px; }
.uid { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--bg); border-radius: 8px; padding: 6px 8px; overflow-wrap: anywhere; flex: 1; min-width: 0; }

/* bottom tabs */
.tabs { flex: none; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); z-index: 5; }
.tabs a { flex: 1; height: var(--nav-h); display: grid; place-items: center; align-content: center; gap: 1px; text-decoration: none; color: var(--muted); font-size: 11.5px; position: relative; }
.tabs a svg { width: 22px; height: 22px; }
.tabs a[aria-current="page"] { color: var(--primary); font-weight: 700; }
.tabs .dot { position: absolute; top: 9px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }

/* address layer */
.layer { position: fixed; inset: 0; z-index: 20; background: rgb(0 0 0 / .45); display: grid; place-items: end center; padding-top: calc(env(safe-area-inset-top, 0px) + 24px); }
.layer-box { width: 100%; max-width: 720px; height: 100%; background: var(--surface); border-radius: 16px 16px 0 0; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom, 0px); }
.layer-head { display: flex; justify-content: space-between; align-items: center; padding: 10px var(--gutter-r) 10px var(--gutter-l); border-bottom: 1px solid var(--line); }
.addr-embed { flex: 1; min-height: 0; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 16px); z-index: 30; background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 4px 16px rgb(0 0 0 / .25); }

/* map marker label (kakao custom overlay) */
.admin-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }
.pin-label { background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 12px; font-weight: 500; white-space: nowrap; transform: translateY(4px); box-shadow: 0 1px 4px rgb(0 0 0 / .15); }
@media (prefers-reduced-motion: no-preference) { .sheet .card { animation: up .18s ease-out; } @keyframes up { from { transform: translateY(16px); opacity: .6; } } }
