/* ============================================================
   Perkly — Design System
   Warm "neighborhood / artisanal" aesthetic.
   Cream paper base · espresso ink · coral-tangerine accent.
   ============================================================ */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css');
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400..900;1,9..144,400..700&display=swap');

:root {
  /* color */
  --bg: #E9EAEC;            /* canvas behind the app (desktop) */
  --paper: #FFFFFF;         /* app background */
  --surface: #FFFFFF;
  --surface-sunk: #F4F5F7;
  --ink: #221A14;
  --ink-2: #5E5147;
  --muted: #978777;
  --line: #ECECEF;
  --line-2: #E0E0E5;

  --accent: #FF5A36;        /* perkly coral */
  --accent-deep: #C7370F;
  --accent-soft: #FFE9E2;

  --green: #1E8C5B;
  --green-soft: #DEF3E7;
  --gold: #E0A22B;
  --gold-soft: #FBEFD2;
  --berry: #B0356B;

  /* type */
  --display: 'Fraunces', 'Pretendard', serif;
  --sans: 'Pretendard', -apple-system, system-ui, sans-serif;

  /* shape */
  --r-sm: 12px;
  --r: 18px;
  --r-lg: 26px;
  --shadow-sm: 0 2px 10px rgba(60, 40, 20, .06);
  --shadow: 0 10px 30px -8px rgba(70, 45, 20, .14);
  --shadow-lg: 0 24px 60px -18px rgba(70, 45, 20, .28);

  /* layout */
  --app-w: 460px;
  --nav-h: 70px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  letter-spacing: -0.01em;
}

/* ---------- App shell (the "phone") ---------- */
.app {
  width: 100%;
  max-width: var(--app-w);
  min-height: 100vh;
  background: var(--paper);
  position: relative;
  overflow-x: hidden;
  box-shadow: var(--shadow-lg);
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 14px);
}
@media (min-width: 480px) {
  /* PC: drop the phone-mockup framing — clean centered white page */
  body { background: var(--paper); align-items: flex-start; }
  .app { box-shadow: none; min-height: 100vh; }
  .tabbar { box-shadow: none; }
}

/* ---------- Header component ---------- */
.appbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  padding: 6px 18px 12px;
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.appbar.flat { background: var(--paper); }
.appbar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }

.loc { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; cursor: pointer; color: var(--ink); }
.loc .pin { color: var(--accent); display: grid; place-items: center; }
.loc .loc-txt { text-align: left; line-height: 1.05; }
.loc .loc-txt small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.loc .loc-txt b { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; display: inline-flex; align-items: center; gap: 4px; }
.loc .loc-txt b .loc-chev { color: var(--muted); margin-top: 1px; }

.appbar h1 { font-family: var(--display); font-weight: 600; font-size: 22px; letter-spacing: -0.02em; }
.appbar .back { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink); }

.icon-btn {
  width: 42px; height: 42px; border-radius: 13px; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink);
  position: relative; transition: transform .12s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.avatar-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer; overflow: hidden; background: var(--accent); display: grid; place-items: center; color: #fff; font-weight: 800; }

.wordmark { font-family: var(--display); font-weight: 600; letter-spacing: -0.03em; }
.wordmark .k { color: var(--accent); }

/* ---------- Content scaffolding ---------- */
.screen { padding: 0 18px; }
.section { margin-top: 26px; animation: rise .5s both; }
.section:nth-of-type(2) { animation-delay: .05s; }
.section:nth-of-type(3) { animation-delay: .1s; }
.section:nth-of-type(4) { animation-delay: .15s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 13px; padding: 0 2px; }
.sec-head h2 { font-size: 18.5px; font-weight: 800; letter-spacing: -0.02em; }
.sec-head h2 .emoji { font-weight: 400; }
.sec-head a { font-size: 13px; color: var(--muted); font-weight: 700; text-decoration: none; }
.sort-btn { font-size: 13px; color: var(--ink-2); font-weight: 800; background: none; border: 0; cursor: pointer; font-family: var(--sans); padding: 0; }
.sort-btn:active { opacity: .6; }

