/**
 * API Gateway Monitor - Premium Monochrome Design System (B&W)
 * Default: White (Light) | Dynamic: Dark Mode Toggle
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* White (Light Theme) - Default */
  --bg-app: #fcfcfd;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f4f4f5;
  --bg-input: #ffffff;
  --border: #e4e4e7;
  --border-subtle: #f4f4f5;
  --border-focus: #09090b;

  --text-main: #09090b;
  --text-muted: #71717a;
  --text-faint: #a1a1aa;

  --btn-primary-bg: #09090b;
  --btn-primary-text: #ffffff;
  --btn-primary-hover: #27272a;

  --btn-secondary-bg: #ffffff;
  --btn-secondary-text: #09090b;
  --btn-secondary-border: #e4e4e7;
  --btn-secondary-hover: #f4f4f5;

  /* Refined Monochromatic Accents with subtle status tints */
  --status-success-bg: #ecfdf5;
  --status-success-text: #047857;
  --status-success-border: #a7f3d0;

  --status-failed-bg: #fff1f2;
  --status-failed-text: #be123c;
  --status-failed-border: #fecdd3;

  --status-error-bg: #fffbeb;
  --status-error-text: #b45309;
  --status-error-border: #fde68a;

  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 8px 24px -4px rgba(0, 0, 0, 0.04);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

[data-theme="dark"] {
  /* Dark Theme */
  --bg-app: #09090b;
  --bg-surface: #121215;
  --bg-surface-subtle: #18181b;
  --bg-input: #18181b;
  --border: #27272a;
  --border-subtle: #1f1f23;
  --border-focus: #ffffff;

  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-faint: #52525b;

  --btn-primary-bg: #ffffff;
  --btn-primary-text: #09090b;
  --btn-primary-hover: #e4e4e7;

  --btn-secondary-bg: #18181b;
  --btn-secondary-text: #f4f4f5;
  --btn-secondary-border: #27272a;
  --btn-secondary-hover: #27272a;

  --status-success-bg: rgba(16, 185, 129, 0.1);
  --status-success-text: #34d399;
  --status-success-border: rgba(52, 211, 153, 0.25);

  --status-failed-bg: rgba(244, 63, 94, 0.1);
  --status-failed-text: #fb7185;
  --status-failed-border: rgba(251, 113, 133, 0.25);

  --status-error-bg: rgba(245, 158, 11, 0.1);
  --status-error-text: #fbbf24;
  --status-error-border: rgba(251, 191, 36, 0.25);

  --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.15s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* Custom sleek scrollbar for webkit browsers */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-faint);
}

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1560px;
  margin: 0 auto;
  padding: 24px 36px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--text-main);
  color: var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  overflow: hidden;
}

/* Brand Avatar Styles (lo.png) */
.brand-avatar-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand-avatar-login {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--text-main);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.brand-avatar-login:hover {
  transform: scale(1.05) rotate(1deg);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.brand-avatar-header {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--text-main);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease;
}

.brand-avatar-header:hover {
  transform: scale(1.08);
}

.user-avatar-mini {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

.avatar-status-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid var(--bg-surface);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
}

.avatar-status-badge.lg {
  bottom: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  border-width: 2.5px;
}

.user-badge-role {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--text-main);
  color: var(--bg-app);
  letter-spacing: 0.05em;
  margin-left: 2px;
}

.brand-icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--bg-app);
  stroke-width: 2.2;
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-main);
}

.brand-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.theme-toggle-btn:hover {
  background: var(--bg-surface-subtle);
  border-color: var(--border-focus);
}

.theme-toggle-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
}

.logout-btn {
  padding: 8px 14px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 500;
}

.logout-btn:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-main);
  border-color: var(--text-main);
}

/* Metrics Bar */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.metric-card:hover {
  border-color: var(--text-muted);
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.metric-value {
  font-size: 2.2rem;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -0.04em;
  color: var(--text-main);
}

/* Workspace Layout */
.workspace-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 24px;
}

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

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title-badge {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

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

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

select, textarea, input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 11px 14px;
  font-size: 0.9rem;
  outline: none;
  font-family: inherit;
}

select:focus, textarea:focus, input:focus {
  border-color: var(--border-focus);
}

textarea,
#batch-input {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  resize: none;
  min-height: 220px;
  line-height: 1.6;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

textarea::-webkit-scrollbar,
#batch-input::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Progress bar */
.progress-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--text-main);
  transition: width 0.15s ease;
}

/* Action Buttons */
.button-row {
  display: flex;
  gap: 12px;
}

.btn {
  flex: 1;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
}

.btn-primary:hover:not(:disabled) {
  background: var(--btn-primary-hover);
}

