/* ────────────────────────────────────────────────────────────────
   Design system — Evris Payment Gateway
   Inspirado em TailAdmin (https://demo.tailadmin.com)
   ──────────────────────────────────────────────────────────────── */

:root {
  /* Primary */
  --primary:       #7B3FE4;
  --primary-dark:  #6D28D9;
  --primary-light: #EDE9FE;
  --primary-ring:  rgba(123, 63, 228, 0.18);

  /* Backgrounds */
  --bg-page:    #F1F5F9;
  --bg-card:    #FFFFFF;
  --bg-sidebar: #FFFFFF;

  /* Borders */
  --border:   #E2E8F0;
  --divider:  #F1F5F9;

  /* Text */
  --text-heading:   #1C2434;
  --text-body:      #374151;
  --text-secondary: #637381;
  --text-muted:     #9CA3AF;

  /* Status */
  --s-bg:   #DCFCE7; --s-text: #15803D; --s-dot: #22AD5C;
  --w-bg:   #FEF3C7; --w-text: #B45309; --w-dot: #F59E0B;
  --e-bg:   #FEE2E2; --e-text: #B91C1C; --e-dot: #EF4444;
  --i-bg:   #DBEAFE; --i-text: #1D4ED8; --i-dot: #3B82F6;
  --n-bg:   #F1F5F9; --n-text: #637381; --n-dot: #9CA3AF;

  /* Layout */
  --sidebar-w:  240px;
  --topbar-h:    60px;
  --content-px:  28px;
  --content-py:  28px;

  /* Shape */
  --r-sm:  4px;
  --r-md:  8px;
  --r-lg:  12px;
  --r-xl:  16px;
  --r-full: 9999px;

  /* Shadow */
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-modal: 0 20px 50px rgba(0,0,0,0.18);

  /* Transition */
  --ease: 0.18s ease;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  color: var(--text-body);
  background: var(--bg-page);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button, input, select, textarea { font: inherit; }
table { border-collapse: collapse; width: 100%; }
code {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: var(--r-sm);
  padding: 1px 5px;
  font-size: 12px;
}

/* ── Layout ──────────────────────────────────────────────────── */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid var(--divider);
}
.brand-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-icon svg { width: 18px; height: 18px; stroke: #fff; }
.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.01em;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
}
.nav-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 8px 8px;
  margin-top: 4px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
  user-select: none;
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-link:hover         { background: var(--primary-light); color: var(--primary); }
.nav-link:hover .nav-icon { stroke: var(--primary); }
.nav-link.active        { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-link.active .nav-icon { stroke: var(--primary); }
.nav-link-muted         { opacity: 0.7; }
.nav-link-muted:hover   { opacity: 1; }
.icon-ext               { width: 12px; height: 12px; margin-left: auto; opacity: 0.5; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--divider);
}

/* ── Main wrapper ────────────────────────────────────────────── */
.main-wrap {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--content-px);
  flex-shrink: 0;
}
.breadcrumb { display: flex; align-items: center; gap: 6px; }
.bc-item { font-size: 13px; color: var(--text-muted); }
.bc-sep { width: 14px; height: 14px; stroke: var(--text-muted); }
.bc-active { font-weight: 600; color: var(--text-heading); }
.topbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.refresh-status { font-size: 12px; color: var(--text-muted); }

.auth-pending .layout { visibility: hidden; }
.auth-status {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg-page);
}
.auth-status[hidden] { display: none; }
.auth-error-card {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-card);
  color: var(--text-body);
  box-shadow: var(--shadow-sm);
}
.auth-error-card strong { color: var(--text-heading); }
.auth-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}
.auth-user > span {
  display: grid;
  line-height: 1.2;
  text-align: right;
}
.auth-user strong { color: var(--text-heading); font-size: 12px; font-weight: 600; }
.auth-user small { color: var(--text-muted); font-size: 11px; text-transform: capitalize; }

