/* ==========================================================================
   Truepaybd — Merchant & Gateway Console
   Professional fintech design system · navy / blue / neutral
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("/admin/static/assets/inter-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand */
  --navy: #0b1b33;
  --navy-2: #0e2343;
  --brand: #2563eb;
  --brand-deep: #1d4ed8;
  --brand-soft: #eff5ff;
  --brand-border: #cfdffb;

  /* Text & surfaces */
  --ink: #0b1b33;
  --heading: #101828;
  --body: #475467;
  --muted: #667085;
  --line: #e6eaf1;
  --line-strong: #d5dce8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5fa;

  /* Semantic */
  --success: #0f9d6e;
  --success-bg: #e9f8f1;
  --success-text: #087253;
  --warning: #b45309;
  --warning-bg: #fff7e8;
  --warning-text: #92400e;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-text: #b42318;
  --info: #2563eb;
  --info-bg: #eff5ff;
  --info-text: #1e40af;

  --grad-brand: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  --grad-sidebar: linear-gradient(180deg, #0c1e3a 0%, #081527 100%);

  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 6px 18px -8px rgba(16, 24, 40, 0.18);
  --shadow-md: 0 18px 40px -22px rgba(16, 24, 40, 0.32);
  --shadow-brand: 0 8px 20px -10px rgba(37, 99, 235, 0.55);

  --transition: 170ms cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Aliases used by inline markup in app.js */
  --border: var(--line);
}

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  background-color: #f5f7fb;
  color: var(--heading);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-variant-ligatures: none;
}

.data-table .mono {
  font-size: 11.5px;
}

:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ==========================================================================
   Brand
   ========================================================================== */
.brand-logo {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--grad-brand);
  color: #ffffff;
  font-weight: 800;
  font-size: 13.5px;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 14px -8px rgba(37, 99, 235, 0.85);
}

.brand-logo::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 55%);
  pointer-events: none;
}

/* ==========================================================================
   Authentication
   ========================================================================== */
.auth-wrapper {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  overflow: hidden;
  background: radial-gradient(900px 520px at 10% -10%, #e7eefb 0%, rgba(231, 238, 251, 0) 62%),
    radial-gradient(760px 460px at 96% 4%, #e9f2ff 0%, rgba(233, 242, 255, 0) 58%),
    linear-gradient(180deg, #fbfcfe 0%, #f2f5fa 100%);
}

.auth-aurora {
  display: none;
}

.auth-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1040px;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 34px 80px -46px rgba(11, 27, 51, 0.55);
  overflow: hidden;
}

.auth-aside {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 40px 38px;
  background: var(--grad-sidebar);
  color: #d7e2f3;
}

.auth-aside::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(420px 280px at 100% 0%, rgba(37, 99, 235, 0.38), transparent 66%),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: auto, 36px 36px, 36px 36px;
  pointer-events: none;
}

.auth-aside > * {
  position: relative;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: #ffffff;
  margin-bottom: 4px;
}

.auth-brand-name {
  display: block;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.auth-brand-sub {
  display: block;
  font-size: 11.5px;
  color: rgba(215, 226, 243, 0.62);
}

.auth-headline {
  margin: 0;
  font-size: clamp(23px, 2.5vw, 29px);
  font-weight: 760;
  line-height: 1.22;
  letter-spacing: -0.032em;
  color: #ffffff;
}

.auth-lead {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: rgba(215, 226, 243, 0.7);
}

.auth-points {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-points li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12.8px;
  line-height: 1.55;
  color: rgba(215, 226, 243, 0.86);
}

.auth-point-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #93c5fd;
}

.auth-point-icon svg {
  width: 14px;
  height: 14px;
}

/* Small illustrative verification card in the auth aside */
.auth-preview {
  margin-top: 4px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  padding: 12px 14px;
  backdrop-filter: blur(6px);
}

.auth-preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(215, 226, 243, 0.55);
}

.auth-preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.32);
  color: #6ee7b7;
  font-size: 9.5px;
  letter-spacing: 0.06em;
}

