/* ============================================================
   algo-chartink-trigger · Design System
   Notion-inspired: clean, minimal, white, utilitarian.
   All styling flows through CSS custom properties.
   NO inline styles anywhere in templates.
   ============================================================ */

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  /* Colors */
  --color-bg: #0b0e14;
  --color-bg-subtle: #131722;
  --color-bg-hover: #1e222d;
  --color-surface: #131722;
  --color-border: #2a2e39;
  --color-border-dark: #363c4e;

  --color-text: #ffffff;
  /* Pure white for primary values */
  --color-text-muted: #a0aabf;
  /* Enhanced contrast for secondary text */
  --color-text-faint: #727885;
  /* Clearly visible even if faint */

  --color-accent: #2962ff;
  /* primary action blue */
  --color-accent-hover: #1e4bd8;
  --color-accent-text: #ffffff;

  --color-danger: #f23645;
  --color-danger-hover: #d21a28;
  --color-success: #089981;
  --color-warning: #ff9800;

  --color-badge-bg: #1e222d;
  --color-badge-text: #8b93a6;

  /* Typography */
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'DM Mono', 'Courier New', monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;

  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;

  --leading-tight: 1.25;
  --leading-normal: 1.6;

  /* Spacing — 4-pt base grid */
  --space-1: 0.125rem;
  --space-2: 0.25rem;
  --space-3: 0.5rem;
  --space-4: 0.75rem;
  --space-5: 1rem;
  --space-6: 1.25rem;
  --space-7: 1.5rem;
  --space-8: 1.75rem;
  --space-10: 2rem;
  --space-12: 2.5rem;
  --space-16: 3rem;
  --space-20: 4rem;
  --space-24: 5rem;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  /* Shadow */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, .12);

  /* Layout */
  --sidebar-width: 220px;
  --content-max: 760px;

  /* Transitions */
  --transition: 140ms ease;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-dark) var(--color-bg);
}

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

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border-dark);
  border-radius: 4px;
}

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
}

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

a:hover {
  text-decoration: underline;
}

img,
svg {
  display: block;
}

/* ── Typography ──────────────────────────────────────────── */
h1,
h2,
h3,
h4 {
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  color: var(--color-text);
}

h1 {
  font-size: var(--text-3xl);
}

h2 {
  font-size: var(--text-2xl);
}

h3 {
  font-size: var(--text-xl);
}

h4 {
  font-size: var(--text-lg);
}

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

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

.text-faint {
  color: var(--color-text-faint);
  font-size: var(--text-sm);
}

.text-sm {
  font-size: var(--text-sm);
}

.text-xs {
  font-size: var(--text-xs);
}

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

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

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  border-right: 1px solid var(--color-border);
  background: rgba(19, 23, 34, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  padding: var(--space-4) 0;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.sidebar-logo svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-section {
  padding: var(--space-1) var(--space-3);
  margin-bottom: var(--space-2);
}

.sidebar-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--space-1) var(--space-2);
  margin-bottom: var(--space-1);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
  cursor: pointer;
}

.sidebar-link:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
  text-decoration: none;
}

.sidebar-link.active {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

.sidebar-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
}

.sidebar-link.active svg,
.sidebar-link:hover svg {
  opacity: 1;
}

.sidebar-footer {
  margin-top: auto;
  padding: var(--space-3) var(--space-3);
  border-top: 1px solid var(--color-border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.sidebar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* ── Main content area ───────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.page {
  flex: 1;
  padding: var(--space-6) var(--space-8);
  max-width: 100%;
}

.page-header {
  margin-bottom: var(--space-6);
}

.page-header h1 {
  margin-bottom: var(--space-2);
}

/* ── Auth pages (centered, no sidebar) ──────────────────── */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-subtle);
}

.auth-card {
  background: rgba(19, 23, 34, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-10) var(--space-12);
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.auth-card h2 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-2);
}

.auth-card .auth-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-8);
}

.auth-footer {
  margin-top: var(--space-6);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ── Form elements ───────────────────────────────────────── */
.form-group {
  margin-bottom: var(--space-4);
}

.form-group:last-of-type {
  margin-bottom: 0;
}

label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-1);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(41, 98, 255, .25);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-faint);
}

input[type="number"] {
  font-family: var(--font-mono);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23787774' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-8);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

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

/* Primary */
.btn-primary {
  background: var(--color-accent);
  color: var(--color-accent-text);
  border-color: var(--color-accent);
  box-shadow: 0 4px 14px 0 rgba(41, 98, 255, 0.39);
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  text-decoration: none;
  color: var(--color-accent-text);
}

/* Secondary (outlined) */
.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border-dark);
}

.btn-secondary:hover {
  background: var(--color-bg-hover);
  text-decoration: none;
  color: var(--color-text);
}

/* Ghost (text-only feel) */
.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}

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

/* Danger */
.btn-danger {
  background: transparent;
  color: var(--color-danger);
  border-color: var(--color-danger);
}

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

/* Full width */
.btn-full {
  width: 100%;
}