.context-store-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--r-md);
  background: var(--divider);
}
.context-store-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}
.context-store-select {
  min-width: 140px;
  max-width: 240px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-card);
  color: var(--text-body);
}
.context-store-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-ring);
}

/* ── Content area ────────────────────────────────────────────── */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: var(--content-py) var(--content-px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Tab panes ───────────────────────────────────────────────── */
.tab-pane { display: none; flex-direction: column; gap: 20px; }
.tab-pane.active { display: flex; }

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.01em;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  max-width: 720px;
  line-height: 1.45;
}
.page-subtitle strong { color: var(--text-body); font-weight: 600; }

/* ── Metrics row ─────────────────────────────────────────────── */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}
.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}
button.metric-card {
  display: block;
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
button.metric-card:hover {
  border-color: var(--primary);
}
.metric-card.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-ring);
}
.metric-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.metric-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1;
}
.metric-success .metric-value { color: var(--s-text); }
.metric-warning .metric-value { color: var(--w-text); }
.metric-error   .metric-value { color: var(--e-text); }
.metric-info    .metric-value { color: var(--i-text); }
.metric-inactive .metric-value { color: var(--n-text); }
.metric-card.is-pending .metric-value { color: var(--text-muted); }

/* ── Card ────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--divider);
}
.card-head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.table-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}
.table-filter label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}
.table-filter-select {
  min-width: 160px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-card);
  color: var(--text-body);
}
.table-filter-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-ring);
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-heading);
}
.record-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 2px 10px;
}

.table-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--divider);
}
.pagination-meta {
  font-size: 12px;
  color: var(--text-muted);
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pagination-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
}
.pagination-btn:hover:not(:disabled) {
  background: var(--primary-light);
  color: var(--primary);
}
.pagination-btn.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.pagination-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.pagination-size {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.pagination-size select {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-body);
  padding: 0 8px;
}

/* ── Data table ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table { min-width: 600px; }
.data-table thead tr {
  border-bottom: 1px solid var(--divider);
}
.data-table th {
  padding: 12px 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: left;
  white-space: nowrap;
  background: transparent;
}
.data-table td {
  padding: 14px 20px;
  font-size: 13px;
  color: var(--text-body);
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #F8FAFC; }
.col-right { text-align: right; }
.col-right-td { text-align: right; }
.cell-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
}
.cell-id {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.cell-primary   { font-weight: 500; color: var(--text-heading); }
.cell-mono      { font-family: monospace; font-size: 12px; }
.cell-amount    { font-weight: 600; color: var(--text-heading); font-variant-numeric: tabular-nums; }
.cell-error     { color: var(--e-text); font-size: 12px; }
.drawer-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.drawer-link:hover { text-decoration: underline; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 18px;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
/* success */
.badge-success { background: var(--s-bg); color: var(--s-text); }
.badge-success .badge-dot { background: var(--s-dot); }
/* warning */
.badge-warning { background: var(--w-bg); color: var(--w-text); }
.badge-warning .badge-dot { background: var(--w-dot); }
/* error / danger */
.badge-error   { background: var(--e-bg); color: var(--e-text); }
.badge-error .badge-dot { background: var(--e-dot); }
/* info */
.badge-info    { background: var(--i-bg); color: var(--i-text); }
.badge-info .badge-dot { background: var(--i-dot); }
/* neutral / secondary */
.badge-neutral { background: var(--n-bg); color: var(--n-text); }
.badge-neutral .badge-dot { background: var(--n-dot); }
/* mode badges (small labels for vendor/integration mode) */
.badge-mode {
  background: #F0F4FF;
  color: #4338CA;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-weight: 500;
}

/* ── Terminals split layout ──────────────────────────────────── */
.terminals-split {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  min-height: 560px;
}

/* Lista esquerda */
.terminals-panel-list {
  width: 375px;
  flex-shrink: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
}
.terminals-list-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.terminals-list-scroll {
  overflow-y: auto;
  flex: 1;
}

