/* ==========================================================================
   Juk Gateway — design system
   One stylesheet for the landing page, dashboard, docs and hidden console.
   No framework, no build step: a single ~30 KB file that renders instantly.
   ========================================================================== */

:root {
  color-scheme: dark;

  --jade-300: #7bf3d0;
  --jade-400: #46e9bd;
  --jade-500: #1fd4a4;
  --jade-600: #10b489;
  --jade-ink: #04140f;
  --gold-400: #f6c96b;
  --gold-500: #eab54a;
  --lilac-400: #b3a0ff;
  --danger-400: #ff8b8b;
  --danger-600: #e05252;

  --ink-950: #05080f;
  --ink-900: #080d18;
  --ink-850: #0b1220;
  --ink-800: #0f1729;
  --ink-750: #131d33;
  --ink-700: #18233c;

  --page: var(--ink-950);
  --surface: rgba(19, 29, 51, 0.72);
  --surface-solid: #121b2e;
  --surface-2: rgba(255, 255, 255, 0.035);
  --surface-3: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);

  --text: #eaf0fa;
  --text-soft: #c3cee0;
  --muted: #8b9ab3;
  --faint: #64748b;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 18px 40px -24px rgba(0, 0, 0, 0.9);
  --shadow-lg: 0 40px 90px -40px rgba(0, 0, 0, 0.95);
  --glow: 0 0 0 1px rgba(31, 212, 164, 0.25), 0 20px 60px -30px rgba(31, 212, 164, 0.55);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --font: "Plus Jakarta Sans", "Kantumruy Pro", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-km: "Kantumruy Pro", "Noto Sans Khmer", "Khmer OS Battambang", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --header-h: 68px;
}

html[data-theme="light"] {
  color-scheme: light;

  --jade-400: #0f9d7c;
  --jade-500: #0b8a6d;
  --jade-600: #087259;
  --jade-ink: #ffffff;
  --gold-400: #b7791f;
  --gold-500: #9c6412;

  --page: #f7f7f3;
  --surface: rgba(255, 255, 255, 0.85);
  --surface-solid: #ffffff;
  --surface-2: rgba(9, 20, 38, 0.035);
  --surface-3: rgba(9, 20, 38, 0.06);
  --line: rgba(9, 20, 38, 0.1);
  --line-strong: rgba(9, 20, 38, 0.18);

  --text: #0a1120;
  --text-soft: #2a3547;
  --muted: #5c6a80;
  --faint: #7b8798;

  --shadow-sm: 0 1px 2px rgba(9, 20, 38, 0.06);
  --shadow-md: 0 18px 40px -28px rgba(9, 20, 38, 0.35);
  --shadow-lg: 0 40px 90px -50px rgba(9, 20, 38, 0.45);
  --glow: 0 0 0 1px rgba(11, 138, 109, 0.2), 0 20px 60px -34px rgba(11, 138, 109, 0.4);

  --danger-400: #c53030;
}

/* --------------------------------------------------------------- reset -- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Two soft glows behind everything: jade top-left, gold bottom-right. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 620px at 12% -8%, rgba(31, 212, 164, 0.14), transparent 62%),
    radial-gradient(760px 560px at 92% 8%, rgba(246, 201, 107, 0.08), transparent 60%),
    radial-gradient(900px 700px at 50% 110%, rgba(179, 160, 255, 0.07), transparent 65%);
}

html[data-theme="light"] body::before {
  background:
    radial-gradient(900px 620px at 10% -10%, rgba(15, 157, 124, 0.13), transparent 60%),
    radial-gradient(760px 560px at 95% 0%, rgba(234, 181, 74, 0.14), transparent 55%);
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { letter-spacing: -0.02em; line-height: 1.15; font-weight: 800; }
::selection { background: var(--jade-400); color: var(--jade-ink); }

:focus-visible {
  outline: 2px solid var(--jade-400);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------------------------------------------------------- typography -- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--jade-400);
}

.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
}

h1.display {
  font-size: clamp(2.35rem, 5.2vw, 4.15rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.03;
}

h1.display .accent {
  background: linear-gradient(100deg, var(--jade-300), var(--jade-500) 45%, var(--gold-400));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  font-size: clamp(1rem, 1.35vw, 1.14rem);
  color: var(--muted);
  max-width: 60ch;
}

.km { font-family: var(--font-km); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.hidden { display: none !important; }

/* ------------------------------------------------------------- layout -- */

.wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 22px;
}

.wrap-narrow { max-width: 860px; }

.section { padding: 76px 0; }
.section-sm { padding: 48px 0; }

.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1 1 auto; }
.wrap-row { flex-wrap: wrap; }

.grid { display: grid; gap: 18px; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-overview { grid-template-columns: 1.15fr .85fr; }

.stack-sm > * + * { margin-top: 8px; }
.stack > * + * { margin-top: 16px; }
.stack-lg > * + * { margin-top: 28px; }

/* ------------------------------------------------------------- header -- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(16px) saturate(140%);
  background: color-mix(in srgb, var(--page) 78%, transparent);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  color: var(--jade-ink);
  background: linear-gradient(145deg, var(--jade-300), var(--jade-500) 60%, var(--jade-600));
  box-shadow: 0 10px 26px -12px rgba(31, 212, 164, 0.9);
}

.brand-name { font-weight: 800; letter-spacing: -0.02em; font-size: 16px; line-height: 1.1; white-space: nowrap; }
.brand-sub { font-size: 10.5px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--faint); }

.nav-links { display: flex; align-items: center; gap: 4px; }

.nav-links a {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-soft);
  transition: background 0.16s ease, color 0.16s ease;
}

.nav-links a:hover { background: var(--surface-3); color: var(--text); }

.header-actions { display: flex; align-items: center; gap: 10px; }

/* Mobile-only menu button and its panel. */
.mobile-only { display: none; }
.mobile-nav { display: none; }

@media (max-width: 760px) {
  .mobile-only { display: inline-flex; }
  .brand-sub { display: none; }
  .brand-name { font-size: 15px; }
  .site-header .wrap { gap: 8px; }
  .header-actions { gap: 6px; }
  .btn-sm { padding: 9px 12px; font-size: 12.5px; }
  .mobile-nav.open {
    display: grid;
    gap: 2px;
    padding: 6px 22px 14px;
    border-top: 1px solid var(--line);
  }
  .mobile-nav a {
    padding: 11px 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-soft);
  }
  .mobile-nav a:hover { background: var(--surface-3); color: var(--text); }
}

/* ------------------------------------------------------------ buttons -- */

.btn {
  --btn-bg: var(--surface-3);
  --btn-fg: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
  white-space: nowrap;
  user-select: none;
}

.btn:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--jade-300), var(--jade-500) 70%);
  border-color: transparent;
  color: var(--jade-ink);
  box-shadow: 0 14px 34px -18px rgba(31, 212, 164, 0.9);
}

.btn-primary:hover { box-shadow: 0 18px 44px -18px rgba(31, 212, 164, 0.95); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  color: #22180a;
  border-color: transparent;
}

.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-3); }

.btn-outline { background: transparent; border-color: var(--line-strong); }

.btn-danger { color: var(--danger-400); border-color: rgba(255, 139, 139, 0.35); background: rgba(255, 139, 139, 0.08); }

.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 10px; }
.btn-lg { padding: 14px 24px; font-size: 15px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 11px; }

.btn .spinner { width: 15px; height: 15px; border-width: 2px; }

