/* ─────────────────────────────────────────────────────────────────────
   WalletLab — App (back-office)
   Built on top of landing tokens. Adds: layout shell, sidebar/tab bar,
   tables, inputs, KPI cards, scanner viewport, stamp grid, push card.
   ───────────────────────────────────────────────────────────────────── */

:root {
  --sidebar-w: 240px;
  --tab-bar-h: 64px;
  --topbar-h: 60px;
  --app-shadow: 0 1px 0 var(--line), 0 1px 3px rgba(13, 31, 23, 0.04);
}
:root.dark {
  --app-shadow: 0 1px 0 var(--line);
}

body.app {
  background: var(--bg);
  font-family: var(--font-text);
  color: var(--fg);
  letter-spacing: -0.005em;
}

/* ── App shell ─────────────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
}

/* ── Sidebar (desktop) ─────────────────────────────────────────────── */
.app-sidebar {
  background: var(--green-deep, #06271B);
  border-right: 0;
  display: flex; flex-direction: column;
  padding: 22px 16px;
  position: sticky; top: 0;
  height: 100vh;
  gap: 4px;
  overflow: hidden;
}
.app-sidebar::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(70% 40% at 20% 0%, rgba(47,212,106,.14), transparent 60%);
  pointer-events: none;
}
.app-sidebar > * { position: relative; }
@media (max-width: 880px) {
  .app-sidebar { display: none; }
}
.app-sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 6px 10px 24px;
  font-family: var(--font-display);
  font-weight: 700; font-size: 18px;
  letter-spacing: -0.03em;
  color: #EAF6EF;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 8px;
}
.app-sidebar-section {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: #74998A;
  padding: 16px 12px 8px;
}
.app-nav-item {
  display: flex; align-items: center; gap: 12px;
  height: 42px; padding: 0 12px;
  border-radius: 12px;
  font-size: 14.5px; font-weight: 500;
  color: #EAF6EF;
  cursor: pointer;
  border: 0; background: transparent;
  text-align: left; width: 100%;
  transition: background .18s;
}
.app-nav-item:hover { background: rgba(255,255,255,.05); }
.app-nav-item.active {
  background: rgba(47,212,106,.15);
  color: #ffffff;
  font-weight: 600;
}
.app-nav-item svg { flex-shrink: 0; color: #74998A; transition: color .18s; }
.app-nav-item:hover svg { color: #EAF6EF; }
.app-nav-item.active svg { color: #2FD46A; }
.app-nav-item .badge {
  margin-left: auto;
  min-width: 22px; height: 18px; padding: 0 6px;
  border-radius: 99px;
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 600;
  background: rgba(47,212,106,.2);
  color: #2FD46A;
  font-family: var(--font-mono);
}
.app-nav-item.active .badge {
  background: rgba(47,212,106,.2);
  color: #2FD46A;
}

.app-sidebar-foot {
  margin-top: auto;
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 6px 4px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.app-user {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  color: #EAF6EF;
}
.app-user-name { font-size: 13.5px; font-weight: 600; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-user-role { font-size: 11.5px; color: #74998A; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Org / shop card in sidebar foot */
.app-shop-card {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px; padding: 10px 11px;
  cursor: pointer; margin-bottom: 8px;
  transition: background .18s, border-color .18s;
}
.app-shop-card:hover { background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.14); }
.app-shop-logo {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(145deg, #2FD46A, #0E9D5C);
  display: grid; place-items: center; overflow: hidden;
  color: #06271B; font-weight: 800; font-size: 15px;
}
.app-shop-logo img { width: 100%; height: 100%; object-fit: cover; }
.app-shop-name { font-size: 13px; font-weight: 600; color: #EAF6EF; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-shop-meta { font-size: 11px; color: #74998A; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-shop-card > svg { color: #74998A; flex-shrink: 0; }

/* ── Top bar (mobile + desktop minimal) ───────────────────────────── */
.app-topbar {
  height: calc(var(--topbar-h) + var(--safe-t, 0px));
  padding-top: var(--safe-t, 0px);
  padding-left: max(20px, var(--safe-l));
  padding-right: max(20px, var(--safe-r));
  display: flex; align-items: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.app-topbar-title {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 600;
  letter-spacing: -0.02em;
}
.app-topbar-back {
  width: 38px; height: 38px;
  margin-left: -10px; margin-right: 4px;
  border-radius: 10px;
  background: transparent; border: 0;
  display: grid; place-items: center;
  color: var(--fg);
}
.app-topbar-back:active { background: var(--bg-soft); }
.app-topbar-actions {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
}
.app-topbar-brand-mobile {
  display: none;
  align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-weight: 600; font-size: 16px;
  letter-spacing: -0.02em;
}
@media (max-width: 880px) {
  .app-topbar-brand-mobile { display: flex; }
}

/* ── Content area ──────────────────────────────────────────────────── */
.app-content {
  background: var(--bg);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.app-page {
  flex: 1;
  padding: 32px 40px 80px;
  max-width: 1280px;
  width: 100%;
}
@media (max-width: 880px) {
  .app-page {
    padding: 20px 20px calc(var(--tab-bar-h) + 40px + var(--safe-b, 0px));
  }
}

/* ── Bottom tab bar (mobile) ───────────────────────────────────────── */
.app-tabbar {
  display: none;
}
@media (max-width: 880px) {
  .app-tabbar {
    position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 60;
    height: calc(var(--tab-bar-h) + var(--safe-b, 0px));
    padding-bottom: var(--safe-b, 0px);
    display: flex; align-items: stretch;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--line);
  }
  .app-tabbar-item {
    flex: 1;
    background: transparent; border: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px;
    color: var(--muted);
    font-size: 10px; font-weight: 600;
    letter-spacing: 0.02em;
    padding-top: 4px;
  }
  .app-tabbar-item.active { color: var(--accent); }
  :root.dark .app-tabbar-item.active { color: var(--lime); }
  .app-tabbar-item:active { opacity: 0.6; }
}

/* ── Page heading ──────────────────────────────────────────────────── */
.page-head {
  display: flex; align-items: flex-end;
  justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 28px;
}
.page-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.4vw, 38px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
  margin: 0 0 8px;
}
.page-sub {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Cards (app version, denser) ──────────────────────────────────── */
.app-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 22px;
  display: flex; flex-direction: column;
}
.app-card.pad-sm { padding: 14px 16px; }
.app-card.pad-lg { padding: 32px; }
.app-card.flush { padding: 0; overflow: hidden; }
.app-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 12px;
}
.app-card-title {
  font-family: var(--font-display);
  font-size: 15px; font-weight: 600;
  letter-spacing: -0.015em;
}
.app-card-sub {
  font-size: 13px; color: var(--muted); margin-top: 2px;
}
.app-card-section {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.app-card-section:last-child { border-bottom: 0; }

.label-tiny {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted);
}

/* ── KPI cards ─────────────────────────────────────────────────────── */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
@media (max-width: 720px) {
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
.kpi {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px;
}
.kpi-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 32px; font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--fg);
}
.kpi-delta {
  margin-top: 6px;
  font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px;
}
.kpi-delta.up { color: #2a8a4a; }
.kpi-delta.down { color: #c14040; }
:root.dark .kpi-delta.up { color: var(--lime); }

/* ── Inputs ────────────────────────────────────────────────────────── */
.app-input {
  height: 42px;
  padding: 0 14px;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--fg);
  font: 14px var(--font-text);
  width: 100%;
  transition: border-color .15s, background .15s;
}
.app-input:focus {
  outline: 0;
  border-color: var(--accent);
  background: var(--bg);
}
:root.dark .app-input:focus { border-color: var(--lime); }
.app-input::placeholder { color: var(--muted-2); }
.app-input.with-icon { padding-left: 38px; }
.input-wrap {
  position: relative;
  display: flex; align-items: center;
}
.input-wrap-icon {
  position: absolute; left: 12px;
  color: var(--muted);
  pointer-events: none;
  display: grid; place-items: center;
}
.input-wrap-right {
  position: absolute; right: 12px;
  background: transparent; border: 0;
  color: var(--muted-2);
  cursor: pointer;
}
.app-textarea {
  min-height: 84px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.45;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--fg);
  font: 14px var(--font-text);
  width: 100%;
}
.field-label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--fg-2);
  margin-bottom: 8px;
}

/* ── Buttons (app variants) ────────────────────────────────────────── */
.app-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border-radius: 10px;
  font-size: 14px; font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s, background .15s, transform .1s;
}
.app-btn:active { transform: scale(0.98); }
.app-btn.primary {
  background: linear-gradient(145deg, var(--lime), var(--accent));
  color: #06271B;
  box-shadow: 0 6px 18px rgba(14,157,92,.3);
}
.app-btn.primary:hover { box-shadow: 0 10px 26px rgba(14,157,92,.42); }
.app-btn.lime { background: var(--lime); color: var(--lime-ink); }
.app-btn.ghost {
  background: var(--bg-card);
  color: var(--fg);
  border-color: var(--line-strong);
}
.app-btn.ghost:hover { background: var(--bg-soft); }
.app-btn.danger {
  background: transparent;
  color: #c14040;
  border-color: rgba(193, 64, 64, 0.3);
}
:root.dark .app-btn.danger { color: #ff7373; border-color: rgba(255, 115, 115, 0.3); }
.app-btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.app-btn.lg { height: 52px; padding: 0 24px; font-size: 15px; border-radius: 12px; }
.app-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.app-btn.icon-only { width: 38px; padding: 0; }

/* ── Tags / badges ─────────────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 9px;
  border-radius: 99px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--bg-soft);
  color: var(--muted);
  border: 1px solid var(--line);
}
.tag.accent {
  background: var(--gold-bg);
  color: var(--lime);
  border-color: var(--gold-ring);
}
:root:not(.dark) .tag.accent { color: #5d8a1e; }
.tag.live {
  background: rgba(143, 196, 48, 0.15);
  color: #5d8a1e;
  border-color: rgba(143, 196, 48, 0.3);
}
:root.dark .tag.live { color: var(--lime); }
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Avatar ────────────────────────────────────────────────────────── */
.av {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--fg-2);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  display: grid; place-items: center;
  flex-shrink: 0;
  border: 1px solid var(--line);
}
.av.lg { width: 48px; height: 48px; font-size: 16px; border-radius: 12px; }
.av.sm { width: 28px; height: 28px; font-size: 11px; border-radius: 8px; }
.av.accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.av.lime { background: var(--lime); color: var(--lime-ink); border-color: transparent; }

/* ── Tables ────────────────────────────────────────────────────────── */
.app-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.app-table th {
  text-align: left;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted);
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.app-table td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--fg-2);
  vertical-align: middle;
}
.app-table tr:last-child td { border-bottom: 0; }
.app-table tr.click { cursor: pointer; }
.app-table tr.click:hover td { background: var(--bg-soft); }
.app-table tr.selected td { background: var(--bg-soft); }
.app-table .mono { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.app-table .name { font-weight: 600; color: var(--fg); }

/* Mobile: stack tables as cards */
@media (max-width: 720px) {
  .app-table.mobile-stack thead { display: none; }
  .app-table.mobile-stack tr { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .app-table.mobile-stack td { display: block; padding: 4px 0; border: 0; }
  .app-table.mobile-stack tr:last-child { border-bottom: 0; }
}

/* ── Stamp grid (interactive) ──────────────────────────────────────── */
.stamp-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.stamp-cell {
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 13px; font-weight: 500;
  color: var(--muted-2);
  background: var(--bg-soft);
  border: 1.5px dashed var(--line-strong);
  transition: background .25s, color .25s, transform .2s, border .15s;
}
.stamp-cell.on {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1.5px solid var(--accent);
}
:root.dark .stamp-cell.on {
  background: var(--lime);
  color: var(--lime-ink);
  border-color: var(--lime);
}
.stamp-cell.on.pulse { animation: stampPop .35s ease; }

/* ── Scanner viewport ──────────────────────────────────────────────── */
.scanner-vp {
  position: relative;
  width: 100%;
  min-height: 300px;
  border-radius: 18px;
  overflow: hidden;
  background: #0a0a0a;
  color: #f5f5f5;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
}
.scanner-vp.idle {
  background: var(--bg-soft);
  color: var(--muted);
  border: 1px dashed var(--line-strong);
}
.scanner-vp::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.55) 75%);
  pointer-events: none;
}
.scanner-vp.idle::before { display: none; }
.scanner-corner {
  position: absolute;
  width: 56px; height: 56px;
  border: 3px solid var(--lime);
  z-index: 2;
}
.scanner-corner.tl { top: 30%; left: 6%; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.scanner-corner.tr { top: 30%; right: 6%; border-left: 0; border-bottom: 0; border-radius: 0 8px 0 0; }
.scanner-corner.bl { bottom: 30%; left: 6%; border-right: 0; border-top: 0; border-radius: 0 0 0 8px; }
.scanner-corner.br { bottom: 30%; right: 6%; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }
.scanner-line {
  position: absolute;
  left: 10%; right: 10%; top: 50%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--lime), transparent);
  box-shadow: 0 0 18px var(--lime);
  z-index: 2;
  animation: scan 2s ease-in-out infinite;
}
@keyframes scan {
  0%, 100% { top: 22%; opacity: 0.4; }
  50% { top: 75%; opacity: 1; }
}
.scanner-fakecam {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(255,255,255,0.06), transparent 50%),
    linear-gradient(160deg, #1a2a20 0%, #0a0f0c 100%);
  z-index: 1;
}
.scanner-overlay {
  position: relative;
  z-index: 3;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--lime);
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,0.5);
  padding: 6px 12px;
  border-radius: 99px;
  margin-top: auto;
  margin-bottom: 24px;
}
.scanner-overlay .pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 12px var(--lime);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.6); }
}