/* Item da lista */
.terminal-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
  transition: background var(--ease), border-left-color var(--ease);
  border-left: 3px solid transparent;
}
.terminal-list-item:last-child { border-bottom: none; }
.terminal-list-item:hover { background: var(--bg-page); }
.terminal-list-item.context-store-focus:not(.selected) {
  border-left-color: rgba(123, 63, 228, 0.45);
}
.terminal-list-item.selected {
  background: var(--primary-light);
  border-left-color: var(--primary);
}
.tli-body { flex: 1; min-width: 0; }
.tli-id   { font-size: 13px; font-weight: 600; color: var(--text-heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tli-store { font-size: 11px; color: var(--text-muted); font-family: monospace; margin-top: 2px; }
.tli-desc  { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.tli-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }

/* Painel de detalhe direito */
.terminals-panel-detail {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Placeholder quando nada selecionado */
.detail-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 80px 24px;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--r-lg);
  color: var(--text-muted);
  text-align: center;
  font-size: 13px;
  line-height: 1.7;
  flex: 1;
  min-height: 300px;
}

/* Card body (formulários inline) */
.card-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}
.detail-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 4px;
}
.section-divider {
  border: none;
  border-top: 1px solid var(--divider);
  margin: 20px 0 8px;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline {
  background: var(--bg-card);
  color: var(--text-body);
  border-color: var(--border);
}
.btn-outline:hover { background: var(--bg-page); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-page); color: var(--text-body); }
.btn-danger {
  background: var(--e-dot);
  color: #fff;
  border-color: var(--e-dot);
}
.btn-danger:hover { background: #DC2626; border-color: #DC2626; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ── Toggle ──────────────────────────────────────────────────── */
.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  color: var(--text-body);
}
.toggle-input { position: absolute; opacity: 0; width: 0; height: 0; }
/* Sem o trilho irmão o checkbox nativo precisa continuar visível. */
.toggle-input:not(:has(+ .toggle-track)) {
  position: static;
  opacity: 1;
  width: auto;
  height: auto;
}
.toggle-track {
  width: 40px;
  height: 22px;
  border-radius: var(--r-full);
  background: var(--border);
  position: relative;
  flex-shrink: 0;
  transition: background var(--ease);
}
.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform var(--ease);
}
.toggle-input:checked + .toggle-track { background: var(--primary); }
.toggle-input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 13px; font-weight: 500; color: var(--text-heading); }
.req { color: var(--e-dot); }
.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-card);
  color: var(--text-body);
  font-size: 13px;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.form-input[readonly] {
  background: var(--bg-muted, rgba(127, 127, 127, 0.08));
  color: var(--text-muted, #6b7280);
  cursor: not-allowed;
}
.form-input[readonly]:focus {
  border-color: var(--border);
  box-shadow: none;
}
.form-input::placeholder { color: var(--text-muted); }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
}
.config-block-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 16px 0 10px;
}

/* ── Methods list (inside modal) ─────────────────────────────── */
.methods-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.method-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  flex-wrap: wrap;
}
.method-row-id {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
  min-width: 140px;
}
.method-row-vendor {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
  min-width: 80px;
}
.method-row-config {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 2;
}
.config-tag {
  font-size: 11px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-family: monospace;
}
.method-row-actions { display: flex; gap: 6px; margin-left: auto; }
.methods-empty {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--bg-page);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  margin-top: 10px;
}
.methods-error { color: var(--e-text); background: var(--e-bg); border-color: var(--e-dot); }

