/* 휴대폰을 먼저 봅니다. 매장을 돌아다니며 한 손으로 보는 화면입니다. */
:root {
  --ink: #16191d;
  --dim: #667085;
  --line: #e4e7ec;
  --bg: #ffffff;
  --panel: #f7f8fa;
  --accent: #16191d;
  --ok: #0f7b4f;
  --ok-bg: #e8f5ee;
  --busy: #8a5a00;
  --busy-bg: #fdf3e0;
  --bad: #b42318;
  --bad-bg: #fdeceb;
  --tap: 44px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e7eaee; --dim: #9aa3af; --line: #2b313a; --bg: #101317; --panel: #191d23;
    --accent: #e7eaee; --ok: #6ee7a8; --ok-bg: #12291f; --busy: #f0c26b; --busy-bg: #2a2113;
    --bad: #ff9c92; --bad-bg: #2b1614;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; padding: 0 0 56px;
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard",
        "Malgun Gothic", system-ui, sans-serif;
  color: var(--ink); background: var(--bg);
  overflow-wrap: anywhere;
}
main, .bar-inner, .notices { max-width: 720px; margin-inline: auto; }
main { padding: 16px; }
h1 { margin: 0; font-size: 20px; letter-spacing: -0.015em; }
.sub { margin: 4px 0 0; color: var(--dim); font-size: 13px; }
.loading { color: var(--dim); }
code { font-size: .92em; padding: 1px 4px; background: var(--panel); border-radius: 4px; }

/* 머리띠 ------------------------------------------------------------------ */
.bar {
  position: sticky; top: 0; z-index: 5;
  padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.bar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-weight: 650; font-size: 16px; color: inherit; text-decoration: none;
         letter-spacing: -0.01em; white-space: nowrap; }
.who { display: flex; align-items: center; gap: 12px; flex: none;
       color: var(--dim); font-size: 13px; white-space: nowrap; }
.who > span { max-width: 9em; overflow: hidden; text-overflow: ellipsis; }
.link { min-height: auto; padding: 6px 2px; font: inherit; font-size: 13px; color: var(--dim);
        background: none; border: 0; border-radius: 0; cursor: pointer; text-decoration: underline; }