.auth-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 9px;
}

.auth-preview-row strong {
  font-size: 17px;
  font-weight: 750;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.auth-preview-row span {
  font-size: 11.5px;
  color: rgba(215, 226, 243, 0.62);
}

.auth-aside-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(215, 226, 243, 0.75);
  text-decoration: none;
  transition: color var(--transition), gap var(--transition);
}

.auth-back-link svg {
  width: 15px;
  height: 15px;
}

.auth-back-link:hover {
  color: #ffffff;
  gap: 9px;
}

.auth-card {
  padding: 40px 38px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-card-head {
  margin-bottom: 18px;
}

.auth-title {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.028em;
}

.auth-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 18px;
}

.auth-tab {
  padding: 8px 12px;
  border: none;
  border-radius: 7px;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  color: var(--body);
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition),
    box-shadow var(--transition);
}

.auth-tab:hover {
  color: var(--heading);
}

.auth-tab.active {
  background: #ffffff;
  color: var(--brand-deep);
  box-shadow: var(--shadow-xs);
}

.auth-link {
  background: none;
  border: 0;
  padding: 0;
  margin: 2px auto 0;
  display: block;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
  text-decoration: none;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-helper {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

#reset-otp-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-legal {
  margin: 18px 0 0;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted);
  text-align: center;
}

.label-optional {
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.totp-input {
  letter-spacing: 0.4em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 16px;
  text-align: center;
}

/* Password field with visibility toggle */
.password-field {
  position: relative;
}

.password-field input {
  padding-right: 42px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--transition), background-color var(--transition);
}

.password-toggle:hover {
  color: var(--brand-deep);
  background: var(--brand-soft);
}

.password-toggle svg {
  width: 17px;
  height: 17px;
}

.password-toggle .icon-eye-off {
  display: none;
}

.password-toggle.is-visible .icon-eye {
  display: none;
}

.password-toggle.is-visible .icon-eye-off {
  display: block;
}

@media (max-width: 900px) {
  .auth-panel {
    grid-template-columns: 1fr;
    max-width: 480px;
    border-radius: 16px;
  }

  .auth-aside {
    padding: 24px 26px 20px;
  }

  .auth-headline {
    font-size: 20px;
  }

  .auth-lead,
  .auth-points,
  .auth-preview,
  .auth-aside-footer {
    display: none;
  }

  .auth-card {
    padding: 24px 24px 28px;
  }

  .auth-title {
    font-size: 19px;
  }
}

@media (max-width: 480px) {
  .auth-wrapper {
    padding: 0;
    align-items: stretch;
    background: #ffffff;
  }

  .auth-panel {
    max-width: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    min-height: 100vh;
  }

  .auth-aside {
    border-radius: 0;
  }

  .auth-card {
    padding: 22px 20px 32px;
  }
}