/* Sizes */
.btn-sm {
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-3);
}

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-6) 0;
  color: var(--color-text-faint);
  font-size: var(--text-xs);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

thead {
  background: rgba(25, 29, 43, 0.6);
  border-bottom: 1px solid var(--color-border);
}

th {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  white-space: nowrap;
}

td {
  padding: var(--space-2) var(--space-3);
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

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

tbody tr:hover {
  background: var(--color-bg-subtle);
}

/* ── Badge ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: 4px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  background: var(--color-badge-bg);
  color: var(--color-badge-text);
  white-space: nowrap;
}

.badge-green {
  background: rgba(8, 153, 129, 0.15);
  color: var(--color-success);
}

.badge-red {
  background: rgba(242, 54, 69, 0.15);
  color: var(--color-danger);
}

.badge-blue {
  background: rgba(41, 98, 255, 0.15);
  color: var(--color-accent);
}

.badge-yellow {
  background: rgba(255, 152, 0, 0.15);
  color: var(--color-warning);
}

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: rgba(19, 23, 34, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

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

.card-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}

/* ── Alerts / flash messages ─────────────────────────────── */
.flash {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-5);
  border: 1px solid transparent;
}

.flash-success {
  background: rgba(8, 153, 129, 0.1);
  color: #10b981;
  border-color: rgba(8, 153, 129, 0.3);
}

.flash-error {
  background: rgba(242, 54, 69, 0.1);
  color: #ef4444;
  border-color: rgba(242, 54, 69, 0.3);
}

.flash-info {
  background: rgba(41, 98, 255, 0.1);
  color: #3b82f6;
  border-color: rgba(41, 98, 255, 0.3);
}

/* ── Webhook URL display ─────────────────────────────────── */
.webhook-url {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  overflow: hidden;
}

.webhook-url-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--color-text-faint);
}

.empty-state h3 {
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-8);
  border-bottom: 1px solid var(--color-border);
  background: rgba(11, 14, 20, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  min-height: 44px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ── Stat row ────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

@media (max-width: 1200px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  background: rgba(19, 23, 34, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
  transition: transform var(--transition), box-shadow var(--transition);
  min-width: 0; /* Allow card to shrink below content size */
  overflow: hidden; /* Prevent overflow */
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.stat-card .stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  /* Brighter label color */
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2);
}

.stat-card .stat-value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  font-family: var(--font-mono);
  color: var(--color-text);
  line-height: 1.2;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-all;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Smaller font for very large numbers */
.stat-card .stat-value.text-2xl {
  font-size: clamp(var(--text-lg), 2.5vw, var(--text-2xl));
}

/* ── Settings page ───────────────────────────────────────── */
.settings-section {
  margin-bottom: var(--space-6);
}

.settings-section h3 {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-6);
}

/* ── Broker credential item ──────────────────────────────── */
.credential-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-border);
}

.credential-item:last-child {
  border-bottom: none;
}

.credential-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.credential-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
}

.credential-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

/* ── Utility ─────────────────────────────────────────────── */
/* Layout & Display */
.flex {
  display: flex;
}

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

.flex-row {
  display: flex;
  flex-direction: row;
}

.flex-1 {
  flex: 1;
}

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

.flex-wrap {
  flex-wrap: wrap;
}

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

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

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

.justify-center {
  justify-content: center;
}

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

.justify-end {
  justify-content: flex-end;
}

.justify-start {
  justify-content: flex-start;
}

.grid {
  display: grid;
}

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

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-cols-2-1 {
  grid-template-columns: 2fr 1fr;
}

.h-full {
  height: 100%;
}

.w-full {
  width: 100%;
}

.w-auto {
  width: auto;
}

.max-w-500 {
  max-width: 500px;
}

.max-w-600 {
  max-width: 600px;
}

.cursor-pointer {
  cursor: pointer;
}

.cursor-not-allowed {
  cursor: not-allowed;
}

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

.max-w-500 {
  max-width: 500px;
}

.max-w-600 {
  max-width: 600px;
}

