/* ==========================================================================
   CRUDE TRADER - Institutional Admin Console & Access Control Design System
   Aesthetic: Obsidian Glassmorphism, Neon Cyan & Emerald Accents, High Precision
   ========================================================================== */

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

:root {
  --bg-base: #060911;
  --bg-primary: #0a0f1d;
  --bg-secondary: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-input: rgba(10, 15, 29, 0.85);
  --bg-glass: rgba(15, 23, 42, 0.65);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.15);
  --border-glow: rgba(59, 130, 246, 0.4);
  --border-emerald: rgba(16, 185, 129, 0.4);
  --border-rose: rgba(244, 63, 94, 0.4);

  --text-main: #f8fafc;
  --text-dim: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #38bdf8;

  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #8b5cf6;
  --accent-gold: #fbbf24;

  --glow-cyan: 0 0 25px rgba(6, 182, 212, 0.25);
  --glow-blue: 0 0 25px rgba(59, 130, 246, 0.25);
  --glow-emerald: 0 0 25px rgba(16, 185, 129, 0.25);
  --glow-rose: 0 0 25px rgba(244, 63, 94, 0.25);

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  background: radial-gradient(circle at 15% 15%, #0f172a 0%, #060911 60%), #060911;
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  background-attachment: fixed;
}

/* Background Ambient Neon Orbs */
body::before {
  content: '';
  position: fixed;
  top: -150px;
  left: 20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: '';
  position: fixed;
  bottom: -200px;
  right: 15%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* ==========================================================================
   Top Header Navigation
   ========================================================================== */
.admin-navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.8rem;
  background: rgba(10, 15, 29, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(59, 130, 246, 0.2));
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: var(--radius-md);
  font-size: 1.35rem;
  box-shadow: var(--glow-cyan);
}

.brand-title-group h1 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #38bdf8, #a855f7, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-title-group .admin-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.brand-title-group p {
  font-size: 0.76rem;
  color: var(--text-dim);
}

.header-status-strip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-capsule {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.status-dot.green {
  background: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
}
.status-dot.blue {
  background: var(--accent-blue);
  box-shadow: 0 0 10px var(--accent-blue);
}
.status-dot.amber {
  background: var(--accent-amber);
  box-shadow: 0 0 10px var(--accent-amber);
}
.status-dot.pulse {
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 14px currentColor; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-terminal-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.95rem;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(6, 182, 212, 0.15));
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: var(--radius-sm);
  color: #38bdf8;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.25s ease;
}
.btn-terminal-link:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(6, 182, 212, 0.3));
  border-color: #38bdf8;
  box-shadow: var(--glow-blue);
  transform: translateY(-1px);
}

.user-profile-menu {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 30px;
}

.user-avatar-small {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}

.user-info-text {
  display: flex;
  flex-direction: column;
}
.user-info-text .uname {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}
.user-info-text .urole {
  font-size: 0.65rem;
  color: var(--accent-gold);
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1rem;
  transition: color 0.2s;
  display: flex;
  align-items: center;
}
.btn-logout:hover {
  color: var(--accent-rose);
}

/* ==========================================================================
   Navigation Tabs
   ========================================================================== */
.admin-tabbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.8rem;
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  position: sticky;
  top: 61px;
  z-index: 990;
  backdrop-filter: blur(12px);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-dim);
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}
.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}
.tab-btn.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(139, 92, 246, 0.15));
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.tab-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}
.tab-btn.active .tab-badge {
  background: rgba(59, 130, 246, 0.4);
  color: #fff;
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.admin-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.8rem;
  position: relative;
  z-index: 10;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-out;
}
.tab-content.active {
  display: block;
}

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

