/* ═══════════════════════════════════════════════════════════════════════════
   TradeBridge Pro — Design System
   Dark navy-charcoal base | Electric teal accent | Inter + JetBrains Mono
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ──────────────────────────────────────────────── */
:root {
  /* Palette */
  --bg: #0d0f14;
  --surface: #141720;
  --surface-2: #1c2030;
  --surface-3: #242840;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* Accent */
  --accent: #00d4aa;
  --accent-dim: rgba(0, 212, 170, 0.12);
  --accent-hover: #00ebb8;
  --accent-glow: 0 0 20px rgba(0, 212, 170, 0.18);

  /* State colors */
  --success: #22c55e;
  --success-dim: rgba(34, 197, 94, 0.12);
  --danger: #ef4444;
  --danger-dim: rgba(239, 68, 68, 0.12);
  --warn: #f59e0b;
  --warn-dim: rgba(245, 158, 11, 0.12);
  --info: #3b82f6;
  --info-dim: rgba(59, 130, 246, 0.12);

  /* Text */
  --text: #e2e8f0;
  --text-2: #94a3b8;
  --text-muted: #475569;

  /* Typography */
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.07);

  /* Spacing */
  --sidebar-w: 220px;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-accent: 0 0 24px rgba(0, 212, 170, 0.2);

  /* Transition */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 150ms;
}

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}

a:hover {
  color: var(--accent-hover);
}

ul {
  list-style: none;
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* ── Layout Shell ────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: width var(--dur) var(--ease);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: var(--shadow-accent);
}

