/* developer: HLK */
/* PayKoneq design system. gunmetal and maroon and black. dark first always. */
/* light mode exists. some people like it. fine. */

/* load Inter fast or fall back gracefully */
@font-face {
  font-family: 'Inter';
  font-display: swap;
  src: local('Inter');
}

:root {
  /* dark mode. the real one. */
  --bg:           #08090C;
  --surface:      #0F1117;
  --surface2:     #161B24;
  --surface3:     #1D2330;
  --border:       #1E2535;
  --border2:      #2A3347;
  --text:         #E2E5EC;
  --text-dim:     #C2C8D4;
  --muted:        #6B7585;
  /* RGB triplets for Tailwind opacity-modifier classes (bg-surface/50, border-border/30, etc.) */
  --bg-rgb:       8 9 12;
  --surface-rgb:  15 17 23;
  --surface2-rgb: 22 27 36;
  --surface3-rgb: 29 35 48;
  --border-rgb:   30 37 53;
  --border2-rgb:  42 51 71;
  --muted-rgb:    107 117 133;
  --accent:       #8B1A2E;
  --accent-bright:#A92038;
  --accent-hover: #6F1524;
  --accent-glow:  rgba(139,26,46,0.3);
  --gunmetal:     #2D3540;
  --gunmetal2:    #3A4150;
  --success:      #22C55E;
  --warning:      #F59E0B;
  --danger:       #EF4444;
  --info:         #3B82F6;
  --success-dim:  rgba(34,197,94,0.12);
  --warning-dim:  rgba(245,158,11,0.12);
  --danger-dim:   rgba(239,68,68,0.12);
  --info-dim:     rgba(59,130,246,0.12);
  --card-shadow:  0 4px 32px rgba(0,0,0,0.65);
  --card-shadow-hover: 0 20px 60px rgba(0,0,0,0.8);
  --sidebar-w:    240px;
  --header-h:     56px;
  --radius:       10px;
  --radius-lg:    14px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --gold:         #C9A84C;
  --gold-dim:     rgba(201,168,76,0.12);
  --glass-bg:     rgba(255,255,255,0.03);
  --glass-border: rgba(255,255,255,0.07);
  --sidebar-glow: rgba(139,26,46,0.08);
  --header-bg:    rgba(8,9,12,0.92);
  --accent-subtle:rgba(139,26,46,0.08);
}

[data-theme="light"] {
  --bg:           #EEF0F5;
  --surface:      #FFFFFF;
  --surface2:     #F4F6FA;
  --surface3:     #EBEEf4;
  --border:       #D4D8E3;
  --border2:      #C2C7D6;
  --text:         #111318;
  --text-dim:     #2D333F;
  --muted:        #6B7280;
  /* RGB triplets for Tailwind opacity-modifier classes */
  --bg-rgb:       238 240 245;
  --surface-rgb:  255 255 255;
  --surface2-rgb: 244 246 250;
  --surface3-rgb: 235 238 244;
  --border-rgb:   212 216 227;
  --border2-rgb:  194 199 214;
  --muted-rgb:    107 114 128;
  --card-shadow:  0 2px 16px rgba(0,0,0,0.10);
  --card-shadow-hover: 0 10px 36px rgba(0,0,0,0.18);
  --accent-glow:  rgba(139,26,46,0.15);
  --glass-bg:     rgba(255,255,255,0.7);
  --glass-border: rgba(0,0,0,0.08);
  --header-bg:    rgba(238,240,245,0.92);
  --sidebar-glow: rgba(139,26,46,0.05);
  --accent-subtle:rgba(139,26,46,0.06);
}

/* reset. browser defaults are terrible. fix everything. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; }
table { border-collapse: collapse; }

/* text. inter for reading and jetbrains mono for code. */
.text-xs   { font-size: 0.75rem; }
.text-sm   { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg   { font-size: 1.125rem; }
.text-xl   { font-size: 1.25rem; }
.text-2xl  { font-size: 1.5rem; }
.text-3xl  { font-size: 1.875rem; }
.font-mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-muted  { color: var(--muted); }
.text-accent { color: var(--accent-bright); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-info    { color: var(--info); }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.05em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* page skeleton */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  min-height: 100vh;
}

/* content areas must always occupy the wide column (col 2).
   Without this, hiding #pk2-sidebar via display:none removes it from
   grid flow and auto-placement shifts these elements into the now-vacant
   narrow sidebar column instead. */
#merchant-content-area,
#pk2-main {
  grid-column: 2 / -1;
}