/* Page Section Headers */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.4rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.section-title-group h2 {
  font-family: var(--font-heading);
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}
.section-title-group p {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

/* ==========================================================================
   KPI Cards & Overview Grid
   ========================================================================== */
.overview-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.1rem;
  margin-bottom: 1.8rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.kpi-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.5), transparent);
}
.kpi-card.emerald::before { background: linear-gradient(90deg, transparent, var(--accent-emerald), transparent); }
.kpi-card.amber::before { background: linear-gradient(90deg, transparent, var(--accent-amber), transparent); }
.kpi-card.purple::before { background: linear-gradient(90deg, transparent, var(--accent-purple), transparent); }
.kpi-card.cyan::before { background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent); }

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}
.kpi-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kpi-icon {
  font-size: 1.25rem;
  opacity: 0.85;
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}
.kpi-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Quick Actions Box */
.quick-action-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.quick-action-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.quick-action-title h3 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
}
.quick-action-title p {
  font-size: 0.76rem;
  color: var(--text-dim);
}

.action-btn-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: 1px solid #3b82f6;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-heading);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.2), rgba(225, 29, 72, 0.3));
  border: 1px solid rgba(244, 63, 94, 0.5);
  border-radius: var(--radius-md);
  color: #fda4af;
  font-family: var(--font-heading);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
}
.btn-danger:hover {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.4), rgba(225, 29, 72, 0.5));
  border-color: #f43f5e;
  box-shadow: var(--glow-rose);
  color: #fff;
}

.btn-warning {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-md);
  color: #fbbf24;
  font-family: var(--font-heading);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-warning:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: #f59e0b;
}

/* ==========================================================================
   User Management & RBAC Feature Matrix
   ========================================================================== */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.table-toolbar {
  padding: 1.1rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(10, 15, 29, 0.5);
}

.search-input-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.85rem;
  min-width: 280px;
}
.search-input-group input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.85rem;
  width: 100%;
}
.search-input-group input::placeholder {
  color: var(--text-muted);
}

.filter-select {
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.85rem;
  color: var(--text-main);
  font-size: 0.84rem;
  font-family: var(--font-main);
  outline: none;
  cursor: pointer;
}

/* Luxury Data Table */
.data-table-container {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.84rem;
}

.admin-table th {
  padding: 0.85rem 1.1rem;
  background: rgba(10, 15, 29, 0.9);
  color: var(--text-dim);
  font-family: var(--font-heading);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.admin-table td {
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
  color: var(--text-main);
}

.admin-table tbody tr {
  transition: background-color 0.2s ease;
}
.admin-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.025);
}

/* User cell */
.user-identity-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.user-avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}
.user-identity-text {
  display: flex;
  flex-direction: column;
}
.user-identity-text .name {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.88rem;
}
.user-identity-text .email {
  font-size: 0.74rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Role Badges */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
}
.role-badge.admin {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.role-badge.trader {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}
.role-badge.viewer {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Cyberpunk / iOS Style Toggle Switches */
.switch-container {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  user-select: none;
}
.switch-container input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.switch-slider {
  width: 40px;
  height: 22px;
  background-color: rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.switch-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 2px;
  top: 2px;
  background-color: #94a3b8;
  border-radius: 50%;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}
.switch-container input:checked + .switch-slider {
  background-color: rgba(16, 185, 129, 0.35);
  border-color: var(--accent-emerald);
}
.switch-container input:checked + .switch-slider::before {
  transform: translateX(18px);
  background-color: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
}
.switch-container input:checked.danger + .switch-slider {
  background-color: rgba(244, 63, 94, 0.35);
  border-color: var(--accent-rose);
}
.switch-container input:checked.danger + .switch-slider::before {
  background-color: var(--accent-rose);
  box-shadow: 0 0 10px var(--accent-rose);
}
.switch-container input:disabled + .switch-slider {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Action Dropdown or Buttons */
.action-icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}
.action-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  border-color: var(--border-medium);
}
.action-icon-btn.danger:hover {
  background: rgba(244, 63, 94, 0.2);
  color: var(--accent-rose);
  border-color: var(--accent-rose);
}

/* ==========================================================================
   System & Trading Settings (Moved & Enhanced)
   ========================================================================== */
.settings-layout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 1.4rem;
  margin-bottom: 2rem;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.settings-card.span-2 {
  grid-column: 1 / -1;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
}
.card-header-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.card-header-title h3 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}
.card-header-title .card-tag {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.form-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.form-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.form-item label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
}
.form-item .input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.form-item input, .form-item select, .form-item textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.85rem;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  outline: none;
  transition: all 0.2s ease;
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.25);
}