/* 알림 -------------------------------------------------------------------- */
.notices { padding: 0 16px; }
.notice {
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 10px; padding: 11px 13px; font-size: 14px;
  border: 1px solid transparent; border-radius: 10px;
}
.notice.ok { color: var(--ok); background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.notice.busy { color: var(--busy); background: var(--busy-bg); border-color: color-mix(in srgb, var(--busy) 25%, transparent); }
.notice.bad { color: var(--bad); background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.notice { transition: opacity .35s ease, transform .35s ease; }
.notice.fading { opacity: 0; transform: translateY(-6px); }
@media (prefers-reduced-motion: reduce) { .notice { transition: none; } }
.notice p { margin: 0; flex: 1; }
.notice button { min-width: auto; min-height: auto; padding: 0 4px; font-size: 16px; line-height: 1;
                 color: inherit; background: none; border: 0; cursor: pointer; opacity: .6; }

/* 입력 -------------------------------------------------------------------- */
button {
  min-height: var(--tap); padding: 0 16px; font: inherit; font-size: 14px; font-weight: 550;
  color: var(--bg); background: var(--accent); border: 0; border-radius: 10px; cursor: pointer;
}
button.quiet { color: var(--ink); background: var(--bg); border: 1px solid var(--line); }
button:disabled { opacity: .4; cursor: default; }
input[type=search], input[type=text], input[type=password] {
  width: 100%; min-height: var(--tap); padding: 0 13px; font: inherit; font-size: 16px;
  color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
input:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 2px;
}
.search { display: flex; gap: 8px; margin-bottom: 12px; }
.search button { flex: none; }

/* 시·도가 18곳이라 줄바꿈하면 매장 목록이 화면 밖으로 밀립니다. 한 줄로 밀어 봅니다. */
.chips, .tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px;
                scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
.chips .chip, .tabs .chip { flex: none; white-space: nowrap; }
.chip {
  min-height: 34px; padding: 0 11px; font-size: 13px; font-weight: 450;
  color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
}
.chip[aria-pressed=true] { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.tabs { margin-bottom: 12px; }

.count { margin: 14px 0 2px; font-size: 13px; color: var(--dim); }
.foot { margin: 20px 0 0; font-size: 12px; color: var(--dim); text-align: center; }

/* 로그인 ------------------------------------------------------------------ */
.gate { max-width: 360px; margin: 12vh auto 0; text-align: center; }
.gate h1 { font-size: 26px; }
.gate .card { display: grid; gap: 12px; margin-top: 28px; text-align: left; }
.gate label { display: grid; gap: 5px; font-size: 13px; color: var(--dim); }
.gate button { margin-top: 4px; }
.error { min-height: 1.4em; margin: 0; font-size: 13px; color: var(--bad); text-align: center; }
.hint { margin-top: 20px; font-size: 13px; color: var(--dim); }

/* 매장 목록 --------------------------------------------------------------- */
.list, .items { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.list a { flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.list .name { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; font-weight: 600; }
.list .meta { margin-top: 2px; font-size: 13px; color: var(--dim); }
.list .go { flex: none; }
.dist { font-variant-numeric: tabular-nums; font-weight: 450; color: var(--dim); font-size: 13px; }
.tag { padding: 1px 6px; font-size: 11px; font-weight: 500; color: var(--dim);
       border: 1px solid var(--line); border-radius: 5px; }
.tag.on { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.tag.off { color: var(--bad); background: var(--bad-bg); border-color: transparent; }
.unpublished { margin: 0 0 14px; padding: 13px 15px; color: var(--bad);
               background: var(--bad-bg); border-radius: 10px; }
.unpublished p { margin: 6px 0 0; font-size: 13px; line-height: 1.55; }

/* 확인 시각 — HANDOFF 7.3: 크게 보여 주고 사용자가 직접 갱신합니다 --------- */
.checked {
  margin: 12px 0 16px; padding: 14px 15px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px;
}
.checked .when { font-size: 17px; font-weight: 650; letter-spacing: -0.02em; }
.checked .when.stale { color: var(--busy); }
.checked .what { margin-top: 3px; font-size: 13px; color: var(--dim); }
.checked .coverage-gap { margin: 10px 0 0; padding: 9px 11px; color: var(--busy);
                         background: var(--busy-bg); border-radius: 8px; font-size: 13px; }
.checked .row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.checked details { margin-top: 11px; font-size: 13px; }
.checked summary { color: var(--dim); cursor: pointer; }
.checked details p { margin: 6px 0 0; color: var(--dim); }

/* 매장 조회 진행과 자동 품번 보완 상태를 한 카드에서 보여 줍니다. */
.refresh { margin: 16px 0 12px; padding: 15px; border: 1px solid var(--line);
           border-radius: 12px; background: var(--panel); }
.refresh-head { display: flex; align-items: baseline; justify-content: space-between;
                flex-wrap: wrap; gap: 6px 12px; }
.refresh-head > strong { font-size: 16px; }
.refresh-help { margin: 8px 0 0; color: var(--dim); font-size: 13px; line-height: 1.5; }
.refresh-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.refresh-progress { display: grid; gap: 2px; margin-top: 12px; padding: 11px 12px;
                    border: 1px solid var(--line); border-radius: 9px; background: var(--bg); }
.refresh-progress-primary { font-size: 16px; line-height: 1.45; letter-spacing: -.015em;
                            font-variant-numeric: tabular-nums; }
.refresh-progress-secondary { color: var(--dim); font-size: 13px; line-height: 1.45;
                              font-variant-numeric: tabular-nums; }

/* 조회 대기열 ------------------------------------------------------------- */
.queue { margin: 0 0 18px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.queue-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
              padding: 11px 15px; background: var(--panel); border-bottom: 1px solid var(--line); }
.queue-title { font-weight: 600; font-size: 14px; }
.queue-row { display: flex; align-items: center; gap: 12px; padding: 12px 15px;
             border-top: 1px solid var(--line); }
.queue-row:first-of-type { border-top: 0; }
.queue-row.live { background: var(--busy-bg); }
.queue-no { flex: none; width: 22px; text-align: center; font-size: 13px; font-weight: 650;
            color: var(--dim); font-variant-numeric: tabular-nums; }
.queue-row.live .queue-no { color: var(--busy); }
.queue-body { flex: 1; min-width: 0; }
.queue-name { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; font-weight: 600; }
.queue-name a { color: inherit; text-decoration: none; }
.queue-when { margin-top: 3px; font-size: 13px; color: var(--dim); }
.queue-row .track { margin: 8px 0 6px; }

/* 조회 진행 --------------------------------------------------------------- */
.scan { margin: 16px 0; padding: 15px; border: 1px solid var(--line); border-radius: 12px; }
.scan.live { border-color: color-mix(in srgb, var(--busy) 40%, transparent); background: var(--busy-bg); }
.scan .head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.scan .title { font-weight: 600; }
.scan .pct { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--dim); }
.track { height: 7px; margin: 11px 0 9px; background: var(--line); border-radius: 99px; overflow: hidden; }
.fill { height: 100%; background: var(--busy); border-radius: 99px; transition: width .4s ease; }
.scan .note { font-size: 13px; color: var(--dim); }
.scan .row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* 품목 -------------------------------------------------------------------- */
.items li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line);
            content-visibility: auto; contain-intrinsic-size: auto 86px; }
.item-image { flex: none; width: 60px; height: 60px; object-fit: cover;
              background: var(--panel); border-radius: 8px; }
.item-image.placeholder { position: relative; border: 1px solid var(--line); }
.item-image.placeholder::before { content: ''; position: absolute; inset: 19px 16px;
                                  border: 2px solid var(--line); border-radius: 50% 50% 45% 45%; }
.items .body { flex: 1; min-width: 0; }
.items .name { font-weight: 550; }
.items .code { margin-top: 1px; font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
.items .line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-top: 5px; font-size: 13px; }
.items .price { font-weight: 600; font-variant-numeric: tabular-nums; }
.items .was { font-size: 12px; color: var(--dim); text-decoration: line-through;
              font-variant-numeric: tabular-nums; }
.items .off { padding: 1px 6px; font-size: 12px; font-weight: 600; color: var(--bad);
              background: var(--bad-bg); border-radius: 6px; }
.pickup { padding: 1px 7px; font-size: 12px; font-weight: 550; color: var(--ok);
          background: var(--ok-bg); border-radius: 6px; }
button.tiny { min-height: 30px; padding: 0 10px; font-size: 12px; font-weight: 450; border-radius: 8px; }
.items .load-more { display: block; padding: 18px 0; text-align: center; content-visibility: visible; }
.load-more button { width: 100%; }

.empty { margin: 28px 0; padding: 22px; font-size: 14px; color: var(--dim); text-align: center;
         background: var(--panel); border-radius: 12px; }

/* 무엇이 잘못됐는지 화면에 적습니다. 하얗게 비는 것보다 낫습니다. */
.fatal { margin: 24px 0; padding: 20px; background: var(--bad-bg); border-radius: 12px;
         color: var(--bad); }
.fatal-title { font-size: 17px; font-weight: 650; margin-bottom: 8px; }
.fatal p { margin: 0 0 14px; font-size: 14px; line-height: 1.55; }
.fatal button { color: var(--bg); background: var(--ink); }
.fatal-env { margin: 14px 0 0 !important; font-size: 11px; opacity: .65; }

.back { display: inline-block; margin-bottom: 14px; font-size: 13px; color: var(--dim); text-decoration: none; }

@media (min-width: 640px) {
  main { padding: 24px 16px 64px; }
  h1 { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) {
  .fill { transition: none; }
}
