/* ==========================================================================
   Enterprise Admin Console Design System (Stripe / Linear inspired)
   ========================================================================== */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;

  --success: #166534;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;

  --warning: #b45309;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;

  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-bg: #fef2f2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .brand-name {
  color: var(--text-main);
  font-weight: 600;
  letter-spacing: -0.01em;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

/* ==========================================================================
   Sidebar Navigation
   ========================================================================== */
.sidebar {
  width: 220px;
  position: fixed;
  inset: 0 auto 0 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 24px;
}

.brand-badge {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: var(--text-main);
  color: #fff;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.nav-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
  padding: 0 10px 8px;
}

.sidebar nav {
  display: grid;
  gap: 2px;
}

.nav-item {
  height: 36px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.12s ease;
}

.nav-item:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.nav-svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.nav-item.active {
  background: #f1f5f9;
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active .nav-svg {
  color: var(--primary);
}

/* ==========================================================================
   Header & Layout
   ========================================================================== */
.main {
  margin-left: 220px;
  min-height: 100vh;
}

.topbar {
  height: 54px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.sidebar-toggle {
  display: none;
  width: 28px;
  height: 28px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}

.sidebar-toggle span {
  display: block;
  width: 14px;
  height: 2px;
  background: var(--text-muted);
  margin: 2px 0;
}

.topbar-page {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.topbar-page h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.heading-with-count {
  display: flex;
  align-items: center;
  gap: 10px;
}

.heading-with-count h1 {
  margin: 0;
  font-size: 16px;
}

.count-pill {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.date-chip {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.top-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  margin-left: auto;
  user-select: none;
}

.profile-menu { position: relative; }
.profile-menu > summary { list-style: none; }
.profile-menu > summary::-webkit-details-marker { display: none; }

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e2e8f0;
  color: var(--text-main);
  font-weight: 600;
  font-size: 11px;
}

.chevron { color: var(--text-muted); font-size: 10px; }

.profile-dropdown {
  position: absolute;
  z-index: 100;
  right: 0;
  top: calc(100% + 6px);
  width: 160px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.profile-dropdown a, .profile-dropdown button {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  text-align: left;
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

.profile-dropdown a:hover, .profile-dropdown button:hover {
  background: #f1f5f9;
}

.profile-dropdown form { margin: 0; }
.profile-dropdown form button.logout-btn { color: var(--danger); }

/* Content wrapper */
.content {
  padding: 24px 32px 40px;
  max-width: 1400px;
  margin: 0;
}

.muted {
  color: var(--text-muted);
  font-size: 12.5px;
  margin: 0;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* Flash Messages - Fixed Floating Toast Notifications (Top Right Corner) */
.flash-stack {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
  width: calc(100% - 48px);
  pointer-events: none;
}

.flash {
  pointer-events: auto;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(50px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.flash.success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  border-left: 4px solid #16a34a;
}

.flash.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-left: 4px solid #dc2626;
}

.flash button {
  border: 0;
  background: none;
  color: inherit;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.flash button:hover {
  opacity: 1;
}

/* Tooltip Styles */
.tooltip-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
}

.tooltip-wrapper:hover .tooltip-bubble,
.tooltip-wrapper:focus .tooltip-bubble {
  visibility: visible !important;
  opacity: 1 !important;
  transform: translateX(-50%) translateY(0) !important;
}

.tooltip-bubble {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #0f172a;
  color: #f8fafc;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.4;
  width: 280px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
  z-index: 1000;
  pointer-events: none;
  text-align: left;
}

.tooltip-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #0f172a transparent transparent transparent;
}

/* Transaction History Pagination */
.tx-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
}

.tx-pagination-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.82rem;
  color: #64748b;
}

.tx-per-page-select {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-size: 0.80rem;
  background: #ffffff;
  color: #1e293b;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.tx-pagination-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tx-page-btn {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tx-page-btn:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

.tx-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tx-page-info {
  font-size: 0.80rem;
  font-weight: 600;
  color: #475569;
}

/* ==========================================================================
   Dashboard Overview
   ========================================================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
}

/* Dashboard cards use the same soft, light color treatment as user profile cards. */
.stat-card { border-radius: 12px; box-shadow: 0 2px 8px rgba(25,35,60,.025); transition: transform .16s ease, box-shadow .16s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(25,35,60,.07); }
.stat-card:nth-child(1) { background: linear-gradient(145deg,#f0f7ff 0%,#fbfdff 78%); border-color: #dcecff; }
.stat-card:nth-child(2) { background: linear-gradient(145deg,#fff5ed 0%,#fffdfb 78%); border-color: #f7e4d5; }
.stat-card:nth-child(3) { background: linear-gradient(145deg,#f0fbf7 0%,#fbfefd 78%); border-color: #d7f1e7; }
.stat-card:nth-child(4) { background: linear-gradient(145deg,#f7f4ff 0%,#fdfcff 78%); border-color: #e5dfff; }

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.stat-pill {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 10px;
  color: var(--text-main);
}

.stat-foot {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.chart-panel {
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-head h2 {
  font-size: 14.5px;
  margin: 0 0 2px;
  font-weight: 600;
}

.panel-head select {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  outline: none;
}

.chart-wrap {
  height: 250px;
  margin-top: 16px;
}

.dashboard-billing-section { margin-top: 20px; }
.dashboard-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dashboard-section-heading h2 { margin: 2px 0 0; color: var(--text-main); font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
.dashboard-eyebrow { color: #7b72db; font-size: 9.5px; font-weight: 750; letter-spacing: .09em; }
.dashboard-text-link, .dashboard-list-link { color: var(--primary); font-size: 11.5px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.dashboard-text-link:hover, .dashboard-list-link:hover { text-decoration: underline; }
.dashboard-rate-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-top: 11px; }
.dashboard-rate-card { min-width: 0; padding: 14px 16px; border: 1px solid #dcecff; border-radius: 12px; background: linear-gradient(145deg,#f0f7ff 0%,#fbfdff 78%); }
.dashboard-rate-card.rate-tone-2 { background: linear-gradient(145deg,#f0fbf7 0%,#fbfefd 78%); border-color: #d7f1e7; }
.dashboard-rate-card.rate-tone-3 { background: linear-gradient(145deg,#fff5ed 0%,#fffdfb 78%); border-color: #f7e4d5; }
.dashboard-rate-card.rate-tone-4 { background: linear-gradient(145deg,#f7f4ff 0%,#fdfcff 78%); border-color: #e5dfff; }
.dashboard-rate-top { display: flex; align-items: center; justify-content: flex-start; gap: 8px; color: var(--text-secondary); font-size: 11px; font-weight: 650; }
.dashboard-rate-icon { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 28px; border-radius: 9px; background: #e8efff; color: #536ed1; }
.dashboard-rate-icon svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rate-tone-2 .dashboard-rate-icon { background: #e4f6ed; color: #22845e; }
.rate-tone-3 .dashboard-rate-icon { background: #ffecdf; color: #c27642; }
.rate-tone-4 .dashboard-rate-icon { background: #eee8fb; color: #8058bc; }
.dashboard-rate-amount { margin-top: 8px; color: var(--text-main); font-size: 22px; font-weight: 750; letter-spacing: -.035em; }
.dashboard-rate-amount small { color: var(--text-muted); font-size: 11px; font-weight: 550; letter-spacing: 0; }
.dashboard-rate-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; color: var(--text-muted); font-size: 10px; }
.dashboard-draft-tag { padding: 2px 6px; border-radius: 999px; background: #fff4df; color: #9b6611; font-size: 9.5px; font-weight: 650; }
.dashboard-insights-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-top: 16px; }
.dashboard-insight-card { min-width: 0; padding: 17px 18px 13px; border-radius: 12px; box-shadow: 0 2px 8px rgba(25,35,60,.025); }
.dashboard-insight-card.low-balance-panel { background: linear-gradient(145deg,#fff8f3 0%,#fff 72%); border-color: #f5e7dc; }
.dashboard-insight-card.top-codes-panel { background: linear-gradient(145deg,#f6f4ff 0%,#fff 72%); border-color: #e7e2fb; }
.dashboard-section-note { margin: 4px 0 9px; color: var(--text-muted); font-size: 10.5px; }
.dashboard-insight-count { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 25px; padding: 0 8px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.low-count { background: #fff0e7; color: #c76b37; }
.top-count { background: #efedff; color: #6557cb; }
.dashboard-insight-list { display: grid; }
.dashboard-user-row { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 9px 1px; border-top: 1px solid rgba(120,130,150,.12); color: inherit; text-decoration: none; }
.dashboard-user-row:hover .dashboard-user-info strong { color: var(--primary); }
.dashboard-heading-title { display: flex; align-items: center; gap: 9px; }
.dashboard-heading-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; border-radius: 10px; }
.dashboard-heading-icon svg { width: 17px; height: 17px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.low-heading-icon { background: #fff0e7; color: #c76b37; }
.top-heading-icon { background: #efedff; color: #6557cb; }
.dashboard-user-avatar, .dashboard-rank { display: grid; place-items: center; flex: 0 0 30px; width: 30px; height: 30px; border-radius: 10px; background: #ffede2; color: #bf6d3e; font-size: 12px; font-weight: 700; }
.dashboard-rank { background: #efedff; color: #6b5fd1; border-radius: 50%; font-size: 10px; }
.dashboard-rank.rank-1 { background: #fff0d7; color: #a97513; }
.dashboard-user-info { display: grid; min-width: 0; flex: 1; gap: 2px; }
.dashboard-user-info strong { overflow: hidden; color: var(--text-main); font-size: 11.5px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-user-info small { overflow: hidden; color: var(--text-muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-user-balance { color: #c76b37; font-size: 12px; font-weight: 750; white-space: nowrap; }
.dashboard-user-balance small { font-size: 9px; font-weight: 550; }
.dashboard-code-count { padding: 5px 8px; border-radius: 8px; background: #efedff; color: #6257c7; font-size: 11px; font-weight: 750; white-space: nowrap; }
.dashboard-code-count small { color: #79719f; font-size: 9px; font-weight: 550; }
.dashboard-empty-state { padding: 20px 8px; color: var(--text-muted); font-size: 11px; text-align: center; }
.dashboard-list-link { display: inline-block; margin: 8px 0 2px 40px; }

/* User directory visual accents */
.users-table thead th { background: #f7f7ff; }
.users-table thead th:first-child, .users-table thead th:last-child { background: #f7f7ff; }
.table-heading-label { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.table-heading-label svg { display: block; width: 22px; height: 22px; flex: 0 0 22px; padding: 4px; overflow: visible; border-radius: 7px; background: #eeedff; color: #6358ce; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.users-table thead th:nth-child(3) .table-heading-label svg { background: #e7f7ef; color: #19845f; }
.users-table thead th:nth-child(4) .table-heading-label svg { background: #fff1e6; color: #c57742; }
.users-table thead th:nth-child(5) .table-heading-label svg { background: #edf4ff; color: #5575c7; }
.users-table thead th[data-sort] { padding-right: 12px; }
.users-table thead th[data-sort]::after { display: none; }
.users-table thead th[data-sort] .table-heading-label::after { content: ''; display: inline-block; width: 6px; height: 6px; flex: 0 0 6px; margin-left: 3px; border-right: 1.5px solid #9aa3b4; border-bottom: 1.5px solid #9aa3b4; transform: rotate(45deg); }
.users-table thead th[data-sort].sort-asc .table-heading-label::after { transform: rotate(225deg); border-color: var(--primary); }
.users-table thead th[data-sort].sort-desc .table-heading-label::after { transform: rotate(45deg); border-color: var(--primary); }
.users-table tbody tr:nth-child(even) td:not(:first-child):not(:last-child) { background: #fcfcff; }
.users-table tbody tr:hover td:not(:first-child):not(:last-child) { background: #f7f6ff; }
.users-table .avatar-circle { width: 34px; height: 34px; border: 1px solid rgba(98,87,220,.08); font-weight: 700; }
.users-table .user-avatar-tone-0 { background: #efedff; color: #6257ce; }
.users-table .user-avatar-tone-1 { background: #e8f6ef; color: #25845f; }
.users-table .user-avatar-tone-2 { background: #fff0e5; color: #bd7040; }
.users-table .user-avatar-tone-3 { background: #edf4ff; color: #5272bf; }
.users-table .credit-balance-icon { display: grid; place-items: center; width: 25px; height: 25px; flex: 0 0 25px; border-radius: 8px; background: #e7f7ef; color: #19845f; }
.users-table .credit-balance-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.users-table .low-credit-cell .credit-balance-icon { background: #fff0e7; color: #c76b37; }
.users-table .low-credit-cell .credit-badge { border-color: #f4ddce; background: #fff7f1; color: #b96435; }
.users-table .provider-pill { min-height: 25px; padding: 3px 8px; border-radius: 999px; }
.users-table .provider-pill.inactive { background: #f5f6fa; color: #7d8799; }
.users-table .provider-pill.active { background: #edfaf3; border-color: #d4efdf; color: #25845f; }

/* Soft color treatment and icons for credit-code tables */
.credit-code-panel { border-color: #e6e2fb; box-shadow: 0 3px 12px rgba(82,69,160,.045); }
.code-count-pill { border: 1px solid #e6e2fb; background: #f3f1ff; color: #6557c9; font-weight: 650; }
.credit-codes-table thead th, .credit-codes-table thead th:first-child, .credit-codes-table thead th:last-child { background: #f7f6ff; }
.credit-codes-table thead th:nth-child(2) .table-heading-label svg { background: #eaf4ff; color: #5272bf; }
.credit-codes-table thead th:nth-child(3) .table-heading-label svg { background: #efedff; color: #6358ce; }
.credit-codes-table thead th:nth-child(4) .table-heading-label svg { background: #e7f7ef; color: #19845f; }
.credit-codes-table thead th:nth-child(5) .table-heading-label svg { background: #fff0e5; color: #bd7040; }
.credit-codes-table.used-codes-table thead th:nth-child(2) .table-heading-label svg { background: #fff0e5; color: #bd7040; }
.credit-codes-table.used-codes-table thead th:nth-child(3) .table-heading-label svg { background: #efedff; color: #6358ce; }
.credit-codes-table.used-codes-table thead th:nth-child(4) .table-heading-label svg { background: #e7f7ef; color: #19845f; }
.credit-codes-table.used-codes-table thead th:nth-child(5) .table-heading-label svg { background: #eaf4ff; color: #5272bf; }
.credit-codes-table.used-codes-table thead th:nth-child(6) .table-heading-label svg { background: #e5f6ef; color: #25845f; }
.credit-codes-table tbody tr:nth-child(even) td:not(:first-child):not(:last-child) { background: #fcfbff; }
.credit-codes-table tbody tr:hover td:not(:first-child):not(:last-child) { background: #f7f5ff; }
.credit-codes-table .credit-code-tag { border-color: #e4defa; border-radius: 8px; background: #f5f2ff; color: #5448ad; font-weight: 650; letter-spacing: .025em; }
.credit-codes-table .credit-code-tag:hover { border-color: #cfc5f4; background: #eeeaff; color: #443799; }
.credit-codes-table .credit-value-badge { height: 26px; border-color: #d9eee2; border-radius: 999px; background: #effaf3; color: #25845f; font-size: 11.5px; font-weight: 700; }
.credit-codes-table .credit-balance-icon { display: grid; place-items: center; width: 25px; height: 25px; flex: 0 0 25px; border-radius: 8px; background: #e7f7ef; color: #19845f; }
.credit-codes-table .credit-balance-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.credit-codes-table .credit-avatar-tone-0 { background: #efedff; color: #6257ce; }
.credit-codes-table .credit-avatar-tone-1 { background: #e8f6ef; color: #25845f; }
.credit-codes-table .credit-avatar-tone-2 { background: #fff0e5; color: #bd7040; }
.credit-codes-table .credit-avatar-tone-3 { background: #edf4ff; color: #5272bf; }
.credit-codes-table .date-cell { color: #52617b !important; font-size: 11.5px !important; }

@media (max-width: 1050px) {
  .dashboard-rate-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 700px) {
  .dashboard-insights-grid { grid-template-columns: 1fr; }
  .dashboard-insight-card { padding: 15px 14px 12px; }
}
@media (max-width: 420px) {
  .dashboard-rate-grid { gap: 8px; }
  .dashboard-rate-card { padding: 12px; }
  .dashboard-rate-amount { font-size: 19px; }
  .dashboard-section-heading h2 { font-size: 14px; }
}

/* ==========================================================================
   Enterprise Data Table
   ========================================================================== */
.table-panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 12px;
}

.table-toolbar.live-search {
  justify-content: space-between;
}
.users-toolbar-heading { flex: 0 0 auto; }
.users-toolbar-heading h1 { font-size: 20px; letter-spacing: -.035em; font-weight: 700; }
.users-toolbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.search-wrap {
  display: inline-flex;
  align-items: center;
  position: relative;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
  box-sizing: border-box;
}

.search-wrap .search-btn-trigger {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--text-muted);
  padding: 0;
  margin: 0;
  transition: color 0.15s;
}

.search-wrap .search-btn-trigger:hover {
  color: var(--text-main);
}

.search-svg {
  width: 15px;
  height: 15px;
  color: inherit;
  flex: none;
}

.search-wrap input {
  border: 0;
  outline: 0;
  width: 0;
  opacity: 0;
  padding: 0;
  font-size: 13px;
  color: var(--text-main);
  background: transparent;
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s;
}

.search-wrap.is-open,
.search-wrap:focus-within,
.search-wrap.has-value {
  width: min(340px, 55vw) !important;
  padding: 0 10px 0 2px;
  border-color: #a5b4fc;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.search-wrap.is-open input,
.search-wrap:focus-within input,
.search-wrap.has-value input {
  width: 100%;
  opacity: 1;
  padding: 0 6px;
}

.table-scroll {
  position: relative;
  max-height: calc(100vh - 220px);
  overflow: auto;
  overscroll-behavior: contain;
}

.enterprise-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.enterprise-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.enterprise-table tbody tr {
  transition: background 0.1s ease;
}

.enterprise-table tbody tr:hover {
  background: #f8fafc;
}

.enterprise-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  font-size: 13px;
  color: var(--text-main);
}

.id-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--text-muted);
}

.nowrap { white-space: nowrap; }

/* User Column */
.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #eef2ff;
  color: #4338ca;
  font-weight: 600;
  font-size: 12px;
  display: grid;
  place-items: center;
  flex: none;
}

.avatar-circle.tiny {
  width: 24px;
  height: 24px;
  font-size: 10.5px;
}

.user-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.user-name {
  font-weight: 600;
  color: var(--text-main);
  font-size: 13px;
}

.user-email {
  color: #1e293b;
  font-weight: 700;
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.user-uuid-sub {
  color: #475569;
  font-weight: 700;
  font-size: 10.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  cursor: pointer;
}

.user-uuid-sub:hover {
  color: var(--primary);
  text-decoration: underline;
}

.phone-cell {
  color: #1e293b;
  font-weight: 700;
  font-size: 12px;
}

.bold-text {
  font-weight: 700 !important;
}

/* Credits Balance Column */
.credits-cell {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  vertical-align: middle;
}

.badge.credit-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  line-height: 1;
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
  font-weight: 600;
  font-size: 11.5px;
  padding: 0 8px;
  border-radius: 4px;
  white-space: nowrap;
  box-sizing: border-box;
  margin: 0;
}

.btn-quick-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  line-height: 1;
  border: 1px solid #c7d2fe;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  padding: 0 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
  box-sizing: border-box;
  margin: 0;
}

.btn-quick-add:hover {
  background: var(--primary);
  color: #fff;
}

/* Device Binding Column & Copy On Hover */
.device-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  padding: 2px 6px;
  border-radius: 4px;
}

.status-pill.bound {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.copyable-badge {
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
  user-select: none;
}

.copyable-badge:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #0f172a;
}

.copyable-badge.copied {
  background: #dcfce7 !important;
  color: #166534 !important;
  border-color: #86efac !important;
}

.status-pill.unbound {
  background: transparent;
  color: var(--text-muted);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
}

.status-dot.green { background: #16a34a; }
.status-dot.orange { background: #d97706; }
.status-dot.gray { background: #cbd5e1; }

.btn-copy-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 3px;
  cursor: pointer;
}

.btn-copy-chip:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

/* AI Provider Column */
.ai-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.provider-pill {
  border: 1px solid transparent;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 140px;
}

.provider-pill.active {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
  cursor: pointer;
  font-weight: 500;
}

.provider-pill.inactive {
  background: transparent;
  color: #94a3b8;
  font-weight: 400;
}

/* Code Voucher Tag */
.code-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: #f8fafc;
  color: #1e293b;
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
}

.code-tag:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.code-tag.copied, .btn-copy-chip.copied {
  background: var(--success-bg) !important;
  color: var(--success) !important;
  border-color: var(--success-border) !important;
}

/* Billing Rates Table */
.service-name-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.service-name-cell strong {
  font-size: 13px;
  font-weight: 600;
}

.service-name-cell small {
  font-size: 11px;
  color: var(--text-muted);
}

.rate-draft-value {
  font-weight: 600;
  color: #b45309;
}

.rate-published-value {
  font-weight: 600;
  color: var(--success);
}

.billing-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.billing-status.published {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.billing-status.draft {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.billing-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.billing-actions form { margin: 0; }

/* Billing rates table accents */
.billing-panel { border-color: #e6e2fb; box-shadow: 0 3px 12px rgba(82,69,160,.045); }
.billing-rate-count-pill { border: 1px solid #e6e2fb; background: #f3f1ff; color: #6557c9; font-weight: 650; }
.billing-rates-table thead th, .billing-rates-table thead th:first-child, .billing-rates-table thead th:last-child { background: #f2f0ff; }
.billing-rates-table thead th:nth-child(2) .table-heading-label svg { background: #eaf4ff; color: #5272bf; }
.billing-rates-table thead th:nth-child(3) .table-heading-label svg { background: #fff0e5; color: #bd7040; }
.billing-rates-table thead th:nth-child(4) .table-heading-label svg { background: #e7f7ef; color: #19845f; }
.billing-rates-table thead th:nth-child(5) .table-heading-label svg { background: #efedff; color: #6358ce; }
.billing-rates-table thead th:nth-child(6) .table-heading-label svg { background: #eaf4ff; color: #5272bf; }
.billing-rates-table .rate-draft-value, .billing-rates-table .rate-published-value { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border: 1px solid #f4e4cf; border-radius: 999px; background: #fff8ed; color: #a66a18; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.billing-rates-table .rate-published-value { border-color: #d9eee2; background: #effaf3; color: #25845f; }
.billing-rates-table .service-name-cell strong { color: #302d55; }
.billing-rates-table .service-name-cell small { max-width: 320px; line-height: 1.45; }
.billing-edit-button { height: 28px; padding: 0 10px; font-size: 11.5px; }

/* ==========================================================================
   Modern Attractive Empty State Component with Floating Icon
   ========================================================================== */
.empty {
  text-align: center;
  padding: 0 !important;
  color: var(--text-muted);
  font-size: 13px;
  background: transparent !important;
}

.empty-state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  margin: 0 auto;
  max-width: 480px;
}

.empty-state-icon-box {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  box-shadow: 0 8px 20px -4px rgba(79, 70, 229, 0.15), 0 0 0 1px rgba(79, 70, 229, 0.08);
  animation: emptyFloat 3.2s ease-in-out infinite;
}

.empty-state-icon-box.search-tone {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  box-shadow: 0 8px 20px -4px rgba(22, 101, 52, 0.12), 0 0 0 1px rgba(22, 101, 52, 0.08);
}

.empty-state-icon-box.danger-tone {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  box-shadow: 0 8px 20px -4px rgba(220, 38, 38, 0.12), 0 0 0 1px rgba(220, 38, 38, 0.08);
}

.empty-state-icon-box.warning-tone {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  box-shadow: 0 8px 20px -4px rgba(180, 83, 9, 0.12), 0 0 0 1px rgba(180, 83, 9, 0.08);
}

.empty-state-icon-box svg {
  width: 32px;
  height: 32px;
  stroke: var(--primary);
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state-icon-box.search-tone svg {
  stroke: #16a34a;
}

.empty-state-icon-box.danger-tone svg {
  stroke: #dc2626;
}

.empty-state-icon-box.warning-tone svg {
  stroke: #d97706;
}

.empty-state-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 6px 0;
  letter-spacing: -0.01em;
}

.empty-state-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 16px 0;
  max-width: 340px;
}

.empty-state-action {
  margin-top: 4px;
}

.empty-state-action .button {
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.2);
}

@keyframes emptyFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-7px) rotate(-1.5deg);
  }
}

.dashboard-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
}

.dashboard-empty-state .empty-state-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  margin-bottom: 10px;
}

.dashboard-empty-state .empty-state-icon-box svg {
  width: 22px;
  height: 22px;
}

.dashboard-empty-state h4 {
  margin: 0 0 4px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.dashboard-empty-state p {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-muted);
  max-width: 240px;
}

/* ==========================================================================
   Action Menu Dropdown
   ========================================================================== */
.action-menu-wrap {
  position: relative;
  display: inline-flex;
  justify-content: flex-end;
}

.more-button {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}

.more-button.action-dots {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  color: #475569;
  border-radius: 5px;
}

.more-button:hover, .more-button:focus-visible {
  background: #f1f5f9;
  color: var(--text-main);
  border-color: #cbd5e1;
}

/* Interactive Table Sorting */
th[data-sort] {
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background-color 0.12s;
}

th[data-sort]:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

th[data-sort]::after {
  content: ' ⇅';
  font-size: 10px;
  color: #94a3b8;
  margin-left: 4px;
  display: inline-block;
  opacity: 0.6;
}

th[data-sort]:hover::after {
  opacity: 1;
}

th[data-sort].sort-asc::after {
  content: ' ▲';
  color: var(--primary);
  opacity: 1;
}

th[data-sort].sort-desc::after {
  content: ' ▼';
  color: var(--primary);
  opacity: 1;
}

.action-menu {
  position: absolute;
  z-index: 50;
  right: 0;
  top: calc(100% + 4px);
  min-width: 170px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
  text-align: left;
}

.action-menu.open-up {
  top: auto;
  bottom: calc(100% + 4px);
}

.action-menu > button, .action-menu form button {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
}

.action-menu > button:hover, .action-menu form button:hover {
  background: #f1f5f9;
}

.action-menu form { margin: 0; }
.action-menu form button.warning { color: var(--warning); }
.action-menu form button.danger { color: var(--danger); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.button.primary {
  background: var(--primary);
  color: #fff;
}

.button.primary:hover {
  background: var(--primary-hover);
}

.button.secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-main);
}

.button.secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.button.danger-button {
  background: var(--danger);
  color: #fff;
}

.button.danger-button:hover {
  background: var(--danger-hover);
}

/* ==========================================================================
   Modals & Dialogs
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal-backdrop.open { display: flex; }

.modal {
  position: relative;
  width: min(480px, 100%);
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
}

.modal.user-modal {
  width: min(580px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: 0;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover { color: var(--text-main); }

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

.eyebrow.accent { color: var(--primary); }
.eyebrow.danger { color: var(--danger); }

.modal h2 {
  font-size: 17px;
  margin: 4px 0 3px;
  font-weight: 600;
}

.modal label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 14px;
}

.modal input, .modal select {
  height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 10px;
  outline: none;
  font-size: 13px;
  color: var(--text-main);
  background: var(--surface);
  transition: all 0.12s;
}

.modal input:focus, .modal select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.12);
}

.modal-fields-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

.input-action {
  display: flex;
  gap: 6px;
}

.input-action input { flex: 1; min-width: 0; }

.input-action button {
  border: 1px solid var(--border);
  background: #f1f5f9;
  color: var(--text-main);
  border-radius: 6px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.input-action button:hover {
  background: #e2e8f0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

/* Preset Chips for Credits Recharge */
.preset-chips {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  margin-bottom: 8px;
}

.preset-chip {
  flex: 1;
  padding: 6px 0;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  transition: all 0.1s;
}

.preset-chip:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.preset-chip.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.form-divider {
  display: flex;
  align-items: center;
  margin: 18px 0 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.form-divider:after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  margin-left: 10px;
}

.mode-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 4px;
}

.mode-option {
  display: grid;
  gap: 2px;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-main);
  cursor: pointer;
}

.mode-option strong { font-size: 12.5px; }
.mode-option small { font-size: 11px; color: var(--text-muted); }

.mode-option.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.batch-preview {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  margin-top: 12px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.batch-preview span { font-size: 10px; font-weight: 600; color: var(--text-muted); }
.batch-preview strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--text-main); }
.batch-preview small { font-size: 11px; color: var(--text-muted); }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.pagination strong { color: var(--text-main); }

.page-buttons {
  display: flex;
  align-items: center;
  gap: 3px;
}

.page-button {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11.5px;
  color: var(--text-secondary);
  background: var(--surface);
}

.page-button:hover {
  background: #f1f5f9;
}

.page-button.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.page-button.disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .sidebar { width: 190px; }
  .main { margin-left: 190px; }
  .content { padding: 20px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .sidebar-toggle { display: block; }
  .sidebar {
    width: 220px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  body.sidebar-expanded .sidebar { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px 12px; }
  .stat-grid { grid-template-columns: 1fr; }
  .modal-fields-row { grid-template-columns: 1fr; gap: 0; }
}

/* --------------------------------------------------------------------------
   CreditDesk UI refinement: consistent rhythm, clearer hierarchy, and fit
   -------------------------------------------------------------------------- */
:root {
  --bg: #f5f7fb;
  --surface: #fff;
  --text-main: #172033;
  --text-secondary: #48546a;
  --text-muted: #778198;
  --border: #e4e8f0;
  --border-subtle: #edf0f5;
  --primary: #6257dc;
  --primary-hover: #5146c8;
  --primary-light: #f0efff;
}

body {
  font-family: 'DM Sans', Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  background: #f5f7fb;
}

.sidebar { width: 236px; padding: 22px 14px; background: #fff; }
.main { margin-left: 236px; }
.brand { padding: 4px 10px 30px; }
.nav-label { padding: 0 12px 10px; letter-spacing: .11em; }
.sidebar nav { gap: 4px; }
.nav-item { min-height: 40px; height: auto; padding: 0 12px; border-radius: 8px; }
.nav-item.active { background: #f0efff; color: #5146c8; }
.nav-item.active .nav-svg { color: #5146c8; }

.topbar {
  height: 62px;
  padding: 0 clamp(18px, 3vw, 38px);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(12px);
}
.topbar-page h1, .heading-with-count h1 { font-size: 20px; letter-spacing: -.035em; font-weight: 700; }
.heading-with-count { gap: 11px; }
.count-pill, .date-chip { padding: 4px 10px; border-radius: 999px; background: #f6f7fb; font-size: 12px; }
.content { width: 100%; max-width: 1500px; padding: 28px clamp(18px, 3vw, 38px) 36px; }
.panel, .stat-card { border-color: #e7eaf1; border-radius: 12px; box-shadow: 0 2px 8px rgba(25,35,60,.025); }

.stat-grid { gap: 16px; margin-bottom: 22px; }
.stat-card { padding: 18px 20px; transition: transform .16s ease, box-shadow .16s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(25,35,60,.07); }
.stat-value { margin-top: 12px; font-size: clamp(24px, 2.2vw, 30px); letter-spacing: -.04em; }
.stat-label { margin-top: 3px; color: #344057; font-size: 13px; }
.stat-foot { margin-top: 2px; font-size: 12px; }
.chart-panel { padding: 20px 22px 16px; }
.panel-head h2 { font-size: 16px; }
.chart-wrap { height: clamp(230px, 36vh, 340px); }

.table-toolbar { min-height: 38px; padding-bottom: 14px; }
.search-wrap { height: 38px; border-radius: 8px; background: #fff; }
.search-wrap input { font-size: 13px; }
.button { min-height: 36px; border-radius: 8px; padding: 7px 13px; font-size: 13px; }
.table-panel { border-radius: 12px; }
.table-scroll {
  max-height: calc(100vh - 235px);
  min-height: 180px;
  scrollbar-width: thin;
  scrollbar-color: #cbd2df transparent;
}
.table-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.table-scroll::-webkit-scrollbar-thumb { background: #cbd2df; border: 2px solid #fff; border-radius: 99px; }
.table-scroll::-webkit-scrollbar-thumb:hover { background: #aab4c5; }
.enterprise-table { min-width: 850px; }
.enterprise-table thead th { padding: 12px 14px; background: #f7f6ff; color: #657087; font-size: 10.5px; letter-spacing: .07em; }
.enterprise-table tbody td { padding: 12px 14px; font-size: 13px; }
.enterprise-table tbody tr:last-child td { border-bottom: 0; }
.enterprise-table tbody tr:hover td { background: #f7f5ff; }
.enterprise-table th:first-child, .enterprise-table td:first-child {
  position: sticky; left: 0; z-index: 3; min-width: 58px; background: #fff;
}
.enterprise-table thead th:first-child { z-index: 6; background: #f7f6ff; }
.enterprise-table th:last-child, .enterprise-table td:last-child {
  position: sticky; right: 0; z-index: 3; min-width: 72px; background: #fff;
}
.enterprise-table thead th:last-child { z-index: 6; background: #f7f6ff; }
.enterprise-table tbody tr:hover td:first-child, .enterprise-table tbody tr:hover td:last-child { background: #f7f5ff; }
.enterprise-table th:last-child, .enterprise-table td:last-child { box-shadow: -5px 0 10px -10px rgba(15,23,42,.28); }
.user-name { font-size: 13px; }
.user-email { color: #5b667a; font-weight: 500; }
.user-uuid-sub { color: #737e92; font-weight: 500; }
.code-tag { border-radius: 6px; padding: 4px 9px; }
.date-cell { color: #59657a !important; font-size: 12px !important; font-weight: 500; }
.badge.credit-badge, .provider-pill, .billing-status { border-radius: 999px; }

.pagination { padding: 12px 16px; background: #fff; }
.page-button { min-width: 32px; height: 32px; border-radius: 7px; }
.action-menu { border-radius: 9px; box-shadow: 0 12px 30px rgba(24,32,52,.14); }
.more-button.action-dots { width: 32px; height: 32px; border-radius: 8px; }

.modal-backdrop { padding: 24px; background: rgba(19,25,43,.42); backdrop-filter: blur(3px); }
.modal {
  width: min(560px, 100%);
  padding: 26px 28px 24px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(15,23,42,.22);
}
.modal.user-modal { width: min(760px, 100%); }
.modal h2 { font-size: 19px; letter-spacing: -.025em; }
.modal > .muted { margin-top: 5px; line-height: 1.55; }
.modal label { font-size: 12.5px; }
.modal input, .modal select { height: 40px; border-radius: 8px; }
.modal-actions { margin-top: 20px; }
.modal-actions .button { min-width: 96px; }
.modal-close { top: 16px; right: 18px; width: 30px; height: 30px; border-radius: 8px; }
.modal-close:hover { background: #f1f3f8; }

.profile-grid { display: grid; grid-template-columns: 1fr; align-items: start; gap: 18px; }
.profile-panel { padding: 22px; }
.form-section { padding: 0 0 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border-subtle); }
.form-section h3 { margin: 0 0 4px; font-size: 15px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.profile-panel label { display: grid; gap: 6px; margin-top: 14px; color: var(--text-secondary); font-size: 12.5px; font-weight: 600; }
.profile-panel input { height: 40px; padding: 0 11px; border: 1px solid var(--border); border-radius: 8px; outline: none; }
.profile-panel input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(98,87,220,.12); }
.profile-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(360px,1fr) minmax(420px,1fr); background: #fff; }
.login-art { min-height: 100vh; padding: 34px clamp(28px,5vw,72px); display: flex; flex-direction: column; justify-content: space-between; background: radial-gradient(circle at 15% 15%,#3b3564 0,#292543 44%,#211e37 100%); color: #fff; }
.login-art h1 { color: #fff; font-size: clamp(36px,4vw,56px); line-height: 1.1; letter-spacing: -.045em; }
.login-side { display: grid; place-items: center; padding: 32px; }
.login-card { width: min(410px,100%); }
.login-card h2 { margin: 8px 0 4px; font-size: 26px; letter-spacing: -.035em; }
.login-card label { display: grid; gap: 7px; margin-top: 18px; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.login-card input { height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; }
.login-card input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(98,87,220,.12); }
.login-card .button { width: 100%; margin-top: 20px; }

@media (max-width: 1100px) {
  .sidebar { width: 220px; }
  .main { margin-left: 220px; }
  .content { padding: 22px 22px 30px; }
  .enterprise-table { min-width: 900px; }
}
@media (max-width: 700px) {
  .sidebar { width: 236px; }
  .main { margin-left: 0; }
  .topbar { height: 58px; padding: 0 14px; }
  .topbar-page h1, .heading-with-count h1 { font-size: 18px; }
  .content { padding: 18px 14px 26px; }
  .stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 23px; }
  .chart-panel { padding: 16px; }
  .chart-wrap { height: 245px; }
  .table-toolbar { align-items: stretch; }
  .table-toolbar.live-search { flex-wrap: wrap; }
  .table-toolbar .search-wrap { width: 100%; }
  .table-toolbar .users-toolbar-actions { width: 100%; justify-content: flex-end; }
  .table-toolbar .users-toolbar-actions .search-wrap { width: 38px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .modal-backdrop { padding: 12px; }
  .modal, .modal.user-modal { width: min(620px,100%); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 22px 18px 18px; }
  .login-page { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-side { min-height: 100vh; padding: 24px; }
}
@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr; }
  .heading-with-count { flex-wrap: wrap; }
  .users-toolbar-heading { width: auto; }
  .pagination { align-items: center; gap: 10px; }
  .preset-chips { flex-wrap: wrap; }
  .preset-chip { flex: 1 0 28%; }
}

/* Consistent vector icon system and unclipped table action menus */
.brand-icon svg, .nav-icon svg, .chevron svg, .stat-icon svg,
.more-button svg, .modal-close svg, .flash button svg {
  display: block;
  width: 100%;
  height: 100%;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.brand-icon { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 9px; background: var(--primary); color: #fff; }
.brand-icon svg { width: 17px; height: 17px; stroke-width: 1.7; }
.brand > span:last-child { color: var(--text-main); font-size: 17px; font-weight: 750; letter-spacing: -.055em; }
.brand-light { color: #818ba0; font-weight: 500; }
.brand.inverse > span:last-child { color: #fff; }
.brand.inverse .brand-light { color: #bcb7d4; }
.nav-icon { display: inline-grid; place-items: center; flex: none; width: 17px; height: 17px; }
.nav-icon svg { width: 17px; height: 17px; }
.nav-item.active .nav-icon { color: var(--primary); }
.dropdown-icon { width: 16px; height: 16px; margin-right: 9px; flex: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.date-chip { display: inline-flex; align-items: center; gap: 6px; }
.inline-icon { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.chevron { display: inline-grid; width: 16px; height: 16px; place-items: center; }
.chevron svg { width: 14px; height: 14px; }
.stat-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; }
.stat-icon.lavender { background: #efedff; color: #6257dc; }
.stat-icon.peach { background: #fff2e9; color: #d98245; }
.stat-icon.mint { background: #eaf8f1; color: #32956b; }
.stat-icon.lemon { background: #fff8df; color: #b98a20; }
.stat-trend { color: #7b8498; font-size: 10px; font-weight: 700; letter-spacing: .07em; }
.stat-icon svg { width: 20px; height: 20px; }
.login-art { position: relative; overflow: hidden; }
.art-grid { position: absolute; inset: 0; opacity: .16; background-image: linear-gradient(rgba(255,255,255,.12) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.12) 1px,transparent 1px); background-size: 54px 54px; mask-image: linear-gradient(135deg,#000,transparent 86%); }
.art-copy { position: relative; z-index: 1; display: flex; min-height: 100%; flex-direction: column; justify-content: space-between; }
.art-message { max-width: 500px; margin: auto 0; padding: 70px 0; }
.login-art .eyebrow { color: #b8b2ff; }
.art-message p { max-width: 390px; color: #c3c1d2; font-size: 15px; line-height: 1.7; }
.art-foot { color: #a5a1bc; font-size: 10px; letter-spacing: .11em; }
.login-note { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 18px; color: var(--text-muted); font-size: 11.5px; }
.login-note span { color: #35a675; font-size: 10px; }
.more-button.action-dots svg { width: 18px; height: 18px; fill: currentColor; }
.modal-close { display: grid; place-items: center; }
.modal-close svg, .flash button svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.8; }
.flash button { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; }
.flash button:hover { background: rgba(15,23,42,.06); }

.copyable-badge { cursor: pointer; }
.device-cell .copy-hint-pill, .device-cell .copy-label { display: none !important; }
.copyable-badge:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.copyable-badge.copied { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }

.action-menu {
  position: fixed;
  z-index: 3000;
  right: auto;
  top: auto;
  min-width: 184px;
  max-width: min(260px, calc(100vw - 16px));
  max-height: min(360px, calc(100vh - 16px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 5px;
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(20, 28, 48, .2), 0 2px 8px rgba(20, 28, 48, .08);
}
.action-menu[hidden] { display: none; }
.action-menu > button, .action-menu form button {
  min-height: 36px;
  padding: 8px 11px;
  border-radius: 7px;
  white-space: normal;
}
.action-menu > button:hover, .action-menu form button:hover { background: #f2f3f9; }
.action-menu form + form, .action-menu > button + form { border-top: 1px solid var(--border-subtle); margin-top: 3px; padding-top: 3px; }

.table-scroll { isolation: isolate; }
.enterprise-table { min-width: 960px; table-layout: auto; }
.enterprise-table th:last-child, .enterprise-table td:last-child { min-width: 76px; width: 76px; }
.enterprise-table th:first-child, .enterprise-table td:first-child { min-width: 58px; }
.enterprise-table td, .enterprise-table th { overflow-wrap: anywhere; }
.enterprise-table .code-tag { white-space: nowrap; }
.enterprise-table .action-menu-wrap { z-index: auto; }
.enterprise-table thead th[data-sort] {
  position: sticky;
  top: 0;
  padding-right: 28px;
}
.enterprise-table thead th[data-sort]::after {
  position: absolute;
  top: 50%;
  right: 10px;
  margin: 0;
  vertical-align: initial;
  transform: translateY(-50%) rotate(45deg);
}
.enterprise-table thead th[data-sort].sort-asc::after {
  transform: translateY(-50%) rotate(225deg);
}
.enterprise-table thead th[data-sort].sort-desc::after {
  transform: translateY(-50%) rotate(45deg);
}
th[data-sort]::after {
  content: '';
  width: 6px;
  height: 6px;
  border-right: 1.5px solid #9aa3b4;
  border-bottom: 1.5px solid #9aa3b4;
}
th[data-sort].sort-asc::after, th[data-sort].sort-desc::after { border-color: var(--primary); }
@media (max-width: 700px) {
  .enterprise-table { min-width: 860px; }
  .action-menu { min-width: 176px; }
}

/* Keep the sidebar control available on desktop and mobile. */
.sidebar-toggle {
  display: grid;
  place-content: center;
  gap: 3px;
  flex: none;
  width: 34px;
  height: 34px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  transition: background .15s ease, border-color .15s ease;
}
.sidebar-toggle:hover { background: #f4f5fa; border-color: #d4d9e4; }
.sidebar-toggle span { width: 15px; height: 1.5px; margin: 0; border-radius: 2px; background: #606b80; }
body.sidebar-collapsed .sidebar { width: 72px; padding: 20px 9px; }
body.sidebar-collapsed .main { margin-left: 72px; }
body.sidebar-collapsed .brand { justify-content: center; padding: 4px 0 28px; }
body.sidebar-collapsed .brand > span:last-child,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-item > span:not(.nav-icon) { display: none; }
body.sidebar-collapsed .nav-item { justify-content: center; padding: 0; }
body.sidebar-collapsed .nav-icon { width: 19px; height: 19px; }

@media (max-width: 700px) {
  .sidebar-toggle { display: grid; }
  body.sidebar-collapsed .sidebar { width: 236px; padding: 22px 14px; transform: translateX(-100%); }
  body.sidebar-expanded .sidebar { transform: translateX(0); }
  body.sidebar-collapsed .main { margin-left: 0; }
  body.sidebar-collapsed .brand { justify-content: flex-start; padding: 4px 10px 30px; }
  body.sidebar-collapsed .brand > span:last-child,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .nav-item > span:not(.nav-icon) { display: initial; }
  body.sidebar-collapsed .nav-item { justify-content: flex-start; padding: 0 12px; }
  body.sidebar-collapsed .nav-label { display: block; }
}

/* Icon Copy Button */
.icon-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.icon-copy-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--text-main);
  transform: translateY(-1px);
}
.icon-copy-btn:active {
  transform: translateY(0);
}
.icon-copy-btn.copied {
  background: #dcfce7 !important;
  border-color: #86efac !important;
  color: #166534 !important;
}
.icon-copy-btn.copied .icon-copy-default {
  display: none !important;
}
.icon-copy-btn.copied .icon-copy-check {
  display: inline-block !important;
}

/* User profile overview */
.user-profile-page {
  display: grid;
  gap: 16px;
}
.user-summary-card {
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.user-summary-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.user-back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease;
}
.user-back-link:hover { background: #f8f9fc; border-color: #d5d9e5; }
.user-summary-actions { display: flex; align-items: center; gap: 8px; }
.user-summary-actions form { margin: 0; }
.user-summary-actions .button { display: inline-flex; align-items: center; gap: 7px; }
.user-reset-button { color: #b45309; border-color: #f3d48c; }
.user-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.user-profile-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 50%;
  background: linear-gradient(145deg, #7168ef, #5549d3);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(98,87,220,.18);
}
.user-identity-main { min-width: 0; }
.user-identity-main h2 {
  margin: 0 0 8px;
  color: var(--text-main);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.025em;
}
.user-contact-list { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px; color: var(--text-muted); font-size: 12.5px; }
.user-contact-list span { min-width: 0; overflow-wrap: anywhere; }
.user-contact-list strong { margin-right: 4px; color: var(--text-secondary); font-weight: 600; }
.user-overview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; gap: 14px; }
.user-overview-card {
  min-width: 0;
  padding: 17px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(25,35,60,.025);
}
.user-overview-card:nth-child(1) {
  background: linear-gradient(145deg, #f0fbf7 0%, #fbfefd 76%);
  border-color: #d7f1e7;
}
.user-overview-card:nth-child(2) {
  background: linear-gradient(145deg, #f5f3ff 0%, #fdfcff 76%);
  border-color: #e5dfff;
}
.user-overview-card:nth-child(3) {
  background: linear-gradient(145deg, #f0f7ff 0%, #fbfdff 76%);
  border-color: #dcecff;
}
.user-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; margin-bottom: 12px; color: var(--text-secondary); font-size: 11.5px; font-weight: 700; letter-spacing: .055em; text-transform: uppercase; }
.user-live-badge, .user-claim-badge { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; padding: 4px 8px; border-radius: 999px; background: #f1f3f8; color: #68748a; font-size: 10.5px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.user-live-badge { background: #ecfdf5; color: #07845e; }
.user-live-badge i { width: 6px; height: 6px; border-radius: 50%; background: #10b981; }
.user-claim-badge.claimed { background: #eef2ff; color: #5146c8; }
.user-balance-value { margin: 2px 0 10px; color: #07845e; font-size: 27px; font-weight: 750; letter-spacing: -.04em; line-height: 1.15; }
.user-balance-value.low { color: #dc4b4b; }
.user-balance-value span { color: var(--text-muted); font-size: 13px; font-weight: 500; letter-spacing: 0; }
.user-balance-breakdown { display: flex; flex-wrap: wrap; gap: 6px 14px; padding-top: 10px; border-top: 1px solid var(--border-subtle); color: var(--text-muted); font-size: 11.5px; }
.user-balance-breakdown strong { margin-left: 3px; color: var(--text-secondary); font-weight: 650; }
.user-referral-code-row { display: flex; align-items: center; gap: 8px; margin: 1px 0 10px; }
.user-referral-code { color: var(--text-main); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; font-weight: 700; letter-spacing: .035em; }
.user-referral-stats { display: flex; flex-wrap: wrap; gap: 5px 14px; color: var(--text-muted); font-size: 11.5px; }
.user-referral-stats strong { color: #07845e; font-weight: 700; }
.user-referral-stats span:nth-child(2) strong { color: var(--primary); }
.user-referral-stats .user-referred-by { flex-basis: 100%; padding-top: 8px; border-top: 1px solid var(--border-subtle); color: var(--text-muted); overflow-wrap: anywhere; }
.user-referral-stats .user-referred-by strong { color: var(--text-secondary); }
.user-client-details { display: grid; gap: 8px; color: var(--text-secondary); font-size: 12px; }
.user-client-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.user-client-line > strong { min-width: 65px; color: var(--text-secondary); font-size: 11.5px; font-weight: 650; }
.user-client-line .copyable-badge { max-width: 100%; overflow-wrap: anywhere; cursor: pointer; }
.user-client-line .status-pill, .user-client-line .provider-pill { padding: 3px 8px; font-size: 10.5px; }
.user-api-date, .user-muted-value { color: var(--text-muted); font-size: 10.5px; }
.tx-records-count {
  margin-left: 2px;
  padding: 3px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.profile-transaction-scroll {
  width: 100%;
  max-height: 450px;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #cbd2df transparent;
}
.profile-transaction-scroll::-webkit-scrollbar { width: 7px; height: 7px; }
.profile-transaction-scroll::-webkit-scrollbar-thumb { background: #cbd2df; border: 2px solid #fff; border-radius: 99px; }
.profile-transaction-scroll::-webkit-scrollbar-thumb:hover { background: #aab4c5; }
.enterprise-table.transaction-table { min-width: 940px; }
.enterprise-table.transaction-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f7f6ff;
  white-space: nowrap;
}
.enterprise-table.transaction-table th:first-child,
.enterprise-table.transaction-table td:first-child,
.enterprise-table.transaction-table th:last-child,
.enterprise-table.transaction-table td:last-child {
  min-width: 0;
  box-shadow: none;
}
.enterprise-table.transaction-table td:first-child,
.enterprise-table.transaction-table td:last-child { position: static; }
.enterprise-table.transaction-table thead th:first-child,
.enterprise-table.transaction-table thead th:last-child {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f7f6ff;
}
.enterprise-table.transaction-table tbody td { white-space: nowrap; }
.enterprise-table.transaction-table .tx-description-cell { min-width: 300px; }
.tx-history-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.tx-history-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; margin-left: auto; }
.tx-icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #fff;
  color: #526078;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.tx-icon-button:hover { border-color: #c7d2e2; background: #f8fafc; color: #4f46e5; }
.tx-icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tx-filter-backdrop { position: fixed; inset: 0; z-index: 1000; background: rgba(20,27,45,.35); opacity: 0; transition: opacity .2s ease; }
.tx-filter-backdrop.open { opacity: 1; }
.tx-filter-backdrop[hidden] { display: none !important; }
.tx-filter-drawer { position: fixed; inset: 0 0 0 auto; z-index: 1001; display: flex; flex-direction: column; width: min(390px, 92vw); padding: 22px; border-left: 1px solid #e7eaf1; background: #fff; box-shadow: -14px 0 36px rgba(25,35,60,.12); transform: translateX(105%); transition: transform .22s ease; visibility: hidden; }
.tx-filter-drawer.open { transform: translateX(0); visibility: visible; }
.tx-filter-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid #edf0f5; }
.tx-filter-eyebrow { color: #766cf0; font-size: 10px; font-weight: 700; letter-spacing: .1em; }
.tx-filter-header h3 { margin: 4px 0 0; color: #202b40; font-size: 18px; font-weight: 700; }
.tx-filter-form { display: grid; align-content: start; gap: 17px; padding-top: 22px; }
.tx-filter-form label { display: grid; gap: 7px; color: #46536a; font-size: 12px; font-weight: 600; }
.tx-filter-form input, .tx-filter-form select { width: 100%; min-width: 0; height: 39px; padding: 0 10px; border: 1px solid #dce2eb; border-radius: 8px; outline: 0; background: #fff; color: #29364b; font: inherit; font-size: 12.5px; }
.tx-filter-form input:focus, .tx-filter-form select:focus { border-color: #8b83f4; box-shadow: 0 0 0 3px rgba(99,87,228,.1); }
.tx-type-dropdown { position: relative; width: 100%; }
.tx-type-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 39px;
  padding: 0 11px;
  border: 1px solid #dce2eb;
  border-radius: 8px;
  background: #fff;
  color: #29364b;
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.tx-type-trigger:hover, .tx-type-trigger[aria-expanded="true"] { border-color: #9b94f6; }
.tx-type-trigger:focus-visible { outline: 0; border-color: #8b83f4; box-shadow: 0 0 0 3px rgba(99,87,228,.1); }
.tx-type-trigger svg { width: 16px; height: 16px; fill: none; stroke: #7b8799; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s ease; }
.tx-type-trigger[aria-expanded="true"] svg { transform: rotate(180deg); }
.tx-type-options { position: absolute; inset: calc(100% + 5px) 0 auto; z-index: 5; display: grid; padding: 5px; border: 1px solid #e1e6ef; border-radius: 9px; background: #fff; box-shadow: 0 12px 28px rgba(28,38,60,.14); }
.tx-type-options[hidden] { display: none !important; }
.tx-type-options [role="option"] { width: 100%; min-height: 36px; padding: 0 9px; border: 0; border-radius: 6px; background: transparent; color: #46536a; font: inherit; font-size: 12.5px; text-align: left; cursor: pointer; }
.tx-type-options [role="option"]:hover, .tx-type-options [role="option"]:focus-visible { outline: 0; background: #f5f4ff; color: #4f46c8; }
.tx-type-options [role="option"].selected { background: #eeecff; color: #5046c8; font-weight: 650; }
.tx-date-filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tx-filter-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 7px; padding-top: 16px; border-top: 1px solid #edf0f5; }
body.tx-filter-open { overflow: hidden; }
.tx-row[hidden] { display: none; }
.tx-client-pagination[hidden] { display: none !important; }
.tx-client-pagination .page-button { padding: 0; cursor: pointer; font: inherit; }
.tx-client-pagination .page-button:disabled { cursor: default; }
.rows-per-page { display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.rows-per-page select { height: 30px; min-width: 64px; padding: 0 25px 0 8px; border: 1px solid var(--border); border-radius: 6px; appearance: none; background-color: #fff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20' fill='none' stroke='%23657087' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 7.5 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 7px center; color: var(--text-main); font: inherit; font-size: 12px; cursor: pointer; }
.rows-per-page select:focus { outline: 0; border-color: #a5b4fc; box-shadow: 0 0 0 2px rgba(79,70,229,.1); }
.rows-per-page select option { background: #fff; color: #273449; }
.client-table-pagination { justify-content: space-between; }


@media (max-width: 1050px) {
  .user-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-client-card { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .user-profile-page { gap: 12px; }
  .user-summary-card { padding: 14px; }
  .user-summary-topline { flex-wrap: wrap; margin-bottom: 14px; }
  .user-summary-actions { gap: 6px; }
  .user-summary-actions .button { min-height: 33px; padding: 6px 9px; font-size: 11.5px; }
  .user-identity { align-items: flex-start; gap: 11px; }
  .user-profile-avatar { width: 42px; height: 42px; flex-basis: 42px; font-size: 16px; }
  .user-identity-main h2 { font-size: 17px; }
  .user-contact-list { display: grid; gap: 5px; font-size: 12px; }
  .user-overview-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .user-client-card { grid-column: auto; }
  .user-overview-card { padding: 15px; }
  .tx-history-toolbar { align-items: flex-start; }
  .tx-history-toolbar > div:first-child { flex-wrap: wrap; }
  .tx-filter-drawer { padding: 18px; }
}

/* Consistent, compact modal styling across admin pages */
.modal-backdrop {
  padding: 24px;
  background: rgba(21, 29, 48, .46);
  backdrop-filter: blur(3px);
}
.modal-backdrop.open { animation: modal-backdrop-in .16s ease-out both; }
.modal-backdrop.open > .modal,
.modal-backdrop.open > form.modal {
  animation: modal-card-in .2s cubic-bezier(.2,.75,.25,1) both;
}
@keyframes modal-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-card-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal {
  --modal-pad-x: 28px;
  --modal-pad-bottom: 24px;
  width: min(620px, 100%);
  max-height: min(880px, calc(100dvh - 48px));
  overflow: auto;
  padding: 24px var(--modal-pad-x) var(--modal-pad-bottom);
  border: 1px solid #e3e7f2;
  border-top: 3px solid #776ce2;
  border-radius: 15px;
  background: linear-gradient(180deg, #fff 0%, #fdfdff 100%);
  box-shadow: 0 22px 58px rgba(28,35,66,.2), 0 3px 10px rgba(51,65,110,.06);
  scrollbar-width: thin;
  scrollbar-color: #cbd2df transparent;
}
.modal.user-modal { width: min(820px, 100%); }
.modal.confirm-modal { width: min(520px, 100%); }
.modal .eyebrow { display: block; width: fit-content; margin: -24px calc(-1 * var(--modal-pad-x)) 14px; padding: 17px var(--modal-pad-x) 10px; border-bottom: 1px solid #eceef5; color: #675bd0; font-size: 9px; letter-spacing: .09em; }
.modal .eyebrow:empty { display: none; }
.modal .eyebrow.danger { background: #fff0ee; color: #c24f55; }
.modal h2 { margin: 0 36px 6px 0; color: #202b40; font-size: 20px; line-height: 1.25; font-weight: 700; letter-spacing: -.025em; }
.modal > .muted { color: #707b90; font-size: 12px; line-height: 1.55; }
.modal label { gap: 6px; margin-top: 12px; color: #4d5a70; font-size: 11.5px; font-weight: 650; }
.modal input, .modal select { height: 38px; padding: 0 11px; border: 1px solid #dfe4ee; border-radius: 8px; background: #fbfcff; color: #26334a; font-size: 12.5px; }
.modal input:hover, .modal select:hover { border-color: #cbd2e2; }
.modal input:focus, .modal select:focus { border-color: #9289eb; background: #fff; box-shadow: 0 0 0 3px rgba(105,91,214,.11); }
.modal-fields-row { gap: 12px; }
.field-hint { color: #8993a6; font-size: 10.5px; line-height: 1.4; }
.modal-close { top: 15px; right: 16px; display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #e6e8f0; border-radius: 9px; background: #fff; color: #7b8497; }
.modal-close:hover { border-color: #d9d4fa; background: #f4f2ff; color: #6257c7; }
.modal-actions { justify-content: flex-end; gap: 8px; margin: 22px calc(-1 * var(--modal-pad-x)) calc(-1 * var(--modal-pad-bottom)); padding: 13px var(--modal-pad-x); border-top: 1px solid #eceef5; border-radius: 0 0 15px 15px; background: #f8f8fd; }
.modal-actions .button { min-width: 92px; min-height: 35px; padding: 7px 13px; border-radius: 8px; font-size: 11.5px; font-weight: 650; }
.preset-chip { border-color: #e1e4ef; border-radius: 8px; background: #fafbff; color: #536079; }
.preset-chip:hover { border-color: #d2cdf5; background: #f6f4ff; color: #5b50bd; }
.preset-chip.selected, .mode-option.selected { border-color: #d7d1fa; background: #f1efff; color: #5d52c4; }
.mode-option { border-color: #e2e6ef; border-radius: 9px; background: #fbfcff; }
.mode-option:hover { border-color: #d6d0f7; background: #f8f7ff; }
.batch-preview { border: 1px solid #e5e2f7; border-radius: 9px; background: #f8f7ff; }
.form-divider { color: #7168c6; }
.form-divider:after { background: #e7e5f2; }
@media (max-width: 700px) {
  .modal-backdrop { padding: 12px; }
  .modal { --modal-pad-x: 18px; --modal-pad-bottom: 18px; width: min(620px,100%); max-height: calc(100dvh - 24px); padding-top: 22px; }
  .modal.user-modal { width: min(760px,100%); }
  .modal .eyebrow { margin-top: -22px; padding-top: 15px; }
  .modal h2 { font-size: 18px; }
  .modal-fields-row { grid-template-columns: 1fr; gap: 0; }
  .modal-actions { flex-wrap: wrap; }
}