/* the bar at the top */
.app-header {
  grid-column: 1 / -1;
  height: var(--header-h);
  background: var(--header-bg);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04), 0 4px 24px rgba(0,0,0,0.4);
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.header-wordmark { font-size: 0.95rem; font-weight: 800; letter-spacing: -0.01em; display: flex; align-items: baseline; }
.hw-pay   { color: var(--accent); }
.hw-koneq { color: var(--text); }
[data-theme="light"] .hw-koneq { color: #111318; }
.header-logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--gunmetal) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.header-center {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.env-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--warning-dim);
  color: var(--warning);
  border: 1px solid rgba(245,158,11,0.3);
}
.env-badge.prod {
  background: var(--success-dim);
  color: var(--success);
  border-color: rgba(34,197,94,0.3);
}
.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.header-user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-dim);
}
.header-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gunmetal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 800;
  color: #fff;
}
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: var(--surface3); color: var(--text); border-color: var(--border2); }
.icon-btn svg { width: 16px; height: 16px; }

/* the panel on the left. it collapses on mobile. thats the whole point. */
.sidebar {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 60%, var(--surface) 100%);
  border-right: 1px solid var(--glass-border);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  box-shadow: 4px 0 32px var(--sidebar-glow), inset -1px 0 0 rgba(255,255,255,0.03);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-section {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.sidebar-section:last-child { border-bottom: none; flex: 1; }
.sidebar-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0.6rem 1rem 0.3rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  border-left: 2px solid transparent;
  transition: all 0.15s;
  cursor: pointer;
  width: 100%;
  text-align: left;
  border-radius: 0;
  background: none;
}
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.nav-item:hover { color: var(--text); background: linear-gradient(90deg, var(--accent-subtle) 0%, transparent 100%); border-left: 2px solid rgba(139,26,46,0.4); padding-left: calc(0.875rem - 2px); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(139,26,46,0.25) 0%, rgba(139,26,46,0.05) 100%);
  border-left: 2px solid var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 20px rgba(139,26,46,0.1);
}
.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* where the actual content lives */
.main-content {
  background: radial-gradient(ellipse at 20% 0%, rgba(139,26,46,0.04) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 100%, rgba(45,53,64,0.3) 0%, transparent 60%),
              var(--bg);
  overflow-y: auto;
  overflow-x: hidden;
  min-height: calc(100vh - var(--header-h));
}
.page-wrapper {
  padding: 1.5rem;
  max-width: 1400px;
}
.page-header {
  margin-bottom: 1.25rem;
}
.page-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.page-subtitle {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}
.tab-panel { display: none; }
.tab-panel.active {
  display: block;
  animation: pkFadeUp 0.22s ease both;
}
@keyframes pkFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* cards with a subtle depth effect */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
  transform-style: preserve-3d;
  will-change: transform;
}
.card-3d {
  cursor: default;
}
.card-3d:hover {
  box-shadow: var(--card-shadow-hover);
  border-color: var(--border2);
}
.card-inner {
  padding: 1.25rem;
}
.card-inner-lg { padding: 1.5rem; }
.card-inner-sm { padding: 0.875rem; }

/* the four big number boxes on overview */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.kpi-card {
  background: linear-gradient(135deg, var(--surface2) 0%, var(--surface) 100%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
  transform-style: preserve-3d;
  will-change: transform;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139,26,46,0.5), transparent);
}
.kpi-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.kpi-value {
  font-size: 1.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
}
.kpi-sub {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.35rem;
}
.kpi-icon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--surface3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-bright);
}
.kpi-icon svg { width: 18px; height: 18px; }

/* things you click. please make them look clickable. */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 7px;
  transition: all 0.15s;
  line-height: 1;
}
.btn svg { width: 14px; height: 14px; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-bright) 0%, var(--accent) 60%, var(--accent-hover) 100%);
  color: #fff;
  border: none;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 16px rgba(139,26,46,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-ghost {
  background: var(--surface2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface3); color: var(--text); border-color: var(--border2); }
.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-success {
  background: var(--success-dim);
  color: var(--success);
  border: 1px solid rgba(34,197,94,0.3);
}
.btn-success:hover { background: rgba(34,197,94,0.2); }
.btn-sm { font-size: 0.72rem; padding: 0.35rem 0.75rem; }
.btn-lg { font-size: 0.9rem; padding: 0.65rem 1.4rem; }
.btn-icon-only { padding: 0.4rem; }

/* inputs and selects and textareas */
.form-group { margin-bottom: 0.875rem; }
.form-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.form-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}
.form-input:focus {
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input::placeholder { color: var(--muted); }
select.form-input { cursor: pointer; }

/* rows and columns of data. every tab has one. */
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--radius) var(--radius); }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.data-table thead tr {
  border-bottom: 1px solid var(--border);
}
.data-table th {
  padding: 0.65rem 0.875rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
  background: var(--surface2);
}
.data-table th:first-child { border-radius: var(--radius) 0 0 0; }
.data-table th:last-child  { border-radius: 0 var(--radius) 0 0; }
.data-table td {
  padding: 0.6rem 0.875rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.1s; }
