/* ============================================================
   PAYFLOW PREMIUM — styles_v4.css
   Dark-first | Glassmorphic | 3D Immersive | Production
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── TOKEN SYSTEM ──────────────────────────────────────────── */
:root {
  /* Light theme (fallback) */
  --bg: #F0F4F8;
  --surface: #F8FAFC;
  --card: rgba(255,255,255,0.72);
  --rail: rgba(255,255,255,0.65);
  --line: rgba(226,232,240,0.7);
  --line-soft: rgba(241,245,249,0.5);

  --ink: #0F172A;
  --text: #334155;
  --muted: #64748B;
  --faint: #94A3B8;

  --primary: #6366F1;
  --primary-hover: #4F46E5;
  --primary-wash: rgba(99,102,241,0.1);
  --primary-glow: rgba(99,102,241,0.4);
  --primary-br: #818CF8;

  --emerald: #10B981;
  --emerald-wash: rgba(16,185,129,0.1);
  --emerald-glow: rgba(16,185,129,0.4);

  --danger: #EF4444;
  --danger-hover: #DC2626;
  --danger-wash: rgba(239,68,68,0.1);
  --danger-glow: rgba(239,68,68,0.3);

  --warn: #F59E0B;
  --warn-wash: rgba(245,158,11,0.1);

  --gold: #B45309;

  --shadow-sm: 0 2px 8px -2px rgba(15,23,42,0.04), 0 1px 2px rgba(15,23,42,0.02), inset 0 1px 0 rgba(255,255,255,0.8);
  --shadow-md: 0 8px 24px -6px rgba(15,23,42,0.08), 0 2px 8px rgba(15,23,42,0.03), inset 0 1px 0 rgba(255,255,255,0.9);
  --shadow-lg: 0 20px 40px -12px rgba(15,23,42,0.14), 0 4px 12px rgba(15,23,42,0.05), inset 0 1px 0 rgba(255,255,255,0.9);
  --shadow-float: 0 32px 64px -16px rgba(15,23,42,0.2), inset 0 1px 0 rgba(255,255,255,1);

  --radius-sm: 14px;
  --radius: 20px;
  --radius-lg: 28px;
  --radius-full: 9999px;

  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --trans: 0.4s cubic-bezier(0.16,1,0.3,1);
  --trans-fast: 0.18s cubic-bezier(0.16,1,0.3,1);
}

/* ── DARK THEME ─────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg: #080C17;
  --surface: #0C1221;
  --card: rgba(255,255,255,0.04);
  --rail: rgba(13,19,38,0.85);
  --line: rgba(255,255,255,0.07);
  --line-soft: rgba(255,255,255,0.04);

  --ink: #F1F5F9;
  --text: #CBD5E1;
  --muted: #64748B;
  --faint: #475569;

  --primary: #818CF8;
  --primary-hover: #6366F1;
  --primary-wash: rgba(129,140,248,0.12);
  --primary-glow: rgba(129,140,248,0.5);

  --emerald: #34D399;
  --emerald-wash: rgba(52,211,153,0.1);
  --emerald-glow: rgba(52,211,153,0.4);

  --danger: #F87171;
  --danger-wash: rgba(248,113,113,0.1);
  --danger-glow: rgba(248,113,113,0.3);

  --warn: #FBBF24;
  --warn-wash: rgba(251,191,36,0.1);

  --gold: #FBBF24;

  --shadow-sm: 0 4px 16px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.07);
  --shadow-md: 0 12px 32px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.08);
  --shadow-lg: 0 24px 48px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.1);
  --shadow-float: 0 32px 64px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.12);
}

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

/* ── BODY & AURORA CANVAS ───────────────────────────────────── */
body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  transition: background-color 0.5s ease, color 0.5s ease;
  min-height: 100vh;
}

/* ── CSS AURORA BLOBS (pure CSS, no canvas, no flicker) ──────── */
#bg-blobs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  will-change: transform;
}
[data-theme="dark"] .blob { opacity: 0.55; }