/* Gaps (Tightened for density) */
.gap-1 {
  gap: var(--space-1);
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.gap-5 {
  gap: var(--space-5);
}

.gap-6 {
  gap: var(--space-6);
}

.gap-8 {
  gap: var(--space-8);
}

/* Spacing - Margin */
.m-0 {
  margin: 0;
}

.mt-0 {
  margin-top: 0;
}

.mt-1 {
  margin-top: var(--space-1);
}

.mt-2 {
  margin-top: var(--space-2);
}

.mt-3 {
  margin-top: var(--space-3);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mt-5 {
  margin-top: var(--space-5);
}

.mt-6 {
  margin-top: var(--space-6);
}

.mt-8 {
  margin-top: var(--space-8);
}

.mt-10 {
  margin-top: var(--space-10);
}

.mb-0 {
  margin-bottom: 0;
}

.mb-1 {
  margin-bottom: var(--space-1);
}

.mb-2 {
  margin-bottom: var(--space-2);
}

.mb-3 {
  margin-bottom: var(--space-3);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.mb-5 {
  margin-bottom: var(--space-5);
}

.mb-6 {
  margin-bottom: var(--space-6);
}

.mb-8 {
  margin-bottom: var(--space-8);
}

.ml-auto {
  margin-left: auto;
}

.mr-auto {
  margin-right: auto;
}

/* Spacing - Padding */
.p-0 {
  padding: 0;
}

.p-1 {
  padding: var(--space-1);
}

.p-2 {
  padding: var(--space-2);
}

.p-3 {
  padding: var(--space-3);
}

.p-4 {
  padding: var(--space-4);
}

.px-8 {
  padding-left: var(--space-8);
  padding-right: var(--space-8);
}

.px-12 {
  padding-left: var(--space-12);
  padding-right: var(--space-12);
}

.px-16 {
  padding-left: var(--space-16);
  padding-right: var(--space-16);
}

/* Typography & Colors */
.text-white {
  color: #ffffff !important;
}

.text-tiny {
  font-size: 10px;
}

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

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

.text-warning {
  color: var(--color-warning) !important;
}

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

.font-normal {
  font-weight: var(--weight-normal);
}

.font-medium {
  font-weight: var(--weight-medium);
}

.font-semibold {
  font-weight: var(--weight-semibold);
}

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

/* Pulse Indicator */
.pulse-live {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  margin-right: var(--space-2);
  vertical-align: middle;
  box-shadow: 0 0 0 0 rgba(8, 153, 129, 0.4);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(8, 153, 129, 0.7);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(8, 153, 129, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(8, 153, 129, 0);
  }
}

/* ── Spinner ─────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s linear infinite;
}

.spinner-hidden {
  display: none;
}

.flash-wrap {
  padding-left: var(--space-8);
  padding-right: var(--space-8);
}

.flash-inline {
  margin-top: var(--space-3);
}

.dashboard-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
}

.dashboard-status {
  white-space: nowrap;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.dashboard-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.metric-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.section-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

.broker-fields {
  margin-top: var(--space-6);
}

.is-hidden {
  display: none;
}

.broker-fields-visible {
  display: block;
}

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

/* ── btn-xs ──────────────────────────────────────────────── */
.btn-xs {
  font-size: 11px;
  padding: 2px var(--space-2);
}

/* ── ml-2 ────────────────────────────────────────────────── */
.ml-2 {
  margin-left: var(--space-2);
}

/* ── text-right ──────────────────────────────────────────── */
.text-right {
  text-align: right;
}

/* ── Feed pill (topbar) ──────────────────────────────────── */
.feed-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  border: 1px solid var(--color-border-dark);
  background: var(--color-bg-subtle);
  color: var(--color-text-faint);
  white-space: nowrap;
}

.feed-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-text-faint);
  flex-shrink: 0;
}

.feed-live .feed-dot {
  background: var(--color-success);
  box-shadow: 0 0 0 0 rgba(8, 153, 129, 0.4);
  animation: pulse 2s infinite;
}
.feed-live { color: var(--color-success); border-color: rgba(8,153,129,0.3); }

.feed-stale .feed-dot { background: var(--color-warning); }
.feed-stale { color: var(--color-warning); border-color: rgba(255,152,0,0.3); }

.feed-offline .feed-dot { background: var(--color-danger); }
.feed-offline { color: var(--color-danger); border-color: rgba(242,54,69,0.3); }