.data-table tbody tr:hover { background: var(--surface2); }
.data-table .mono { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; }
.data-table .empty-row td {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
}

/* little colored pills. active and pending and suspended and rejected. */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid;
}
.badge-success { color: var(--success); background: var(--success-dim); border-color: rgba(34,197,94,0.3); }
.badge-warning { color: var(--warning); background: var(--warning-dim); border-color: rgba(245,158,11,0.3); }
.badge-danger  { color: var(--danger);  background: var(--danger-dim);  border-color: rgba(239,68,68,0.3); }
.badge-info    { color: var(--info);    background: var(--info-dim);    border-color: rgba(59,130,246,0.3); }
.badge-muted   { color: var(--muted);   background: var(--surface3);    border-color: var(--border); }
.badge-accent  { color: var(--accent-bright); background: var(--accent-glow); border-color: rgba(139,26,46,0.4); }

/* the line between things */
.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* gray bar with a label. section divider basically. */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.section-subtitle {
  font-size: 0.73rem;
  color: var(--muted);
  margin-top: 2px;
}

/* two column and three column layouts */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; }
.flex-row { display: flex; align-items: center; gap: 0.6rem; }
.flex-wrap { flex-wrap: wrap; }
.space-y > * + * { margin-top: 1rem; }
.space-y-sm > * + * { margin-top: 0.6rem; }
.hidden { display: none !important; }

/* the popups in the corner that tell you if something worked */
#pk2-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9999;
}
.pk2-toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 500;
  border: 1px solid;
  backdrop-filter: blur(8px);
  transform: translateX(110%);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(.22,1,.36,1), opacity 0.25s ease;
  max-width: 320px;
}
.pk2-toast.show { transform: translateX(0); opacity: 1; }
.pk2-toast.success { background: var(--surface); border-color: rgba(34,197,94,0.4); color: var(--success); }
.pk2-toast.danger  { background: var(--surface); border-color: rgba(239,68,68,0.4);  color: var(--danger); }
.pk2-toast.info    { background: var(--surface); border-color: var(--border);         color: var(--text); }
.pk2-toast svg     { width: 15px; height: 15px; flex-shrink: 0; }

/* animated ring loader */
#pk2-loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  transition: opacity 0.4s ease;
  gap: 0;
}
.pk2-loader-inner {
  position: relative;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}