/* ---------- Search ---------- */
.search {
  display: flex; align-items: center; gap: 10px; margin-top: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 13px 15px; color: var(--muted); cursor: text; box-shadow: var(--shadow-sm);
}
.search svg { color: var(--muted); flex: none; }
.search span { font-size: 15px; font-weight: 500; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 15px; font-weight: 500; font-family: var(--sans); color: var(--ink); }
.search input::placeholder { color: var(--muted); }

/* ---------- Category chips ---------- */
.chips { display: flex; gap: 9px; overflow-x: auto; padding: 4px 18px 4px; margin: 14px -18px 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
  font-size: 14px; font-weight: 700; color: var(--ink-2); cursor: pointer;
  white-space: nowrap; transition: transform .12s, background .15s;
}
.chip .ce { font-size: 16px; }
.chip svg { width: 18px; height: 18px; flex: none; }
.chip:active { transform: scale(.95); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Horizontal scroll rail ---------- */
.rail { display: flex; gap: 14px; overflow-x: auto; padding: 2px 18px 6px 26px; margin: 0 -18px; scrollbar-width: none; scroll-snap-type: x mandatory; scroll-padding-left: 26px; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }

/* ---------- Markdown / closing-deal card ---------- */
.deal-card {
  flex: none; width: 230px; border-radius: var(--r); overflow: hidden; background: var(--surface);
  box-shadow: var(--shadow); border: 1px solid var(--line); position: relative; cursor: pointer;
  transition: transform .15s;
}
.deal-card:active { transform: scale(.97); }
.deal-card .ph { height: 132px; position: relative; background: var(--surface-sunk); }
.deal-card .ph img { width: 100%; height: 100%; object-fit: cover; }
.deal-card .ph::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.45)); }
.timer {
  position: absolute; top: 10px; left: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 5px;
  background: rgba(20,12,8,.62); backdrop-filter: blur(4px); color: #fff; font-size: 12px; font-weight: 800;
  padding: 5px 9px; border-radius: 999px; letter-spacing: .01em;
}
.timer .pulse { width: 7px; height: 7px; border-radius: 50%; background: #FF5A36; box-shadow: 0 0 0 0 rgba(255,90,54,.7); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(255,90,54,0); } 100% { box-shadow: 0 0 0 0 rgba(255,90,54,0); } }
.deal-card .pct { position: absolute; bottom: 10px; left: 12px; z-index: 2; color: #fff; font-family: var(--display); font-weight: 600; font-size: 30px; line-height: 1; }
.deal-card .body { padding: 11px 13px 13px; }
.deal-card .body h3 { font-size: 14.5px; font-weight: 800; }
.deal-card .body .shop { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.deal-card .body .price { margin-top: 9px; display: flex; align-items: baseline; gap: 7px; }
.deal-card .body .price b { font-size: 16px; font-weight: 800; color: var(--accent-deep); }
.deal-card .body .price s { font-size: 12.5px; color: var(--muted); }

/* ---------- Shop list card ---------- */
.shop-list { display: flex; flex-direction: column; gap: 13px; margin-top: 4px; }
.shop-card {
  display: flex; gap: 13px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px; box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .14s;
  position: relative; text-decoration: none; color: inherit;
}
.shop-card:active { transform: scale(.98); }
.shop-card .thumb { width: 88px; height: 88px; border-radius: 14px; overflow: hidden; flex: none; background: var(--surface-sunk); position: relative; }
.shop-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.shop-card .info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.shop-card .cat { font-size: 11.5px; font-weight: 800; color: var(--accent-deep); letter-spacing: .02em; }
.shop-card .name { font-size: 16px; font-weight: 800; margin-top: 1px; }
.shop-card .meta { display: flex; align-items: center; gap: 9px; margin-top: 5px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.shop-card .meta span { display: inline-flex; align-items: center; gap: 3px; }
.shop-card .meta svg { width: 13px; height: 13px; }
.shop-card .meta .star { color: var(--gold); }
.shop-card .meta .dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--line-2); }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800; padding: 4px 8px; border-radius: 7px; white-space: nowrap; }
.badge.deal { background: var(--accent-soft); color: var(--accent-deep); }
.badge.open { background: var(--green-soft); color: var(--green); }
.badge.close { background: #FBE3DC; color: var(--accent-deep); }
.badge.new { background: var(--gold-soft); color: #9A6B12; }

/* mini stamp progress on a shop card */
.mini-stamps { margin-top: auto; padding-top: 9px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 7px; }
.mini-track { flex: 1; height: 7px; border-radius: 999px; background: var(--surface-sunk); overflow: hidden; }
.mini-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #FF8A52); }
.mini-stamps small { font-size: 11.5px; font-weight: 800; color: var(--ink-2); }

/* ---------- Deals board (알림판) ---------- */
.post {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-sm); margin-top: 11px; overflow: hidden;
}
.post-top { display: flex; align-items: center; gap: 10px; padding: 11px 13px 9px; }
.post-top .av { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; flex: none; }
.post-top .av svg { width: 19px; height: 19px; }
.post-top .who { flex: 1; min-width: 0; }
.post-top .who b { font-size: 13.5px; font-weight: 800; }
.post-top .who small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 1px; }
.post-img { width: 100%; height: 150px; object-fit: cover; background: var(--surface-sunk); }
.post-body { padding: 11px 13px 13px; }
.post-body .tags { display: flex; gap: 6px; margin-bottom: 7px; flex-wrap: wrap; }
.post-body h3 { font-size: 14.5px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.3; }
.post-body p { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; margin-top: 5px; }
.post-foot { display: flex; align-items: center; gap: 16px; padding: 9px 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 700; }
.post-foot span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Shop detail ---------- */
.hero { position: relative; height: 248px; margin: 0 -18px; }
.hero img { width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.25) 0%, transparent 30%, transparent 60%, rgba(20,12,8,.55)); }
.hero-meta { position: absolute; left: 18px; right: 18px; bottom: 16px; color: #fff; z-index: 2; }
.hero-meta .cat { font-size: 12.5px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; opacity: .92; }
.hero-meta h1 { font-family: var(--display); font-weight: 600; font-size: 30px; letter-spacing: -0.02em; margin-top: 2px; }
.hero-meta .row { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; font-weight: 700; }
.hero-meta .row span { display: inline-flex; align-items: center; gap: 3px; }
.hero-meta .row svg { width: 13px; height: 13px; }
.hero-meta .row .star { color: #FFCB5B; }

.quick-row { display: flex; gap: 10px; margin-top: 18px; }
.quick {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 13px 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 15px; cursor: pointer;
  font-size: 12.5px; font-weight: 700; color: var(--ink-2); transition: transform .12s;
}
.quick:active { transform: scale(.95); }
.quick svg { color: var(--accent); }

/* loyalty coupon / ticket card — white */
.loyalty {
  position: relative; margin-top: 22px; border-radius: var(--r-lg); overflow: hidden; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px -14px rgba(60,40,20,.18);
}
.loyalty::before { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 80% at 100% 0%, rgba(255,90,54,.06), transparent 55%); }

.loyalty-head { position: relative; display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 19px 18px 16px; }
.loyalty-head > div:first-child { min-width: 0; }
.lh-cat { font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--accent-deep); }
.loyalty-head h3 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; margin-top: 5px; color: var(--ink); }
.loyalty-head p { font-size: 12.5px; color: var(--ink-2); margin-top: 5px; }
.lh-badge { flex: none; width: 60px; height: 60px; border-radius: 50%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; line-height: 1; color: #fff;
  background: linear-gradient(135deg, #FF6B45, #FF8A52); box-shadow: 0 8px 16px -5px rgba(255,90,54,.55); }
.lh-badge b { font-family: var(--display); font-weight: 600; font-size: 24px; }
.lh-badge small { font-size: 10.5px; opacity: .9; margin-top: 2px; }

/* perforated divider (notches hidden on white card) */
.perf { position: relative; height: 0; margin: 0 18px; border-top: 2px dashed var(--line-2); }
.perf .notch { display: none; }

.stamps { position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); justify-items: center; gap: 10px 6px; padding: 16px 14px 4px; }
.stamp { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; align-self: center; }
.stamp svg { width: 18px; height: 18px; }
.stamp.empty { background: #FFEDE6; color: #F4B7A0; padding: 0; } /* padding:0 stops the global .empty rule from stretching it */
.stamp.filled { background: var(--accent); color: #fff; box-shadow: 0 5px 13px rgba(255,90,54,.4); animation: stamppop .4s both; }
.stamp.reward { background: linear-gradient(135deg, #F5BE4D, #E0A22B); color: #fff; box-shadow: 0 5px 13px rgba(224,162,43,.45); }
@keyframes stamppop { 0% { transform: scale(0); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }

.loyalty-foot { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 18px 18px; }
.loyalty-foot .lf-bar { flex: 1; height: 7px; border-radius: 999px; background: #FAD5C6; overflow: hidden; }
.loyalty-foot .lf-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #FF8A52); }
.loyalty-foot small { font-size: 12px; font-weight: 800; color: var(--accent-deep); white-space: nowrap; }

/* login-gate banner */
.gate {
  margin-top: 16px; display: flex; align-items: center; gap: 13px; padding: 15px 16px;
  background: var(--accent-soft); border: 1px solid #FAD7CB; border-radius: var(--r);
}
.gate .g-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.gate .g-txt { flex: 1; }
.gate .g-txt b { font-size: 14px; font-weight: 800; }
.gate .g-txt small { display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 1px; }

/* info rows */
.info-list { margin-top: 10px; }
.info-row { display: flex; gap: 13px; padding: 13px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.info-row:last-child { border-bottom: 0; }
.info-row svg { color: var(--muted); flex: none; margin-top: 1px; }
.info-row b { font-weight: 700; }
.info-row .sub { color: var(--muted); font-size: 12.5px; }

/* ---------- Cards page (내 적립) ---------- */
.stamp-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 15px; box-shadow: var(--shadow-sm); margin-top: 13px; display: flex; gap: 14px; align-items: center;
}
.ring { --p: 70; width: 64px; height: 64px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-sunk) 0); position: relative; }
.ring::after { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.ring b { position: relative; z-index: 1; font-size: 14px; font-weight: 800; }
.ring.ready { background: conic-gradient(var(--gold) 100%, var(--gold) 0); }
.ring.ready b { font-size: 22px; }
.stamp-card .sc-info { flex: 1; }
.stamp-card .sc-info .cat { font-size: 11.5px; font-weight: 800; color: var(--accent-deep); }
.stamp-card .sc-info b { display: block; font-size: 16px; font-weight: 800; margin-top: 1px; }
.stamp-card .sc-info small { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.reward-pill { font-size: 12px; font-weight: 800; color: #9A6B12; background: var(--gold-soft); padding: 6px 10px; border-radius: 9px; }

/* ---------- Auth pages ---------- */
.auth { padding: 30px 26px 40px; min-height: 100vh; display: flex; flex-direction: column; }
.auth-logo { font-family: var(--display); font-weight: 600; font-size: 42px; letter-spacing: -0.03em; text-align: center; margin-top: 26px; }
.auth-logo .k { color: var(--accent); }
.auth-tag { text-align: center; color: var(--muted); font-size: 14px; font-weight: 500; margin-top: 6px; }

.seg { display: flex; background: var(--surface-sunk); border-radius: 14px; padding: 5px; margin-top: 34px; gap: 4px; }
.seg button { flex: 1; border: 0; background: none; padding: 10px 4px; border-radius: 10px; font-size: 13.5px; font-weight: 800; color: var(--muted); cursor: pointer; font-family: var(--sans); transition: .15s; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.field { margin-top: 14px; }
.field label { font-size: 13px; font-weight: 700; color: var(--ink-2); margin-left: 3px; }
.field input { width: 100%; margin-top: 6px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); font-size: 15px; font-family: var(--sans); color: var(--ink); }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.btn { width: 100%; padding: 15px; border-radius: 14px; border: 0; font-size: 15.5px; font-weight: 800; cursor: pointer; font-family: var(--sans); transition: transform .12s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 8px 20px -6px rgba(255,90,54,.5); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-google { background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); display: flex; align-items: center; justify-content: center; gap: 10px; box-shadow: var(--shadow-sm); }

.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.auth-foot { margin-top: auto; padding-top: 24px; text-align: center; font-size: 13.5px; color: var(--muted); }
.auth-foot a { color: var(--accent-deep); font-weight: 800; text-decoration: none; }
.ghost-link { display: block; text-align: center; margin-top: 16px; color: var(--ink-2); font-size: 13.5px; font-weight: 700; text-decoration: none; }

/* role choose cards (signup) */
.role-grid { display: grid; gap: 13px; margin-top: 26px; }
.role-c { display: flex; gap: 14px; align-items: center; padding: 17px; border-radius: var(--r); border: 1.5px solid var(--line-2); background: var(--surface); cursor: pointer; transition: .15s; }
.role-c.on { border-color: var(--accent); background: var(--accent-soft); }
.role-c .ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: var(--surface-sunk); flex: none; }
.role-c.on .ic { background: #fff; }
.role-c b { font-size: 15.5px; font-weight: 800; }
.role-c small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- Business / Admin dashboard ---------- */
.dash-head { padding: 4px 18px 0; }
.store-hdr { display: flex; gap: 13px; align-items: center; margin-top: 8px; }
.store-hdr .logo { width: 56px; height: 56px; border-radius: 16px; overflow: hidden; flex: none; background: var(--surface-sunk); }
.store-hdr .logo img { width: 100%; height: 100%; object-fit: cover; }
.store-hdr h2 { font-size: 19px; font-weight: 800; }
.store-hdr small { color: var(--muted); font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 15px 16px; box-shadow: var(--shadow-sm);
}
.stat .lab { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.stat .val { font-family: var(--sans); font-weight: 800; font-size: 27px; letter-spacing: -0.03em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 12px; font-weight: 800; margin-top: 3px; }
.stat .delta.up { color: var(--green); }
.stat .delta.down { color: var(--accent-deep); }
.stat.feature { grid-column: 1 / -1; background: linear-gradient(135deg, var(--ink) 0%, #3A2A1E 100%); color: #fff; border: 0; }
.stat.feature .lab { color: rgba(255,255,255,.7); }

.action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.act { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; cursor: pointer; transition: transform .12s; text-decoration: none; color: inherit; }
.act:active { transform: scale(.94); }
.act .ai { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.act span { font-size: 11.5px; font-weight: 700; color: var(--ink-2); }

.list-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .lav { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; font-size: 15px; }
.list-row .ld { flex: 1; min-width: 0; }
.list-row .ld b { font-size: 14.5px; font-weight: 800; }
.list-row .ld small { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.list-row .lr { font-size: 12.5px; font-weight: 800; color: var(--ink-2); text-align: right; }
.list-row .lr small { display: block; color: var(--muted); font-weight: 600; }

.card-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 16px; box-shadow: var(--shadow-sm); margin-top: 13px; }

.sub-card { margin-top: 16px; border-radius: var(--r); padding: 18px; background: linear-gradient(135deg, #FF6B45, #FF8A52); color: #fff; box-shadow: 0 12px 26px -10px rgba(255,90,54,.55); }
.sub-card .pln { font-size: 13px; font-weight: 700; opacity: .9; }
.sub-card .amt { font-family: var(--display); font-weight: 600; font-size: 30px; margin-top: 2px; }
.sub-card .amt small { font-size: 14px; opacity: .85; }
.sub-card .nx { font-size: 12.5px; opacity: .9; margin-top: 8px; }
.sub-card .manage { margin-top: 13px; width: 100%; padding: 11px; border-radius: 11px; border: 0; background: rgba(255,255,255,.22); color: #fff; font-weight: 800; font-size: 13.5px; cursor: pointer; }

/* ---------- Bottom tab bar component ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 70;
  width: 100%; max-width: var(--app-w);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(1.5) blur(18px); -webkit-backdrop-filter: saturate(1.5) blur(18px);
  border-top: 1px solid var(--line);
  display: flex; padding: 9px 8px calc(9px + var(--safe-b));
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 5px 0; background: none; border: 0; cursor: pointer; color: var(--muted); text-decoration: none; transition: color .15s; }
.tab span { font-size: 10.5px; font-weight: 700; }
.tab.on { color: var(--accent); }
.tab .ti { position: relative; }
.tab .ti .ndot { position: absolute; top: -2px; right: -4px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); border: 1.5px solid var(--surface); }

/* center FAB-style tab (for business "올리기") */
.tab.fab { position: relative; }
.tab.fab .ti { width: 50px; height: 50px; border-radius: 16px; background: var(--accent); color: #fff; display: grid; place-items: center; margin-top: -16px; box-shadow: 0 8px 18px -4px rgba(255,90,54,.6); }

/* ---------- auth state visibility (set by /js/auth.js on <html>) ---------- */
.perkly-guest .auth-only { display: none !important; }
.perkly-auth .guest-only { display: none !important; }

/* ---------- misc ---------- */
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.spacer { height: 8px; }
.hint { font-size: 12px; color: var(--muted); text-align: center; margin-top: 14px; font-weight: 500; }
.empty { text-align: center; color: var(--muted); font-size: 13.5px; font-weight: 600; padding: 34px 12px; }

/* ---------- Notification sheet ---------- */
.sheet-ov { position: fixed; inset: 0; background: rgba(20,12,8,.42); z-index: 90; opacity: 0; pointer-events: none; transition: opacity .25s; }
.sheet-ov.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.96);
  width: calc(100% - 36px); max-width: 420px; z-index: 91; background: var(--surface);
  border-radius: 22px; box-shadow: 0 24px 64px rgba(40,25,10,.30);
  padding: 14px 18px calc(18px + var(--safe-b)); max-height: 80vh; overflow-y: auto;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .22s, transform .24s cubic-bezier(.32,.72,.3,1), visibility .22s;
}
.sheet.on { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.sheet-grab { display: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px 8px; }
.sheet-head h3 { font-size: 18px; font-weight: 800; }
.sheet-x { border: 0; background: var(--surface-sunk); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; color: var(--ink-2); font-size: 13px; line-height: 1; }
.notif-item { display: flex; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--line); position: relative; }
.notif-item:last-child { border-bottom: 0; }
.notif-item .ni-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.notif-item .ni-ic svg { width: 21px; height: 21px; }
.ni-tx { flex: 1; min-width: 0; }
.ni-tx b { font-size: 14px; font-weight: 800; }
.ni-tx p { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; line-height: 1.45; }
.ni-tx small { font-size: 11px; color: var(--muted); font-weight: 600; display: block; margin-top: 4px; }
.notif-item.unread::after { content: ''; position: absolute; top: 17px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.push-cta { width: 100%; margin-top: 16px; padding: 14px; border-radius: 14px; border: 0; background: var(--accent); color: #fff; font-weight: 800; font-size: 14.5px; cursor: pointer; font-family: var(--sans); transition: transform .12s; }
.push-cta:active { transform: scale(.98); }
.push-cta.on { background: var(--green-soft); color: var(--green); }
.push-note { font-size: 11.5px; color: var(--muted); text-align: center; margin-top: 10px; font-weight: 500; }
.location-banner { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 12px; padding: 11px 14px; background: var(--green-soft); border: 0; border-radius: 13px; font-size: 12.5px; font-weight: 700; color: var(--green); font-family: var(--sans); text-align: left; cursor: pointer; transition: transform .12s; }
.location-banner:active { transform: scale(.99); }
.location-banner svg { flex: none; }

/* ===================================================================
   Wide desktop: bottom tab bar -> left sidebar + roomy content.
   Placed at end of file so it overrides the base component styles above.
   =================================================================== */
@media (min-width: 1140px) {
  body { align-items: flex-start; }
  .app {
    max-width: 1120px; margin: 0 auto;
    padding-left: 252px; padding-right: 12px; padding-bottom: 40px;
  }

  /* fixed left sidebar, pinned to the app's left edge */
  .tabbar {
    left: calc(50% - 560px); transform: none; bottom: auto; top: 0;
    width: 252px; max-width: 252px; height: 100vh;
    flex-direction: column; justify-content: flex-start; gap: 5px;
    border-top: 0; border-right: 1px solid var(--line);
    padding: 26px 16px; background: var(--paper);
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .tabbar::before {
    content: "Perkly"; font-family: var(--display); font-weight: 600; font-size: 25px;
    letter-spacing: -0.03em; color: var(--ink); padding: 4px 14px 20px;
  }
  .tab { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 14px; padding: 12px 14px; border-radius: 13px; }
  .tab span { font-size: 14.5px; }
  .tab.on { background: var(--accent-soft); }
  .tab .ti .ndot { right: -3px; }
  .tab.fab { order: 9; margin-top: 4px; }
  .tab.fab .ti { width: 100%; height: auto; border-radius: 13px; padding: 11px 0; margin-top: 0; }

  /* roomier content */
  .appbar { padding-left: 28px; padding-right: 28px; }
  .screen { padding: 0 28px; max-width: 900px; }
  .auth { max-width: 460px; margin: 0 auto; }
  .dash-head { padding-left: 28px; padding-right: 28px; }

  /* let lists use the width */
  .shop-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .stat.feature { grid-column: 1 / -1; }
  .hero { margin: 0 -28px; border-radius: 0; }

  /* deals feed: narrow centered column so chips + posts stay aligned */
  .screen.feed { max-width: 580px; margin-left: auto; margin-right: auto; }
  .feed .post-img { height: 190px; }
}

/* ===================================================================
   Business console — page headers, two-column layout, full-width PC.
   =================================================================== */
.biz-page-head { padding: 26px 18px 2px; }
.biz-page-head .crumb { font-size: 12.5px; font-weight: 800; color: var(--muted); }
.biz-page-head h1 { font-family: var(--display); font-weight: 600; font-size: 26px; letter-spacing: -0.02em; margin-top: 2px; }
.biz-page-head p { font-size: 13px; color: var(--ink-2); margin-top: 3px; }

.biz-cols { display: grid; gap: 16px; margin-top: 18px; align-items: start; }
.biz-block { margin-top: 0; }
.biz-block + .biz-block { margin-top: 18px; }

/* section card used across console pages */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); padding: 16px; }
.panel + .panel { margin-top: 14px; }
.panel-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-h h2 { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.panel-h a, .panel-h button { font-size: 12.5px; font-weight: 800; color: var(--accent-deep); background: none; border: 0; cursor: pointer; text-decoration: none; font-family: var(--sans); }

/* simple seg filter (reuse) on console list pages */
.biz-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0; margin-top: 2px; scrollbar-width: none; }
.biz-chips::-webkit-scrollbar { display: none; }

@media (min-width: 1140px) {
  /* business console uses the full viewport width (sidebar + fluid content) */
  body.biz .app { max-width: none; margin: 0; padding-left: 252px; padding-right: 40px; }
  body.biz .tabbar { left: 0; }
  body.biz .screen, body.biz .dash-head, body.biz .biz-page-head { max-width: none; padding-left: 36px; padding-right: 36px; }
  body.biz .stat-grid { grid-template-columns: repeat(4, 1fr); }
  body.biz .action-grid { max-width: 760px; }

  /* dashboard / list pages: roomy two-column split */
  .biz-cols { grid-template-columns: 1.6fr 1fr; gap: 22px; }
  .biz-cols.even { grid-template-columns: 1fr 1fr; }
}

/* ---------- shared toast ---------- */
.toast { position: fixed; left: 50%; transform: translateX(-50%) translateY(20px); bottom: 96px; z-index: 95; background: var(--ink); color: #fff; padding: 13px 20px; border-radius: 999px; font-weight: 800; font-size: 14px; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; max-width: 90vw; text-align: center; box-shadow: var(--shadow); }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 1140px) { body.biz .toast { bottom: 32px; } }

/* row that's being removed (admin/console actions) */
.fade-out { opacity: 0; transform: translateX(10px); transition: opacity .3s, transform .3s; }

/* operator (admin) impersonation banner on /business/* pages */
.admin-view-bar { position: sticky; top: 0; z-index: 80; display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 700; padding: 9px 16px; }
.admin-view-bar b { font-weight: 800; }
.admin-view-bar button { margin-left: auto; border: 0; background: rgba(255,255,255,.2); color: #fff;
  font-weight: 800; font-size: 12px; padding: 5px 11px; border-radius: 8px; cursor: pointer; font-family: var(--sans); }
.admin-view-bar button:active { transform: scale(.96); }