.blob.b1 {
  width: 600px;
  height: 600px;
  top: -15%;
  left: -8%;
  background: radial-gradient(circle, rgba(99,102,241,0.9), transparent 70%);
  animation: blob-drift-1 18s ease-in-out infinite alternate;
}
.blob.b2 {
  width: 500px;
  height: 500px;
  top: -10%;
  right: -8%;
  background: radial-gradient(circle, rgba(16,185,129,0.7), transparent 70%);
  animation: blob-drift-2 22s ease-in-out infinite alternate;
}
.blob.b3 {
  width: 550px;
  height: 550px;
  bottom: -15%;
  left: 25%;
  background: radial-gradient(circle, rgba(56,189,248,0.6), transparent 70%);
  animation: blob-drift-3 26s ease-in-out infinite alternate;
}
.blob.b4 {
  width: 420px;
  height: 420px;
  bottom: -10%;
  right: -5%;
  background: radial-gradient(circle, rgba(168,85,247,0.6), transparent 70%);
  animation: blob-drift-4 20s ease-in-out infinite alternate;
}

@keyframes blob-drift-1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(80px, 60px) scale(1.08); }
}
@keyframes blob-drift-2 {
  from { transform: translate(0, 0) scale(1.05); }
  to   { transform: translate(-70px, 80px) scale(0.95); }
}
@keyframes blob-drift-3 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(60px, -50px) scale(1.1); }
}
@keyframes blob-drift-4 {
  from { transform: translate(0, 0) scale(0.9); }
  to   { transform: translate(-50px, -60px) scale(1.05); }
}

#login, #app {
  position: relative;
  z-index: 1;
}

/* ── TYPOGRAPHY ─────────────────────────────────────────────── */
h1, h2, h3, h4 {
  color: var(--ink);
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.03em;
  transition: color 0.3s ease;
}
a { color: var(--primary); text-decoration: none; }
button, input, select { font-family: inherit; }

/* ── APP SHELL ──────────────────────────────────────────────── */
#app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
#app.hidden, #login.hidden { display: none !important; }

/* ── NAVIGATION RAIL ────────────────────────────────────────── */
.rail {
  background: var(--rail);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-right: 1px solid var(--line);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 50;
  transition: background 0.5s ease, border-color 0.5s ease;
}
.rail::-webkit-scrollbar { width: 0; }

/* Logo */
.rail .logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
  letter-spacing: -0.02em;
  transition: color 0.3s;
}
.rail .logo .mark {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 4px 16px var(--primary-glow);
  animation: logo-breathe 3s ease-in-out infinite;
  flex-shrink: 0;
  transition: box-shadow 0.3s;
}
@keyframes logo-breathe {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 16px var(--primary-glow); }
  50% { transform: scale(1.06); box-shadow: 0 8px 28px var(--primary-glow); }
}

/* Nav section labels */
.rail .nav-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 24px 0 6px 10px;
  transition: color 0.3s;
}

/* Nav items */
.rail nav { display: flex; flex-direction: column; gap: 2px; }
.rail a.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--trans-fast);
  position: relative;
  overflow: hidden;
}
.rail a.item:hover {
  color: var(--ink);
  background: var(--line);
  transform: translateX(2px);
}
.rail a.item.active {
  background: var(--primary-wash);
  color: var(--primary);
  font-weight: 600;
}
/* Glowing left-edge active indicator */
.rail a.item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  height: 50%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow), 0 0 20px var(--primary-glow);
}
.rail a.item svg {
  width: 17px;
  height: 17px;
  color: var(--faint);
  flex-shrink: 0;
  transition: color var(--trans-fast), filter var(--trans-fast);
}
.rail a.item.active svg {
  color: var(--primary);
  filter: drop-shadow(0 0 6px var(--primary-glow));
}
.rail a.item:hover svg { color: var(--text); }

.rail .spacer { flex: 1; }

/* Merchant card */
.merchant {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--line-soft);
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: 8px;
  transition: background 0.3s;
}
.merchant .av {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ink), #334155);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
[data-theme="dark"] .merchant .av {
  background: linear-gradient(135deg, var(--primary-hover), var(--primary));
}
.merchant .who { display: flex; flex-direction: column; overflow: hidden; }
.merchant b { font-size: 13px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; overflow: hidden; transition: color 0.3s; }
.merchant span { font-size: 11px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }

/* Theme toggle & logout */
.theme-toggle {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  border-radius: 10px;
  transition: all var(--trans-fast);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  backdrop-filter: blur(8px);
}
.theme-toggle:hover { background: var(--line); color: var(--ink); }
.theme-toggle svg { width: 16px; height: 16px; flex-shrink: 0; }

.logout {
  width: 100%;
  padding: 9px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  border-radius: 10px;
  transition: all var(--trans-fast);
}
.logout:hover { background: var(--danger-wash); color: var(--danger); }

/* ── WORK AREA ──────────────────────────────────────────────── */
.work {
  padding: 48px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Route transition animation */
#view {
  animation: view-fadein 0.35s cubic-bezier(0.16,1,0.3,1);
}
@keyframes view-fadein {
  from { opacity: 0; transform: translateY(12px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ── PAGE HEADERS ───────────────────────────────────────────── */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 36px;
}
.kicker {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0 0 6px 0;
}
.page-head h1 { font-size: 36px; }
.page-head .desc { color: var(--muted); font-size: 14px; margin: 6px 0 0 0; }

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-full);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans-fast);
  border: 1px solid transparent;
  white-space: nowrap;
  will-change: transform;
}
.btn svg { width: 15px; height: 15px; }
.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--primary-glow), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn.primary:active { transform: translateY(0); }
.btn.secondary {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
}
.btn.secondary:hover { border-color: var(--muted); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn.ghost:hover { background: var(--line); color: var(--ink); }
.btn.danger-outline { background: transparent; color: var(--danger); border-color: var(--danger-wash); }
.btn.danger-outline:hover { background: var(--danger-wash); }
.btn:disabled { opacity: 0.4; pointer-events: none; }

/* ── INPUTS ─────────────────────────────────────────────────── */
input, select {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink);
  background: var(--card);
  backdrop-filter: blur(8px);
  transition: all var(--trans-fast);
  outline: none;
}
input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-wash);
  background: var(--surface);
}
.toolbar { display: flex; gap: 12px; margin-bottom: 20px; align-items: center; }
.toolbar .search { flex: 1; max-width: 300px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 18px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink); }

/* ── KPI CARDS (3D Tiltable) ────────────────────────────────── */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}
.kpis.bento {
  grid-template-columns: repeat(3, 1fr);
}
.kpis.bento .kpi-wrapper:nth-child(1) { grid-column: span 2; }
.kpis.bento .kpi-wrapper:nth-child(2) { grid-column: span 1; }
.kpis.bento .kpi-wrapper:nth-child(3) { grid-column: span 1; }
.kpis.bento .kpi-wrapper:nth-child(4) { grid-column: span 2; }
.kpi-wrapper {
  perspective: 800px;
  will-change: transform;
}
.kpi {
  background: var(--card);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  transition: transform 0.12s ease, box-shadow var(--trans);
  position: relative;
  overflow: hidden;
  will-change: transform;
  transform-style: preserve-3d;
  box-shadow: var(--shadow-sm);
}
/* Light-source specular highlight */
.kpi::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 50%);
  pointer-events: none;
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--trans);
}
.kpi:hover::after { opacity: 1; }
.kpi:hover { box-shadow: var(--shadow-lg); }