/* -------------------------------------------------------------- bits -- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-soft);
}

.chip-jade { color: var(--jade-400); border-color: rgba(31, 212, 164, 0.3); background: rgba(31, 212, 164, 0.09); }
.chip-gold { color: var(--gold-400); border-color: rgba(246, 201, 107, 0.3); background: rgba(246, 201, 107, 0.09); }
.chip-danger { color: var(--danger-400); border-color: rgba(255, 139, 139, 0.3); background: rgba(255, 139, 139, 0.08); }

.dot { width: 7px; height: 7px; border-radius: 999px; background: var(--jade-400); box-shadow: 0 0 10px currentColor; }

.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
}

.card-pad { padding: 22px; }
.card-hover { transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease; }
.card-hover:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow-lg); }

.card-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-body { padding: 22px; }
.card-foot { padding: 16px 22px; border-top: 1px solid var(--line); }

.note {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 13.5px;
  color: var(--text-soft);
}

.note-jade { border-color: rgba(31, 212, 164, 0.26); background: rgba(31, 212, 164, 0.07); }
.note-gold { border-color: rgba(246, 201, 107, 0.26); background: rgba(246, 201, 107, 0.07); }
.note-danger { border-color: rgba(255, 139, 139, 0.26); background: rgba(255, 139, 139, 0.07); }

/* --------------------------------------------------------------- hero -- */

.hero { padding: 72px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1.08fr 0.92fr; gap: 48px; align-items: center; }
.hero-copy { max-width: 620px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 26px; color: var(--muted); font-size: 13px; }
.hero-meta span { display: inline-flex; align-items: center; gap: 7px; }

.hero-art { position: relative; }

.device {
  border-radius: var(--r-xl);
  border: 1px solid var(--line-strong);
  background: linear-gradient(160deg, var(--ink-800), var(--ink-950) 70%);
  box-shadow: var(--shadow-lg), var(--glow);
  overflow: hidden;
}

html[data-theme="light"] .device { background: linear-gradient(160deg, #ffffff, #f1f5f2 80%); }

.device-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.device-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--line-strong); }
.device-title { margin-left: 8px; font-size: 11.5px; color: var(--faint); font-family: var(--mono); }
.device-body { padding: 20px; }

.qr-demo {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 20px;
  align-items: center;
}

.qr-frame {
  padding: 12px;
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.qr-frame svg { width: 100%; height: auto; }

.demo-amount { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.demo-line { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
.demo-line:last-child { border-bottom: 0; }
.demo-line span:first-child { color: var(--muted); }
.demo-line span:last-child { font-family: var(--mono); font-size: 12px; }

.pulse-ring {
  position: absolute;
  inset: auto -10px -14px auto;
  right: -14px;
  bottom: -18px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(31, 212, 164, 0.35);
  background: color-mix(in srgb, var(--surface-solid) 88%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 700;
}

/* --------------------------------------------------------- marketing --- */

.feature {
  padding: 22px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface-2);
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.feature:hover { border-color: var(--line-strong); transform: translateY(-2px); }

.feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(31, 212, 164, 0.1);
  border: 1px solid rgba(31, 212, 164, 0.22);
  color: var(--jade-400);
  margin-bottom: 14px;
}

.feature h3 { font-size: 15.5px; margin-bottom: 6px; }
.feature p { font-size: 13.5px; color: var(--muted); }

.step { position: relative; padding: 20px 20px 20px 22px; border-left: 1px solid var(--line); }
.step-num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--jade-400);
  margin-bottom: 8px;
}
.step h3 { font-size: 15px; margin-bottom: 6px; }
.step p { font-size: 13.5px; color: var(--muted); }

.stat { padding: 18px 20px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2); }
.stat-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); font-weight: 700; }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; margin-top: 4px; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ------------------------------------------------------------- pricing -- */

.plans-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: stretch; }

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 22px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.plan-card:hover { transform: translateY(-3px); border-color: var(--line-strong); }

.plan-card.is-featured {
  border-color: rgba(31, 212, 164, 0.42);
  box-shadow: 0 24px 60px -34px rgba(31, 212, 164, 0.5);
  background: linear-gradient(180deg, rgba(31, 212, 164, 0.08), var(--surface) 45%);
}

.plan-card.is-current { border-color: var(--gold-400); }

.plan-badge {
  position: absolute;
  top: -11px;
  left: 22px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--jade-400);
  color: var(--jade-ink);
}