/* ── KPI bar ─────────────────────────────────────────────── */
.kpi-bar {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-6);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.kpi-group {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.kpi-divider {
  width: 1px;
  height: 36px;
  background: var(--color-border-dark);
  flex-shrink: 0;
}

.kpi-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kpi-label {
  font-size: 10px;
  font-weight: var(--weight-semibold);
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.kpi-value {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  font-family: var(--font-mono);
  color: var(--color-text);
  line-height: 1.2;
  white-space: nowrap;
}

.kpi-indices {
  gap: var(--space-5);
}

.kpi-index {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kpi-index-val {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  line-height: 1.2;
}

/* ── Positions card ──────────────────────────────────────── */
.positions-card {
  margin-bottom: var(--space-5);
  padding: 0;
}

.positions-card .card-header {
  padding: var(--space-4) var(--space-5);
  margin-bottom: 0;
  border-bottom: 1px solid var(--color-border);
}

.positions-card .table-wrap {
  border: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Bottom grid: exits + algo perf ─────────────────────── */
.dash-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

/* ── Exit list ───────────────────────────────────────────── */
.exits-list {
  display: flex;
  flex-direction: column;
}

.exit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.exit-row:last-child {
  border-bottom: none;
}

.exit-meta {
  font-size: 11px;
  display: block;
  margin-top: 1px;
}

.exit-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.exit-time {
  font-size: 11px;
}

/* ── Alert stock rows ────────────────────────────────────── */
.alert-stock-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  line-height: 1.6;
}

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  max-width: 320px;
}

.toast-show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  background: rgba(8, 153, 129, 0.15);
  border: 1px solid rgba(8, 153, 129, 0.4);
  color: #10d4b0;
}

.toast-error {
  background: rgba(242, 54, 69, 0.15);
  border: 1px solid rgba(242, 54, 69, 0.4);
  color: #f87171;
}

/* ── Mobile Responsiveness ───────────────────────────────── */
@media (max-width: 768px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    min-height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-2) 0;
  }

  .sidebar-section {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: center;
    padding: var(--space-2);
  }

  .sidebar-label {
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  .topbar {
    padding: var(--space-3) var(--space-4);
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
  }

  .page {
    max-width: 100%;
    /* Modified based on instruction */
    padding: var(--space-6) var(--space-4);
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

  .flash-wrap {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .kpi-bar {
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
  }

  .kpi-divider { display: none; }

  .dash-bottom {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
}

/* ============================================================
   2026 Redesign Layer (frontend-design skill inspired)
   Direction: editorial trading desk with cinematic contrast.
   Functionality unchanged; visual system overridden only.
   ============================================================ */

:root {
  --color-bg: #090d15;
  --color-bg-subtle: #111726;
  --color-bg-hover: #192136;
  --color-surface: #10182a;
  --color-border: #2b3a59;
  --color-border-dark: #3d5077;

  --color-text: #f5f8ff;
  --color-text-muted: #b6c2da;
  --color-text-faint: #7f8cac;

  --color-accent: #35d6c8;
  --color-accent-hover: #1cc1b3;
  --color-accent-text: #041313;

  --color-danger: #ff5476;
  --color-danger-hover: #e2385d;
  --color-success: #49e5b4;
  --color-warning: #ffbf4f;

  --color-badge-bg: rgba(117, 137, 183, 0.15);
  --color-badge-text: #d1dbef;

  --font-sans: 'Source Sans 3', 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
  --font-display: 'Chakra Petch', 'Source Sans 3', sans-serif;

  --radius-sm: 7px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 8px 20px rgba(4, 9, 18, 0.22);
  --shadow-md: 0 16px 40px rgba(4, 9, 18, 0.35);
  --shadow-lg: 0 26px 52px rgba(4, 9, 18, 0.42);

  --sidebar-width: 252px;
  --transition: 180ms cubic-bezier(0.22, 0.8, 0.32, 1);
}

html,
body {
  min-height: 100%;
}

body {
  position: relative;
  font-family: var(--font-sans);
  color: var(--color-text);
  background:
    radial-gradient(1200px 540px at -10% -20%, rgba(76, 100, 156, 0.22), transparent 62%),
    radial-gradient(800px 420px at 110% 6%, rgba(53, 214, 200, 0.16), transparent 58%),
    linear-gradient(160deg, #090d15 0%, #0d1424 44%, #0f182d 100%);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 52px 52px;
  opacity: 0.33;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.11) 0.7px, transparent 0.7px);
  background-size: 3px 3px;
  opacity: 0.04;
  z-index: 0;
}

.app-shell,
.auth-shell {
  position: relative;
  z-index: 1;
}

h1,
h2,
h3,
h4,
.card-title,
.topbar-title,
.sidebar-logo,
.sidebar-label {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

h1 {
  font-size: clamp(1.9rem, 2.2vw, 2.5rem);
  letter-spacing: 0.03em;
}

a {
  color: #88f3e8;
}

a:hover {
  color: #c6fff8;
}

/* App shell */
.app-shell {
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background:
    linear-gradient(190deg, rgba(13, 20, 34, 0.98) 0%, rgba(13, 22, 37, 0.93) 46%, rgba(10, 18, 31, 0.98) 100%);
  border-right: 1px solid rgba(87, 113, 164, 0.42);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03), 18px 0 30px rgba(4, 9, 18, 0.3);
}

.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(0deg, transparent 0%, rgba(53, 214, 200, 0.07) 100%);
}

.sidebar-logo {
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #d9e6ff;
}

.sidebar-section {
  padding: var(--space-2) var(--space-4);
}

.sidebar-label {
  color: #8295be;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
}

.sidebar-link {
  border: 1px solid transparent;
  margin-bottom: 6px;
  color: #b9c7e2;
  border-radius: 12px;
  padding: 10px 11px;
}

.sidebar-link:hover {
  color: #eff5ff;
  border-color: rgba(101, 124, 170, 0.48);
  background: rgba(38, 54, 86, 0.44);
  transform: translateX(3px);
}

.sidebar-link.active {
  color: #f7feff;
  background: linear-gradient(92deg, rgba(53, 214, 200, 0.27) 0%, rgba(49, 118, 178, 0.34) 100%);
  border-color: rgba(114, 223, 212, 0.5);
  box-shadow: 0 8px 20px rgba(10, 24, 38, 0.35);
}

.sidebar-link svg {
  opacity: 0.82;
}

.sidebar-footer {
  border-top: 1px solid rgba(93, 116, 163, 0.35);
  background: rgba(8, 14, 24, 0.5);
}

.sidebar-avatar {
  background: linear-gradient(130deg, rgba(53, 214, 200, 0.34), rgba(84, 118, 186, 0.64));
  border: 1px solid rgba(117, 204, 195, 0.54);
  color: #e7feff;
}

/* Main + topbar */
.main {
  background: transparent;
}

.topbar {
  min-height: 56px;
  padding: var(--space-3) var(--space-8);
  border-bottom: 1px solid rgba(90, 113, 158, 0.42);
  background: linear-gradient(180deg, rgba(12, 20, 35, 0.86), rgba(12, 20, 35, 0.56));
  backdrop-filter: blur(10px);
}

.topbar-title {
  color: #f3f7ff;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.page {
  padding: var(--space-8);
}

.page-header {
  margin-bottom: var(--space-7);
}

.page-header p {
  color: #aebddc;
  max-width: 760px;
}

/* Flash */
.flash-wrap {
  padding-left: var(--space-8);
  padding-right: var(--space-8);
}

.flash {
  border-radius: 12px;
  border-width: 1px;
  box-shadow: var(--shadow-sm);
}

.flash-success {
  background: rgba(73, 229, 180, 0.12);
  border-color: rgba(73, 229, 180, 0.34);
  color: #90ffd9;
}

.flash-error {
  background: rgba(255, 84, 118, 0.12);
  border-color: rgba(255, 84, 118, 0.32);
  color: #ffadc1;
}

.flash-info {
  background: rgba(124, 157, 239, 0.14);
  border-color: rgba(124, 157, 239, 0.36);
  color: #d2deff;
}

/* Cards */
.card,
.table-wrap,
.stat-card,
.auth-card,
.kpi-bar {
  border-radius: var(--radius-lg);
}

.card,
.stat-card,
.kpi-bar,
.auth-card,
.table-wrap {
  background: linear-gradient(150deg, rgba(19, 29, 49, 0.92), rgba(14, 23, 40, 0.9));
  border: 1px solid rgba(86, 111, 159, 0.5);
  box-shadow: var(--shadow-md);
}

.card {
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(112, 166, 255, 0.08), transparent 38%, transparent 62%, rgba(53, 214, 200, 0.08));
}