.kpi.accent {
  background: linear-gradient(135deg, var(--primary-hover), var(--primary));
  border: none;
  box-shadow: 0 8px 32px var(--primary-glow), inset 0 1px 0 rgba(255,255,255,0.15);
  animation: kpi-glow-pulse 4s ease-in-out infinite;
}
@keyframes kpi-glow-pulse {
  0%, 100% { box-shadow: 0 8px 32px var(--primary-glow), inset 0 1px 0 rgba(255,255,255,0.15); }
  50%       { box-shadow: 0 12px 48px var(--primary-glow), 0 0 80px rgba(99,102,241,0.15), inset 0 1px 0 rgba(255,255,255,0.2); }
}
.kpi.accent .k-label,
.kpi.accent .k-sub { color: rgba(255,255,255,0.75); }
.kpi.accent .k-val { color: #fff; }
.kpi.accent .k-val .cur { color: rgba(255,255,255,0.65); }

.k-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.k-val {
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.04em;
  margin-bottom: 6px;
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}
.k-val .cur { font-size: 17px; color: var(--faint); font-weight: 500; }
.k-sub { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 4px; }
.k-trend-up { color: var(--emerald); }
.k-trend-down { color: var(--danger); }

/* ── MINI STRIP ─────────────────────────────────────────────── */
.mini-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }
.mini {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--trans-fast), box-shadow var(--trans-fast);
  text-decoration: none;
  color: var(--ink);
  will-change: transform;
}
.mini:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.mini-ic {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mini-ic svg { width: 18px; height: 18px; }
.mini-ic.risk { background: var(--primary-wash); color: var(--primary); }
.mini-ic.review { background: var(--warn-wash); color: var(--warn); }
.mini-ic.danger { background: var(--danger-wash); color: var(--danger); }
.mini-txt { font-size: 13px; color: var(--text); }
.mini-txt b { color: var(--ink); font-weight: 700; display: block; font-size: 18px; line-height: 1.1; }

/* ── BAR CHART ──────────────────────────────────────────────── */
.bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 160px;
  padding: 0 4px;
  position: relative;
}
/* Subtle horizontal grid lines */
.bars::before {
  content: '';
  position: absolute;
  inset: 0 0 24px 0;
  background: repeating-linear-gradient(
    to bottom,
    var(--line) 0,
    var(--line) 1px,
    transparent 1px,
    transparent 25%
  );
  pointer-events: none;
}
.bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  gap: 6px;
  position: relative;
}
.bar .fill {
  width: 100%;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--primary), var(--primary-hover));
  box-shadow: 0 0 16px var(--primary-glow), 0 -2px 0 rgba(255,255,255,0.3) inset;
  transition: height 0.7s cubic-bezier(0.16,1,0.3,1), box-shadow 0.3s;
  position: relative;
  cursor: pointer;
  will-change: height;
  min-height: 4px;
}
/* Peak glow line */
.bar .fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background: rgba(255,255,255,0.8);
  box-shadow: 0 0 8px rgba(255,255,255,0.6);
}
.bar .fill:hover {
  box-shadow: 0 0 28px var(--primary-glow), 0 -2px 0 rgba(255,255,255,0.4) inset;
  filter: brightness(1.15);
}
/* Tooltip on hover */
.bar .fill[data-amount]:hover::before {
  content: '₹' attr(data-amount);
  position: absolute;
  top: -34px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  font-family: var(--font-mono);
}
.bar .day {
  font-size: 10px;
  color: var(--faint);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Method row */
.method-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.method-row:last-child { border-bottom: none; }
.method-row .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.method-row .name { flex: 1; text-transform: capitalize; color: var(--text); font-weight: 500; }
.method-row .n { font-family: var(--font-mono); font-weight: 700; color: var(--ink); font-size: 14px; }

/* ── GLASS CARDS ────────────────────────────────────────────── */
.card {
  background: var(--card);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
  transition: background 0.5s, border-color 0.5s, box-shadow 0.3s;
  will-change: transform;
}
.card-h {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
[data-theme="dark"] .card-h { background: rgba(255,255,255,0.02); }
.card-h h3 { font-size: 15px; font-weight: 700; }
.card-b { padding: 20px 22px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ── DATA TABLES ────────────────────────────────────────────── */
table.data { width: 100%; border-collapse: collapse; text-align: left; }
table.data th {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255,255,255,0.08);
}
[data-theme="dark"] table.data th { background: rgba(255,255,255,0.02); }
table.data td { padding: 14px 20px; font-size: 13.5px; border-bottom: 1px solid var(--line-soft); color: var(--text); }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background var(--trans-fast); }
table.data tbody tr:hover { background: var(--primary-wash); }
table.data tbody tr.clickable { cursor: pointer; }
.right { text-align: right; }
.mono { font-family: var(--font-mono); }

/* ── BADGES ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid transparent;
}
.badge.paid, .badge.success, .badge.settled {
  background: var(--emerald-wash);
  color: var(--emerald);
  border-color: rgba(16,185,129,0.2);
  animation: badge-success-pulse 3s ease-in-out infinite;
}
@keyframes badge-success-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--emerald-glow); }
  50% { box-shadow: 0 0 8px 2px var(--emerald-glow); }
}
.badge.failed, .badge.blocked, .badge.chargeback {
  background: var(--danger-wash);
  color: var(--danger);
  border-color: rgba(239,68,68,0.2);
  box-shadow: 0 0 8px var(--danger-glow);
}
.badge.created, .badge.pending, .badge.processing, .badge.authorized {
  background: var(--line-soft);
  color: var(--muted);
  border-color: var(--line);
}
.badge.refunded, .badge.partially_refunded {
  background: var(--warn-wash);
  color: var(--warn);
  border-color: rgba(245,158,11,0.2);
}

/* ── EMPTY STATES ───────────────────────────────────────────── */
.empty {
  padding: 56px 24px;
  text-align: center;
  color: var(--faint);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  font-size: 14px;
}
.empty-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary-wash);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.empty-icon svg { width: 40px; height: 40px; color: var(--primary); opacity: 0.7; }
.empty h3 { font-size: 18px; color: var(--ink); margin: 0; }
.empty p { color: var(--muted); margin: 0; max-width: 320px; line-height: 1.6; }

