/* ==========================================================================
   MetaTrader EA Instance Licensing, Remote Config & Billing Engine
   Theme: Grey + Gold High-Tech Financial Terminal
   Aesthetics: Translucent Glassmorphism, Graphite Obsidian, Metallic Gold Accents
   ========================================================================== */

:root {
  /* Tech Obsidian & Graphite Dark Base */
  --bg-main: #0a0c10;
  --bg-surface: rgba(18, 22, 29, 0.72);
  --bg-surface-solid: #12161d;
  --bg-surface-elevated: rgba(26, 32, 42, 0.78);
  --bg-surface-elevated-solid: #1a202a;
  --bg-surface-hover: rgba(38, 46, 60, 0.85);

  /* Hairline & Frosted Borders */
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-default: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --border-gold: rgba(212, 175, 55, 0.32);
  --border-gold-strong: rgba(229, 184, 105, 0.65);
  
  /* High-Contrast Crisp Tech Typography */
  --text-primary: #f4f5f7;
  --text-secondary: #9ca3af;
  --text-muted: #64748b;
  --text-gold: #e5b869;
  --text-gold-light: #fef08a;

  /* Metallic Tech Gold Brand Palette */
  --brand-primary: #d4af37;
  --brand-hover: #f3cf8a;
  --brand-subtle: rgba(212, 175, 55, 0.14);
  --brand-glow: 0 0 20px rgba(212, 175, 55, 0.3);
  --brand-gradient: linear-gradient(135deg, #f5d77f 0%, #d4af37 50%, #9e741d 100%);
  
  /* Semantic Status Accents */
  --color-success: #10b981;
  --color-success-subtle: rgba(16, 185, 129, 0.14);
  --color-danger: #f43f5e;
  --color-danger-subtle: rgba(244, 63, 94, 0.14);
  --color-warning: #f59e0b;
  --color-warning-subtle: rgba(245, 158, 11, 0.14);
  --color-info: #e5b869;
  --color-info-subtle: rgba(212, 175, 55, 0.14);

  /* Fonts */
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Monaco, Consolas, monospace;
  
  /* Glassmorphic Shadows & Elevations */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 16px -2px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 14px 28px -4px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 24px 44px -6px rgba(0, 0, 0, 0.75);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-glass-gold: 0 8px 24px rgba(212, 175, 55, 0.18), 0 0 16px rgba(212, 175, 55, 0.08);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(212, 175, 55, 0.08), transparent 70%),
    radial-gradient(circle at 100% 100%, rgba(26, 32, 42, 0.4), transparent 40%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--brand-primary);
  text-decoration: none;
  transition: color 0.15s ease, text-shadow 0.15s ease;
}

a:hover {
  color: var(--brand-hover);
  text-shadow: 0 0 12px rgba(212, 175, 55, 0.4);
}

/* --------------------------------------------------------------------------
   Layout & Container
   -------------------------------------------------------------------------- */

.app-container {
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
  padding: 26px 22px;
  flex: 1;
}

/* --------------------------------------------------------------------------
   Navbar (Frosted Smoky Glass with Gold Accent)
   -------------------------------------------------------------------------- */

.navbar {
  background-color: rgba(11, 14, 19, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0 22px;
}

.navbar-inner {
  max-width: 1380px;
  height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  cursor: pointer;
}

.nav-brand-logo {
  width: 36px;
  height: 36px;
  background: var(--brand-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0a0c10;
  font-weight: 900;
  font-size: 1.1rem;
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  letter-spacing: -0.05em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-item {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  background: transparent;
}

.nav-item:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-color: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
  color: var(--brand-primary);
  background-color: var(--brand-subtle);
  border-color: var(--border-gold);
  font-weight: 600;
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.16), inset 0 1px 0 rgba(212, 175, 55, 0.2);
}

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

/* --------------------------------------------------------------------------
   Status Indicators & Pulses
   -------------------------------------------------------------------------- */

.status-pulse-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
}

.status-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}

.status-pulse.connected {
  background-color: var(--color-success);
  box-shadow: 0 0 10px var(--color-success);
}

.status-pulse.connected::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  border: 1px solid var(--color-success);
  animation: pulse-ring 2s infinite ease-out;
}

.status-pulse.warning {
  background-color: var(--color-warning);
  box-shadow: 0 0 8px var(--color-warning);
}

.status-pulse.warning::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  border: 1px solid var(--color-warning);
  animation: pulse-ring 2.5s infinite ease-out;
}

