/* 우카비 웹앱 — 흰 배경, 얇은 회색 선, 로고의 파란색과 노란 반짝임 */
:root {
  --bg: #ffffff;
  --soft: #f7f8fa;
  --ink: #111111;
  --muted: #737373;
  --line: #e3e5e8;
  --accent: #0a84ff;
  --accent-ink: #0660d6;
  --accent-soft: #eaf4ff;
  --spark: #ffc800;
  --spark-soft: #fff8db;
  --grad: linear-gradient(135deg, #3fb0ff 0%, #0a84ff 55%, #0a63e0 100%);
  --ok: #1a7f45; --ok-soft: #e6f5ec;
  --warn: #9a6400; --warn-soft: #fcf2dc;
  --bad: #d12b2b; --bad-soft: #fdeaea;
  --info: #2f5bb7; --info-soft: #e9effb;
  --grey-soft: #f0f1f3;
  --font: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --tabbar: 64px;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.55; letter-spacing: -0.01em; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent-ink); }

.boot { min-height: 100%; display: grid; place-items: center; }
.boot img { border-radius: 18px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .boot img { animation: none; } }

/* 공통 레이아웃 */
.shell { max-width: 560px; margin: 0 auto; min-height: 100%; padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 16px); }
.topbar { position: sticky; top: 0; z-index: 5; background: rgba(255,255,255,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: calc(10px + env(safe-area-inset-top)) 16px 10px; display: flex; align-items: center; gap: 10px; }
.topbar img { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); }
.wordmark { font-weight: 800; font-size: 21px; letter-spacing: -0.055em; color: var(--accent); }
.wordmark i { font-style: normal; color: var(--spark); }
.topbar .store { font-size: 12.5px; color: var(--muted); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.usage-pill { font-size: 12.5px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); border: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
.usage-pill.low { background: var(--spark-soft); color: var(--warn); }
.usage-pill.pro { background: var(--grad); color: #fff; }
main { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
h2.page { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; margin: 4px 0 0; }
.page-sub { color: var(--muted); font-size: 13.5px; margin: -8px 0 0; }

.card { background: var(--bg); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card h3 { margin: 0; font-size: 16px; font-weight: 700; }
.card .sub { margin: -6px 0 0; font-size: 13px; color: var(--muted); }
.card.hero { background: var(--accent-soft); border-color: transparent; }
.card.hero h3 { color: var(--accent-ink); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.btn { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 14px; font-size: 14.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn { white-space: nowrap; flex: none; }
.btn.block { width: 100%; padding: 13px; font-size: 15.5px; }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 10px; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .55; cursor: default; }
.link-btn { border: 0; background: none; color: var(--accent-ink); font-weight: 600; padding: 0; }

.inp, textarea.inp, select.inp { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--soft); font-size: 15px; }
.inp:focus { background: #fff; border-color: #a9b0b8; outline: none; }
.inp:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
textarea.inp { resize: vertical; min-height: 70px; }
label.lbl, .lbl { font-size: 12.5px; font-weight: 700; color: var(--muted); display: block; margin-bottom: 4px; }

/* 칩·태그 */
.chip { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.c-inquiry { background: var(--ok-soft); color: var(--ok); }
.c-reservation { background: var(--info-soft); color: var(--info); }
.c-personal, .c-unclear, .c-attachment { background: var(--grey-soft); color: var(--muted); }
.c-complaint { background: var(--bad-soft); color: var(--bad); }
.c-partnership, .c-rule, .c-quota { background: var(--warn-soft); color: var(--warn); }
.c-spam { background: var(--grey-soft); color: var(--muted); text-decoration: line-through; }
.act { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; border: 1px solid currentColor; white-space: nowrap; }
.a-sent { color: var(--ok); } .a-draft { color: var(--info); } .a-handoff { color: var(--bad); } .a-ignore, .a-rule { color: var(--muted); }
.samples { display: flex; flex-wrap: wrap; gap: 6px; }
.sample { border: 1px solid var(--line); background: var(--soft); border-radius: 999px; padding: 6px 11px; font-size: 13px; }

/* 알림함 */
.inbox-item { border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 14px; padding: 13px 14px; display: flex; flex-direction: column; gap: 9px; }
.inbox-item.urgent { border-left-color: var(--bad); }
.inbox-item.draft, .inbox-item.reservation { border-left-color: var(--info); }
.inbox-item.unknown, .inbox-item.quota { border-left-color: var(--spark); }
.inbox-item h4 { margin: 0; font-size: 14.5px; }
.inbox-item .from { font-size: 12.5px; color: var(--muted); }
.quote { margin: 0; padding: 8px 12px; background: var(--soft); border-radius: 12px; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.empty { text-align: center; padding: 26px 12px; color: var(--muted); font-size: 14px; }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* 테스트 결과 */
.result { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--soft); display: flex; flex-direction: column; gap: 8px; }
.result .reason { margin: 0; font-size: 14px; }
.steps { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); }
.source { font-size: 11.5px; color: var(--muted); }

/* 대화 */
.contact { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; }
.avatar { width: 44px; height: 44px; border-radius: 50%; padding: 2px; background: var(--line); flex: none; }
.avatar span { width: 100%; height: 100%; border-radius: 50%; background: var(--grey-soft); border: 2px solid #fff; display: grid; place-items: center; font-weight: 800; color: var(--ink); }
.avatar.live { background: var(--grad); }
.contact .name { font-weight: 700; }
.contact .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.contact .grow { flex: 1; min-width: 0; }
.chat { display: flex; flex-direction: column; gap: 6px; padding: 4px 0 8px; }
.bubble { max-width: 80%; padding: 9px 14px; border-radius: 20px; white-space: pre-wrap; word-break: break-word; font-size: 15px; }
.bubble.in { align-self: flex-start; background: #efefef; }
.bubble.ai { align-self: flex-end; background: var(--grad); color: #fff; }
.bubble.owner { align-self: flex-end; background: #1f2328; color: #fff; }
.bubble-label { font-size: 11px; color: var(--muted); align-self: flex-end; margin: -2px 6px 4px; }
.composer { position: sticky; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); background: #fff; padding: 8px 0; display: flex; gap: 8px; }
.composer .inp { border-radius: 999px; }

/* 가게 정보 폼 */
.time-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.time-grid label:last-child { grid-column: 1 / -1; }
.time-grid .inp { padding: 9px 6px; font-size: 14px; min-width: 0; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.day { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 0; font-weight: 700; }
.day[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 13px; font-size: 14px; font-weight: 600; }
.pill[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.menu-item { display: grid; grid-template-columns: minmax(0, 1fr) 92px 34px; gap: 6px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.menu-item .note { grid-column: 1 / 3; font-size: 13.5px; padding: 7px 10px; }
.x { border: 0; background: none; color: var(--muted); font-size: 20px; border-radius: 10px; }
.add { border: 1px dashed #c4c9cf; background: #fff; border-radius: 12px; padding: 10px; font-weight: 700; color: var(--accent-ink); }
.amen { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.amen button { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px; display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 14px; text-align: left; }
.amen .st { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--grey-soft); color: var(--muted); white-space: nowrap; }
.amen button[data-v="yes"] { border-color: #9fd3b4; } .amen button[data-v="yes"] .st { background: var(--ok-soft); color: var(--ok); }
.amen button[data-v="no"] { border-color: #f0b2b2; } .amen button[data-v="no"] .st { background: var(--bad-soft); color: var(--bad); }
.faq-item { background: var(--soft); border-radius: 12px; padding: 10px; display: grid; grid-template-columns: 1fr 34px; gap: 6px; }
.faq-item .inp { background: #fff; grid-column: 1; }
.faq-item .x { grid-row: 1; grid-column: 2; }
.save-bar { position: sticky; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 8px); z-index: 3; }
.save-bar .btn { box-shadow: 0 6px 18px rgba(10,132,255,.25); }

/* 설정 */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 10px 4px; font-weight: 600; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.bar { height: 8px; border-radius: 4px; background: var(--grey-soft); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--grad); }
.price { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.price small { font-size: 14px; font-weight: 600; color: var(--muted); }
.pay-box { background: var(--soft); border-radius: 12px; padding: 12px; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.pay-box .acc { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.list-link { display: flex; justify-content: space-between; padding: 12px 2px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.list-link:last-child { border-bottom: 0; }

/* 배너 (무료 사용자 전용) */
.banner { border-radius: 14px; overflow: hidden; min-height: 50px; display: flex; justify-content: center; }
.banner.house { background: var(--grad); color: #fff; padding: 12px 14px; justify-content: space-between; align-items: center; gap: 10px; border: 0; width: 100%; text-align: left; }
.banner.house b { font-size: 14.5px; }
.banner.house span { font-size: 12.5px; opacity: .9; display: block; }
.ad-label { font-size: 10.5px; color: var(--muted); text-align: center; margin-top: -8px; }

/* 하단 탭 */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar nav { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); height: var(--tabbar); }
.tabbar button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11.5px; font-weight: 600; color: var(--muted); position: relative; }
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button[aria-current="page"] { color: var(--accent); }
.tabbar .badge { position: absolute; top: 8px; left: calc(50% + 6px); background: var(--bad); color: #fff; font-size: 10.5px; border-radius: 999px; padding: 0 5px; min-width: 17px; text-align: center; }

/* 로그인 */
.auth { min-height: 100%; display: flex; flex-direction: column; justify-content: center; max-width: 420px; margin: 0 auto; padding: 32px 20px; gap: 22px; }
.auth .hero-logo { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.auth .hero-logo img { width: 84px; height: 84px; border-radius: 22px; border: 1px solid var(--line); }
.auth .hero-logo .wordmark { font-size: 34px; }
.auth .hero-logo p { margin: 0; color: var(--muted); }
.auth form { display: flex; flex-direction: column; gap: 12px; }
.auth .switch { text-align: center; font-size: 14px; color: var(--muted); }
.error { color: var(--bad); font-size: 13.5px; margin: 0; }

#toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 14px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