/* ── SKELETON LOADERS ───────────────────────────────────────── */
.skeleton-view { padding: 48px; max-width: 1200px; margin: 0 auto; width: 100%; }
.skel-head { width: 280px; height: 44px; border-radius: 12px; background: var(--line); margin-bottom: 12px; animation: skel-pulse 1.6s ease infinite; }
.skel-sub  { width: 180px; height: 20px; border-radius: 8px; background: var(--line); margin-bottom: 40px; animation: skel-pulse 1.6s ease infinite 0.2s; }
.skel-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 32px; }
.skel-card { height: 140px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); animation: skel-pulse 1.6s ease infinite 0.4s; }
.skel-table { height: 380px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); animation: skel-pulse 1.6s ease infinite 0.6s; }
@keyframes skel-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ── SLIDE-OUT DRAWER ───────────────────────────────────────── */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--trans);
}
.scrim.show { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: 420px;
  background: var(--surface);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  z-index: 210;
  transform: translateX(calc(100% + 24px)) rotateY(-6deg);
  transform-origin: right center;
  perspective: 1200px;
  transition: transform 0.55s cubic-bezier(0.16,1,0.3,1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  will-change: transform;
}
.drawer.show {
  transform: translateX(0) rotateY(0deg);
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255,255,255,0.04);
  flex-shrink: 0;
}
.drawer-head h2 { font-size: 18px; }
.close-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: all var(--trans-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}
.close-btn:hover { background: var(--line); color: var(--ink); transform: rotate(90deg); }
.close-btn svg { width: 18px; height: 18px; }

/* Drawer tabs */
.d-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line-soft);
  padding: 0 24px;
  background: rgba(255,255,255,0.02);
  flex-shrink: 0;
}
.d-tab {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--trans-fast);
  margin-bottom: -1px;
}
.d-tab:hover { color: var(--ink); }
.d-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.d-panel { display: none; }
.d-panel.active { display: block; }

.drawer-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}
.drawer-body::-webkit-scrollbar { width: 4px; }
.drawer-body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }

/* Amount hero in drawer */
.amt-hero {
  font-size: 52px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.05em;
  margin-bottom: 6px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: color 0.3s;
}
.amt-hero .cur { font-size: 26px; color: var(--faint); font-weight: 500; vertical-align: middle; }
.amt-status { text-align: center; margin-bottom: 24px; }

/* Key-value pairs in drawer */
.kv { display: flex; justify-content: space-between; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; gap: 16px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); font-weight: 500; flex-shrink: 0; }
.kv .v { color: var(--ink); font-weight: 600; text-align: right; }