/* ==========================================================================
   Console layout & sidebar
   ========================================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: #f5f7fb;
}

.sidebar {
  position: relative;
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--grad-sidebar);
  color: rgba(214, 225, 242, 0.76);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 40;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(280px 200px at 100% 0%, rgba(37, 99, 235, 0.2), transparent 70%);
  pointer-events: none;
}

.sidebar > * {
  position: relative;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.sidebar-title {
  font-weight: 750;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.sidebar-sub {
  font-size: 10.5px;
  color: rgba(214, 225, 242, 0.55);
  letter-spacing: 0.02em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group-label {
  display: none;
  padding: 0 12px 6px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(214, 225, 242, 0.38);
}

.nav-group:has(.nav-link:not([hidden])) .nav-group-label {
  display: block;
}

.nav-group:not(:has(.nav-link:not([hidden]))) {
  display: none;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(214, 225, 242, 0.72);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition),
    border-color var(--transition);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.78;
  transition: opacity var(--transition), color var(--transition);
}

.nav-link-label {
  flex: 1;
  min-width: 0;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.055);
  color: #ffffff;
}

.nav-link:hover .nav-icon {
  opacity: 1;
}

.nav-link.active {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(96, 165, 250, 0.22);
  color: #ffffff;
  font-weight: 600;
}

.nav-link.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #60a5fa;
}

.nav-link.active .nav-icon {
  opacity: 1;
  color: #93c5fd;
}

.nav-pill {
  min-width: 21px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.92);
  color: #261600;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.02);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  margin-bottom: 9px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #93c5fd;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.user-avatar svg {
  width: 16px;
  height: 16px;
}

.user-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.user-email {
  font-size: 11.5px;
  font-weight: 600;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  font-size: 10px;
  color: rgba(214, 225, 242, 0.55);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-sidebar,
.btn-sidebar-ghost {
  flex: 1;
  padding: 7px 9px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 650;
  border-radius: 7px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  transition: background-color var(--transition), border-color var(--transition),
    color var(--transition);
}

.btn-sidebar:hover {
  background: rgba(255, 255, 255, 0.14);
}

.btn-sidebar-ghost {
  background: transparent;
  color: rgba(214, 225, 242, 0.8);
}

.btn-sidebar-ghost:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-scrim {
  display: none;
}

.content-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 26px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar-titles {
  min-width: 0;
}

.topbar h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.022em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-sub {
  margin: 1px 0 0;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--heading);
  cursor: pointer;
  flex-shrink: 0;
}

.mobile-menu-btn svg {
  width: 100%;
  height: 100%;
}

@media (max-width: 1100px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: -282px;
    width: 272px;
    transition: left 220ms var(--ease-out);
    box-shadow: 24px 0 60px -30px rgba(8, 13, 28, 0.7);
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 39;
    background: rgba(8, 16, 32, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms var(--ease-out);
  }

  .sidebar-scrim.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 11px 14px;
    gap: 8px;
  }

  .topbar h2 {
    font-size: 15px;
  }

  .topbar-sub {
    display: none;
  }

  .topbar-link span {
    display: none;
  }

  .topbar-link {
    padding: 7px 9px;
  }

  #refresh-view-btn {
    padding: 7px 9px;
  }

  #refresh-view-btn span {
    display: none;
  }
}

/* ==========================================================================
   View scaffolding
   ========================================================================== */
.view-section {
  padding: 22px 24px 46px;
}

@media (max-width: 760px) {
  .view-section {
    padding: 16px 14px 34px;
  }
}

.view-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.view-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-deep);
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  padding: 3px 9px;
  margin-bottom: 7px;
}

.view-title {
  margin: 0;
  font-size: 20px;
  font-weight: 720;
  letter-spacing: -0.028em;
}

