@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #F5F7F8;
  --surface: #FFFFFF;
  --surface-2: #F1F3F4;
  --surface-3: #E9ECED;
  --line: #E4E7E8;
  --text: #171A1C;
  --muted: #6B7378;
  --accent: #00AA13;
  --accent-soft: rgba(0, 170, 19, 0.10);
  --mint: #16C74E;
  --mint-soft: rgba(22, 199, 78, 0.10);
  --warn: #F5A623;
  --warn-soft: rgba(245, 166, 35, 0.12);
  --danger: #E1483F;
  --danger-soft: rgba(225, 72, 63, 0.10);
  --radius: 16px;
  --radius-lg: 24px;
  --radius-pill: 100px;
  --elevation-1: 0 1px 2px rgba(23,26,28,0.04), 0 1px 4px rgba(23,26,28,0.06);
  --elevation-2: 0 4px 10px rgba(23,26,28,0.07), 0 2px 4px rgba(23,26,28,0.05);
  --elevation-3: 0 10px 26px rgba(23,26,28,0.12), 0 4px 8px rgba(23,26,28,0.06);
  --font-display: 'Plus Jakarta Sans', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
hr { border: none; border-top: 1px solid var(--line); }

/* ---------- Buttons (Material-style) ---------- */
.btn {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface-3);
  color: var(--text);
  padding: 10px 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: border-color .15s ease, transform .08s ease, filter .15s ease, box-shadow .15s ease;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: var(--elevation-1);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: var(--elevation-2); }
.btn-primary:active { box-shadow: var(--elevation-1); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--line); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-block { width: 100%; justify-content: center; }

/* Floating Action Button */
.fab {
  position: fixed; right: 20px; bottom: 96px; z-index: 15;
  width: 56px; height: 56px; border-radius: var(--radius-lg);
  background: var(--accent); color: #fff; border: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--elevation-3); cursor: pointer;
  transition: transform .12s ease, filter .15s ease;
}
.fab:hover { filter: brightness(1.08); }
.fab:active { transform: scale(0.94); }
.fab svg { width: 26px; height: 26px; }

/* ---------- Admin shell (sidebar layout) ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 9px;
  padding: 0 8px 20px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
}
.sidebar .brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px var(--mint-soft); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar a.nav-link {
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.sidebar a.nav-link:hover { color: var(--text); background: var(--surface-2); }
.sidebar a.nav-link.active { color: var(--text); background: var(--accent-soft); }
.sidebar .sidebar-foot { margin-top: auto; padding: 0 8px; font-size: 12px; color: var(--muted); }

.main { flex: 1; min-width: 0; }
.main-inner { max-width: 1080px; margin: 0 auto; padding: 30px 28px 80px; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-head h1 { font-family: var(--font-display); font-size: 21px; margin: 0; }
.page-head p { color: var(--muted); font-size: 13.5px; margin: 4px 0 0; }

/* ---------- Cards / stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--elevation-1); }
.stat-card .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 8px; }
.stat-card .value { font-family: var(--font-mono); font-size: 23px; font-weight: 600; }
.stat-card .value.accent { color: var(--accent); }
.stat-card .value.mint { color: var(--mint); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 20px; box-shadow: var(--elevation-1); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); gap: 10px; flex-wrap: wrap; }
.panel-head h2 { font-family: var(--font-display); font-size: 15px; margin: 0; font-weight: 600; }

/* ---------- Tables ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 600; padding: 10px 18px; border-bottom: 1px solid var(--line);
}
table.data td { padding: 13px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data .mono { font-family: var(--font-mono); font-size: 12.5px; }
table.data .muted { color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  padding: 4px 9px; border-radius: 100px;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.pending, .badge.active { background: var(--warn-soft); color: var(--warn); }
.badge.paid { background: var(--mint-soft); color: var(--mint); }
.badge.expired, .badge.suspended, .badge.failed { background: var(--danger-soft); color: var(--danger); }
.badge.cr { background: var(--mint-soft); color: var(--mint); }
.badge.db { background: var(--danger-soft); color: var(--danger); }
.badge.not_sent { background: var(--surface-3); color: var(--muted); }
.badge.sent { background: var(--mint-soft); color: var(--mint); }

.empty-row { padding: 46px 20px; text-align: center; color: var(--muted); }
.empty-row .eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: .1em; color: var(--accent); margin-bottom: 8px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; color: var(--text); font-family: var(--font-mono); font-size: 13.5px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.field-hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.err, .ok {
  border-radius: 14px; padding: 12px 14px; font-size: 13px; margin-bottom: 16px;
}
.err { background: var(--danger-soft); color: var(--danger); }
.ok { background: var(--mint-soft); color: var(--mint); }

.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 26px; max-width: 460px; box-shadow: var(--elevation-1); }

/* ---------- Code / key display ---------- */
.code-box {
  background: #060911; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; font-family: var(--font-mono); font-size: 12.5px; color: #C9D3E8;
  overflow-x: auto; white-space: pre;
}
.key-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #060911; border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px;
  font-family: var(--font-mono); font-size: 12.5px; margin-bottom: 10px; word-break: break-all;
}
.copy-btn { flex-shrink: 0; }

/* ---------- Mobile app shell (vendor dashboard: top header + bottom nav) ---------- */
.mobile-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 5;
  box-shadow: var(--elevation-1);
}
.mobile-topbar .brand { display: flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.mobile-topbar .brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); }
.mobile-topbar .logout-link { color: var(--muted); display: flex; }
.mobile-topbar .logout-link:hover { color: var(--danger); }
.mobile-topbar .logout-link svg { width: 20px; height: 20px; }

