/* ═══════════════════════════════════════════════════════════════
   SSFX HQ — Trading Command Platform
   Aesthetic: Industrial utilitarian command console
   Typography: JetBrains Mono (data) + Instrument Sans (UI)
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Surface palette — deep charcoal with blue-black undertone */
  --bg-0: #08090c;
  --bg-1: #0e1015;
  --bg-2: #14161d;
  --bg-3: #1a1d26;
  --bg-4: #222530;
  --bg-hover: #1e2130;

  /* Borders and dividers */
  --border: rgba(255, 255, 255, 0.06);
  --border-subtle: rgba(255, 255, 255, 0.03);
  --border-focus: rgba(84, 160, 255, 0.5);

  /* Accent palette — signal-inspired */
  --accent: #54a0ff;
  --accent-dim: rgba(84, 160, 255, 0.12);
  --accent-glow: 0 0 20px rgba(84, 160, 255, 0.2);
  --green: #2ecc71;
  --green-dim: rgba(46, 204, 113, 0.1);
  --green-glow: 0 0 12px rgba(46, 204, 113, 0.25);
  --red: #e74c3c;
  --red-dim: rgba(231, 76, 60, 0.1);
  --amber: #f0a030;
  --amber-dim: rgba(240, 160, 48, 0.1);
  --purple: #a55eea;
  --purple-dim: rgba(165, 94, 234, 0.1);
  --cyan: #00d2d3;
  --cyan-dim: rgba(0, 210, 211, 0.1);

  /* Text hierarchy */
  --text-primary: #e4e8f0;
  --text-secondary: #8b92a5;
  --text-tertiary: #565c6e;
  --text-inverse: #08090c;

  /* Typography */
  --font-ui: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Radius */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 12px;
  --r-full: 9999px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 120ms;
  --dur-normal: 200ms;
  --dur-slow: 350ms;
}

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-ui);
  background: var(--bg-0);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  line-height: 1.5;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ── Typography ────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-ui);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }

.mono { font-family: var(--font-mono); }
.text-dim { color: var(--text-secondary); }
.text-tert { color: var(--text-tertiary); }

/* ── App Shell ─────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-rows: 48px 1fr;
  height: 100vh;
}

/* ── Top Bar ──────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-5);
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  z-index: 30;
  gap: var(--sp-4);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
  flex-shrink: 0;
}

.topbar-logo {
  width: 24px;
  height: 24px;
  background: var(--accent);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M12 2L2 7l10 5 10-5-10-5z'/%3E%3Cpath d='M2 17l10 5 10-5'/%3E%3Cpath d='M2 12l10 5 10-5'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M12 2L2 7l10 5 10-5-10-5z'/%3E%3Cpath d='M2 17l10 5 10-5'/%3E%3Cpath d='M2 12l10 5 10-5'/%3E%3C/svg%3E") center/contain no-repeat;
}

.topbar-title {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

.topbar-title span {
  color: var(--text-tertiary);
  font-weight: 400;
}

/* ── Navigation ───────────────────────────────────────── */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.topbar-nav::-webkit-scrollbar { display: none; }

.nav-item {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
  white-space: nowrap;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

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

/* ── Topbar Right ─────────────────────────────────────── */
.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

.status-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
}

.status-dot.online { background: var(--green); box-shadow: var(--green-glow); }
.status-dot.warn { background: var(--amber); }
.status-dot.offline { background: var(--red); }

.user-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-full);
  background: var(--bg-2);
  border: 1px solid var(--border);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}

.user-chip:hover { background: var(--bg-3); }

.role-tag {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 1px 6px;
  border-radius: var(--r-sm);
  background: var(--accent-dim);
  color: var(--accent);
}

.role-tag.master {
  background: var(--purple-dim);
  color: var(--purple);
}

/* ── User Dropdown ────────────────────────────────────── */
.user-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--sp-2);
  min-width: 180px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-1);
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: menuIn var(--dur-fast) var(--ease);
}

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