.view-intro-meta {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

@media (max-width: 620px) {
  .view-intro-meta {
    display: none;
  }
}

/* ==========================================================================
   KPI cards
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(184px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-card {
  position: relative;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 15px 16px 16px;
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition), box-shadow var(--transition),
    border-color var(--transition);
}

.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  width: 26px;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--brand);
  opacity: 0.75;
}

.kpi-card:nth-child(3n + 2)::before {
  background: var(--success);
}

.kpi-card:nth-child(3n + 3)::before {
  background: #7c93b5;
}

.kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: var(--line-strong);
}

.kpi-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.075em;
  text-transform: uppercase;
  color: var(--muted);
}

.kpi-value {
  font-size: 23px;
  font-weight: 750;
  letter-spacing: -0.033em;
  line-height: 1.22;
  color: var(--heading);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.card-heading {
  min-width: 0;
}

.card-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.018em;
}

.card-subtitle {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

@media (max-width: 620px) {
  .card {
    padding: 14px 12px;
    border-radius: 12px;
  }

  .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
  }

  .card-header .btn {
    align-self: flex-start;
  }
}

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 660px;
}

.data-table th,
.data-table td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}

.data-table td.mono {
  white-space: nowrap;
}

.data-table thead th {
  position: sticky;
  top: 0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.065em;
  color: var(--muted);
  background-color: var(--surface-2);
  font-weight: 700;
  white-space: nowrap;
  z-index: 1;
}

.data-table tbody tr {
  transition: background-color var(--transition);
}

.data-table tbody tr:hover {
  background-color: #f6f9ff;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table td {
  color: var(--body);
}

.data-table td.mono {
  color: var(--heading);
  font-weight: 500;
}

.data-table strong {
  color: var(--heading);
  font-weight: 650;
  white-space: nowrap;
}

.data-table a {
  color: var(--brand-deep);
  font-weight: 600;
  text-decoration: none;
}

.data-table a:hover {
  text-decoration: underline;
}

#view-payments .data-table td:nth-child(3),
#view-payments .data-table td:nth-child(4) {
  white-space: normal;
  min-width: 120px;
}

.table-wrap:has(tbody:empty)::after {
  content: "No records to display.";
  display: block;
  padding: 26px 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}

/* Mobile record cards — labels are supplied by app.js from the table header */
@media (max-width: 700px) {
  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  .data-table {
    min-width: 0;
    display: block;
    font-size: 12.5px;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .data-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #ffffff;
    box-shadow: var(--shadow-xs);
  }

  .data-table tbody tr:hover {
    background: #ffffff;
  }

  .data-table td {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0;
    border: 0;
    white-space: normal;
    min-width: 0;
    word-break: break-word;
  }

  .data-table td::before {
    content: attr(data-label);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .data-table td:not([data-label])::before {
    display: none;
  }

  .data-table td[colspan] {
    grid-column: 1 / -1;
  }

  .data-table td strong {
    white-space: normal;
  }

  .data-table td.mono {
    white-space: normal;
    word-break: break-all;
  }
}

/* ==========================================================================
   Status tags
   ========================================================================== */
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.025em;
  line-height: 1.6;
  white-space: nowrap;
  border: 1px solid transparent;
}

.status-tag::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.tag-green {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: #b7e8d7;
}

.tag-amber {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: #f5dfb4;
}

.tag-red {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: #f6cfcb;
}

.tag-blue {
  background: var(--info-bg);
  color: var(--info-text);
  border-color: #cfdffb;
}

.tag-slate {
  background: var(--surface-3);
  color: var(--body);
  border-color: var(--line-strong);
}

/* ==========================================================================
   Forms
   ========================================================================== */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.field {
  display: flex;
  flex-direction: column;
}

label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--body);
  margin-bottom: 5px;
  letter-spacing: 0.005em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  font-family: inherit;
  font-size: 13.5px;
  color: var(--heading);
  background: #ffffff;
  transition: border-color var(--transition), box-shadow var(--transition),
    background-color var(--transition);
}

input::placeholder,
textarea::placeholder {
  color: #9aa7bb;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #bcc8da;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.6;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5.5 7.5L10 12l4.5-4.5' stroke='%23667085' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 16px;
  padding-right: 30px;
  cursor: pointer;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(200px, 2fr) 1fr 1.15fr 0.85fr 0.85fr auto;
  align-items: end;
  gap: 9px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.filter-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.filter-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 5px;
}

.filter-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

@media (max-width: 1180px) {
  .filter-bar {
    grid-template-columns: 1fr 1fr;
  }

  .filter-field--wide {
    grid-column: 1 / -1;
  }

  .filter-actions {
    grid-column: 1 / -1;
  }

  .filter-actions .btn {
    flex: 1;
  }
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

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

.full-span {
  grid-column: 1 / -1;
}

.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
}

.checkbox-row label {
  margin: 0;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
  flex-shrink: 0;
}

.review-decision-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line-strong);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: var(--radius-xs);
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.005em;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background-color var(--transition), border-color var(--transition),
    color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.btn:active {
  transform: translateY(1px);
}

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 11.5px;
  border-radius: 7px;
  gap: 5px;
}

.btn-block {
  width: 100%;
  padding: 11px 16px;
  font-size: 13.5px;
  margin-top: 2px;
}

.btn-full {
  width: 100%;
}