.status-pulse.disconnected {
  background-color: var(--color-danger);
  box-shadow: 0 0 8px var(--color-danger);
}

.status-pulse.connecting {
  background-color: var(--brand-primary);
  box-shadow: 0 0 8px var(--brand-primary);
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(2.4); opacity: 0; }
}

/* --------------------------------------------------------------------------
   Cards, Grid & Panels (Frosted Obsidian Glass)
   -------------------------------------------------------------------------- */

.card {
  background: linear-gradient(145deg, rgba(20, 24, 32, 0.75) 0%, rgba(13, 16, 22, 0.8) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: var(--border-gold);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.48), 0 0 20px rgba(212, 175, 55, 0.08);
}

.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.grid-cols-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 992px) {
  .grid-cols-2-1 {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background: linear-gradient(180deg, rgba(24, 29, 39, 0.72) 0%, rgba(14, 17, 23, 0.8) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-top: 2px solid rgba(212, 175, 55, 0.45);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(212, 175, 55, 0.2);
  transition: transform 0.2s ease, border-top-color 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  border-top-color: var(--brand-primary);
  box-shadow: var(--shadow-md), 0 0 18px rgba(212, 175, 55, 0.12);
  transform: translateY(-2px);
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.stat-value {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  font-family: var(--font-sans);
}

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

/* --------------------------------------------------------------------------
   Translucent Glassmorphic Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  text-decoration: none;
  user-select: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Primary Button: Translucent Golden Amber Glass */
.btn-primary {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.26) 0%, rgba(160, 120, 20, 0.14) 100%);
  border: 1px solid rgba(229, 184, 105, 0.5);
  color: #fff9e6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 4px 14px rgba(212, 175, 55, 0.22);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(229, 184, 105, 0.38) 0%, rgba(180, 135, 25, 0.24) 100%);
  border-color: rgba(245, 215, 127, 0.85);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 6px 22px rgba(212, 175, 55, 0.45);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 2px 8px rgba(212, 175, 55, 0.25);
}

/* Secondary Button: Translucent Smoky Graphite Glass */
.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 3px 10px rgba(0, 0, 0, 0.25);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(212, 175, 55, 0.38);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 4px 14px rgba(0, 0, 0, 0.35), 0 0 14px rgba(212, 175, 55, 0.12);
  transform: translateY(-1px);
}

.btn-secondary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Danger Button: Translucent Ruby Crimson Glass */
.btn-danger {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.24) 0%, rgba(159, 18, 57, 0.14) 100%);
  border: 1px solid rgba(244, 63, 94, 0.45);
  color: #ffe4e6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 4px 14px rgba(244, 63, 94, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.btn-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.36) 0%, rgba(190, 18, 60, 0.24) 100%);
  border-color: rgba(251, 113, 133, 0.75);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 20px rgba(244, 63, 94, 0.4);
  transform: translateY(-1px);
}

.btn-danger:active:not(:disabled) {
  transform: translateY(0);
}

/* Success Button: Translucent Emerald Glass */
.btn-success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.24) 0%, rgba(5, 150, 105, 0.14) 100%);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #d1fae5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 4px 14px rgba(16, 185, 129, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.btn-success:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.36) 0%, rgba(5, 150, 105, 0.24) 100%);
  border-color: rgba(52, 211, 153, 0.75);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 20px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

.btn-success:active:not(:disabled) {
  transform: translateY(0);
}

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

.btn-icon {
  padding: 6px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   Badges & Pills (Frosted Glass Micro-Pills)
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.badge-success {
  background-color: var(--color-success-subtle);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.12);
}

.badge-danger {
  background-color: var(--color-danger-subtle);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.35);
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.12);
}

.badge-warning {
  background-color: rgba(212, 175, 55, 0.15);
  color: #f5d77f;
  border: 1px solid rgba(212, 175, 55, 0.35);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.12);
}

.badge-info {
  background-color: rgba(212, 175, 55, 0.15);
  color: #e5b869;
  border: 1px solid rgba(212, 175, 55, 0.35);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.12);
}

.badge-neutral {
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

/* --------------------------------------------------------------------------
   Data Tables (Frosted Glass Table Container)
   -------------------------------------------------------------------------- */

.table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, rgba(20, 24, 32, 0.75) 0%, rgba(13, 16, 22, 0.8) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
}

.fleet-kpi-grid {
  margin-bottom: 20px;
}

.fleet-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.fleet-toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(100%, 680px);
}

.fleet-toolbar-controls .form-control {
  min-width: 140px;
  padding: 8px 10px;
}