.user-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
  border: none;
  background: none;
  cursor: pointer;
}

.user-menu-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.user-menu-item.danger:hover {
  color: var(--red);
  background: var(--red-dim);
}

/* ── Main Content ──────────────────────────────────────── */
.main-content {
  overflow-y: auto;
  padding: var(--sp-6);
}

/* ── Page Header ──────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-6);
  gap: var(--sp-4);
}

.page-header h1 {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
}

.page-subtitle {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-secondary);
}

/* ── Card / Panel ─────────────────────────────────────── */
.panel {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.panel-subtitle {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.panel-body { padding: var(--sp-5); }

/* ── Data Grid ───────────────────────────────────────── */
.data-grid {
  display: grid;
  gap: var(--sp-4);
}

.data-grid-2 { grid-template-columns: repeat(2, 1fr); }
.data-grid-3 { grid-template-columns: repeat(3, 1fr); }
.data-grid-4 { grid-template-columns: repeat(4, 1fr); }
.data-grid-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* ── Stat Card ────────────────────────────────────────── */
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  transition: border-color var(--dur-fast) var(--ease);
}

.stat-card:hover { border-color: rgba(255, 255, 255, 0.1); }

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: var(--sp-2);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }
.stat-value.amber { color: var(--amber); }
.stat-value.accent { color: var(--accent); }
.stat-value.purple { color: var(--purple); }

.stat-change {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  margin-top: var(--sp-1);
  color: var(--text-tertiary);
}

/* ── Badge ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-secondary);
}

.badge-green { color: var(--green); border-color: rgba(46, 204, 113, 0.25); background: var(--green-dim); }
.badge-red { color: var(--red); border-color: rgba(231, 76, 60, 0.25); background: var(--red-dim); }
.badge-amber { color: var(--amber); border-color: rgba(240, 160, 48, 0.25); background: var(--amber-dim); }
.badge-accent { color: var(--accent); border-color: rgba(84, 160, 255, 0.25); background: var(--accent-dim); }
.badge-purple { color: var(--purple); border-color: rgba(165, 94, 234, 0.25); background: var(--purple-dim); }
.badge-cyan { color: var(--cyan); border-color: rgba(0, 210, 211, 0.25); background: var(--cyan-dim); }

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.data-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  white-space: nowrap;
}

.data-table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  white-space: nowrap;
}

.data-table tbody tr { transition: background var(--dur-fast) var(--ease); }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

.table-empty {
  text-align: center;
  color: var(--text-tertiary);
  padding: var(--sp-8);
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover { background: var(--bg-3); border-color: rgba(255, 255, 255, 0.1); }
.btn:active { transform: scale(0.98); }

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

.btn-primary:hover { background: #4390e8; border-color: #4390e8; }

.btn-success {
  background: var(--green);
  border-color: var(--green);
  color: var(--text-inverse);
}

.btn-danger {
  background: var(--red-dim);
  border-color: rgba(231, 76, 60, 0.3);
  color: var(--red);
}

.btn-danger:hover { background: rgba(231, 76, 60, 0.2); }

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-secondary);
}

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

.btn-sm { padding: var(--sp-1) var(--sp-3); font-size: 0.75rem; }
.btn-block { display: flex; width: 100%; }

/* ── Forms ─────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.form-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}

.form-input, .form-select, .form-textarea {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-0);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

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

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

.form-textarea { resize: vertical; min-height: 60px; }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%23565c6e' stroke-width='1.5'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-4);
}

.form-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.form-row label {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.form-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.form-section {
  margin-bottom: var(--sp-5);
}

.form-section-title {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--accent-dim);
  margin-bottom: var(--sp-4);
}

/* ── PIN Input ────────────────────────────────────────── */
.pin-dots {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.pin-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--text-tertiary);
  transition: all var(--dur-fast) var(--ease);
}

.pin-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-dim);
}

.pin-toggle {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--sp-1);
}

.pin-toggle:hover { color: var(--text-secondary); }