.btn-icon {
  transition: transform var(--transition);
}

.btn:hover .btn-icon {
  transform: translateX(3px);
}

.btn-primary {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.22);
}

.btn-primary:hover {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
  box-shadow: 0 7px 16px -8px rgba(37, 99, 235, 0.65);
}

.btn-secondary {
  background: #ffffff;
  color: var(--heading);
  border-color: var(--line-strong);
}

.btn-secondary:hover {
  background: var(--surface-3);
  border-color: #bcc8da;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.btn-ghost {
  background: transparent;
  color: var(--body);
  border-color: transparent;
}

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

/* ==========================================================================
   Alerts, callouts, secrets, toasts
   ========================================================================== */
.alert {
  position: relative;
  padding: 10px 12px 10px 32px;
  border-radius: var(--radius-xs);
  font-size: 12.5px;
  line-height: 1.5;
}

.alert::before {
  content: "!";
  position: absolute;
  left: 11px;
  top: 10px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: currentColor;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.alert-danger {
  background: var(--danger-bg);
  border: 1px solid #f6cfcb;
  color: var(--danger-text);
}

.alert-info {
  background: var(--info-bg);
  border: 1px solid #cfdffb;
  color: var(--info-text);
}

.policy-callout {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  background: #f6f9ff;
  border: 1px solid var(--brand-border);
  color: #23408f;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 12.5px;
  line-height: 1.6;
}

.policy-callout p {
  margin: 0;
}

.policy-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--brand-border);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.policy-icon svg {
  width: 16px;
  height: 16px;
}

.secret-reveal-box {
  position: relative;
  background: #fffaf0;
  border: 1px solid #f5d9a8;
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  margin-bottom: 14px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #7c4a03;
  word-break: break-word;
}

.secret-reveal-box strong {
  color: #6b3d00;
}

.muted-note {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
  margin: 0 0 12px;
}

.toast-banner {
  position: fixed;
  top: 74px;
  right: 24px;
  z-index: 95;
  max-width: 380px;
  padding: 11px 14px 11px 36px;
  border-radius: var(--radius-sm);
  background: var(--success-bg);
  border: 1px solid #b7e8d7;
  color: var(--success-text);
  font-size: 12.8px;
  font-weight: 600;
  box-shadow: 0 16px 36px -18px rgba(16, 24, 40, 0.4);
  animation: toastIn 200ms var(--ease-out);
}

.toast-banner::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  transform: translateY(-50%);
  box-shadow: 0 0 0 4px rgba(15, 157, 110, 0.14);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .toast-banner {
    top: 64px;
    right: 12px;
    left: 12px;
    max-width: none;
  }
}

/* ==========================================================================
   Manual review queue
   ========================================================================== */
.stack-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.review-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 18px 18px 20px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.review-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--warning);
  opacity: 0.85;
}

.review-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: #ecd9b6;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 13px 0;
  padding: 12px 13px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
}

.review-grid > div {
  min-width: 0;
}

.review-grid .mono {
  word-break: break-word;
}

/* ==========================================================================
   Modal
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 16, 32, 0.52);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 90;
  animation: fadeIn 170ms ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-dialog {
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: 0 36px 80px -36px rgba(8, 16, 32, 0.7);
  animation: modalIn 220ms var(--ease-out);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 1;
}

.modal-header h3 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.018em;
}

.modal-close {
  width: 31px;
  height: 31px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color var(--transition), color var(--transition),
    border-color var(--transition);
}

.modal-close svg {
  width: 100%;
  height: 100%;
}

.modal-close:hover {
  background: var(--danger-bg);
  border-color: #f6cfcb;
  color: var(--danger-text);
}

.modal-body {
  padding: 18px 20px 22px;
}

.modal-body p {
  margin-top: 0;
  color: var(--body);
  font-size: 13px;
  line-height: 1.62;
}

.modal-body a {
  color: var(--brand-deep);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--brand-border);
}

.modal-body a:hover {
  border-bottom-color: var(--brand-deep);
}

.modal-body h4 {
  margin: 18px 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--heading);
}

@media (max-width: 600px) {
  .modal-backdrop {
    padding: 10px;
    align-items: flex-end;
  }

  .modal-dialog {
    max-height: 92vh;
    border-radius: 16px;
  }

  .modal-header {
    border-radius: 16px 16px 0 0;
    padding: 14px 16px;
  }

  .modal-body {
    padding: 16px;
  }
}

/* ==========================================================================
   Segmented control
   ========================================================================== */
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.segmented button {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 13px;
  border-radius: 7px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition),
    box-shadow var(--transition);
}

