/* iSmart Portal Marketplace (v2) — visual language ported from v1 admin. */

:root {
  --bg: #f3f4f6; --panel: #ffffff; --ink: #111827; --muted: #6b7280;
  --line: #e5e7eb; --line-2: #d1d5db;
  --sidebar: #0f172a; --sidebar-ink: #cbd5e1; --sidebar-active: #ffffff;
  --primary: #2563eb; --green: #10b981; --pink: #ec4899;
  --yellow: #f59e0b; --red: #ef4444; --grey: #6b7280; --blue: #3b82f6;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 1px 3px rgba(0,0,0,.04);
}
body[data-theme=dark] {
  --bg: #0b1220; --panel: #111827; --ink: #e5e7eb; --muted: #9ca3af;
  --line: #1f2937; --line-2: #374151;
  --sidebar: #050a18; --sidebar-ink: #94a3b8; --sidebar-active: #ffffff;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { margin-left: auto; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---- App shell -------------------------------------------------------------*/
.app { display: grid; grid-template-columns: 240px 1fr; height: 100vh; overflow: hidden; }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-ink);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.main {
  display: flex; flex-direction: column;
  overflow: auto;
  min-width: 0;
}

/* ---- Sidebar ---------------------------------------------------------------*/
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid rgba(255,255,255,.06); flex-shrink: 0; }
.brand-mark { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg,#f97316,#ec4899,#a855f7); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.brand-title { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.2; }
.brand-sub, .brand-pro { color: var(--pink); font-weight: 600; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; padding: 8px 0 16px; flex: 1; min-height: 0; overflow-y: auto; }
.nav-group { display: flex; flex-direction: column; }
.nav-group-items { display: flex; flex-direction: column; overflow: hidden; transition: max-height .18s ease; max-height: 800px; }
.nav-group.collapsed .nav-group-items { max-height: 0; }
button.nav-sec {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: transparent; border: 0; cursor: pointer;
  color: #6b7280; font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  padding: 18px 18px 8px; font-family: inherit; font-weight: 600;
}
button.nav-sec:hover { color: #e5e7eb; }
.nav-sec-chev { width: 14px; height: 14px; transition: transform .18s ease; opacity: .6; }
.nav-group.collapsed .nav-sec-chev { transform: rotate(-90deg); }
/* Legacy non-button .nav-sec rule kept for backward compat */
.nav > .nav-sec { color: #6b7280; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 18px 18px 8px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 18px; color: var(--sidebar-ink); font-size: 14px; cursor: pointer; border-left: 3px solid transparent; text-decoration: none; }
.nav-item:hover { background: rgba(255,255,255,.04); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(255,255,255,.06); color: var(--sidebar-active); border-left-color: var(--primary); }
.nav-item i[data-lucide] { width: 18px; height: 18px; stroke-width: 2; flex: 0 0 18px; }
.nav-item.danger { color: #fca5a5; }
.nav-item.danger:hover { background: rgba(239,68,68,.08); color: #fecaca; }
.sidebar-foot { padding: 8px 18px; border-top: 1px solid rgba(255,255,255,.06); display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ---- Topbar ----------------------------------------------------------------*/
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.company { font-size: 17px; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.role-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; background: linear-gradient(135deg, #f97316, #ec4899); color: #fff; font-size: 12px; font-weight: 600; }
.role-pill i[data-lucide] { width: 14px; height: 14px; }
.icon-btn { background: transparent; border: 1px solid var(--line); color: inherit; width: 36px; height: 36px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.icon-btn i[data-lucide] { width: 18px; height: 18px; }
#sidebarToggle { display: none; }   /* visible on mobile via @media */

/* ---- Content --------------------------------------------------------------*/
.content { padding: 24px 24px 48px; max-width: 100%; }
.content > .view > h1 { margin: 0 0 8px; font-size: 24px; }
.content > .view > p.muted { margin: 0 0 16px; }
.crumbs { font-size: 13px; margin-bottom: 16px; color: var(--muted); }
.crumbs span:first-child { color: var(--ink); font-weight: 500; }

/* ---- Panels + cards -------------------------------------------------------*/
.panel { background: var(--panel); border-radius: 12px; padding: 22px 24px; box-shadow: var(--shadow); margin-bottom: 16px; overflow-x: auto; }
.panel h2 { margin: 0 0 16px; font-size: 18px; }
.panel h3 { margin: 18px 0 8px; font-size: 14px; }
.panel input, .panel select, .panel textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--panel); color: var(--ink); font: inherit;
  box-sizing: border-box;
}
.panel textarea { font: 13px ui-monospace, Menlo, monospace; resize: vertical; min-height: 80px; }

/* Stat cards (the four-up at top of dashboards).
   Default = plain white card with dark text. Opt into a gradient by adding
   a color class (.green / .blue / .grey / .pink / .amber / .indigo). */
.cards-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 16px; }
.info-card {
  position: relative; border-radius: 16px; padding: 22px;
  min-height: 110px; box-shadow: var(--shadow);
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
}
.info-val { font-size: 28px; font-weight: 700; line-height: 1.15; color: var(--ink); }
.info-lbl { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: .02em; }
.info-card .muted, .info-card .small { color: var(--muted); }
.info-ic { position: absolute; right: 16px; bottom: 16px; opacity: .15; color: var(--muted); }
.info-ic i[data-lucide] { width: 36px; height: 36px; stroke-width: 1.5; }
/* Gradient variants (use these on hero stat rows for visual punch) */
.info-card.green, .info-card.blue, .info-card.grey, .info-card.pink, .info-card.amber, .info-card.indigo {
  color: #fff; border: 0;
}
.info-card.green  .info-val, .info-card.blue .info-val, .info-card.grey .info-val,
.info-card.pink   .info-val, .info-card.amber .info-val, .info-card.indigo .info-val { color: #fff; }
.info-card.green  .info-lbl, .info-card.blue .info-lbl, .info-card.grey .info-lbl,
.info-card.pink   .info-lbl, .info-card.amber .info-lbl, .info-card.indigo .info-lbl,
.info-card.green  .muted, .info-card.blue .muted, .info-card.grey .muted,
.info-card.pink   .muted, .info-card.amber .muted, .info-card.indigo .muted { color: rgba(255,255,255,.85); }
.info-card.green  .info-ic, .info-card.blue .info-ic, .info-card.grey .info-ic,
.info-card.pink   .info-ic, .info-card.amber .info-ic, .info-card.indigo .info-ic { color: #fff; opacity: .28; }
.info-card.green { background: linear-gradient(135deg,#10b981,#059669); }
.info-card.blue  { background: linear-gradient(135deg,#3b82f6,#2563eb); }
.info-card.grey  { background: linear-gradient(135deg,#6b7280,#4b5563); }
.info-card.pink  { background: linear-gradient(135deg,#ec4899,#db2777); }
.info-card.amber { background: linear-gradient(135deg,#f59e0b,#d97706); }
.info-card.indigo{ background: linear-gradient(135deg,#6366f1,#4f46e5); }
.info-card.plain { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 24px; }
.kv-grid > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv-grid strong { font-size: 15px; word-break: break-all; }
.kv-grid .muted { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }

/* ---- Buttons --------------------------------------------------------------*/
.primary { background: var(--primary); color: #fff; border: none; padding: 10px 18px; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.primary i[data-lucide] { width: 16px; height: 16px; }
.primary:hover { background: #1d4ed8; }
.primary.small { padding: 6px 12px; font-size: 13px; }
button:disabled, button[disabled] { opacity: .45; cursor: not-allowed; filter: grayscale(.3); }
.ghost-btn { background: transparent; border: 1px solid var(--line-2); color: inherit; padding: 8px 14px; border-radius: 8px; cursor: pointer; font: inherit; display: inline-flex; align-items: center; gap: 8px; }
.ghost-btn.small { padding: 4px 10px; font-size: 12px; }
.ghost-btn i[data-lucide] { width: 14px; height: 14px; }
.danger { background: transparent; border: 1px solid var(--red); color: var(--red); padding: 8px 14px; border-radius: 8px; cursor: pointer; font: inherit; display: inline-flex; align-items: center; gap: 8px; }
.danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.danger:hover { background: #fef2f2; }
.danger.solid:hover { background: #dc2626; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Tables (v1-style bordered container) ---------------------------------*/
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 12px 14px; text-align: left; vertical-align: middle; }
.data-table thead tr { background: var(--bg); border-bottom: 1px solid var(--line); }
.data-table thead th { background: var(--bg); font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding-top: 14px; padding-bottom: 14px; }
.data-table tbody tr { border-bottom: 1px solid var(--line); }
.data-table tbody tr:last-child { border-bottom: 0; }
.data-table tbody tr:hover { background: rgba(0,0,0,.02); }
.data-table .center { text-align: center; }
/* When a data-table is the direct child of a .panel (no wrap), still give it
   the bordered look so panels with tables match wrapped ones visually. */
.panel > .data-table { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.panel > .data-table thead tr:first-child th:first-child { border-top-left-radius: 12px; }
.panel > .data-table thead tr:first-child th:last-child { border-top-right-radius: 12px; }

/* Inline toggle switch (replaces raw checkboxes in tables) */
.toggle { position: relative; display: inline-block; width: 36px; height: 20px; cursor: pointer; vertical-align: middle; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider { position: absolute; inset: 0; background: var(--line-2); border-radius: 20px; transition: background .12s; }
.toggle-slider::before { content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .12s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* Mini icon-only button used inline next to text/code (e.g. reveal-key, rotate) */
.icon-mini { background: transparent; border: 0; padding: 2px 4px; cursor: pointer; color: var(--muted); vertical-align: middle; border-radius: 4px; }
.icon-mini:hover { background: var(--line); color: var(--ink); }
.icon-mini i[data-lucide] { width: 14px; height: 14px; }

/* Inline danger button (just the trash icon, no label) */
.ghost-btn.danger-btn { color: #b91c1c; border-color: rgba(239,68,68,.4); padding: 6px 8px; }
.ghost-btn.danger-btn:hover { background: rgba(239,68,68,.08); }

/* Status pills */
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 12px; white-space: nowrap; }
.pill.ok, .pill.approved, .pill.paid, .pill.active { background: rgba(16,185,129,.12); color: #047857; }
.pill.bad, .pill.rejected, .pill.failed { background: rgba(239,68,68,.12); color: #991b1b; }
.pill.warn, .pill.pending { background: rgba(245,158,11,.15); color: #92400e; }
.pill.paid_submitted { background: rgba(99,102,241,.12); color: #4338ca; }
.pill.expired { background: rgba(107,114,128,.15); color: #4b5563; }
.pill.muted { background: var(--line); color: var(--muted); }
.pill.soon { background: rgba(245,158,11,.15); color: #b45309; }

/* ---- Filter / search bars -------------------------------------------------*/
.filters { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--panel); color: var(--ink); font: inherit; }

/* Compact filter row used in transaction/agent/admin list pages. Locks every
   control (label-stacked input + raw input + button) to a single line height
   so search/date/Apply/Clear/Export sit on one tight baseline. */
.filter-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.filter-row > div { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.filter-row > div.grow { flex: 1; }
.filter-row label { margin: 0; font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.filter-row input, .filter-row select {
  height: 34px; padding: 0 10px; font-size: 13px;
  border: 1px solid var(--line-2); border-radius: 6px;
  background: var(--panel); color: var(--ink); font-family: inherit;
  box-sizing: border-box;
}
.filter-row .primary,
.filter-row .ghost-btn,
.filter-row .danger { height: 34px; padding: 0 14px; font-size: 13px; line-height: 1; }
.filter-row .ghost-btn.small,
.filter-row .primary.small { height: 34px; padding: 0 14px; font-size: 13px; }

/* ---- Forms ----------------------------------------------------------------*/
label { display: block; font-size: 13px; margin: 12px 0 6px; color: var(--muted); }
label.small { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.form-msg { margin-top: 8px; padding: 8px 12px; border-radius: 6px; background: #fef3c7; color: #92400e; font-size: 13px; }
.form-msg:empty { display: none; }   /* don't render the yellow strip when there's no message */
.form-msg.ok  { background: #d1fae5; color: #065f46; }
.form-msg.err { background: #fee2e2; color: #991b1b; }

/* Copy-row pattern (URL + Copy button) */
.copy-row { display: flex; gap: 6px; align-items: center; }
.copy-row input { flex: 1; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 6px; font: 12.5px ui-monospace, Menlo, monospace; }

/* ---- Code blocks ----------------------------------------------------------*/
.panel pre { background: #0f172a; color: #e2e8f0; padding: 14px 16px; border-radius: 8px; overflow-x: auto; font-size: 12.5px; line-height: 1.5; }
.panel code, code { background: rgba(15,23,42,.06); padding: 1px 6px; border-radius: 4px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
body[data-theme=dark] .panel code, body[data-theme=dark] code { background: rgba(255,255,255,.08); color: #f8fafc; }

/* ---- Auth pages (login / forgot / reset) ----------------------------------*/
.auth-body { background: linear-gradient(135deg, #1e3a8a 0%, #6d28d9 100%); min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { background: #fff; border-radius: 16px; padding: 36px 32px 24px; max-width: 400px; width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.auth-brand .brand-mark { width: 40px; height: 40px; font-size: 14px; }
.auth-brand-title { font-size: 17px; font-weight: 700; color: #111827; }
.auth-brand-sub { font-size: 12px; color: #6b7280; margin-top: 2px; }
.auth-card h1 { margin: 0 0 6px; font-size: 22px; color: #111827; }
.auth-card .muted { font-size: 13px; margin: 0 0 20px; }
.auth-card label { display: block; font-size: 12px; font-weight: 500; color: #4b5563; margin: 14px 0 6px; }
.auth-card input { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font: 14px inherit; color: var(--ink); }
.auth-card input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.auth-card .primary { width: 100%; margin-top: 18px; padding: 10px 16px; background: #2563eb; color: #fff; border: 0; border-radius: 8px; font: 14px inherit; font-weight: 600; cursor: pointer; justify-content: center; }

/* ---- Modals ---------------------------------------------------------------*/
/* Two class names used historically: .modal-backdrop (new) and .modal-overlay
   (older markup). Style both the same so the entire app works regardless. */
.modal-backdrop, .modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 32px 16px; }
.modal-backdrop[hidden], .modal-overlay[hidden] { display: none; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,.25); max-height: calc(100vh - 64px); overflow-y: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-x, .modal-card .modal-x { background: transparent; border: 0; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.modal-body { padding: 0; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.modal-card label { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--ink); font-weight: 500; }
.modal-card label.small { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 12px 0 4px; }
.modal-card input, .modal-card select, .modal-card textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; box-sizing: border-box; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
/* Inline checkbox-with-text labels — keep the row horizontal regardless of
   the .small text-transform; cap the text width so it doesn't column-wrap. */
.modal-card label[style*="flex"] { display: flex !important; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink); font-weight: 500; }
.modal-card label[style*="flex"] input[type="checkbox"] { width: 16px; height: 16px; padding: 0; margin: 0; flex-shrink: 0; }

/* ---- Drawer (right-side slide-out for merchant/agent detail) -------------*/
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer[hidden] { display: none; }
.drawer-bg { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.drawer-panel { position: absolute; right: 0; top: 0; height: 100vh; width: 560px; max-width: 100vw; background: var(--panel); overflow-y: auto; box-shadow: -20px 0 60px rgba(0,0,0,.25); display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: flex-start; gap: 16px; padding: 24px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 4px 0; }
.drawer-head .icon-btn { margin-left: auto; }
.drawer-body { padding: 24px; flex: 1; }
.drawer-actions { display: flex; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }

/* ---- Toast ----------------------------------------------------------------*/
.toast { position: fixed; top: 24px; right: 24px; background: #111827; color: #fff; padding: 12px 18px; border-radius: 8px; z-index: 100; box-shadow: 0 8px 20px rgba(0,0,0,.2); }

/* ---- Impersonation banner -------------------------------------------------*/
.imp-banner { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---- Platform Usage view (admin) ------------------------------------------*/
.funnel { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.funnel-stage { flex: 1; min-width: 160px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); text-align: center; }
.funnel-num { font-size: 32px; font-weight: 700; color: var(--ink); line-height: 1; }
.funnel-lbl { font-size: 12px; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; }
.funnel-pct { font-size: 13px; color: #16a34a; font-weight: 600; margin-top: 8px; }
.funnel-arrow { font-size: 22px; color: var(--muted); flex-shrink: 0; }
.usage-bars { display: flex; flex-direction: column; gap: 8px; }
.us-row { display: grid; grid-template-columns: 160px 1fr 60px; gap: 10px; align-items: center; font-size: 13px; }
.us-row .lbl { color: var(--ink); text-transform: capitalize; word-break: break-all; }
.us-row .track { background: var(--line); border-radius: 4px; height: 8px; overflow: hidden; }
.us-row .fill { background: linear-gradient(90deg, #6366f1, #06b6d4); height: 100%; border-radius: 4px; }
.us-row .n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.stack-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--line); }
.stack-bar > span { display: block; height: 100%; }
.stack-legend { display: flex; gap: 18px; margin-top: 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.stack-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 6px -1px 0; }

/* ---- Footprint card (merchant drawer + standalone) ------------------------*/
.fp-card { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.fp-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.fp-timeline { display: flex; flex-direction: column; gap: 10px; }
.fp-step { display: flex; gap: 10px; align-items: flex-start; }
.fp-step strong { font-size: 13px; color: var(--ink); display: block; }
.fp-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.fp-dot-1 { background: #6366f1; }
.fp-dot-2 { background: #06b6d4; }
.fp-dot-3 { background: #16a34a; }
.fp-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }

/* ---- Theme picker cards (admin → iSmart Pay → default checkout theme) ----*/
.theme-card {
  display: flex; flex-direction: column; gap: 12px; padding: 14px;
  border: 2px solid var(--line); border-radius: 14px; background: var(--panel);
  color: var(--ink); cursor: pointer; font: inherit; font-weight: 500;
  text-align: left; transition: border-color .15s, transform .12s, box-shadow .15s;
  position: relative;
}
.theme-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(37,99,235,.12); }
.theme-card.active {
  border-color: var(--primary);
  background: rgba(37,99,235,.06);
  box-shadow: 0 0 0 4px rgba(37,99,235,.20), 0 8px 24px rgba(37,99,235,.15);
}
.theme-card.active::after {
  content: '✓ SELECTED'; position: absolute; top: -10px; right: 10px;
  padding: 4px 10px; border-radius: 999px; background: var(--primary);
  color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .05em;
  box-shadow: 0 4px 12px rgba(37,99,235,.35);
}
.theme-card .theme-name { font-size: 14px; font-weight: 600; padding: 0 2px; display: flex; align-items: center; justify-content: space-between; }
.theme-card .theme-sub { font-size: 11px; font-weight: 400; color: var(--muted); }

/* The preview is a small mock of the checkout layout: brand chip, QR area, button. */
.theme-card .theme-preview {
  width: 100%; aspect-ratio: 16 / 10; border-radius: 10px;
  border: 1px solid var(--line); position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 10px;
}
.theme-card .tp-head { display: flex; align-items: center; gap: 6px; }
.theme-card .tp-logo { width: 14px; height: 14px; border-radius: 4px; }
.theme-card .tp-title-bar { flex: 1; height: 5px; border-radius: 2px; opacity: .35; background: currentColor; max-width: 60%; }
.theme-card .tp-qr { align-self: center; width: 38px; height: 38px; border-radius: 4px; opacity: .85; background:
  conic-gradient(currentColor 0 25%, transparent 0 50%, currentColor 0 75%, transparent 0); }
.theme-card .tp-btn { height: 14px; border-radius: 4px; opacity: .9; }

/* Theme palettes (background, accent text color used by ::after / tp-btn / tp-qr) */
.tp-classic { background: #f1f5f9; color: #6366f1; }
.tp-classic .tp-logo { background: #6366f1; }
.tp-classic .tp-btn  { background: #6366f1; }
.tp-orange  { background: #fff7ed; color: #ea580c; }
.tp-orange  .tp-logo { background: #ea580c; }
.tp-orange  .tp-btn  { background: #ea580c; }
.tp-dark    { background: #0f172a; color: #818cf8; }
.tp-dark    .tp-logo { background: #818cf8; }
.tp-dark    .tp-btn  { background: #818cf8; }
.tp-dark    .tp-title-bar { background: #cbd5e1; opacity: .25; }
.tp-blue    { background: #eff6ff; color: #1d4ed8; }
.tp-blue    .tp-logo { background: #1d4ed8; }
.tp-blue    .tp-btn  { background: #1d4ed8; }

/* ---- Nepal Gateway workspace ----------------------------------------------*/
.nepal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 1100px) { .nepal-grid { grid-template-columns: 1fr; } }
.qr-frame { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px; border: 1px dashed var(--line-2); border-radius: 12px; background: var(--bg); }
.qr-frame img { width: 240px; height: 240px; max-width: 100%; border-radius: 12px; background: #fff; padding: 8px; box-shadow: var(--shadow); }
.qr-frame .vpa-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font: 12.5px ui-monospace, Menlo, monospace; }

/* ---- Chart container ------------------------------------------------------*/
/* Chart.js sizes its canvas to fit the parent. Without a height on the parent
   the canvas ends up at 0px and you get an invisible chart inside a tall panel.
   Give every chart a fixed height + responsive width. */
.chart-box { position: relative; width: 100%; height: 240px; }
.chart-box canvas { width: 100% !important; height: 100% !important; }
.chart-box.tall { height: 320px; }

/* ---- Loading state --------------------------------------------------------*/
.loading { color: var(--muted); padding: 32px; text-align: center; }
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }

/* ---- Sidebar collapsed (laptop hamburger) ---------------------------------*/
.app.sidebar-collapsed { grid-template-columns: 64px 1fr; }
.app.sidebar-collapsed .sidebar .brand-title,
.app.sidebar-collapsed .sidebar .brand-sub,
.app.sidebar-collapsed .sidebar .brand-pro,
.app.sidebar-collapsed .sidebar .nav-sec,
.app.sidebar-collapsed .sidebar .nav-item > span { display: none; }
.app.sidebar-collapsed .sidebar .nav-item { justify-content: center; padding: 12px 0; }
.app.sidebar-collapsed .sidebar .brand { justify-content: center; padding: 16px 0; }
.app.sidebar-collapsed .sidebar .sidebar-foot { justify-content: center; padding: 8px 0; }

/* ---- Mobile (≤1024px): hide sidebar by default, hamburger reveals it ------*/
@media (max-width: 1024px) {
  .app { grid-template-columns: 0 1fr; }
  .app:not(.sidebar-open) .sidebar { width: 0; overflow: hidden; }
  .app.sidebar-open .sidebar {
    position: fixed; top: 0; left: 0; width: 240px; height: 100vh;
    z-index: 30; box-shadow: 8px 0 24px rgba(0,0,0,.25);
  }
  .app.sidebar-open::after {
    content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 29;
  }
  #sidebarToggle { display: grid; }
  .content { padding: 16px 16px 32px; }
  .topbar { padding: 10px 16px; }
  .nepal-grid { grid-template-columns: 1fr; }
  .drawer-panel { width: 100vw; }
  .modal-card { max-width: 100%; }
}

@media (max-width: 640px) {
  .cards-row { grid-template-columns: 1fr; }
  .funnel { flex-direction: column; }
  .funnel-arrow { transform: rotate(90deg); }
}