/* ── Auth Views ────────────────────────────────────────── */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--sp-6);
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-card .panel { padding: var(--sp-8); }

.auth-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}

.auth-logo-mark {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: var(--r-md);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M12 2L2 7l10 5 10-5-10-5z'/%3E%3Cpath d='M2 17l10 5 10-5'/%3E%3Cpath d='M2 12l10 5 10-5'/%3E%3C/svg%3E") center/60% no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M12 2L2 7l10 5 10-5-10-5z'/%3E%3Cpath d='M2 17l10 5 10-5'/%3E%3Cpath d='M2 12l10 5 10-5'/%3E%3C/svg%3E") center/60% no-repeat;
}

.auth-logo-text {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.auth-form .form-group { margin-bottom: var(--sp-4); }
.auth-form .form-label { margin-bottom: var(--sp-1); }
.auth-form .btn { margin-top: var(--sp-2); }

.auth-links {
  display: flex;
  justify-content: space-between;
  margin-top: var(--sp-5);
  font-size: 0.8125rem;
}

.auth-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}

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

.auth-msg {
  font-size: 0.8125rem;
  margin-top: var(--sp-3);
  min-height: 1.5em;
}

.auth-msg.error { color: var(--red); }
.auth-msg.success { color: var(--green); }

/* ── Alert Banner ──────────────────────────────────────── */
.alert {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  border: 1px solid;
  margin-bottom: var(--sp-4);
  font-size: 0.8125rem;
}

.alert-warn {
  background: var(--amber-dim);
  border-color: rgba(240, 160, 48, 0.25);
  color: var(--amber);
}

.alert-error {
  background: var(--red-dim);
  border-color: rgba(231, 76, 60, 0.25);
  color: var(--red);
}

.alert-success {
  background: var(--green-dim);
  border-color: rgba(46, 204, 113, 0.25);
  color: var(--green);
}

.alert-info {
  background: var(--accent-dim);
  border-color: rgba(84, 160, 255, 0.25);
  color: var(--accent);
}

/* ── Info Grid (dashboard key-values) ─────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}

.info-item {
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.info-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}

.info-value {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-primary);
}

.info-value.code {
  word-break: break-all;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ── Account Cards (auth site) ─────────────────────────── */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--sp-4);
}

.account-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  transition: border-color var(--dur-fast) var(--ease);
}

.account-card:hover { border-color: rgba(255, 255, 255, 0.1); }

.account-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}

.account-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.account-card-broker {
  font-weight: 600;
  font-size: 0.875rem;
}

.account-card-balance {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--green);
  margin-bottom: var(--sp-2);
}

.account-card-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: var(--sp-3);
}

.account-card-detail {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
}

.account-card-detail-label { color: var(--text-tertiary); }
.account-card-detail-value { font-family: var(--font-mono); color: var(--text-secondary); }

.account-card-id {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--text-tertiary);
  margin-top: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--border-subtle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Fleet Cards (command center) ──────────────────────── */
.fleet-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.fleet-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.fleet-card.danger { border-left-color: var(--red); }
.fleet-card.running { border-left-color: var(--green); }
.fleet-card.stopped { border-left-color: var(--text-tertiary); }

.fleet-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.fleet-card-name {
  font-weight: 600;
  font-size: 0.9375rem;
}

.fleet-card-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.fleet-card-actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}

/* ── Pipeline Nodes ────────────────────────────────────── */
.pipeline {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.pipeline-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-2);
  min-width: 100px;
  text-align: center;
  transition: all var(--dur-normal) var(--ease);
}

.pipeline-node-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}

.pipeline-node-sub {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
}

.pipeline-node.active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--accent-glow);
  animation: pipelinePulse 2s infinite;
}

.pipeline-node.active .pipeline-node-label { color: var(--accent); }

.pipeline-node.done {
  border-color: rgba(46, 204, 113, 0.3);
}

.pipeline-node.done .pipeline-node-label { color: var(--green); }

.pipeline-node.warn {
  border-color: rgba(240, 160, 48, 0.3);
}