/* Transaction lifecycle */
.lifecycle { margin-top: 8px; position: relative; padding-left: 4px; }
.lifecycle::before { content: ''; position: absolute; top: 10px; bottom: 10px; left: 11px; width: 2px; background: var(--line); }
.lifecycle .step { position: relative; padding: 0 0 20px 28px; }
.lifecycle .step .dot {
  position: absolute;
  left: 5px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--line);
  border: 2px solid var(--surface);
  z-index: 2;
  transition: all var(--trans);
}
.lifecycle .step.done .dot {
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald-glow);
  animation: dot-pulse 2s ease-in-out infinite;
}
@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--emerald-glow); }
  50% { box-shadow: 0 0 0 4px rgba(16,185,129,0.2); }
}
.lifecycle .step.fail .dot { background: var(--danger); box-shadow: 0 0 8px var(--danger-glow); }
.lifecycle .step.block .dot { background: var(--danger); box-shadow: 0 0 8px var(--danger-glow); }
.lifecycle .step.warn .dot { background: var(--warn); }
.lifecycle .step small {
  font-size: 11px;
  font-weight: 700;
  color: var(--faint);
  display: block;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.lifecycle .step.done small { color: var(--emerald); }
.lifecycle .step.fail small, .lifecycle .step.block small { color: var(--danger); }

/* ── MODALS ─────────────────────────────────────────────────── */
.modal-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--trans);
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-scrim.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-float);
  transform: scale(0.94) translateY(16px);
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1);
  overflow: hidden;
}
.modal-scrim.open .modal { transform: scale(1) translateY(0); }
.m-head {
  padding: 20px 28px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255,255,255,0.03);
}
.m-head h3 { font-size: 17px; }
.m-body { padding: 24px 28px; }
.m-foot {
  padding: 16px 28px;
  border-top: 1px solid var(--line-soft);
  background: rgba(255,255,255,0.02);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── TRANSACTION DETAIL COMPONENTS ──────────────────────────── */
.d-sec { font-size: 13px; font-weight: 700; margin: 24px 0 10px; color: var(--ink); text-transform: uppercase; letter-spacing: 0.07em; }
.attempt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--line-soft);
  border-radius: 10px;
  margin-bottom: 6px;
  font-size: 13px;
  border: 1px solid var(--line);
}
.attempt .st-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.attempt .st-dot.success { background: var(--emerald); box-shadow: 0 0 6px var(--emerald-glow); }
.attempt .st-dot.failed { background: var(--danger); box-shadow: 0 0 6px var(--danger-glow); }
.d-actions { display: flex; gap: 10px; margin-top: 24px; }
.d-actions .btn { flex: 1; justify-content: center; }

/* ── RISK ────────────────────────────────────────────────────── */
.risk-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  background: var(--line-soft);
  margin-bottom: 16px;
  transition: transform var(--trans-fast);
}
.risk-box:hover { transform: translateY(-2px); }
.risk-box.review { background: rgba(251,191,36,0.06); border-color: rgba(251,191,36,0.2); }
.risk-box.block  { background: rgba(239,68,68,0.06); border-color: rgba(239,68,68,0.2); }
.risk-row { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.risk-gauge { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.risk-fill { height: 100%; border-radius: 3px; background: var(--primary); transition: width 1.2s cubic-bezier(0.16,1,0.3,1); }
.risk-box.review .risk-fill { background: var(--warn); }
.risk-box.block  .risk-fill { background: var(--danger); box-shadow: 0 0 8px var(--danger-glow); }
.risk-meta { font-size: 12px; color: var(--muted); font-weight: 500; }
.risk-meta b { font-family: var(--font-mono); font-size: 16px; color: var(--ink); }
.risk-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; padding: 3px 8px; border-radius: 6px; }
.risk-tag.allow  { color: var(--emerald); background: var(--emerald-wash); }
.risk-tag.review { color: var(--warn); background: var(--warn-wash); }
.risk-tag.block  { color: var(--danger); background: var(--danger-wash); }
.risk-reasons { list-style: none; margin: 0; padding: 0; }
.risk-reasons li { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); padding: 8px 0; border-top: 1px dashed var(--line); }
.risk-reasons li:first-child { border-top: none; }
.risk-reasons .pts { font-family: var(--font-mono); color: var(--danger); font-weight: 700; }
.risk-clean { font-size: 13px; color: var(--emerald); font-weight: 600; }