.pk2-loader-ring {
  position: absolute;
  inset: 0;
}
.pk2-loader-ring svg { width: 100%; height: 100%; }
@keyframes pk2spin {
  0%   { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -213; }
}
.pk2-loader-wordmark {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  line-height: 1;
}
.pk2-pay {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.pk2-koneq {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.02em;
}
[data-theme="light"] .pk2-koneq { color: #111318; }
.pk2-loader-tagline {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.25rem;
}
.loader-bar-wrap {
  width: 140px;
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
#pk2-loader-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* box the chart.js graphs sit inside */
.chart-wrap {
  position: relative;
  height: 220px;
}

/* where the api response shows up in the test console */
.result-box {
  font-size: 0.78rem;
  padding: 0.6rem 0.875rem;
  border-radius: 7px;
  border: 1px solid;
  margin-top: 0.5rem;
}
.result-box.success { background: var(--success-dim); border-color: rgba(34,197,94,0.3); color: var(--success); }
.result-box.danger  { background: var(--danger-dim);  border-color: rgba(239,68,68,0.3);  color: var(--danger); }
.result-box.info    { background: var(--info-dim);    border-color: rgba(59,130,246,0.3);  color: var(--info); }

/* scrollbars. thin ones. not the fat ugly default ones. */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* skeleton shimmer. gray pulsing thing while data is fetching. */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
  background-size: 400px 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 5px;
}

/* the three lines on mobile that open the sidebar */
#sidebar-toggle { display: none; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  #sidebar-toggle { display: flex; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .page-wrapper { padding: 1rem; }
}

/* classes admin.js already references. do not rename these. seriously. */
.glass {
  background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--card-shadow), inset 0 1px 0 rgba(255,255,255,0.06);
}
.bg-accent { background: var(--accent) !important; }
.bg-accent-hover:hover { background: var(--accent-hover) !important; }
.bg-surface { background: var(--surface2) !important; }
.bg-background { background: var(--bg) !important; }
.border-border { border-color: var(--border) !important; }
.border-accent { border-color: var(--accent-bright) !important; }
.text-white { color: var(--text) !important; }
.text-primary { color: var(--text) !important; }
.divide-y > * + * { border-top: 1px solid var(--border); }
.divide-border { border-color: var(--border); }
.bg-success\/10 { background: var(--success-dim) !important; }
.bg-danger\/10  { background: var(--danger-dim)  !important; }
.bg-warning\/10 { background: var(--warning-dim) !important; }
.bg-info\/10    { background: var(--info-dim)    !important; }
.border-success\/40 { border-color: rgba(34,197,94,0.4) !important; }
.border-danger\/40  { border-color: rgba(239,68,68,0.4) !important; }
.border-warning\/40 { border-color: rgba(245,158,11,0.4) !important; }
.border-info\/40    { border-color: rgba(59,130,246,0.4) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger)  !important; }
.text-warning { color: var(--warning) !important; }
.text-info    { color: var(--info)    !important; }
.text-muted   { color: var(--muted)   !important; }
.rounded { border-radius: 5px; }
.rounded-lg { border-radius: var(--radius); }
.rounded-xl { border-radius: var(--radius-lg); }
.rounded-full { border-radius: 9999px; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mt-0\.5 { margin-top: 0.125rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.max-w-lg { max-width: 32rem; }
.max-w-2xl { max-width: 42rem; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.max-h-80 { max-height: 20rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: 1fr; }
.grid-cols-2 { grid-template-columns: 1fr 1fr; }
.grid-cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-l { border-left: 1px solid var(--border); }
.shadow-2xl { box-shadow: 0 25px 50px rgba(0,0,0,0.5); }
.whitespace-pre-wrap { white-space: pre-wrap; }
.break-all { word-break: break-all; }
.uppercase { text-transform: uppercase; }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.tracking-wider { letter-spacing: 0.08em; }
.shrink-0 { flex-shrink: 0; }
.fixed { position: fixed; }
.inset-0 { inset: 0; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }
.bg-black\/40 { background: rgba(0,0,0,0.4); }
.h-full { height: 100%; }
.w-80 { width: 20rem; }
.bg-surface { background: var(--surface); }
.border-l { border-left: 1px solid var(--border); }
.flex-col { flex-direction: column; }
.transform { transform: translateX(0); }
.translate-x-full { transform: translateX(100%); }
.transition-transform { transition: transform 0.3s ease; }
.duration-300 { transition-duration: 0.3s; }
.ease-in-out { transition-timing-function: ease-in-out; }
.text-sm { font-size: 0.875rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.border-b { border-bottom: 1px solid var(--border); }
.font-semibold { font-weight: 600; }
.tracking-wide { letter-spacing: 0.05em; }
.hover\:bg-background:hover { background: var(--bg); }
.hover\:text-primary:hover { color: var(--text); }
.transition { transition: all 0.15s; }
.flex-1 { flex: 1; }

/* mobile fixes. added after we actually checked on a phone and panicked. */

/* dark overlay behind the sidebar so tapping outside closes it */
#sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 99;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
#sidebar-backdrop.visible { display: block; }

/* header on small screens. hide the non-essential stuff. */
@media (max-width: 640px) {
  .header-user-chip span:not(.header-avatar) { display: none; }
  #env-switcher { display: none !important; }
  .header-right { gap: 0.4rem; }
  .app-header { padding: 0 0.75rem; }
}

/* fixed heights are evil on mobile. let things expand. */
@media (max-width: 768px) {
  [class*="h-[400px]"],
  [class*="h-[600px]"],
  [class*="h-[300px]"] {
    height: auto !important;
    min-height: 200px;
  }
  .chart-wrap { height: 180px; }
}

/* honeypot table has nine columns. phones cannot handle nine columns. hide some. */
@media (max-width: 768px) {
  .hp-col-ua,
  .hp-col-response,
  .hp-col-country { display: none; }
}

/* toasts stretch full width on phones. looks better. */
@media (max-width: 480px) {
  #pk2-toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }
  .pk2-toast { max-width: 100%; }
}

/* merchant tabs scroll sideways on mobile instead of wrapping and breaking everything. */
@media (max-width: 640px) {
  .m-tab-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    white-space: nowrap;
    display: flex;
    flex-wrap: nowrap;
  }
  .m-tab-bar::-webkit-scrollbar { display: none; }
}