.scanner-guide-hint {
  position: absolute;
  top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 3;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
  background: rgba(0,0,0,0.45);
  padding: 5px 14px;
  border-radius: 99px;
  white-space: nowrap;
}
.scanner-rotate-hint {
  position: absolute;
  bottom: 60px; left: 50%; transform: translateX(-50%);
  z-index: 3;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600;
  color: #ffe66d;
  background: rgba(0,0,0,0.6);
  padding: 7px 16px;
  border-radius: 99px;
  white-space: nowrap;
  animation: pulse 1.4s ease-in-out infinite;
}

/* ── Fullscreen scanner (mobile-app style) ───────────────────────────── */
.scanner-fs {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  display: none;
}
.scanner-fs.active { display: block; }
.scanner-fs-video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.scanner-fs-topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 4;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: max(16px, env(safe-area-inset-top)) 16px 16px;
  background: linear-gradient(180deg, rgba(0,0,0,0.65), transparent);
}
.scanner-fs-btn {
  width: 44px; height: 44px;
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.14);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.15s ease;
}
.scanner-fs-btn:active { background: rgba(255,255,255,0.28); }
.scanner-fs-frame {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(78vw, 62vh);
  height: min(78vw, 62vh);
  z-index: 3;
}
.scanner-fs .scanner-corner { width: 44px; height: 44px; }
.scanner-fs .scanner-corner.tl { top: 0; left: 0; right: auto; bottom: auto; }
.scanner-fs .scanner-corner.tr { top: 0; right: 0; left: auto; bottom: auto; }
.scanner-fs .scanner-corner.bl { bottom: 0; left: 0; right: auto; top: auto; }
.scanner-fs .scanner-corner.br { bottom: 0; right: 0; left: auto; top: auto; }
.scanner-fs .scanner-line { left: 0; right: 0; }
.scanner-fs-hint {
  position: absolute;
  top: calc(50% - min(39vw, 31vh) - 44px);
  left: 50%; transform: translateX(-50%);
  z-index: 4;
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.9);
  background: rgba(0,0,0,0.45);
  padding: 7px 16px;
  border-radius: 99px;
  white-space: nowrap;
}
.scanner-fs-status {
  position: absolute;
  bottom: max(28px, env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  z-index: 4;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--lime);
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,0.5);
  padding: 7px 14px;
  border-radius: 99px;
}
.scanner-fs-status .pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 12px var(--lime);
  animation: pulse 1.4s ease-in-out infinite;
}