.plan-name { font-size: 15px; font-weight: 800; }
.plan-name-km { font-family: var(--font-km); font-size: 13px; line-height: 1.7; color: var(--muted); }
.plan-price { display: flex; align-items: baseline; gap: 6px; }
.plan-price .amount { font-size: 34px; font-weight: 800; letter-spacing: -0.04em; }
.plan-price .per { font-size: 12px; color: var(--muted); }
.plan-limit { font-size: 12.5px; color: var(--text-soft); font-weight: 600; }

.plan-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; font-size: 13px; color: var(--text-soft); }
.plan-features li { display: flex; gap: 9px; align-items: flex-start; }
.plan-features li::before {
  content: "✓";
  color: var(--jade-400);
  font-weight: 800;
  font-size: 12px;
  line-height: 1.5;
}

.plan-card .btn { margin-top: auto; }

/* --------------------------------------------------------------- forms -- */

.field { display: grid; gap: 7px; }
.label { font-size: 12.5px; font-weight: 700; color: var(--text-soft); }
.hint { font-size: 11.5px; color: var(--faint); }

.input, .select, .textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--jade-400);
  box-shadow: 0 0 0 3px rgba(31, 212, 164, 0.16);
  background: var(--surface-3);
}

.textarea { min-height: 92px; resize: vertical; font-family: var(--mono); font-size: 12.5px; }

/* Khmer fields keep the Khmer face even where a mono face would otherwise win. */
.input.km,
.select.km,
.textarea.km { font-family: var(--font-km); }
.textarea.km { font-size: 13px; line-height: 1.9; }

.form-grid { display: grid; gap: 15px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }

.error-text { color: var(--danger-400); font-size: 12.5px; }
.success-text { color: var(--jade-400); font-size: 12.5px; }

/* -------------------------------------------------------------- tables -- */

.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  padding: 11px 14px;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-weight: 800;
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.14s ease; }
.table tbody tr:hover { background: var(--surface-2); }

.empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

/* --------------------------------------------------------- dashboard --- */

.dash { padding: 30px 0 80px; }

.dash-tabs {
  display: flex;
  gap: 4px;
  padding: 5px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  overflow-x: auto;
  scrollbar-width: none;
}

.dash-tabs::-webkit-scrollbar { display: none; }

.dash-tab {
  padding: 8px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease;
}

.dash-tab:hover { color: var(--text); }
.dash-tab.active { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-sm); }

.tab-panel { margin-top: 22px; }
.tab-panel[hidden] { display: none; }

.kv { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }

.quota-bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.quota-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--jade-400), var(--jade-600)); transition: width 0.4s ease; }
.quota-fill.warn { background: linear-gradient(90deg, var(--gold-400), #e08a2c); }
.quota-fill.danger { background: linear-gradient(90deg, var(--danger-400), var(--danger-600)); }

.store-card { display: grid; gap: 14px; }
.key-row { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 10px; border: 1px dashed var(--line-strong); background: var(--surface-2); font-family: var(--mono); font-size: 11.5px; }
.key-row .key-value { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* -------------------------------------------------------------- modal -- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(3, 6, 12, 0.72);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

html[data-theme="light"] .modal-backdrop { background: rgba(10, 17, 32, 0.42); }

.modal-backdrop.open { opacity: 1; pointer-events: auto; }

.modal {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border-radius: var(--r-xl);
  border: 1px solid var(--line-strong);
  background: var(--surface-solid);
  box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(0.985);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-backdrop.open .modal { transform: translateY(0) scale(1); }
.modal.wide { max-width: 720px; }

.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 22px 22px 0; }
.modal-title { font-size: 18px; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 0 22px 22px; display: flex; gap: 10px; }
.modal-close {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}
.modal-close:hover { background: var(--surface-3); color: var(--text); }

.checkout-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  margin-bottom: 18px;
}

.checkout-qr {
  display: grid;
  place-items: center;
  padding: 14px;
  border-radius: var(--r-lg);
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  width: min(260px, 76vw);
  margin: 0 auto;
}
.checkout-qr svg { width: 100%; height: auto; }

.checkout-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
}

.checkout-timer { font-family: var(--mono); font-size: 12.5px; color: var(--text-soft); }

.success-mark {
  width: 62px; height: 62px;
  margin: 6px auto 14px;
  border-radius: 999px;
  display: grid; place-items: center;
  background: rgba(31, 212, 164, 0.12);
  border: 1px solid rgba(31, 212, 164, 0.4);
  color: var(--jade-400);
  animation: pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* -------------------------------------------------- payway-style sheet -- */
/* Modelled on the PayWay checkout sheet: white card, merchant header, a live
   scanning line over the QR and a pulsing "waiting" state. */

.payway-sheet {
  max-width: 430px;
  padding: 0;
  background: #ffffff;
  color: #0b1220;
  border: 0;
  border-radius: 22px;
  box-shadow: 0 30px 80px -20px rgba(3, 8, 20, 0.55), 0 2px 8px rgba(3, 8, 20, 0.12);
}

.pw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 0;
}

.pw-merchant { display: flex; align-items: center; gap: 11px; min-width: 0; }

.pw-logo {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #1fd4a4, #0f9f7c);
  color: #04241c;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -0.02em;
  box-shadow: 0 6px 16px rgba(31, 212, 164, 0.35);
}

.pw-merchant-name {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: #0b1220;
  line-height: 1.2;
}

.pw-merchant-sub {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.pw-close {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 14px;
}
.pw-close:hover { background: #e2e8f0; color: #0b1220; }

.pw-amount { text-align: center; padding: 16px 20px 4px; }
.pw-amount-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #94a3b8;
}
.pw-amount-value {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #0b1220;
  font-variant-numeric: tabular-nums;
}
.pw-plan { margin-top: 2px; font-size: 13px; font-weight: 600; color: #64748b; }

.pw-body { padding: 16px 20px 18px; }

.pw-loading {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 30px 0;
  font-size: 13px;
  color: #64748b;
}
.pw-loading .spinner { border-color: #e2e8f0; border-top-color: #0f9f7c; }

.pw-qr-card {
  position: relative;
  width: min(258px, 72vw);
  margin: 0 auto;
  padding: 15px;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  box-shadow: 0 12px 30px -14px rgba(15, 23, 42, 0.25);
}
.pw-qr svg { display: block; width: 100%; height: auto; }

.pw-scanline {
  position: absolute;
  left: 12px;
  right: 12px;
  height: 42%;
  top: -46%;
  border-bottom: 2px solid rgba(15, 159, 124, 0.85);
  background: linear-gradient(
    180deg,
    rgba(31, 212, 164, 0) 0%,
    rgba(31, 212, 164, 0.06) 55%,
    rgba(31, 212, 164, 0.18) 94%,
    rgba(31, 212, 164, 0.38) 100%
  );
  filter: drop-shadow(0 0 6px rgba(31, 212, 164, 0.35));
  animation: pw-scan 2.6s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  pointer-events: none;
}

@keyframes pw-scan {
  0%   { top: -46%; opacity: 0; }
  12%  { opacity: 1; }
  72%  { top: 100%; opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

.pw-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 3px solid #0f9f7c;
  pointer-events: none;
}
.pw-corner.tl { top: 9px; left: 9px; border-right: 0; border-bottom: 0; border-top-left-radius: 9px; }
.pw-corner.tr { top: 9px; right: 9px; border-left: 0; border-bottom: 0; border-top-right-radius: 9px; }
.pw-corner.bl { bottom: 9px; left: 9px; border-right: 0; border-top: 0; border-bottom-left-radius: 9px; }
.pw-corner.br { bottom: 9px; right: 9px; border-left: 0; border-top: 0; border-bottom-right-radius: 9px; }

.pw-waiting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.pw-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 999px;
  background: #1fd4a4;
  animation: pw-pulse 1.6s ease-in-out infinite;
}

@keyframes pw-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(31, 212, 164, 0.55); }
  60%      { box-shadow: 0 0 0 7px rgba(31, 212, 164, 0); }
}

.pw-ellipsis::after { content: ''; animation: pw-dots 1.4s steps(4, end) infinite; }
@keyframes pw-dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}

.pw-timer {
  margin-top: 6px;
  text-align: center;
  font-size: 12px;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}

.pw-apps { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 14px; }
.pw-app {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  font-size: 10.5px;
  font-weight: 700;
}

.pw-success { text-align: center; padding: 12px 0 6px; }
.pw-success h3 { font-size: 18px; color: #0b1220; }
.pw-success .success-mark { color: #0f9f7c; }

.pw-foot { display: flex; gap: 10px; padding: 0 20px 20px; }

.pw-btn-ghost,
.pw-btn-primary {
  flex: 1;
  height: 46px;
  border: 0;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 800;
  transition: transform 0.12s ease, background 0.15s ease;
}
.pw-btn-ghost { background: #f1f5f9; color: #475569; }
.pw-btn-ghost:hover { background: #e2e8f0; }
.pw-btn-primary { background: #0b1220; color: #ffffff; }
.pw-btn-primary:hover { background: #1e293b; }
.pw-btn-ghost:active,
.pw-btn-primary:active { transform: scale(0.985); }

@media (max-width: 560px) {
  .modal-backdrop.payway-backdrop { padding: 0; align-items: end; }
  .payway-backdrop .payway-sheet {
    max-width: 100%;
    border-radius: 22px 22px 0 0;
    max-height: 94vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pw-scanline { animation: none; top: 50%; opacity: 0.3; }
  .pw-dot,
  .pw-ellipsis::after { animation: none; }
}

/* -------------------------------------------------------------- toast -- */

.toast-host { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: grid; gap: 10px; }

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 13px;
  border: 1px solid var(--line-strong);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.22s ease-out;
}

.toast.ok { border-color: rgba(31, 212, 164, 0.4); }
.toast.err { border-color: rgba(255, 139, 139, 0.4); }

@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* --------------------------------------------------------- misc bits --- */

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--jade-400);
  border-radius: 999px;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

.code {
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--ink-950);
  color: #d7e3f4;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  position: relative;
}

html[data-theme="light"] .code { background: #0c1424; }

.code .c { color: #7f96b3; }
.code .s { color: var(--jade-300); }

.footer {
  border-top: 1px solid var(--line);
  padding: 36px 0 42px;
  margin-top: 40px;
  color: var(--muted);
  font-size: 13px;
}

.footer-grid { display: flex; flex-wrap: wrap; gap: 28px; justify-content: space-between; }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; }
.footer a:hover { color: var(--text); }

.reveal { animation: reveal 0.5s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* --------------------------------------------------------- responsive -- */

@media (max-width: 1000px) {
  .hero-grid { grid-template-columns: 1fr; gap: 34px; }
  .hero { padding-top: 48px; }
  .plans-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Phones: drop the secondary header actions so the menu button never clips. */
@media (max-width: 560px) {
  .hide-sm { display: none; }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  .section { padding: 56px 0; }
  .nav-links { display: none; }
  .dash { padding-top: 18px; }
  .dash-tabs { flex-wrap: wrap; overflow-x: visible; }
  .dash-tab { flex: 1 1 30%; padding: 9px 8px; font-size: 12.5px; text-align: center; }
  .grid-overview,
  .grid-3, .grid-2 { grid-template-columns: 1fr; }

  /* Keys: the masked key gets its own line, actions split the row below. */
  .key-row { flex-wrap: wrap; }
  .key-row .key-value { flex: 1 1 100%; }
  .key-row .btn { flex: 1 1 auto; }

  /* Tables: drop secondary columns instead of hiding them behind a sideways scroll. */
  .table th, .table td { padding-left: 10px; padding-right: 10px; }
  .table th.col-hide-sm, .table td.col-hide-sm { display: none; }
  .table .td-tran { max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .table tbody tr[data-open] { cursor: pointer; }

  .plans-grid { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qr-demo { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .form-grid.two { grid-template-columns: 1fr; }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
  .footer-grid { flex-direction: column; gap: 18px; }
  .hero-actions .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