/* ── Toast ───────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  font-size: 13px;
  font-weight: 500;
  max-width: 360px;
  animation: toastIn 0.25s ease;
}
.toast-success { background: var(--s-bg); color: var(--s-text); border: 1px solid var(--s-dot); }
.toast-error   { background: var(--e-bg); color: var(--e-text); border: 1px solid var(--e-dot); }
.toast-info    { background: var(--i-bg); color: var(--i-text); border: 1px solid var(--i-dot); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section-sub-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.method-form { display: flex; flex-direction: column; gap: 14px; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 60px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state h3 { font-size: 15px; font-weight: 500; color: var(--text-secondary); }
.empty-state p  { font-size: 13px; }

/* ── Loading overlay (global) ────────────────────────────────── */
.loading-row td {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}
.spinner-sm {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Row clickable ───────────────────────────────────────────── */
.row-clickable {
  cursor: pointer;
  transition: background var(--ease);
}
.row-clickable:hover td { background: var(--primary-light); }

/* ── Drawer ──────────────────────────────────────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0);
  z-index: 1200;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
  transition: background 0.25s ease;
}
.drawer-overlay.open {
  background: rgba(0,0,0,0.35);
  pointer-events: all;
}
.drawer {
  width: min(640px, 96vw);
  height: 100%;
  background: var(--bg-card);
  box-shadow: -8px 0 40px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-title { flex: 1; min-width: 0; }
.drawer-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  transition: color var(--ease), background var(--ease);
  flex-shrink: 0;
}
.drawer-close:hover { color: var(--text-heading); background: var(--bg-page); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.drawer-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
}
.drawer-error {
  color: var(--e-text);
  background: var(--e-bg);
  border: 1px solid var(--e-dot);
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-size: 13px;
}
.drawer-error-inline {
  color: var(--e-text);
  font-size: 12px;
}
.drawer-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 32px 0;
}

.drawer-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 20px;
  margin-bottom: 20px;
}
.drawer-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.drawer-meta-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.drawer-meta-value {
  font-size: 13px;
  color: var(--text-heading);
  font-weight: 500;
  word-break: break-all;
}

.drawer-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--divider);
}

.drawer-table {
  font-size: 12px;
}
.drawer-table thead th {
  font-size: 11px;
  padding: 6px 10px;
}
.drawer-table tbody td { padding: 8px 10px; }

/* Key-value list */
.drawer-kv-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.drawer-kv-row {
  display: flex;
  gap: 12px;
  padding: 7px 12px;
  font-size: 12px;
  border-bottom: 1px solid var(--divider);
}
.drawer-kv-row:last-child { border-bottom: none; }
.drawer-kv-row:nth-child(even) { background: var(--bg-page); }
.drawer-kv-key {
  width: 180px;
  flex-shrink: 0;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: monospace;
  font-size: 11px;
  padding-top: 1px;
}
.drawer-kv-val {
  flex: 1;
  color: var(--text-heading);
  font-family: 'Courier New', Courier, monospace;
  font-size: 11.5px;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.55;
}

/* Receipt */
.drawer-receipt {
  background: #0f1117;
  color: #e2e8f0;
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  line-height: 1.5;
  padding: 16px;
  border-radius: var(--r-md);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Events */
.drawer-events {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.drawer-event {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 14px;
}
.drawer-event-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.drawer-event-type {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-heading);
  font-family: monospace;
}
.drawer-event-arrow {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}
.drawer-event-date {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
}
.drawer-event-desc {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.config-group {
  margin-bottom: 12px;
}
.config-group-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 8px 0 6px;
}
.vendor-store-card {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  background: var(--bg-page);
  margin-bottom: 12px;
}
.alert-banner {
  background: var(--e-bg, #fef3c7);
  border: 1px solid var(--e-dot, #f59e0b);
  color: var(--e-text, #92400e);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.5;
}
.alert-banner p { margin: 0 0 6px; }
.alert-banner p:last-child { margin-bottom: 0; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .terminals-split { flex-direction: column; }
  .terminals-panel-list { width: 100%; }
}
@media (max-width: 900px) {
  .form-row-2 { grid-template-columns: 1fr; }
  .metrics-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .sidebar { display: none; }
  .content-area { padding: 16px; }
  .metrics-row { grid-template-columns: repeat(2, 1fr); }
}