/* ── Push card / notification preview ─────────────────────────────── */
.push-preview {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  display: flex; gap: 12px;
}
.push-preview-icon {
  width: 40px; height: 40px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
  flex-shrink: 0;
}
:root.dark .push-preview-icon { background: var(--lime); color: var(--lime-ink); }
.push-preview-app {
  font-size: 10px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.push-preview-title { font-size: 13px; font-weight: 600; color: var(--fg); }
.push-preview-body { font-size: 13px; color: var(--muted); line-height: 1.4; }

/* ── Login split layout ────────────────────────────────────────────── */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 920px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-art { display: none; }
}
.login-art {
  background: linear-gradient(165deg, #0d4a33 0%, #06271B 60%);
  color: #EAF6EF;
  padding: 56px;
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
}
.login-art::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(64% 44% at 22% 6%, rgba(47,212,106,.20), transparent 60%),
    radial-gradient(circle at right bottom, rgba(47,212,106,.10), transparent 50%);
  pointer-events: none;
}
.login-art-inner { position: relative; flex: 1; display: flex; flex-direction: column; }
.login-art h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: auto 0 24px;
  max-width: 460px;
}
.login-art p {
  font-size: 16px;
  color: color-mix(in srgb, var(--accent-ink) 75%, transparent);
  max-width: 460px;
  margin-bottom: 32px;
}
.login-art-content { display: flex; flex-direction: column; gap: 20px; }
.login-art-eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(47,212,106,.85);
}
.login-art-stats {
  display: flex; align-items: center; gap: 20px; margin-top: auto; padding-top: 24px;
}
.login-stat-v { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; }
.login-stat-l { font-size: 12px; color: color-mix(in srgb, var(--accent-ink) 60%, transparent); margin-top: 2px; }
.login-stat-div { width: 1px; height: 32px; background: rgba(255,255,255,.14); }