.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border: 1px solid var(--btn-secondary-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--btn-secondary-hover);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Terminal Console */
.terminal-panel {
  display: flex;
  flex-direction: column;
  height: 620px;
}

.terminal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.terminal-filters {
  display: flex;
  gap: 6px;
}

.filter-btn {
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}

.filter-btn.active, .filter-btn:hover {
  background: var(--text-main);
  color: var(--bg-app);
  border-color: var(--text-main);
}

.terminal-console {
  flex: 1;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.log-entry {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  animation: slideDownIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.log-entry:hover {
  border-color: var(--border);
}

.log-entry.SUCCESS {
  border-left: 3px solid #10b981;
}

.log-entry.FAILED {
  border-left: 3px solid #ef4444;
}

.log-entry.ERROR {
  border-left: 3px solid #f59e0b;
}

.log-entry-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.log-left-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.log-card-number {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-main);
  letter-spacing: 0.02em;
}

.log-copy-inline {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-family: var(--font-sans);
  transition: all 0.15s ease;
}

.log-copy-inline:hover {
  color: var(--text-main);
  border-color: var(--border-focus);
  background: var(--bg-surface);
}

.log-copy-inline.copied {
  color: #10b981;
  border-color: #10b981;
}

.log-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.log-entry-row-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px dashed var(--border-subtle);
}

.log-card-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.card-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  letter-spacing: 0.02em;
}

.card-tag.scheme {
  font-weight: 700;
}

.card-tag.scheme.visa {
  border-color: rgba(37, 99, 235, 0.4);
  color: #3b82f6;
}

.card-tag.scheme.mastercard {
  border-color: rgba(249, 115, 22, 0.4);
  color: #f97316;
}

.card-tag.scheme.elo {
  border-color: rgba(234, 179, 8, 0.4);
  color: #eab308;
}

.card-tag.scheme.amex {
  border-color: rgba(16, 185, 129, 0.4);
  color: #10b981;
}

.log-response-msg {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  font-weight: 500;
}

.response-icon {
  color: var(--text-muted);
  font-weight: 700;
}

.log-entry.SUCCESS .log-response-msg .response-text {
  color: #10b981;
  font-weight: 600;
}

.log-entry.FAILED .log-response-msg .response-text {
  color: var(--text-muted);
}

.log-entry.ERROR .log-response-msg .response-text {
  color: #f59e0b;
}

.log-time {
  color: var(--text-faint);
  font-size: 0.75rem;
}

.log-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-align: center;
}

.log-badge.SUCCESS {
  background: var(--status-success-bg);
  color: var(--status-success-text);
  border: 1px solid var(--status-success-border);
}

.log-badge.FAILED {
  background: var(--status-failed-bg);
  color: var(--status-failed-text);
  border: 1px solid var(--status-failed-border);
}

.log-badge.ERROR {
  background: var(--status-error-bg);
  color: var(--status-error-text);
  border: 1px solid var(--status-error-border);
}

.log-latency {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.log-message {
  color: var(--text-main);
  word-break: break-word;
}

.log-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-faint);
  gap: 12px;
}

/* ====================================================================
   LOGIN PAGE SPECIFIC STYLES
   ==================================================================== */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
}

.login-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.login-header h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

.login-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.login-top-actions {
  position: absolute;
  top: 16px;
  right: 16px;
}

.alert-box {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  display: none;
  font-weight: 500;
}

.alert-box.error {
  display: block;
  background: var(--status-failed-bg);
  color: var(--status-failed-text);
  border: 1px solid var(--status-failed-border);
}

.login-footer-hint {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

/* ====================================================================
   USER MANAGEMENT MODAL & RBAC STYLES
   ==================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  width: 100%;
  max-width: 820px;
  max-height: 88vh;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-title-group h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.modal-title-group p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-main);
  border-color: var(--text-main);
}

.create-user-section {
  padding: 20px 24px;
  background: var(--bg-surface-subtle);
  border-bottom: 1px solid var(--border);
}

.section-subtitle {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.create-user-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 140px 130px;
  gap: 12px;
  align-items: flex-end;
}

@media (max-width: 768px) {
  .create-user-grid {
    grid-template-columns: 1fr;
  }
}

.users-table-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
}

.users-table th {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.users-table td {
  padding: 14px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.role-badge.admin {
  background: var(--text-main);
  color: var(--bg-app);
}

.role-badge.operator {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.actions-cell {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-table-action {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-table-action:hover {
  background: var(--bg-surface-subtle);
  border-color: var(--text-main);
}

.btn-table-action.danger:hover {
  background: var(--status-failed-bg);
  color: var(--status-failed-text);
  border-color: var(--status-failed-border);
}

/* ====================================================================
   UNIFIED EXPANDED NAVIGATION BAR
   ==================================================================== */
.nav-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

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

.nav-link:hover {
  color: var(--text-main);
  background: var(--bg-surface-subtle);
}

.nav-link.active {
  color: var(--text-main);
  background: var(--bg-surface);
  border-color: var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* ====================================================================
   EXPANDED PROFILE HERO & AVATAR UPLOADER
   ==================================================================== */
.profile-hero {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 36px;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 24px;
}

@media (max-width: 768px) {
  .profile-hero {
    flex-direction: column;
    align-items: flex-start;
  }
}

.profile-main-info {
  display: flex;
  align-items: center;
  gap: 24px;
}

.avatar-uploader-container {
  position: relative;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  cursor: pointer;
  overflow: hidden;
  border: 3px solid var(--text-main);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

.avatar-uploader-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease, filter 0.25s ease;
}

.avatar-uploader-container:hover .avatar-uploader-img {
  transform: scale(1.08);
  filter: brightness(0.6);
}

.avatar-uploader-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  color: #ffffff;
  opacity: 0;
  transition: opacity 0.2s ease;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  gap: 4px;
  pointer-events: none;
}

.avatar-uploader-container:hover .avatar-uploader-overlay {
  opacity: 1;
}

.avatar-uploader-overlay svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 2;
}