/* ── NOTIFICATION CHANNELS ───────────────────────────────────── */
.ch { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; padding: 3px 8px; border-radius: 6px; min-width: 60px; text-align: center; }
.ch.email { color: #6366F1; background: rgba(99,102,241,0.1); }
.ch.sms { color: var(--emerald); background: var(--emerald-wash); }
.ch.webhook { color: var(--warn); background: var(--warn-wash); }
.notif-row { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.notif-row .nb { color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }

/* ── CHIP ────────────────────────────────────────────────────── */
.chip-3ds { font-size: 10px; font-weight: 700; color: var(--primary); background: var(--primary-wash); padding: 3px 8px; border-radius: 10px; margin-left: 6px; }

/* ── DEVELOPER / CODE ─────────────────────────────────────────── */
.codebox {
  background: #0A0F1E;
  color: #E2E8F0;
  padding: 20px;
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.7;
  box-shadow: inset 0 2px 16px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.06);
}
.codebox .cm { color: #475569; }
.codebox .st { color: #34D399; }
.secret-row {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  transition: all var(--trans-fast);
  margin-bottom: 10px;
}
.secret-row:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.secret-row .val { flex: 1; padding: 12px 14px; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink); border-right: 1px solid var(--line); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-btn { border: none; background: transparent; color: var(--primary); font-weight: 700; font-size: 12.5px; padding: 0 20px; cursor: pointer; transition: all var(--trans-fast); white-space: nowrap; }
.copy-btn:hover { background: var(--primary-wash); }
.copy-btn.copied { color: var(--emerald); }

/* ── AMOUNT DISPLAY ──────────────────────────────────────────── */
.amt { font-family: var(--font-mono); font-weight: 700; font-size: 14px; }
.amt .cur { color: var(--faint); font-weight: 500; font-size: 12px; }
.amt.gold { color: var(--gold); }

/* ── TOAST ───────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(16px) scale(0.95);
  background: var(--ink);
  color: var(--bg);
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16,1,0.3,1);
  z-index: 500;
  box-shadow: 0 16px 40px rgba(0,0,0,0.25);
  max-width: 90vw;
  text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }

/* ── LOGIN PAGE ──────────────────────────────────────────────── */
#login {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  min-height: 100vh;
}
.brand-side {
  background: linear-gradient(150deg, #070B14 0%, #0D1A30 50%, #0A1525 100%);
  color: #fff;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
/* Ambient glows on login brand side */
.brand-side::before {
  content: '';
  position: absolute;
  top: -10%;
  right: -5%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(99,102,241,0.35), transparent 65%);
  pointer-events: none;
}
.brand-side::after {
  content: '';
  position: absolute;
  bottom: -10%;
  left: -5%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, rgba(16,185,129,0.2), transparent 65%);
  pointer-events: none;
}
.brand-side .logo {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 2;
}
.brand-side .logo .mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  font-size: 18px;
  background: linear-gradient(135deg, #818CF8, #6366F1);
  box-shadow: 0 8px 28px rgba(99,102,241,0.5);
}
.brand-side .pitch { position: relative; z-index: 2; }
.brand-side h1 {
  color: #fff;
  font-size: 52px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.05em;
  margin-bottom: 20px;
  max-width: 480px;
}
/* Gradient text on the EM tag */
.brand-side h1 em {
  font-style: normal;
  background: linear-gradient(135deg, #818CF8, #34D399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-side p { color: #8BA4C0; font-size: 17px; max-width: 420px; line-height: 1.65; }

.flow-line {
  display: flex;
  gap: 0;
  margin-top: 40px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #475569;
  font-weight: 600;
  letter-spacing: 0.08em;
  flex-wrap: wrap;
  gap: 8px;
  position: relative;
  z-index: 2;
}
.flow-line span {
  color: #64748B;
  animation: flow-appear 0.5s both;
  background: rgba(255,255,255,0.04);
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.06);
}
.flow-line span:nth-child(1) { animation-delay: 0.1s; }
.flow-line span:nth-child(2) { animation-delay: 0.2s; }
.flow-line span:nth-child(3) { animation-delay: 0.3s; }
.flow-line span:nth-child(4) { animation-delay: 0.4s; }
.flow-line span:nth-child(5) { animation-delay: 0.5s; }
.flow-line span:nth-child(6) { animation-delay: 0.6s; }
@keyframes flow-appear {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.brand-foot { color: #2D3D52; font-size: 11.5px; position: relative; z-index: 2; }

/* Form side */
.form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: var(--surface);
  position: relative;
}
.form-side::before {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle at bottom right, rgba(16,185,129,0.08), transparent 70%);
  pointer-events: none;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  border: 1px solid var(--line);
  position: relative;
  z-index: 2;
}
/* Top highlight edge on login card */
.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 15%;
  right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
  border-radius: 1px;
}
.login-card h2 { font-size: 30px; margin-bottom: 6px; letter-spacing: -0.03em; }
.login-card .sub { color: var(--muted); margin-bottom: 28px; font-size: 14px; }
.demo-hint {
  background: var(--primary-wash);
  color: var(--primary);
  padding: 13px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 24px;
  border: 1px solid rgba(99,102,241,0.2);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.secure-badge {
  text-align: center;
  margin-top: 16px;
  font-size: 11.5px;
  color: var(--faint);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.secure-badge svg { width: 13px; height: 13px; color: var(--emerald); }

/* ── FOCUS RING ──────────────────────────────────────────────── */
:focus-visible {
  outline: 2.5px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ── COMMAND PALETTE ─────────────────────────────────────────── */
#cmd-palette {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: grid;
  place-items: start center;
  padding-top: 20vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
#cmd-palette.open { opacity: 1; pointer-events: auto; }
.cmd-box {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-float);
  overflow: hidden;
  transform: scale(0.95) translateY(-8px);
  transition: transform 0.25s cubic-bezier(0.16,1,0.3,1);
}
#cmd-palette.open .cmd-box { transform: scale(1) translateY(0); }
.cmd-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.cmd-input-row svg { width: 18px; height: 18px; color: var(--faint); flex-shrink: 0; }
#cmd-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 16px;
  color: var(--ink);
  padding: 0;
  outline: none;
  box-shadow: none;
}
.cmd-results { max-height: 300px; overflow-y: auto; padding: 8px; }
.cmd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  transition: background var(--trans-fast);
}
.cmd-item:hover, .cmd-item.focused { background: var(--primary-wash); color: var(--primary); }
.cmd-item svg { width: 16px; height: 16px; color: var(--faint); }
.cmd-item:hover svg, .cmd-item.focused svg { color: var(--primary); }
.cmd-hint { font-size: 11px; color: var(--faint); padding: 10px 14px 14px; text-align: center; }

/* ── PERFORMANCE & ACCESSIBILITY ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  #bg-canvas { display: none; }
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .work { padding: 32px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  #app { grid-template-columns: 1fr; }

  .rail {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    padding: 10px 14px;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    overflow-y: visible;
    z-index: 100;
    gap: 8px;
    border-radius: 0;
  }
  .rail::-webkit-scrollbar { display: none; }
  .rail .logo { margin: 0 14px 0 0; flex-shrink: 0; font-size: 16px; }
  .rail .logo .mark { width: 26px; height: 26px; font-size: 13px; }
  .rail nav { flex-direction: row; gap: 4px; flex-shrink: 0; }
  .rail a.item {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 7px 14px;
    font-size: 12.5px;
    border-radius: 999px;
  }
  .rail a.item.active::before { display: none; }
  .rail a.item svg { display: none; }
  .rail .nav-label,
  .rail .spacer,
  .rail .merchant,
  .rail .logout,
  .rail .theme-toggle { display: none; }

  #login { grid-template-columns: 1fr; }
  .brand-side { display: none; }

  .work { padding: 20px 14px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 12px; }
  .mini-strip { grid-template-columns: 1fr; gap: 10px; }

  table.data { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .page-head { flex-direction: column; gap: 14px; align-items: flex-start; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .search, .toolbar select { max-width: 100%; width: 100%; }

  .drawer {
    right: 0;
    bottom: 0;
    top: 52px;
    width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(110%);
    transform-origin: bottom center;
  }
  .drawer.show { transform: translateY(0); }
}

@media (max-width: 420px) {
  .kpis { grid-template-columns: 1fr; }
}