/* loyalty card preview in login left panel */
.login-card-preview {
  width: 100%; max-width: 280px;
  border-radius: 18px; padding: 18px;
  background: linear-gradient(150deg, rgba(255,255,255,.10), rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(8px);
  box-shadow: 0 24px 48px -20px rgba(0,0,0,.5);
}
.lcp-top { margin-bottom: 14px; }
.lcp-brand { display: flex; align-items: center; gap: 10px; }
.lcp-logo {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(145deg, #2FD46A, #0E9D5C);
  display: grid; place-items: center;
  color: #06271B; font-weight: 800; font-size: 13px;
}
.lcp-name { font-size: 11px; font-weight: 700; letter-spacing: .05em; color: #EAF6EF; }
.lcp-sub { font-size: 9px; letter-spacing: .08em; color: rgba(234,246,239,.45); margin-top: 1px; }
.lcp-count { display: flex; align-items: baseline; gap: 5px; margin-bottom: 11px; }
.lcp-num { font-size: 28px; font-weight: 800; letter-spacing: -0.04em; color: #EAF6EF; }
.lcp-denom { font-size: 13px; color: rgba(234,246,239,.5); }
.lcp-stamps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.lcp-stamp {
  aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center;
}
.lcp-stamp.on {
  background: linear-gradient(145deg, #2FD46A, #0E9D5C);
  color: #06271B;
}
.lcp-stamp.off { border: 1.4px dashed rgba(234,246,239,.22); }

.login-form-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  background: var(--bg);
}
.login-card {
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column;
}
.login-form-brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 32px;
  font-family: var(--font-display);
  font-size: 17px; font-weight: 600;
  letter-spacing: -0.025em;
}

/* ── Org card (super) ──────────────────────────────────────────────── */
.org-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.org-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 22px;
  display: flex; flex-direction: column;
  gap: 14px;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.org-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}
.org-card-top {
  display: flex; align-items: flex-start; gap: 12px;
}
.org-card-name {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 600;
  letter-spacing: -0.02em;
}
.org-card-meta { font-size: 12px; color: var(--muted); }
.org-card-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.org-stat-val {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--fg);
}
.org-stat-lbl {
  font-size: 10px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}

/* ── CRM split layout ──────────────────────────────────────────────── */
.crm-split {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 0;
  height: calc(100vh - var(--topbar-h));
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  overflow: hidden;
}
@media (max-width: 980px) {
  .crm-split { grid-template-columns: 1fr; height: auto; }
  .crm-split.detail-open .crm-list { display: none; }
  .crm-split:not(.detail-open) .crm-detail { display: none; }
}
.crm-list {
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-height: 0;
}
.crm-list-head {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 10px;
}
.crm-list-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.crm-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .1s;
}
.crm-list-item:hover { background: var(--bg-soft); }
.crm-list-item.active { background: var(--bg-soft); }
.crm-list-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
}
:root.dark .crm-list-item.active::before { background: var(--lime); }
.crm-list-item { position: relative; }
.crm-list-item-name { font-size: 14px; font-weight: 600; color: var(--fg); }
.crm-list-item-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.crm-list-item-stamps {
  margin-left: auto;
  font-family: var(--font-display);
  font-size: 15px; font-weight: 600;
  color: var(--fg);
}
.crm-list-item-stamps .of { color: var(--muted); font-weight: 500; }