.profile-text-info h2 {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-meta-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.profile-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ====================================================================
   DEDICATED USERS PAGE GRID & LAYOUT
   ==================================================================== */
.users-page-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 28px;
}

@media (max-width: 1100px) {
  .users-page-grid {
    grid-template-columns: 1fr;
  }
}

.search-input-wrapper {
  position: relative;
  width: 100%;
}

.search-input-wrapper input {
  padding-left: 38px;
}

.search-input-wrapper svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  stroke: var(--text-faint);
  pointer-events: none;
}

.user-table-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.user-cell-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ====================================================================
   LINE QUOTA & CREDITS SYSTEM (BROGOLI)
   ==================================================================== */
.credits-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.credits-pill svg {
  width: 15px;
  height: 15px;
  stroke: var(--text-main);
}

.credits-pill.warning {
  background: var(--status-error-bg);
  border-color: var(--status-error-border);
  color: var(--status-error-text);
}

.credits-pill.warning svg {
  stroke: var(--status-error-text);
}

.line-counter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.line-counter-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.line-counter-item strong {
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

.line-counter-item.exceeded strong {
  color: #ef4444;
}

.quota-warning-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--status-error-bg);
  border: 1px solid var(--status-error-border);
  border-left: 4px solid #ef4444;
  border-radius: var(--radius-sm);
  color: var(--status-error-text);
  font-size: 0.85rem;
  animation: fadeInQuota 0.25s ease forwards;
}

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

.quota-warning-banner.show {
  display: flex;
}

.quota-warning-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quota-warning-left svg {
  width: 20px;
  height: 20px;
  stroke: #ef4444;
  flex-shrink: 0;
}

.btn-recharge-cta {
  background: #09090b;
  color: #ffffff;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

[data-theme="dark"] .btn-recharge-cta {
  background: #ffffff;
  color: #09090b;
}

.btn-recharge-cta:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Quick Recharge Buttons in Users Table */
.credit-actions-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-credit-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 700;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-surface);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-credit-pill:hover {
  background: var(--text-main);
  color: var(--bg-surface);
  border-color: var(--text-main);
  transform: scale(1.05);
}

.btn-credit-custom {
  padding: 4px 8px;
  font-size: 0.72rem;
  border: 1px dashed var(--border);
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
}

.btn-credit-custom:hover {
  border-color: var(--text-main);
  color: var(--text-main);
}

/* Modal Styling */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
  animation: modalFadeIn 0.2s ease;
}

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

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 680px;
  overflow: hidden;
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  color: var(--text-main);
  background: var(--bg-surface-subtle);
}

.modal-body {
  padding: 24px;
}

.packages-intro {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

.recharge-packages-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 640px) {
  .recharge-packages-grid {
    grid-template-columns: 1fr;
  }
}

.package-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.package-card:hover {
  border-color: var(--text-main);
  transform: translateY(-2px);
  box-shadow: var(--card-shadow);
}

.package-card.highlight {
  border: 2px solid var(--text-main);
}

.package-badge-popular {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  background: var(--text-main);
  color: var(--bg-surface);
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.package-lines-qty {
  font-size: 1.8rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-main);
  letter-spacing: -0.03em;
  margin: 8px 0 4px;
}

.package-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 14px;
}

.package-buy-btn {
  width: 100%;
  padding: 8px;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.package-buy-btn:hover {
  background: var(--btn-primary-hover);
}

.package-contact-box {
  background: var(--bg-surface-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.package-contact-box strong {
  color: var(--text-main);
}

.package-contact-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
}