.form-item small {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.btn-toggle-eye {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 0.9rem;
}
.btn-toggle-eye:hover {
  color: var(--text-main);
}

/* Floating Save Bar */
.sticky-save-footer {
  position: sticky;
  bottom: 1.5rem;
  z-index: 950;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: var(--radius-xl);
  padding: 0.85rem 1.6rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7), var(--glow-blue);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2rem;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   Activity Audit Trail
   ========================================================================== */
.audit-filter-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.category-badge.AUTH { background: rgba(139, 92, 246, 0.15); color: #c084fc; border: 1px solid rgba(139, 92, 246, 0.3); }
.category-badge.TRADING { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.category-badge.SETTINGS { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.category-badge.USER_MGMT { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.category-badge.RISK { background: rgba(244, 63, 94, 0.15); color: #fb7185; border: 1px solid rgba(244, 63, 94, 0.3); }
.category-badge.SECURITY { background: rgba(6, 182, 212, 0.15); color: #22d3ee; border: 1px solid rgba(6, 182, 212, 0.3); }

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.74rem;
  font-weight: 700;
  font-family: var(--font-mono);
}
.status-indicator.success { color: var(--accent-emerald); }
.status-indicator.failed { color: var(--accent-rose); }
.status-indicator.warning { color: var(--accent-amber); }

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 17, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: #0f172a;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 580px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(59, 130, 246, 0.15);
  overflow: hidden;
  transform: translateY(12px) scale(0.97);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.open .modal-dialog {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 1.25rem 1.6rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 15, 29, 0.6);
}
.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
}
.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.2rem;
  transition: color 0.2s;
}
.modal-close-btn:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1.1rem 1.6rem;
  border-top: 1px solid var(--border-subtle);
  background: rgba(10, 15, 29, 0.6);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ==========================================================================
   Toasts & Alerts
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 420px;
  padding: 0.85rem 1.2rem;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.25s ease;
}
.toast.success {
  border-left: 4px solid var(--accent-emerald);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(16, 185, 129, 0.2);
}
.toast.error {
  border-left: 4px solid var(--accent-rose);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(244, 63, 94, 0.2);
}
.toast.info {
  border-left: 4px solid var(--accent-cyan);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ==========================================================================
   Auth Pages (Login / Signup)
   ========================================================================== */
.auth-page-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  padding: 2.2rem;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(59, 130, 246, 0.15);
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #38bdf8, #8b5cf6, #ec4899);
}

.auth-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.auth-logo-badge {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(59, 130, 246, 0.25));
  border: 1px solid rgba(59, 130, 246, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  margin-bottom: 0.4rem;
  box-shadow: var(--glow-cyan);
}

.auth-header h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}
.auth-header p {
  color: var(--text-dim);
  font-size: 0.84rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.auth-hint-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.95rem;
  font-size: 0.78rem;
  color: #fbbf24;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.auth-footer-links {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.auth-footer-links a {
  color: #38bdf8;
  text-decoration: none;
  font-weight: 600;
}
.auth-footer-links a:hover {
  text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .admin-navbar {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  .admin-tabbar {
    padding: 0.5rem 1rem;
    top: 57px;
  }
  .admin-container {
    padding: 1rem;
  }
  .settings-layout-grid {
    grid-template-columns: 1fr;
  }
  .sticky-save-footer {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }
}