.crm-detail {
  overflow-y: auto;
  padding: 24px 28px 32px;
}
@media (max-width: 720px) { .crm-detail { padding: 20px; } }
.crm-detail-head {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 24px;
}
.crm-detail-name {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.crm-detail-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── QR display ────────────────────────────────────────────────────── */
.qr-section-body {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}
.qr-section-info {
  flex: 1;
  display: flex; flex-direction: column;
  gap: 14px;
  justify-content: center;
}
@media (max-width: 640px) {
  .qr-section-body {
    flex-direction: column;
    align-items: center;
  }
  .qr-section-info {
    align-items: center;
    width: 100%;
  }
  .qr-section-info .qr-poster-title,
  .qr-section-info .qr-poster-sub { text-align: center; }
}
.qr-frame {
  width: 200px; height: 200px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 14px;
  padding: 12px;
  display: grid; place-items: center;
  position: relative;
}
.qr-fake {
  width: 100%; height: 100%;
  background-image:
    linear-gradient(45deg, #0d1f17 25%, transparent 25%),
    linear-gradient(-45deg, #0d1f17 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #0d1f17 75%),
    linear-gradient(-45deg, transparent 75%, #0d1f17 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
  border-radius: 6px;
  position: relative;
}
.qr-fake::before, .qr-fake::after,
.qr-corner {
  content: '';
  position: absolute;
  width: 56px; height: 56px;
  background: #fff;
  border: 12px solid #0d1f17;
  border-radius: 14px;
  box-sizing: border-box;
}
.qr-fake::before { top: 0; left: 0; }
.qr-fake::after { top: 0; right: 0; }
.qr-corner.bl { bottom: 0; left: 0; }
.qr-poster-title {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 600;
  letter-spacing: -0.02em;
}
.qr-poster-sub { font-size: 13px; color: var(--muted); line-height: 1.5; }
.qr-url-strip {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--bg-soft);
  padding: 8px 14px;
  border-radius: 99px;
  border: 1px solid var(--line);
  letter-spacing: 0.04em;
  display: inline-flex; align-items: center; gap: 8px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Activity feed (history) ───────────────────────────────────────── */
.feed { display: flex; flex-direction: column; }
.feed-item {
  display: flex; gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.feed-item:last-child { border-bottom: 0; }
.feed-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.feed-dot.stamp { background: var(--gold-bg); color: var(--lime); border-color: var(--gold-ring); }
:root:not(.dark) .feed-dot.stamp { color: #5d8a1e; }
.feed-dot.reward { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.feed-dot.message { background: var(--lime); color: var(--lime-ink); border-color: transparent; }
.feed-body { flex: 1; min-width: 0; }
.feed-line1 { font-size: 13px; color: var(--fg); }
.feed-line1 strong { font-weight: 600; }
.feed-line2 { font-size: 12px; color: var(--muted); margin-top: 2px; }
.feed-time {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ── Misc ──────────────────────────────────────────────────────────── */
.divider {
  height: 1px; background: var(--line);
  margin: 24px 0;
}
.notice {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  display: flex; align-items: center; gap: 10px;
}
.notice.success {
  background: rgba(143, 196, 48, 0.12);
  color: #5d8a1e;
  border: 1px solid rgba(143, 196, 48, 0.3);
}
:root.dark .notice.success { color: var(--lime); }
.notice.error {
  background: rgba(193, 64, 64, 0.1);
  color: #c14040;
  border: 1px solid rgba(193, 64, 64, 0.3);
}
:root.dark .notice.error { color: #ff7373; }

.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--muted);
}
.empty-state-icon {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  border-radius: 18px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  color: var(--muted);
}
.empty-state-title {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.empty-state-sub {
  font-size: 14px; max-width: 320px; margin: 0 auto;
  line-height: 1.5;
}

.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.spacer { flex: 1; }

.crm-back-mobile { display: none; }
@media (max-width: 980px) {
  .crm-back-mobile { display: grid; }
}

.right { text-align: right; }

/* ══ CRM new design ════════════════════════════════════════════════════ */
--crm-amber: #E0A33B;

.crm-root { display: flex; flex-direction: column; height: 100%; }

/* Tabs */
.crm-tabs {
  display: flex; align-items: center; gap: 4px;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.crm-tab {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border-radius: 10px; border: 0; background: transparent;
  font-size: 14px; font-weight: 500; color: var(--muted);
  cursor: pointer; transition: background .15s, color .15s;
}
.crm-tab:hover { background: var(--bg-soft); color: var(--fg); }
.crm-tab.on { background: var(--fg); color: var(--bg); font-weight: 600; }
.crm-tab svg { flex-shrink: 0; }

/* Content area */
.crm-content { display: flex; flex-direction: column; gap: 20px; }

/* KPI cards */
.crm-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 720px) { .crm-kpis { grid-template-columns: repeat(2, 1fr); } }
.crm-kpi {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 20px;
  position: relative; overflow: hidden;
  transition: transform .25s, box-shadow .25s;
}
.crm-kpi:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -26px rgba(6,39,27,.4); }
.crm-spark {
  position: absolute; right: 14px; top: 16px;
  width: 76px; height: 30px; opacity: .9;
}
.crm-kpi-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.crm-kpi-ic {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--gold-bg); color: var(--accent);
  display: grid; place-items: center;
}
.crm-kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.crm-kpi-val {
  font-family: var(--font-display); font-size: 34px; font-weight: 700;
  letter-spacing: -0.04em; line-height: 1; margin-top: 4px;
}
.crm-kpi-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.crm-delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px;
}
.crm-delta.up { background: var(--gold-bg); color: var(--accent); }
.crm-delta.down { background: rgba(224,86,59,.1); color: #E0563B; }

/* Grids */
.crm-grid-2 { display: grid; grid-template-columns: 1.7fr 1fr; gap: 16px; }
.crm-grid-3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .crm-grid-2, .crm-grid-3 { grid-template-columns: 1fr; } }

/* Panel */
.crm-panel {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--r-xl); padding: 22px 24px;
  display: flex; flex-direction: column;
}
.crm-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 20px;
}
.crm-panel-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.crm-panel-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* Feed (activity) */
.crm-feed { display: flex; flex-direction: column; gap: 4px; }
.crm-feed-empty { font-size: 13px; color: var(--muted); padding: 12px 0; text-align: center; }
.crm-feed-item {
  display: flex; gap: 12px; padding: 10px 8px;
  border-radius: 10px; transition: background .15s;
}
.crm-feed-item:hover { background: var(--bg-soft); }
.crm-feed-ic {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; flex-shrink: 0;
}
.crm-feed-ic.send { background: var(--gold-bg); color: var(--accent); }
.crm-feed-ic.stamp { background: var(--gold-bg); color: var(--accent); }
.crm-feed-ic.reward { background: rgba(224,163,59,.14); color: #E0A33B; }
.crm-feed-txt { font-size: 13.5px; line-height: 1.35; }
.crm-feed-time { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; }

/* Push preview */
.crm-push-preview {
  background: var(--green-deep, #06271B);
  border-radius: 14px; padding: 14px;
  position: relative; overflow: hidden; margin: 8px 0;
}
.crm-push-preview::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(60% 50% at 80% 0%, rgba(47,212,106,.16), transparent 60%);
}
.crm-pp-note {
  position: relative; background: rgba(234,246,239,.94);
  border-radius: 12px; padding: 10px; display: flex; gap: 10px;
}
.crm-pp-ic {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(145deg, var(--lime), var(--accent));
  display: grid; place-items: center; color: #06271B; flex-shrink: 0;
}
.crm-pp-meta { font-size: 9px; letter-spacing: .08em; color: #5a6b62; text-transform: uppercase; }
.crm-pp-title { font-size: 13px; font-weight: 700; color: #0a0f0c; }
.crm-pp-body { font-size: 12px; color: #3a453e; line-height: 1.3; margin-top: 1px; }

/* Compose */
.crm-compose { display: flex; flex-direction: column; gap: 12px; }
.crm-field { display: flex; flex-direction: column; gap: 6px; }
.crm-field > label { font-size: 12px; font-weight: 600; color: var(--muted); }
.crm-seg-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.crm-chip {
  font-size: 12.5px; font-weight: 600; padding: 7px 13px;
  border-radius: 99px; border: 1px solid var(--line); color: var(--muted);
  background: transparent; cursor: pointer; transition: all .15s;
}
.crm-chip.on {
  background: var(--green-deep, #06271B); color: #fff;
  border-color: var(--green-deep, #06271B);
}

/* Program card */
.crm-prog-card {
  border-radius: 16px; padding: 16px;
  background: linear-gradient(150deg, #0d4a33, #06271B); color: #EAF6EF;
}
.crm-prog-count { margin-bottom: 10px; }
.crm-prog-count .b { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -0.04em; }
.crm-prog-count .o { font-size: 14px; opacity: .5; margin-left: 4px; }
.crm-prog-bar {
  height: 5px; border-radius: 99px;
  background: rgba(234,246,239,.12); overflow: hidden;
}
.crm-prog-bar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--lime));
  border-radius: 99px;
}

/* ══ Gifts / rewards catalog ════════════════════════════════════════════ */
.gift-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.gift-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 20px;
  display: flex; flex-direction: column;
  gap: 14px;
  transition: border-color .15s, transform .15s, box-shadow .25s;
}
.gift-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: 0 18px 40px -28px rgba(6, 39, 27, .45);
}
.gift-card.off { opacity: .62; }
.gift-card.off:hover { transform: none; box-shadow: none; }
.gift-card-head {
  display: flex; align-items: flex-start; gap: 12px;
}
.gift-ic {
  width: 44px; height: 44px;
  border-radius: 13px;
  background: var(--gold-bg);
  color: var(--accent);
  display: grid; place-items: center;
  flex-shrink: 0;
  border: 1px solid var(--gold-ring);
}
:root.dark .gift-ic { color: var(--lime); }
.gift-card.off .gift-ic {
  background: var(--bg-soft);
  color: var(--muted);
  border-color: var(--line);
}
.gift-cost {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 5px;
  height: 30px; padding: 0 13px;
  border-radius: 99px;
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700;
  letter-spacing: -0.01em;
  background: var(--accent); color: var(--accent-ink);
  border: 1px solid transparent;
  white-space: nowrap;
}
:root.dark .gift-cost { background: var(--lime); color: var(--lime-ink); }
.gift-card.off .gift-cost {
  background: var(--bg-soft); color: var(--muted);
  border-color: var(--line);
}
.gift-cost .unit { font-size: 11px; font-weight: 600; opacity: .8; }
.gift-body { display: flex; flex-direction: column; gap: 3px; min-height: 38px; }
.gift-name {
  font-family: var(--font-display);
  font-size: 16px; font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--fg);
  line-height: 1.25;
}
.gift-desc { font-size: 13px; color: var(--muted); line-height: 1.45; }
.gift-foot {
  display: flex; align-items: center; gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.gift-foot .spacer { flex: 1; }
.gift-act {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.gift-act:hover { background: var(--bg); color: var(--fg); border-color: var(--line-strong); }
.gift-act.danger:hover { color: #c14040; border-color: rgba(193, 64, 64, .35); }
:root.dark .gift-act.danger:hover { color: #ff7373; }

/* ══ Mobile "More" sheet ════════════════════════════════════════════════ */
.app-sheet-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0,0,0,.45);
  opacity: 0; pointer-events: none;
  transition: opacity .22s;
}
.app-sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.app-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
  background: var(--bg-card);
  border-top: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  padding: 6px 16px calc(18px + var(--safe-b, 0px));
  box-shadow: 0 -16px 44px -16px rgba(0,0,0,.4);
  transform: translateY(110%);
  transition: transform .26s cubic-bezier(.32,.72,0,1);
  display: none;
}
@media (max-width: 880px) { .app-sheet { display: block; } }
.app-sheet.open { transform: translateY(0); }
.app-sheet-handle {
  width: 40px; height: 4px; border-radius: 99px;
  background: var(--line-strong);
  margin: 8px auto 14px;
}
/* org card adapts to the light sheet surface (vs dark sidebar) */
.app-sheet .app-shop-card { background: var(--bg-soft); border-color: var(--line); }
.app-sheet .app-shop-card:hover { background: var(--bg); border-color: var(--line-strong); }
.app-sheet .app-shop-meta { color: var(--muted); }
.app-sheet .app-shop-card > svg { color: var(--muted); }
.app-sheet-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin: 6px 0 14px;
}
@media (max-width: 360px) { .app-sheet-grid { grid-template-columns: repeat(3, 1fr); } }
.app-sheet-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 13px 4px; border-radius: 14px;
  background: var(--bg-soft); border: 1px solid var(--line);
  color: var(--fg); font-size: 11px; font-weight: 600;
  cursor: pointer; text-align: center;
}
.app-sheet-item svg { color: var(--muted); }
.app-sheet-item.active { background: var(--gold-bg); border-color: var(--gold-ring); color: var(--accent); }
:root.dark .app-sheet-item.active { color: var(--lime); }
.app-sheet-item.active svg { color: inherit; }
.app-sheet-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }

/* ── Card design settings: split form + phone preview ────────────────── */
.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: start;
}
.settings-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.settings-preview {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.settings-preview .preview-label {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.settings-preview .preview-hint {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--muted);
  text-align: center;
  max-width: 280px;
}

/* iOS / Android segmented toggle */
.device-toggle {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.device-toggle button {
  appearance: none;
  border: none;
  background: none;
  padding: 6px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.device-toggle button.active {
  background: var(--surface, #fff);
  color: var(--ink, #111);
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
}
:root.dark .device-toggle button.active { background: #2a2d30; color: #f5f5f5; }

/* Android Google Wallet top bar */
.phone-mock.android .phone-screen { background: #f1f3f4; }
:root.dark .phone-mock.android .phone-screen { background: #202124; }
.phone-gwbar {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 16px 14px;
  font-size: 16px; font-weight: 500;
  color: var(--ink, #202124);
}
:root.dark .phone-gwbar { color: #e8eaed; }
.phone-gwbar .gw-back { font-size: 22px; line-height: 1; }

.color-field-row { display: flex; gap: 8px; align-items: center; }
.color-swatch {
  width: 38px; height: 38px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  background: none;
}

/* iPhone mockup */
.phone-mock {
  position: relative;
  width: 300px;
  border-radius: 46px;
  padding: 12px;
  background: #1a1a1c;
  box-shadow:
    0 0 0 2px #2c2c2e,
    0 24px 60px -18px rgba(0,0,0,0.5);
}
.phone-notch {
  position: absolute;
  top: 12px; left: 50%; transform: translateX(-50%);
  width: 132px; height: 26px;
  background: #1a1a1c;
  border-radius: 0 0 18px 18px;
  z-index: 3;
}
.phone-screen {
  position: relative;
  border-radius: 34px;
  overflow: hidden;
  background: var(--bg-soft, #f2f2f5);
  min-height: 540px;
  display: flex;
  flex-direction: column;
}
:root.dark .phone-screen { background: #111315; }
.phone-statusbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px 6px;
  font-size: 13px; font-weight: 700;
  color: var(--ink, #111);
}
:root.dark .phone-statusbar { color: #f5f5f5; }
.phone-statusbar-icons { display: flex; align-items: center; gap: 5px; }
.phone-statusbar-icons .sb-signal,
.phone-statusbar-icons .sb-wifi,
.phone-statusbar-icons .sb-battery {
  display: inline-block;
  background: currentColor;
  border-radius: 2px;
}
.phone-statusbar-icons .sb-signal { width: 16px; height: 10px; clip-path: polygon(0 100%,18% 100%,18% 60%,0 60%,0 100%,38% 100%,38% 40%,38% 100%,58% 100%,58% 22%,78% 22%,78% 100%,100% 100%,100% 0,78% 0); }
.phone-statusbar-icons .sb-wifi { width: 15px; height: 11px; clip-path: circle(60% at 50% 90%); }
.phone-statusbar-icons .sb-battery { width: 22px; height: 11px; border-radius: 3px; opacity: 0.9; }
.phone-walletbar {
  padding: 4px 22px 14px;
  font-size: 16px; font-weight: 600;
  color: #007aff;
}
.phone-cardwrap {
  flex: 1;
  padding: 8px 16px 22px;
}

@media (max-width: 980px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-preview {
    position: static;
    order: -1;
    align-items: center;
  }
  .settings-preview .preview-label { align-self: center; }
}