.card-header {
  margin-bottom: var(--space-5);
}

.card-title {
  font-size: 0.96rem;
  color: #eaf1ff;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Form elements */
label {
  color: #dce7ff;
  font-size: 0.81rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-hint {
  color: #8ea0c4;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  padding: 11px 12px;
  border-radius: 10px;
  background: rgba(10, 17, 31, 0.78);
  border-color: rgba(101, 124, 173, 0.58);
  color: #f2f7ff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(53, 214, 200, 0.88);
  box-shadow: 0 0 0 3px rgba(53, 214, 200, 0.2), 0 12px 26px rgba(7, 17, 33, 0.38);
}

input::placeholder,
textarea::placeholder {
  color: #7b8eaf;
}

/* Buttons */
.btn {
  border-radius: 999px;
  padding: 8px 16px;
  border-width: 1px;
  letter-spacing: 0.03em;
}

.btn-primary {
  background: linear-gradient(95deg, #3ddfd1, #6fa9ff);
  border-color: rgba(184, 246, 239, 0.45);
  color: #071823;
  box-shadow: 0 12px 30px rgba(34, 121, 185, 0.34);
}

.btn-primary:hover {
  color: #071823;
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(34, 121, 185, 0.42);
}

.btn-secondary {
  border-color: rgba(123, 147, 194, 0.54);
  background: rgba(24, 35, 57, 0.62);
  color: #d7e4ff;
}

.btn-secondary:hover {
  background: rgba(36, 53, 84, 0.8);
  color: #f4f8ff;
}

.btn-ghost {
  border-color: rgba(95, 119, 164, 0.35);
  color: #b8c6e3;
}

.btn-ghost:hover {
  background: rgba(33, 48, 75, 0.6);
  border-color: rgba(126, 149, 194, 0.58);
  color: #ecf3ff;
}

.btn-danger {
  color: #ff8ca6;
  border-color: rgba(255, 113, 147, 0.5);
}

.btn-danger:hover {
  background: linear-gradient(110deg, #ff5476, #e74b8e);
  border-color: rgba(255, 170, 190, 0.6);
  color: #fff;
}

/* Tables */
.table-wrap {
  overflow: hidden;
  border-color: rgba(90, 114, 159, 0.52);
}

table {
  font-size: 0.87rem;
}

thead {
  background: linear-gradient(180deg, rgba(24, 36, 59, 0.92), rgba(19, 29, 47, 0.9));
}

th {
  color: #9db0d4;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
}

td {
  border-bottom-color: rgba(77, 98, 140, 0.44);
}

tbody tr {
  transition: background var(--transition), transform var(--transition);
}

tbody tr:hover {
  background: rgba(37, 53, 83, 0.5);
}

/* Badges */
.badge {
  border: 1px solid rgba(117, 136, 178, 0.35);
}

.badge-green {
  background: rgba(73, 229, 180, 0.18);
  color: #9effda;
  border-color: rgba(73, 229, 180, 0.42);
}

.badge-red {
  background: rgba(255, 84, 118, 0.18);
  color: #ffb4c4;
  border-color: rgba(255, 84, 118, 0.45);
}

.badge-blue {
  background: rgba(111, 169, 255, 0.2);
  color: #c0dcff;
  border-color: rgba(111, 169, 255, 0.45);
}

.badge-yellow {
  background: rgba(255, 191, 79, 0.2);
  color: #ffe2a2;
  border-color: rgba(255, 191, 79, 0.46);
}

/* Dashboard-specific */
.feed-pill {
  background: rgba(13, 23, 40, 0.78);
  border-color: rgba(104, 129, 174, 0.55);
}

.kpi-bar {
  gap: var(--space-6);
  padding: var(--space-5) var(--space-6);
}

.kpi-label {
  color: #8fa2c8;
  letter-spacing: 0.09em;
}

.kpi-value,
.kpi-index-val {
  color: #f5f8ff;
}

.kpi-divider {
  background: rgba(116, 138, 180, 0.43);
}

.positions-card .card-header {
  border-bottom-color: rgba(91, 114, 155, 0.45);
}

.exit-row {
  border-bottom-color: rgba(88, 109, 149, 0.4);
}

.toast {
  border-radius: 12px;
}

.toast-success {
  background: rgba(73, 229, 180, 0.16);
  border-color: rgba(73, 229, 180, 0.42);
  color: #9effda;
}

.toast-error {
  background: rgba(255, 84, 118, 0.17);
  border-color: rgba(255, 84, 118, 0.42);
  color: #ffafc0;
}

/* Webhook and settings */
.webhook-url {
  background: rgba(8, 15, 29, 0.88);
  border-color: rgba(94, 118, 163, 0.58);
  border-radius: 12px;
}

.settings-section h3 {
  border-bottom-color: rgba(93, 116, 160, 0.5);
  color: #edf4ff;
}

.credential-item {
  border-bottom-color: rgba(84, 105, 145, 0.44);
}

.empty-state {
  border: 1px dashed rgba(108, 134, 184, 0.48);
  border-radius: 14px;
  background: rgba(14, 22, 37, 0.58);
}

/* Auth pages */
.auth-shell {
  background:
    radial-gradient(800px 360px at 50% -8%, rgba(53, 214, 200, 0.23), transparent 70%),
    linear-gradient(180deg, #09101d 0%, #0e1627 100%);
}

.auth-card {
  max-width: 430px;
  border: 1px solid rgba(101, 126, 175, 0.56);
  box-shadow: 0 24px 60px rgba(4, 9, 18, 0.52);
}

.auth-card h2 {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-subtitle {
  color: #afbedb;
}

/* Entrance motion */
.page,
.auth-card,
.sidebar {
  animation: pageFadeIn 0.55s var(--transition) both;
}

.page-header,
.card,
.table-wrap,
.kpi-bar {
  animation: riseIn 0.45s var(--transition) both;
}

.page-header { animation-delay: 40ms; }
.card:nth-of-type(1),
.table-wrap:nth-of-type(1) { animation-delay: 80ms; }
.card:nth-of-type(2),
.table-wrap:nth-of-type(2) { animation-delay: 130ms; }
.card:nth-of-type(3),
.table-wrap:nth-of-type(3) { animation-delay: 170ms; }

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

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Mobile refinements */
@media (max-width: 900px) {
  .topbar {
    padding: var(--space-3) var(--space-5);
  }

  .page,
  .flash-wrap {
    padding-left: var(--space-5);
    padding-right: var(--space-5);
  }

  .kpi-bar {
    padding: var(--space-4);
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    min-height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid rgba(89, 111, 151, 0.5);
    box-shadow: none;
  }

  .sidebar-section {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .sidebar-link {
    flex-shrink: 0;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .page {
    padding: var(--space-5) var(--space-4);
  }

  .flash-wrap {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .card,
  .table-wrap,
  .kpi-bar,
  .auth-card {
    border-radius: 14px;
  }
}

/* ============================================================
   2026 Brutal Minimal Trader Layer
   Goal: function-first, high-density, rapid scanning/actions.
   ============================================================ */

:root {
  --color-bg: #0a0a0a;
  --color-bg-subtle: #111111;
  --color-bg-hover: #1b1b1b;
  --color-surface: #111111;
  --color-border: #2a2a2a;
  --color-border-dark: #3b3b3b;

  --color-text: #f2f2f2;
  --color-text-muted: #b4b4b4;
  --color-text-faint: #888888;

  --color-accent: #c9ff3f;
  --color-accent-hover: #b6e838;
  --color-accent-text: #0f1207;

  --color-danger: #ff5c5c;
  --color-danger-hover: #f14949;
  --color-success: #6aff8d;
  --color-warning: #ffd05a;

  --color-badge-bg: #1e1e1e;
  --color-badge-text: #d1d1d1;

  --font-sans: 'Source Sans 3', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
  --font-display: 'Chakra Petch', 'Source Sans 3', sans-serif;

  --radius-sm: 3px;
  --radius-md: 4px;
  --radius-lg: 6px;

  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;

  --sidebar-width: 214px;
  --transition: 90ms linear;
}

body {
  font-family: var(--font-sans);
  background: #0a0a0a;
  color: var(--color-text);
}

body::before,
body::after {
  display: none;
}

a {
  color: #d7f88a;
}

a:hover {
  color: #effec4;
}

h1,
h2,
h3,
h4,
.card-title,
.topbar-title,
.sidebar-logo,
.sidebar-label {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

h1 {
  font-size: 1.45rem;
}

/* Sidebar */
.sidebar {
  background: #0d0d0d;
  border-right: 1px solid #232323;
  box-shadow: none;
}

.sidebar::before {
  display: none;
}

.sidebar-logo {
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #f1f1f1;
  padding: 10px 16px;
  margin-bottom: 8px;
}

.sidebar-section {
  padding: 4px 10px;
}

.sidebar-label {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: #787878;
  padding: 3px 5px;
}

.sidebar-link {
  border-radius: 3px;
  border: 1px solid transparent;
  padding: 7px 8px;
  margin-bottom: 4px;
  color: #d0d0d0;
  gap: 8px;
}

.sidebar-link:hover {
  color: #ffffff;
  background: #171717;
  border-color: #2f2f2f;
  transform: none;
}

.sidebar-link.active {
  color: #0d1203;
  background: #c9ff3f;
  border-color: #c9ff3f;
  box-shadow: none;
}

.sidebar-link.active svg,
.sidebar-link:hover svg {
  opacity: 1;
}

.sidebar-footer {
  background: #0d0d0d;
  border-top: 1px solid #232323;
}

.sidebar-avatar {
  background: #1a1a1a;
  border: 1px solid #3a3a3a;
  color: #d8d8d8;
}

/* Main layout */
.main {
  background: #0a0a0a;
}

.topbar {
  min-height: 44px;
  padding: 8px 24px;
  border-bottom: 1px solid #232323;
  background: #0e0e0e;
  backdrop-filter: none;
}

.topbar-title {
  color: #f2f2f2;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.topbar-actions {
  gap: 6px;
}

.page {
  padding: 18px 24px;
}

.page-header {
  margin-bottom: 14px;
}

.page-header p {
  color: #9e9e9e;
  max-width: 900px;
}

/* Core surfaces */
.card,
.table-wrap,
.auth-card,
.stat-card,
.kpi-bar {
  background: #121212;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  box-shadow: none;
}

.card {
  padding: 12px;
}

.card::before {
  display: none;
}

.card-header {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #242424;
}

.card-title {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #d3d3d3;
}

/* Flash + empty */
.flash-wrap {
  padding-left: 24px;
  padding-right: 24px;
}

.flash {
  border-radius: 3px;
  border-width: 1px;
  box-shadow: none;
}

.flash-success {
  background: rgba(106, 255, 141, 0.1);
  border-color: rgba(106, 255, 141, 0.35);
  color: #a4ffbb;
}

.flash-error {
  background: rgba(255, 92, 92, 0.1);
  border-color: rgba(255, 92, 92, 0.35);
  color: #ffb3b3;
}

.flash-info {
  background: rgba(201, 255, 63, 0.09);
  border-color: rgba(201, 255, 63, 0.35);
  color: #ebffb7;
}

.empty-state {
  border: 1px dashed #2f2f2f;
  border-radius: 3px;
  background: #101010;
  text-align: left;
  padding: 16px;
}

.empty-state h3,
.empty-state p {
  color: #9d9d9d;
}

/* Form */
label {
  color: #c8c8c8;
  font-size: 0.69rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  margin-bottom: 4px;
}

.form-hint {
  color: #7f7f7f;
  font-size: 0.72rem;
}

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

.form-row {
  gap: 10px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  background: #0d0d0d;
  border: 1px solid #2f2f2f;
  color: #efefef;
  border-radius: 3px;
  padding: 8px 9px;
  font-size: 0.88rem;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #c9ff3f;
  box-shadow: 0 0 0 1px #c9ff3f;
}

input::placeholder,
textarea::placeholder {
  color: #707070;
}

/* Buttons */
.btn {
  border-radius: 3px;
  border: 1px solid #2f2f2f;
  padding: 6px 10px;
  gap: 5px;
  letter-spacing: 0;
}

.btn-sm {
  font-size: 0.74rem;
  padding: 5px 8px;
}

.btn-xs {
  font-size: 0.7rem;
  padding: 3px 6px;
}

.btn-primary {
  background: #c9ff3f;
  border-color: #c9ff3f;
  color: #111507;
  box-shadow: none;
}

.btn-primary:hover {
  background: #b6e838;
  border-color: #b6e838;
  color: #101507;
  transform: none;
}

.btn-secondary {
  background: #171717;
  border-color: #343434;
  color: #d7d7d7;
}

.btn-secondary:hover {
  background: #1d1d1d;
  color: #ffffff;
}

.btn-ghost {
  background: transparent;
  border-color: #2f2f2f;
  color: #bdbdbd;
}

.btn-ghost:hover {
  background: #171717;
  color: #ffffff;
  border-color: #3c3c3c;
}

.btn-danger {
  background: transparent;
  border-color: #5b2f2f;
  color: #ff8a8a;
}

.btn-danger:hover {
  background: #251212;
  color: #ffb8b8;
  border-color: #734040;
}

/* Table + badges */
.table-wrap {
  border-color: #2b2b2b;
  border-radius: 3px;
}

table {
  font-size: 0.82rem;
}

thead {
  background: #151515;
  border-bottom: 1px solid #2a2a2a;
}

th {
  color: #8e8e8e;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  padding: 8px 9px;
}

td {
  border-bottom: 1px solid #232323;
  color: #f0f0f0;
  padding: 8px 9px;
}

tbody tr:hover {
  background: #171717;
}

.badge {
  border: 1px solid #3a3a3a;
  background: #1b1b1b;
  color: #d0d0d0;
  border-radius: 3px;
}

.badge-green {
  border-color: rgba(106, 255, 141, 0.35);
  background: rgba(106, 255, 141, 0.11);
  color: #9effb3;
}

.badge-red {
  border-color: rgba(255, 92, 92, 0.4);
  background: rgba(255, 92, 92, 0.11);
  color: #ffb1b1;
}

.badge-blue {
  border-color: rgba(201, 255, 63, 0.37);
  background: rgba(201, 255, 63, 0.14);
  color: #eaffb3;
}

.badge-yellow {
  border-color: rgba(255, 208, 90, 0.4);
  background: rgba(255, 208, 90, 0.12);
  color: #ffe3a2;
}

.text-success {
  color: #90ffab !important;
}

.text-danger {
  color: #ff9898 !important;
}

.text-faint {
  color: #8a8a8a;
}

/* Feed + toast */
.feed-pill {
  border-radius: 3px;
  border-color: #3a3a3a;
  background: #151515;
  color: #bcbcbc;
  padding: 4px 8px;
}

.feed-dot {
  width: 6px;
  height: 6px;
}

.feed-live {
  color: #90ffab;
  border-color: rgba(106, 255, 141, 0.35);
}

.feed-live .feed-dot {
  background: #90ffab;
  animation: none;
  box-shadow: none;
}

.feed-stale {
  color: #ffe19a;
  border-color: rgba(255, 208, 90, 0.38);
}

.feed-stale .feed-dot {
  background: #ffd05a;
}

.feed-offline {
  color: #ffb0b0;
  border-color: rgba(255, 92, 92, 0.38);
}

.feed-offline .feed-dot {
  background: #ff7f7f;
}

.toast {
  border-radius: 3px;
  box-shadow: none;
}

/* Auth pages */
.auth-shell {
  background: #0a0a0a;
}

.auth-card {
  max-width: 410px;
  border-radius: 3px;
  padding: 20px;
}

.auth-card h2 {
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-subtitle,
.auth-footer {
  color: #969696;
}

/* Dashboard: trader-first */
.trade-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.trade-kpi {
  background: #121212;
  border: 1px solid #2a2a2a;
  border-radius: 3px;
  padding: 10px;
}

.trade-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #8f8f8f;
  margin-bottom: 4px;
}

.trade-value {
  font-family: var(--font-mono);
  font-size: 1.02rem;
  color: #f4f4f4;
  line-height: 1.15;
}

.trade-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 10px;
}

.trade-layout-bottom {
  margin-top: 0;
}

.trade-main,
.trade-side {
  min-height: 100%;
}

.trade-main .table-wrap {
  border-radius: 3px;
}

.trade-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.side-block {
  padding-bottom: 10px;
  border-bottom: 1px solid #232323;
}

.side-block.mb-0 {
  border-bottom: none;
  padding-bottom: 0;
}

.side-label {
  font-size: 0.63rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #8a8a8a;
  margin-bottom: 6px;
  font-family: var(--font-display);
}

.index-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.index-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px solid #1f1f1f;
  color: #d0d0d0;
}

.index-row:last-child {
  border-bottom: none;
}

.action-stack {
  display: grid;
  gap: 6px;
}

.exits-list {
  display: flex;
  flex-direction: column;
}

.exit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #232323;
}

.exit-row:last-child {
  border-bottom: none;
}

.exit-meta,
.exit-time {
  font-size: 0.72rem;
}

/* Remove decorative animations from prior layers */
.page,
.auth-card,
.sidebar,
.page-header,
.card,
.table-wrap,
.kpi-bar {
  animation: none !important;
}

/* Responsiveness */
@media (max-width: 1200px) {
  .trade-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .trade-layout {
    grid-template-columns: 1fr;
  }

  .trade-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #232323;
    position: static;
    height: auto;
    min-height: auto;
  }

  .sidebar-section {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 8px;
  }

  .sidebar-link {
    flex-shrink: 0;
  }

  .sidebar-label,
  .sidebar-footer {
    display: none;
  }

  .topbar {
    padding: 8px 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .topbar-actions {
    width: 100%;
  }

  .page {
    padding: 12px;
  }

  .flash-wrap {
    padding-left: 12px;
    padding-right: 12px;
  }

  .trade-strip {
    grid-template-columns: 1fr;
  }

  .trade-value {
    font-size: 0.98rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}