.mobile-main { padding-bottom: 100px; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 10px 6px calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 10;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.3);
}
.bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--muted); font-size: 11px; font-weight: 500;
  flex: 1; max-width: 120px;
}
.bottom-nav-item .nav-icon-wrap {
  display: flex; align-items: center; justify-content: center;
  width: 52px; height: 30px; border-radius: var(--radius-pill);
  transition: background .2s ease, color .2s ease;
}
.bottom-nav-item svg { width: 22px; height: 22px; }
.bottom-nav-item:hover .nav-icon-wrap { background: var(--surface-2); }
.bottom-nav-item.active { color: var(--text); }
.bottom-nav-item.active .nav-icon-wrap { background: var(--accent-soft); color: var(--accent); }

/* ---------- Public topbar (checkout, docs) ---------- */
.public-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 26px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 5;
  box-shadow: var(--elevation-1);
}
.public-topbar .brand { display: flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.public-topbar .brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); }
.public-topbar nav a { color: var(--muted); font-size: 13.5px; margin-left: 18px; }
.public-topbar nav a:hover { color: var(--text); }

/* ---------- Checkout / receipt ---------- */
.receipt-wrap { max-width: 420px; margin: 44px auto; padding: 0 20px 60px; }
.receipt { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); position: relative; overflow: hidden; box-shadow: var(--elevation-2); }
.receipt::before, .receipt::after {
  content: ''; position: absolute; left: 50%; width: 26px; height: 26px;
  background: var(--bg); border-radius: 50%; transform: translateX(-50%);
}
.receipt::before { top: -13px; } .receipt::after { bottom: -13px; }
.receipt-top-accent {
  height: 5px;
  background: linear-gradient(90deg, var(--accent), var(--mint));
}
.receipt-head { text-align: center; padding: 22px 22px 18px; border-bottom: 1px dashed var(--line); }
.receipt-head .store { font-family: var(--font-display); font-weight: 600; font-size: 16px; margin: 0 0 4px; }
.receipt-head .inv-id { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.receipt-body { padding: 26px 22px; text-align: center; }
.qr-box { background: #fff; border-radius: 14px; padding: 16px; display: inline-block; margin-bottom: 18px; box-shadow: 0 8px 20px rgba(23,26,28,0.10); }
.qr-box img { display: block; width: 220px; height: 220px; object-fit: contain; }
.amount-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 6px; }
.amount-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.amount-value { font-family: var(--font-mono); font-size: 32px; font-weight: 600; color: var(--accent); }
.copy-chip {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 100px;
  padding: 5px 11px; cursor: pointer;
}
.copy-chip:hover { color: var(--text); border-color: var(--accent); }
.amount-hint { font-size: 12.5px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.amount-hint b { color: var(--text); }
.expiry-note { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); margin-top: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 12px; padding: 7px 14px; border-radius: 100px; margin-top: 18px; }
.status-pill.pending { background: var(--warn-soft); color: var(--warn); }
.status-pill.paid { background: var(--mint-soft); color: var(--mint); }
.status-pill.expired { background: var(--danger-soft); color: var(--danger); }
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill.pending .dot { animation: pulse 1.4s infinite ease-in-out; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.receipt-foot { padding: 16px 22px 22px; text-align: center; color: var(--muted); font-size: 12px; }

.success-badge { display: flex; justify-content: center; }
.success-badge svg { width: 72px; height: 72px; }
.success-badge circle { stroke: var(--mint); stroke-width: 3; stroke-dasharray: 166; stroke-dashoffset: 166; animation: circle-draw .5s ease forwards; }
.success-badge path { stroke: var(--mint); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 48; stroke-dashoffset: 48; animation: check-draw .35s .5s ease forwards; }
@keyframes circle-draw { to { stroke-dashoffset: 0; } }
@keyframes check-draw { to { stroke-dashoffset: 0; } }

/* ---------- Docs page ---------- */
.docs-shell { display: flex; }
.docs-nav { width: 200px; flex-shrink: 0; padding: 30px 16px; border-right: 1px solid var(--line); }
.docs-nav a { display: block; padding: 7px 10px; border-radius: 8px; font-size: 13.5px; color: var(--muted); }
.docs-nav a:hover { color: var(--text); background: var(--surface-2); }
.docs-main { flex: 1; max-width: 720px; padding: 34px 30px 100px; }
.docs-main h2 { font-family: var(--font-display); font-size: 19px; margin: 36px 0 12px; }
.docs-main h2:first-child { margin-top: 0; }
.docs-main p { color: #C3CBDD; font-size: 14.5px; line-height: 1.7; }
.docs-main table.params { width: 100%; border-collapse: collapse; font-size: 13px; margin: 14px 0 24px; }
.docs-main table.params th, .docs-main table.params td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.docs-main table.params th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; }
.docs-main table.params td.mono { font-family: var(--font-mono); color: var(--accent); }

/* ---------- Network hero (landing) ---------- */
.hero { padding: 70px 26px 40px; text-align: center; }
.hero h1 { font-family: var(--font-display); font-size: 34px; margin: 0 0 12px; letter-spacing: -0.01em; }
.hero p { color: var(--muted); font-size: 15.5px; max-width: 480px; margin: 0 auto 30px; }
.network {
  max-width: 640px; margin: 0 auto 10px;
}
.upload-preview {
  width: 140px; height: 140px; border: 1px dashed var(--line); border-radius: 10px;
  background: var(--surface-2); display: flex; align-items: center; justify-content: center;
  overflow: hidden; margin-bottom: 12px; color: var(--muted); font-size: 12px; text-align: center;
}
.upload-preview img { width: 100%; height: 100%; object-fit: contain; background: #fff; }

@media (max-width: 720px) {
  .sidebar { display: none; }
  .docs-nav { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