.fleet-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  background: transparent;
  cursor: pointer;
}

.fleet-sort-button:hover,
.fleet-sort-button.active {
  color: var(--text-gold-light);
}

.fleet-sort-indicator {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.fleet-sort-button.active .fleet-sort-indicator {
  color: var(--text-gold);
}

.fleet-toolbar-controls input[type="search"] {
  flex: 1;
  min-width: 260px;
}

#fleet-status-filter {
  flex: 0 0 150px;
  width: 150px;
  min-width: 150px;
}

.fleet-status-cell {
  width: 125px;
  min-width: 90px;
  white-space: nowrap;
}

.fleet-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.fleet-heartbeat-time {
  font-size: 0.775rem;
  font-weight: 600;
  white-space: nowrap;
}

.fleet-heartbeat-time.warning {
  color: var(--color-warning);
}

.fleet-heartbeat-time.danger {
  color: var(--color-danger);
}

.hedged-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
  font-weight: 700;
  text-transform: uppercase;
  background-color: rgba(212, 175, 55, 0.16);
  color: #f5d77f;
  border: 1px solid rgba(212, 175, 55, 0.4);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.15);
}

.fleet-instance-row[hidden] {
  display: none;
}

@media (max-width: 768px) {
  .fleet-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .fleet-toolbar-controls {
    width: 100%;
    flex-wrap: wrap;
  }

  .fleet-toolbar-controls .form-control {
    flex: 1;
  }
}

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

thead {
  background-color: rgba(26, 32, 42, 0.7);
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

th {
  padding: 13px 16px;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-primary);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  vertical-align: middle;
}

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

tbody tr {
  transition: background-color 0.15s ease;
}

tbody tr:hover {
  background-color: rgba(212, 175, 55, 0.05);
}

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

/* --------------------------------------------------------------------------
   Forms & Inputs (Frosted Dark Glass Inputs)
   -------------------------------------------------------------------------- */

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: rgba(14, 18, 24, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.22), inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

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

textarea.form-control {
  min-height: 90px;
  font-family: var(--font-mono);
  font-size: 0.825rem;
  resize: vertical;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d4af37' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 38px;
}

/* --------------------------------------------------------------------------
   Modals & Overlays (Deep Blurred Backdrop + Glass Panel)
   -------------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(5, 7, 10, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fade-in 0.2s ease;
}

.modal-content {
  background: linear-gradient(160deg, rgba(22, 27, 36, 0.94) 0%, rgba(14, 17, 24, 0.96) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 50px -10px rgba(0, 0, 0, 0.75), 0 0 35px rgba(212, 175, 55, 0.12);
  overflow: hidden;
  animation: slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content-lg {
  max-width: 900px;
}

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

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  padding: 4px;
  transition: color 0.15s ease, transform 0.15s ease;
}

.modal-close:hover {
  color: var(--brand-primary);
  transform: scale(1.1);
}

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

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background-color: rgba(10, 13, 18, 0.65);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   Toasts (Glassmorphic Notification Cards)
   -------------------------------------------------------------------------- */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 120;
  max-width: 400px;
  width: 100%;
}

.toast {
  background: linear-gradient(145deg, rgba(26, 32, 42, 0.88) 0%, rgba(16, 20, 28, 0.92) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--text-primary);
  font-size: 0.875rem;
  animation: toast-slide 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.toast-warning {
  border-left: 4px solid var(--brand-primary);
}

.toast-info {
  border-left: 4px solid var(--brand-primary);
}

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

/* --------------------------------------------------------------------------
   Tabs (Frosted High-Tech Navigation Tabs)
   -------------------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab-item {
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-item:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab-item.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
  text-shadow: 0 0 12px rgba(212, 175, 55, 0.35);
}

/* --------------------------------------------------------------------------
   Key-Value Display & Code Blocks (Sleek Tech Graphite)
   -------------------------------------------------------------------------- */

.code-box {
  background-color: rgba(6, 8, 11, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-gold);
  word-break: break-all;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* --------------------------------------------------------------------------
   Custom Tech Scrollbars
   -------------------------------------------------------------------------- */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(10, 12, 16, 0.6);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 175, 55, 0.45);
}

/* --------------------------------------------------------------------------
   Responsive utilities
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  .navbar-inner {
    height: auto;
    padding: 14px 0;
    flex-direction: column;
    gap: 14px;
  }
  
  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .grid-cols-2, .grid-cols-4 {
    grid-template-columns: 1fr;
  }
}

/* Keep all six Fleet KPIs on one row on desktop. */
.fleet-kpi-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.fleet-kpi-grid .stat-card {
  min-width: 0;
  padding: 14px 12px;
  gap: 6px;
}