.sidebar-logo-text {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.sidebar-logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-section {
  padding: 4px 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 600;
  margin: 8px 0 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  margin: 2px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  user-select: none;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
  transform: translateX(2px);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

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

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 30px;
  height: 30px;
  background: var(--accent-dim);
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.avatar-info {
  flex: 1;
  min-width: 0;
}

.avatar-name {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.btn-icon-sm {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--dur) var(--ease);
}

.btn-icon-sm:hover {
  color: var(--danger);
}

/* ── Main Content ─────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-header {
  padding: 28px 32px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.page-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

.page-content {
  padding: 24px 32px 40px;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.card:hover {
  border-color: var(--border-strong);
}

.card-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
}

/* ── Stat Cards ──────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 200ms var(--ease), transform 200ms var(--ease);
}

.stat-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent-dim);
  transform: translate(30px, -30px);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  margin: 8px 0 4px;
  font-family: var(--font-mono);
  letter-spacing: -1px;
}

.stat-change {
  font-size: 12px;
  color: var(--text-muted);
}

.stat-change.up {
  color: var(--success);
}

.stat-change.down {
  color: var(--danger);
}

.stat-icon {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

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

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
  user-select: none;
}

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

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

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

.btn-success {
  background: var(--success-dim);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.btn-success:hover {
  background: var(--success);
  color: #fff;
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
  justify-content: center;
}

/* ── Form Elements ───────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.2px;
}

.form-input,
.form-select,
.form-textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 9px 13px;
  font-family: var(--font);
  font-size: 13.5px;
  width: 100%;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  outline: none;
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-input.error {
  border-color: var(--danger);
}

.form-error {
  font-size: 12px;
  color: var(--danger);
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.form-select {
  appearance: none;
  cursor: pointer;
}

/* Input with icon */
.input-wrap {
  position: relative;
}

.input-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-wrap .form-input {
  padding-left: 38px;
}

/* Range slider */
.form-range {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-value {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  min-width: 48px;
  text-align: right;
}

/* Toggle */
.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle-track {
  width: 40px;
  height: 22px;
  background: var(--surface-3);
  border-radius: 99px;
  position: relative;
  transition: background var(--dur) var(--ease);
  border: 1px solid var(--border);
}

.toggle-track.on {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-thumb {
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 50%;
  transform: translateY(-50%);
  left: 2px;
  transition: left var(--dur) var(--ease);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.toggle-track.on .toggle-thumb {
  left: 20px;
}

.toggle-label {
  font-size: 13.5px;
  font-weight: 500;
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge-success {
  background: var(--success-dim);
  color: var(--success);
}

.badge-danger {
  background: var(--danger-dim);
  color: var(--danger);
}

.badge-warn {
  background: var(--warn-dim);
  color: var(--warn);
}

.badge-info {
  background: var(--info-dim);
  color: var(--info);
}

.badge-muted {
  background: var(--surface-3);
  color: var(--text-muted);
}

.badge-accent {
  background: var(--accent-dim);
  color: var(--accent);
}

/* Pulsing dot for PENDING */
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.4;
    transform: scale(0.75);
  }
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--dur) var(--ease);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

tbody td {
  padding: 13px 16px;
  color: var(--text-2);
  vertical-align: middle;
}

tbody td:first-child {
  color: var(--text);
  font-weight: 500;
}

.mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

/* ── Account Cards ───────────────────────────────────────────────────────── */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  cursor: default;
  transition: border-color 200ms var(--ease), transform 200ms var(--ease);
  min-width: 0;
  /* Enable child truncation */
}

.account-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.account-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.exchange-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.exchange-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.5px;
  border: 1px solid var(--border);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.status-dot.inactive {
  background: var(--text-muted);
  box-shadow: none;
}

.account-label {
  font-size: 14px;
  font-weight: 700;
}

.account-owner {
  font-size: 12px;
  color: var(--text-muted);
}

.account-balance {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.account-balance-label {
  font-size: 11px;
  color: var(--text-muted);
}

.account-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.account-card-actions {
  display: flex;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ── Modals ──────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 150ms var(--ease);
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 200ms var(--ease);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-lg {
  max-width: 600px;
}

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

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
}

.modal-close:hover {
  color: var(--text);
  background: var(--surface-2);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-body {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 22px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Stepper ─────────────────────────────────────────────────────────────── */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 24px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 200ms var(--ease);
}

.step.active .step-num {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  box-shadow: var(--shadow-accent);
}

.step.done .step-num {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.step.active .step-label {
  color: var(--text);
}

.step.done .step-label {
  color: var(--success);
}

.step-line {
  flex: 1;
  height: 1px;
  background: var(--border);
  max-width: 40px;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 380px;
  animation: toastIn 200ms var(--ease);
}

.toast-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: 13.5px;
  font-weight: 700;
}

.toast-msg {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 2px;
}

.toast-success {
  border-left: 3px solid var(--success);
}

.toast-error {
  border-left: 3px solid var(--danger);
}

.toast-info {
  border-left: 3px solid var(--accent);
}

.toast-warn {
  border-left: 3px solid var(--warn);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(16px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── Skeleton ────────────────────────────────────────────────────────────── */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.skeleton {
  background: var(--surface-2);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200%;
  animation: shimmer 1.6s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-title {
  height: 22px;
  width: 50%;
  margin-bottom: 12px;
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}

/* ── Live Feed ───────────────────────────────────────────────────────────── */
.live-feed {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-family: var(--font-mono);
  font-size: 12.5px;
  height: 400px;
  overflow-y: auto;
  padding: 12px;
}

.feed-entry {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  animation: slideFeedIn 250ms var(--ease);
  margin-bottom: 2px;
}

.feed-entry:hover {
  background: rgba(255, 255, 255, 0.03);
}

@keyframes slideFeedIn {
  from {
    opacity: 0;
    transform: translateX(10px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.feed-time {
  color: var(--text-muted);
  flex-shrink: 0;
  font-size: 11px;
}

.feed-badge {
  flex-shrink: 0;
}

.feed-msg {
  color: var(--text-2);
  flex: 1;
}

.feed-success {
  color: var(--success);
}

.feed-error {
  color: var(--danger);
}

.feed-signal {
  color: var(--accent);
}

.feed-dup {
  color: var(--text-muted);
}

/* Live indicator */
.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 1.4s ease-in-out infinite;
  box-shadow: 0 0 6px var(--success);
}

/* ── Login page ──────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(0, 212, 170, 0.07) 0%, transparent 70%),
    radial-gradient(ellipse 40% 30% at 80% 80%, rgba(59, 130, 246, 0.05) 0%, transparent 60%);
  pointer-events: none;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 48px;
  height: 48px;
  background: var(--accent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: #000;
  box-shadow: var(--shadow-accent);
  margin-bottom: 4px;
}

.login-logo h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.login-logo p {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 20px;
  color: var(--text-muted);
  text-align: center;
}

.empty svg {
  width: 40px;
  height: 40px;
  opacity: 0.3;
}

.empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
}

.empty-sub {
  font-size: 13px;
}

/* ── Divider ─────────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ── Light Mode ──────────────────────────────────────────────────────────── */
body.light-mode {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e5e8ed;
  --border: rgba(0, 0, 0, 0.09);
  --border-strong: rgba(0, 0, 0, 0.18);
  --text: #0d1117;
  --text-2: #374151;
  --text-muted: #6b7280;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.08);
}

body.light-mode .sidebar {
  background: #ffffff;
  border-right-color: rgba(0, 0, 0, 0.09);
}

body.light-mode tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

body.light-mode .login-page {
  background: #f4f6f9;
}

/* ── Notification Bell ───────────────────────────────────────────────────── */
.notif-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: color var(--dur) var(--ease);
}

.notif-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.notif-btn svg {
  width: 18px;
  height: 18px;
}

.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 2px solid var(--surface);
  animation: pulse 2s ease-in-out infinite;
}

/* ── Keyboard Shortcuts ──────────────────────────────────────────────────── */
.shortcuts-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  align-items: center;
}

.kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 2px 7px;
  color: var(--text-2);
  white-space: nowrap;
}


/* ── Utility ─────────────────────────────────────────────────────────────── */
.flex {
  display: flex;
}

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

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.gap-4 {
  gap: 16px;
}

.mt-1 {
  margin-top: 4px;
}

.mt-2 {
  margin-top: 8px;
}

.mt-4 {
  margin-top: 16px;
}

.text-sm {
  font-size: 12.5px;
}

.text-muted {
  color: var(--text-muted);
}

.text-accent {
  color: var(--accent);
}

.font-mono {
  font-family: var(--font-mono);
}

.font-bold {
  font-weight: 700;
}

.w-full {
  width: 100%;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

/* Hamburger button — hidden on desktop */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 6px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
}

.mobile-menu-btn:hover {
  background: var(--surface-2);
}

.mobile-menu-btn svg {
  width: 22px;
  height: 22px;
}

/* Sidebar overlay backdrop — hidden on desktop */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 149;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.open {
  display: block;
}

@media (max-width: 768px) {

  /* Sidebar becomes a slide-over drawer */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 250ms var(--ease);
    width: var(--sidebar-w) !important;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* Show all sidebar text when open (override icon-only mode) */
  .sidebar.open .sidebar-logo-text,
  .sidebar.open .sidebar-logo-sub,
  .sidebar.open .nav-item span,
  .sidebar.open .nav-section,
  .sidebar.open .avatar-info {
    display: revert;
  }

  .sidebar-logo-text,
  .sidebar-logo-sub,
  .nav-item span,
  .nav-section,
  .avatar-info {
    display: none;
  }

  /* Main content takes full width */
  .main {
    margin-left: 0 !important;
  }

  /* Mobile top bar with hamburger */
  .page-header {
    padding: 16px 16px 0;
    gap: 10px;
  }

  .page-header::before {
    content: none;
  }

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

  .page-content {
    padding: 16px 16px 32px;
  }

  /* Grids collapse to single column */
  .account-grid {
    grid-template-columns: 1fr !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Stat values slightly smaller on mobile */
  .stat-value {
    font-size: 22px;
  }

  /* Tables scroll horizontally */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Login card full width with smaller padding */
  .login-card {
    padding: 28px 20px;
    max-width: 100%;
    margin: 16px;
  }

  /* Modals use full screen on mobile */
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    max-width: 100% !important;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
    max-height: 92vh;
  }

  /* Toast full width */
  #toast-container {
    left: 12px;
    right: 12px;
    top: 12px;
  }

  .toast {
    min-width: 0;
    max-width: 100%;
  }

  /* Dashboard chart section */
  .chart-section {
    flex-direction: column;
  }

  /* Page header actions wrap properly */
  .page-header>*:last-child {
    flex-shrink: 0;
  }

  /* Two-column grids inside cards (e.g. settings) go single column */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {

  /* Smallest phones: single column stat cards */
  .stats-grid {
    grid-template-columns: 1fr !important;
  }

  .stat-grid {
    grid-template-columns: 1fr !important;
  }

  .stat-value {
    font-size: 20px;
  }

  .page-title {
    font-size: 18px;
  }
}