.segmented button:hover {
  color: var(--heading);
}

.segmented button.active {
  background: #ffffff;
  color: var(--brand-deep);
  box-shadow: var(--shadow-xs);
}

/* ==========================================================================
   Subscription plan cards (merchant)
   ========================================================================== */
.m-plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.m-plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 20px 18px 18px;
  background: #ffffff;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.m-plan-card:hover {
  box-shadow: var(--shadow-sm);
}

.m-plan-card--featured {
  border-color: var(--brand);
  box-shadow: 0 16px 34px -24px rgba(37, 99, 235, 0.6);
}

.m-plan-badge {
  position: absolute;
  top: -10px;
  left: 16px;
  background: var(--brand);
  color: #ffffff;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
}

.m-plan-card h4 {
  margin: 4px 0 6px;
  font-size: 18px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.m-plan-price {
  font-size: 26px;
  font-weight: 800;
  color: var(--brand-deep);
  margin-bottom: 10px;
  letter-spacing: -0.03em;
}

.m-plan-price span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.m-plan-card ul {
  list-style: none;
  margin: 4px 0 18px;
  padding: 0;
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: #374151;
  flex: 1;
}

.m-plan-card ul li {
  position: relative;
  padding-left: 21px;
  line-height: 1.5;
}

.m-plan-card ul li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 800;
}

.m-plans-status-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

/* ==========================================================================
   Scrollbars & motion
   ========================================================================== */
.sidebar-nav,
.table-wrap,
.modal-dialog {
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 135, 170, 0.4) transparent;
}

.sidebar-nav::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar,
.modal-dialog::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.sidebar-nav::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.modal-dialog::-webkit-scrollbar-thumb {
  background: rgba(120, 135, 170, 0.35);
  border-radius: 999px;
}

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

@keyframes tp-fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes tp-shell-out {
  to {
    opacity: 0;
    transform: scale(0.99);
  }
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: tp-spin 0.7s linear infinite;
  vertical-align: -2px;
  flex-shrink: 0;
}

.btn.is-loading {
  pointer-events: none;
  opacity: 0.85;
}

.btn:hover:not(:disabled):not(.is-loading) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.alert {
  animation: tp-fade-up 0.25s cubic-bezier(0.2, 0, 0, 1) both;
}

.auth-card {
  animation: tp-fade-up 0.45s cubic-bezier(0.2, 0, 0, 1) 0.04s both;
}

.auth-aside {
  animation: tp-fade-up 0.45s cubic-bezier(0.2, 0, 0, 1) both;
}

#reg-otp-step:not([hidden]),
#login-verify-group:not([hidden]),
#login-totp-group:not([hidden]) {
  animation: tp-fade-up 0.3s cubic-bezier(0.2, 0, 0, 1) both;
}

.view-section:not([hidden]) {
  animation: tp-fade-up 0.28s cubic-bezier(0.2, 0, 0, 1) both;
}

.nav-link:hover {
  transform: none;
}

#app-shell.is-leaving {
  animation: tp-shell-out 0.35s cubic-bezier(0.2, 0, 0, 1) forwards;
  pointer-events: none;
}

.modal-dialog {
  animation: tp-fade-up 0.28s cubic-bezier(0.2, 0, 0, 1) both;
}

.status-tag {
  transition: transform var(--transition), box-shadow var(--transition);
}

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