.fleet-kpi-grid .stat-label,
.fleet-kpi-grid .stat-subtext {
  font-size: 0.7rem;
}

.fleet-kpi-grid .stat-value {
  font-size: clamp(0.9rem, 1.2vw, 1.2rem);
  overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
  .fleet-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .fleet-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
}

/* --------------------------------------------------------------------------
   Live PnL & Financial Card Metrics
   -------------------------------------------------------------------------- */

.pnl-positive {
  color: var(--color-success) !important;
}

.pnl-negative {
  color: var(--color-danger) !important;
}

.pnl-neutral {
  color: var(--text-secondary) !important;
}

.metric-tile {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.2s ease;
}

.metric-tile:hover {
  border-color: var(--border-gold);
  background-color: var(--bg-surface-hover);
}

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

.metric-tile-value {
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.metric-tile-subtext {
  font-size: 0.725rem;
  color: var(--text-muted);
}

@keyframes live-update-pulse {
  0% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.02); filter: brightness(1.5) drop-shadow(0 0 6px rgba(212, 175, 55, 0.4)); }
  100% { transform: scale(1); filter: brightness(1); }
}

.live-pulse-active {
  animation: live-update-pulse 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.instance-actions {
  position: relative;
}

.instance-actions-menu {
  position: fixed;
  inset: auto;
  margin: 0;
  z-index: 30;
  min-width: 180px;
  padding: 5px;
  background: var(--bg-surface, #1c1c1c);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.instance-actions-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.instance-actions-item:hover:not(:disabled) {
  background: var(--bg-surface-elevated);
}

.instance-actions-item.is-danger {
  color: var(--color-danger);
}

.instance-actions-item:disabled {
  opacity: 0.55;
  cursor: wait;
}

.instance-type-actions {
  position: relative;
}

.instance-type-actions-menu {
  position: fixed;
  inset: auto;
  margin: 0;
  z-index: 20;
  min-width: 170px;
  padding: 5px;
  background: var(--bg-surface, #1c1c1c);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.instance-type-menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.instance-type-menu-item:hover {
  background: var(--bg-surface-elevated);
}

/* --------------------------------------------------------------------------
   User Profile & Management Modal (Grey + Gold Financial Terminal)
   -------------------------------------------------------------------------- */

.admin-user-row {
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.admin-user-row:hover {
  background-color: rgba(212, 175, 55, 0.07) !important;
}

.admin-user-row:hover td strong {
  color: var(--text-gold);
}

.user-info-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.user-profile-header {
  background: linear-gradient(135deg, rgba(26, 32, 42, 0.85) 0%, rgba(18, 22, 29, 0.9) 100%);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.user-profile-avatar-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.user-avatar-badge {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.25) 0%, rgba(18, 22, 29, 0.9) 100%);
  border: 1.5px solid var(--border-gold-strong);
  color: var(--brand-primary);
  font-weight: 700;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.2);
}

.user-profile-email-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-profile-email {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.user-profile-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}

.user-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.user-kpi-grid {
  margin-bottom: 4px;
}

.user-emergency-toggle-card {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 14px 0;
  transition: border-color 0.2s ease;
}

.user-emergency-toggle-card:hover {
  border-color: var(--border-gold);
}

.user-strategy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
  max-height: 190px;
  overflow-y: auto;
  padding: 6px;
  background-color: rgba(10, 13, 18, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.user-strategy-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.user-strategy-card:hover {
  border-color: var(--border-gold);
  background: var(--bg-surface-hover);
}

.user-strategy-card.selected {
  border-color: var(--brand-primary);
  background: rgba(212, 175, 55, 0.09);
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.25);
}

.user-strategy-card input[type="checkbox"] {
  accent-color: var(--brand-primary);
  margin-top: 3px;
  cursor: pointer;
}

.user-empty-instances {
  text-align: center;
  padding: 32px 16px;
  background-color: var(--bg-surface-elevated);
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-md);
}

.btn-outline-danger {
  background: transparent;
  color: var(--color-danger);
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.btn-outline-danger:hover:not(:disabled) {
  background: var(--color-danger-subtle);
  border-color: var(--color-danger);
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.25);
}

.btn-outline-success {
  background: transparent;
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.btn-outline-success:hover:not(:disabled) {
  background: var(--color-success-subtle);
  border-color: var(--color-success);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