.pipeline-node.warn .pipeline-node-label { color: var(--amber); }

.pipeline-node.error {
  border-color: rgba(231, 76, 60, 0.3);
}

.pipeline-node.error .pipeline-node-label { color: var(--red); }

.pipeline-connector {
  width: 24px;
  height: 1px;
  background: var(--text-tertiary);
  flex-shrink: 0;
}

@keyframes pipelinePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(84, 160, 255, 0.2); }
  50% { box-shadow: 0 0 0 8px rgba(84, 160, 255, 0); }
}

/* ── Terminal ─────────────────────────────────────────── */
.terminal {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  height: 300px;
  overflow-y: auto;
  padding: var(--sp-3) var(--sp-4);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.6;
}

.terminal-line { padding: 1px 0; }
.terminal-time { color: var(--text-tertiary); margin-right: var(--sp-2); }
.terminal-info { color: var(--accent); }
.terminal-success { color: var(--green); }
.terminal-warn { color: var(--amber); }
.terminal-error { color: var(--red); }

/* ── Toast Notifications ──────────────────────────────── */
#toast-container {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-4);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  font-size: 0.8125rem;
  animation: toastIn var(--dur-normal) var(--ease);
  pointer-events: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.warn { border-left: 3px solid var(--amber); }
.toast.info { border-left: 3px solid var(--accent); }

.toast.removing {
  opacity: 0;
  transform: translateX(16px);
  transition: all var(--dur-fast) var(--ease);
}

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

/* ── Loading ───────────────────────────────────────────── */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: var(--sp-4);
  color: #fff;
  background: #dc2626;
  font-size: 1.5rem;
  font-weight: 700;
}

.loading-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(8, 9, 12, 0.88);
  gap: var(--sp-4);
}

.skeleton {
  background: var(--bg-3);
  border-radius: var(--r-sm);
  animation: shimmer 1.5s infinite;
}

.skeleton-text { height: 12px; }
.skeleton-text.short { width: 60px; }
.skeleton-text.medium { width: 120px; }
.skeleton-text.long { width: 200px; }

@keyframes shimmer {
  0% { opacity: 0.4; }
  50% { opacity: 0.7; }
  100% { opacity: 0.4; }
}

/* ── Empty State ──────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-10) var(--sp-6);
  text-align: center;
}

.empty-icon {
  font-size: 2rem;
  margin-bottom: var(--sp-3);
  opacity: 0.5;
}

.empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--sp-1);
}

.empty-desc {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  max-width: 320px;
}

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

/* ── Overlay / Modal ───────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(8, 9, 12, 0.92);
  overflow-y: auto;
  padding: var(--sp-6);
  animation: fadeIn var(--dur-fast) var(--ease);
}

.overlay-content {
  max-width: 900px;
  margin: 0 auto;
}

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

/* ── Signal Feed Items ────────────────────────────────── */
.signal-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8125rem;
  transition: background var(--dur-fast) var(--ease);
}

.signal-item:hover { background: var(--bg-hover); }
.signal-item:last-child { border-bottom: none; }

.signal-direction {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  flex-shrink: 0;
}

.signal-direction.buy { background: var(--green-dim); color: var(--green); }
.signal-direction.sell { background: var(--red-dim); color: var(--red); }

.signal-symbol {
  font-family: var(--font-mono);
  font-weight: 700;
  min-width: 60px;
}

.signal-meta { color: var(--text-secondary); font-family: var(--font-mono); font-size: 0.75rem; }

/* ── Heartbeat freshness ──────────────────────────────── */
.heartbeat-fresh { color: var(--green); }
.heartbeat-warm { color: var(--amber); }
.heartbeat-stale { color: var(--red); }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  html { font-size: 13px; }
  .topbar { padding: 0 var(--sp-3); }
  .topbar-nav { display: none; }
  .main-content { padding: var(--sp-4); }
  .data-grid-2, .data-grid-3, .data-grid-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: repeat(2, 1fr); }
}
