:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --line: #edf2f7;
  --line-focus: #cbd5e1;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-light: #eff6ff;
  --blue-border: #bfdbfe;
  --green: #10b981;
  --green-light: #ecfdf5;
  --green-border: #a7f3d0;
  --red: #ef4444;
  --red-light: #fef2f2;
  --red-border: #fca5a5;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
}

/* Base resets & styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* SIDEBAR - Fixed left layout */
.sidebar {
  width: 280px;
  border-right: 1px solid #e5e7eb;
  background-color: #ffffff;
  padding: 26px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 100;
  box-shadow: 4px 0 30px rgba(0, 0, 0, 0.04);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 12px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--line);
  margin-bottom: 20px;
}

.brandLogo, .brand .logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), #4f46e5);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.brandTitle, .brand .name {
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
  letter-spacing: -0.03em;
}

.brandSub, .brand .sub {
  font-size: 11px;
  color: var(--green);
  font-weight: 700;
  margin-top: 1px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex: 1;
  padding-right: 4px;
}

.nav::-webkit-scrollbar {
  width: 4px;
}

.nav::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

/* Sidebar Section Headers */
.section-title, .nav-section {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin: 18px 12px 6px 12px;
}

/* Sidebar Nav Items */
.nav a, .navItem, .nav-item {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Lucide Inspired Inline SVG Icons styling */
.nav-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.3;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.nav a span:first-child, .navItem span:first-child, .nav-item span:first-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav a:hover, .navItem:hover, .nav-item:hover {
  background-color: var(--bg);
  color: var(--text);
  border-color: var(--line);
  transform: translateX(4px);
}

.nav a.active, .navItem.active, .nav-item.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.25);
  transform: none;
}

.nav a.active .nav-icon, .navItem.active .nav-icon, .nav-item.active .nav-icon {
  stroke: #ffffff;
}

/* Premium System Status Card in Sidebar Footer */
.status-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 20px;
}

.status-header {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--green);
  font-size: 12.5px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-light);
  animation: pulse 2s infinite;
}

.status-message {
  font-size: 11px;
  color: var(--text);
  margin-top: 4px;
  font-weight: 500;
}

.status-host {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* MAIN CONTENT AREA */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-left: 280px;
  min-height: 100vh;
}

/* Topbar Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 40px;
  border-bottom: 1px solid var(--line);
  background-color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 90;
}

.title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

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

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

/* Content wrapper */
.content {
  padding: 40px;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
}

/* Card components */
.card {
  background-color: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--blue), #4f46e5);
  opacity: 0;
  transition: opacity 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(37, 99, 235, 0.15);
}

.card:hover::after {
  opacity: 1;
}

.cardTitle {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

/* Grids */
.grid {
  display: grid;
  gap: 24px;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* Badges & Pills */
.pill {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9999px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background-color: var(--bg);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pill.green {
  background-color: var(--green-light);
  border-color: var(--green-border);
  color: var(--green);
}

.pill.red {
  background-color: var(--red-light);
  border-color: var(--red-border);
  color: var(--red);
}

.pill.blue {
  background-color: var(--blue-light);
  border-color: var(--blue-border);
  color: var(--blue);
}

/* Buttons */
.btn {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--blue), #1d4ed8);
  color: #ffffff;
  font-weight: 600;
  font-size: 13px;
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.1);
}

.btn:hover {
  background: linear-gradient(135deg, var(--blue-hover), #172554);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.2);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.secondary {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.btn.secondary:hover {
  background: var(--bg);
  border-color: var(--line-focus);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

/* Form Inputs */
input, .input {
  background: #ffffff;
  border: 1px solid var(--line-focus);
  border-radius: var(--radius);
  padding: 11px 16px;
  color: var(--text);
  width: 100%;
  font-size: 13.5px;
  outline: none;
  transition: all .2s;
}

input::placeholder {
  color: #a0aec0;
}

input:focus, .input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

/* Table styling */
.tableWrap {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background-color: #ffffff;
  box-shadow: var(--shadow-sm);
  margin-top: 16px;
}

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

th, td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--text-muted);
  font-weight: 700;
  background-color: var(--bg);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

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

tr:hover td {
  background-color: rgba(37, 99, 235, 0.015);
}

/* Raw code viewer */
.preBox {
  max-height: 420px;
  overflow: auto;
  padding: 20px;
  border-radius: var(--radius);
  background: #0f172a;
  border: 1px solid var(--text);
  color: #f1f5f9;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  line-height: 1.6;
}

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

.preBox::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

/* AUTH PAGES (Login / Register) */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 10% 20%, rgba(239, 246, 255, 0.8) 0%, rgba(255, 255, 255, 1) 90%);
  padding: 24px;
}

.auth-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.06);
  border-top: 4px solid var(--blue);
}

.auth-head {
  text-align: center;
  margin-bottom: 30px;
}

.auth-logo {
  font-size: 30px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--blue), #4f46e5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.04em;
}

.auth-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
  font-weight: 500;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: -10px;
}

.auth-input {
  background: #ffffff;
  border: 1px solid var(--line-focus);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: all .2s;
}

.auth-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.auth-btn {
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 14px;
  background: linear-gradient(135deg, var(--blue), #1d4ed8);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.15);
}

.auth-btn:hover {
  background: linear-gradient(135deg, var(--blue-hover), #172554);
  box-shadow: 0 6px 12px rgba(37, 99, 235, 0.25);
  transform: translateY(-1px);
}

.auth-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  align-items: center;
}

.auth-row.small {
  margin-top: -6px;
  justify-content: center;
}

.auth-link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s ease;
}

.auth-link:hover {
  color: var(--blue-hover);
  text-decoration: underline;
}

/* Auth specific notification alert boxes */
.auth-error-box {
  background-color: var(--red-light);
  border: 1px solid var(--red-border);
  color: var(--red);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-success-box {
  background-color: var(--green-light);
  border: 1px solid var(--green-border);
  color: var(--green);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─────────────────────────────────────────────
   Phase 9 — Positions / TP-SL Panel
───────────────────────────────────────────── */
.positions-panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(15,23,42,0.05), 0 0 0 1px rgba(15,23,42,0.03);
  overflow: hidden;
  margin-bottom: 32px;
}

.positions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f1f5f9;
  flex-wrap: wrap;
  gap: 12px;
}

.positions-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.positions-title h3 {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.positions-title .pos-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2563eb;
  font-size: 15px;
}

.positions-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #64748b;
}

.pos-count-badge {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
}

.positions-table-wrap {
  overflow-x: auto;
  min-height: 80px;
}

.positions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.positions-table thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
}

.positions-table thead th:last-child { text-align: center; }

.positions-table tbody tr {
  border-bottom: 1px solid #f8fafc;
  transition: background 0.13s;
}

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

.positions-table tbody tr:hover {
  background: #f8fafc;
}

.positions-table td {
  padding: 13px 16px;
  color: #1e293b;
  font-size: 13px;
  white-space: nowrap;
  vertical-align: middle;
}

.pos-coin {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pos-coin-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
}

.pos-sym { font-weight: 700; color: #0f172a; }
.pos-pair { font-size: 11px; color: #94a3b8; }

.pos-num {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12.5px;
  color: #334155;
}

.pnl-pos { color: #059669; font-weight: 700; }
.pnl-neg { color: #dc2626; font-weight: 700; }
.pnl-flat { color: #64748b; font-weight: 600; }

.pos-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.pos-status-open {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.pos-status-closing {
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #fed7aa;
  animation: pos-pulse 1.5s ease-in-out infinite;
}

.pos-status-closed {
  background: #f8fafc;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
}

@keyframes pos-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.65; }
}

.positions-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: #94a3b8;
  gap: 10px;
}

.positions-empty .empty-icon {
  font-size: 32px;
  opacity: 0.4;
}

.positions-empty p {
  font-size: 13.5px;
  font-weight: 500;
}

.positions-footer {
  padding: 10px 24px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: #94a3b8;
  background: #fafbfc;
}

.pos-refresh-ts {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

.pos-open-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  margin-right: 4px;
  animation: pos-dot-blink 2s ease-in-out infinite;
}

@keyframes pos-dot-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ═══════════════════════════════════════════════════
   Phase 10 — Premium Dashboard CSS
═══════════════════════════════════════════════════ */

/* ── KPI Row ── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 1100px) { .kpi-row { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 600px)  { .kpi-row { grid-template-columns: 1fr; } }

.kpi-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px 22px 18px;
  box-shadow: 0 1px 4px rgba(15,23,42,.04);
  transition: box-shadow .15s, transform .15s;
  cursor: default;
}
.kpi-card:hover {
  box-shadow: 0 4px 14px rgba(15,23,42,.08);
  transform: translateY(-1px);
}
.kpi-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #94a3b8;
  margin-bottom: 10px;
}
.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -.03em;
  line-height: 1;
  margin-bottom: 8px;
  transition: color .25s;
}
.kpi-sub { font-size: 12px; }
.kpi-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.kpi-chip.neutral { background:#f1f5f9; color:#64748b; }
.kpi-chip.green   { background:#ecfdf5; color:#059669; }
.kpi-chip.red     { background:#fef2f2; color:#dc2626; }
.kpi-chip.blue    { background:#eff6ff; color:#2563eb; }

/* ── Main grid (positions + activity) ── */
.dash-grid-main {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 1000px) { .dash-grid-main { grid-template-columns: 1fr; } }

/* ── Stats grid (win rate + profit factor + risk) ── */
.dash-grid-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 1000px) { .dash-grid-stats { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px)  { .dash-grid-stats { grid-template-columns: 1fr; } }

/* ── Generic dash-card ── */
.dash-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 1px 4px rgba(15,23,42,.04);
  overflow: hidden;
}
.dash-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #f8fafc;
  flex-wrap: wrap;
  gap: 8px;
}
.dash-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dash-card-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -.01em;
}
.dash-card-route {
  font-size: 10.5px;
  color: #94a3b8;
  margin-top: 1px;
}
.dash-card-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.blue-icon   { background: #eff6ff; color: #2563eb; }
.purple-icon { background: #f5f3ff; color: #7c3aed; }
.gold-icon   { background: #fefce8; color: #ca8a04; }
.green-icon  { background: #ecfdf5; color: #059669; }
.red-icon    { background: #fef2f2; color: #dc2626; }

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #059669;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  padding: 2px 9px;
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  animation: pos-dot-blink 2s ease-in-out infinite;
}

/* ── Dash empty state ── */
.dash-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  color: #94a3b8;
  gap: 6px;
}
.dash-empty-icon { font-size: 28px; opacity: .4; }
.dash-empty-text { font-size: 13px; font-weight: 600; }
.dash-empty-hint { font-size: 11.5px; }

/* ── Positions table headers ── */
.pthead {
  padding: 9px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #94a3b8;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
}

/* ── Risk badges ── */
.risk-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
}
.risk-low  { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.risk-med  { background: #fff7ed; color: #ea580c; border: 1px solid #fed7aa; }
.risk-high { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }

/* ── Activity feed ── */
.activity-feed {
  padding: 6px 0;
  overflow-y: auto;
  max-height: 360px;
}
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 18px;
  border-bottom: 1px solid #f8fafc;
  transition: background .12s;
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: #f8fafc; }
.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.activity-body { flex: 1; min-width: 0; }
.activity-row1 {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}
.activity-sym {
  font-weight: 700;
  font-size: 12.5px;
  color: #0f172a;
}
.activity-ago {
  font-size: 10.5px;
  color: #94a3b8;
  margin-left: auto;
  white-space: nowrap;
}
.activity-row2 {
  font-size: 11.5px;
  color: #64748b;
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  align-items: center;
  gap: 4px;
}
.activity-sep { color: #cbd5e1; }

/* ── Stat cards (win rate, profit factor) ── */
.stat-card { padding-bottom: 18px; }
.stat-big-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 18px 6px;
}
.stat-donut-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  flex-shrink: 0;
}
.stat-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.02em;
  pointer-events: none;
}
.stat-detail { flex: 1; }
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid #f8fafc;
}
.stat-row:last-child { border-bottom: none; }
.stat-lbl { font-size: 12px; color: #64748b; }
.stat-val  { font-size: 13px; font-weight: 700; color: #0f172a; }
.stat-val.green { color: #059669; }
.stat-val.red   { color: #dc2626; }

/* ── Profit Factor ── */
.pf-wrap { padding: 14px 18px 8px; }
.pf-big {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -.04em;
  margin-bottom: 12px;
  transition: color .25s;
}
.pf-bar-wrap { margin-bottom: 10px; }
.pf-bar-track {
  height: 6px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 4px;
}
.pf-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .5s ease, background .25s;
}
.pf-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #94a3b8;
}
.pf-legend { display: flex; flex-direction: column; gap: 5px; }
.pf-leg-item { font-size: 11.5px; color: #64748b; display: flex; align-items: center; gap: 5px; }
.pf-dot { width: 8px; height: 8px; border-radius: 50%; }
.pf-dot.green { background: #22c55e; }
.pf-dot.red   { background: #ef4444; }

/* ── Risk & Bot controls ── */
.ctrl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ctrl-label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}
.ctrl-status {
  font-size: 12px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 8px;
}
.ctrl-btn {
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  white-space: nowrap;
}
.ctrl-btn:hover { opacity: .88; transform: translateY(-1px); }
.ctrl-btn:active { transform: translateY(0); }
.green-btn { background: #059669; color: #fff; }
.red-btn   { background: #ef4444; color: #fff; }
.blue-btn  { background: #2563eb; color: #fff; }
.ghost-btn { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }

.risk-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.risk-pair { display: flex; flex-direction: column; gap: 3px; }
.risk-lbl  { font-size: 10px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: .05em; }
.risk-inp  {
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  font-size: 12px;
  color: #0f172a;
  background: #f8fafc;
  outline: none;
  transition: border-color .15s;
}
.risk-inp:focus { border-color: #2563eb; background: #fff; }

/* ── Equity chart filter buttons ── */
.eq-filter {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
}
.eq-filter:hover { border-color: #2563eb; color: #2563eb; }
.eq-filter.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

/* ── Stat card inner padding ── */
.stat-card .dash-card-head { padding: 14px 18px 10px; }

/* ═══════════════════════════════════════════════════
   Phase 11 — Dashboard Tabs
═══════════════════════════════════════════════════ */

/* ── Tab bar wrapper ── */
.dashboard-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 5px 6px;
  margin-bottom: 22px;
  box-shadow: 0 1px 4px rgba(15,23,42,.04);
  flex-wrap: wrap;
}

/* ── Individual tab button ── */
.dashboard-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
  font-family: inherit;
}
.dashboard-tab:hover {
  background: #f1f5f9;
  color: #334155;
}
.dashboard-tab svg { flex-shrink: 0; }

/* ── Active tab ── */
.dashboard-tab.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37,99,235,.25);
}
.dashboard-tab.active:hover {
  background: #1d4ed8;
  color: #ffffff;
}

/* ── Tab panel (content area) ── */
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
  animation: tabFadeIn .18s ease;
}
@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Tab count badge ── */
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(255,255,255,.25);
  color: inherit;
  line-height: 1;
}
.dashboard-tab:not(.active) .tab-badge {
  background: #e2e8f0;
  color: #64748b;
}

/* ── Responsive tabs ── */
@media (max-width: 700px) {
  .dashboard-tab { padding: 7px 10px; font-size: 12px; }
  .dashboard-tab span.tab-label { display: none; }
}

/* ═══════════════════════════════════════════════════
   Phase 12 Chunk A — Dark Mode
═══════════════════════════════════════════════════ */

[data-theme="dark"] {
  --bg:          #0f172a;
  --card:        #1e293b;
  --text:        #f1f5f9;
  --text-muted:  #94a3b8;
  --line:        #334155;
  --line-focus:  #475569;
  --blue:        #3b82f6;
  --blue-hover:  #2563eb;
  --blue-light:  #1e3a5f;
  --blue-border: #2563eb;
  --green:       #22c55e;
  --green-light: #14532d;
  --green-border:#16a34a;
  --red:         #f87171;
  --red-light:   #450a0a;
  --red-border:  #dc2626;
  --shadow-sm:   0 1px 2px 0 rgba(0,0,0,.4);
  --shadow-md:   0 4px 6px -1px rgba(0,0,0,.35);
  --shadow-lg:   0 10px 15px -3px rgba(0,0,0,.35);
}

/* Sidebar dark */
[data-theme="dark"] .sidebar {
  background: #111827;
  border-right-color: #1f2937;
  box-shadow: 4px 0 30px rgba(0,0,0,.3);
}
[data-theme="dark"] .sidebar a,
[data-theme="dark"] .sidebar .navlink {
  color: #94a3b8;
}
[data-theme="dark"] .sidebar a:hover,
[data-theme="dark"] .sidebar .navlink:hover {
  background: #1f2937;
  color: #f1f5f9;
}
[data-theme="dark"] .sidebar a.active,
[data-theme="dark"] .sidebar .navlink.active {
  background: #1e3a5f;
  color: #3b82f6;
  border-color: #2563eb;
}
[data-theme="dark"] .section-title {
  color: #475569;
}
[data-theme="dark"] .status-card {
  background: #1f2937;
  border-color: #374151;
}

/* Topbar dark */
[data-theme="dark"] .topbar {
  background: #111827;
  border-bottom-color: #1f2937;
}
[data-theme="dark"] .title  { color: #f1f5f9; }
[data-theme="dark"] .subtitle { color: #64748b; }

/* Main area */
[data-theme="dark"] body,
[data-theme="dark"] .main { background: #0f172a; }
[data-theme="dark"] .content { background: #0f172a; }

/* Cards */
[data-theme="dark"] .card,
[data-theme="dark"] .kpi-card,
[data-theme="dark"] .dash-card,
[data-theme="dark"] .positions-panel {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
[data-theme="dark"] .kpi-card:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
[data-theme="dark"] .dash-card-head {
  border-bottom-color: #1f2937;
}

/* KPI chips */
[data-theme="dark"] .kpi-chip.neutral { background: #1f2937; color: #94a3b8; }
[data-theme="dark"] .kpi-chip.green   { background: #14532d; color: #4ade80; }
[data-theme="dark"] .kpi-chip.red     { background: #450a0a; color: #f87171; }
[data-theme="dark"] .kpi-chip.blue    { background: #1e3a5f; color: #60a5fa; }
[data-theme="dark"] .kpi-value        { color: #f1f5f9; }
[data-theme="dark"] .kpi-label        { color: #64748b; }
[data-theme="dark"] .dash-card-name   { color: #f1f5f9; }
[data-theme="dark"] .dash-card-route  { color: #475569; }

/* Tab bar */
[data-theme="dark"] .dashboard-tabs {
  background: #1e293b;
  border-color: #334155;
}
[data-theme="dark"] .dashboard-tab {
  color: #64748b;
}
[data-theme="dark"] .dashboard-tab:hover {
  background: #1f2937;
  color: #f1f5f9;
}
[data-theme="dark"] .dashboard-tab.active {
  background: #2563eb;
  color: #fff;
}

/* Tables */
[data-theme="dark"] .pthead,
[data-theme="dark"] .positions-table thead th {
  background: #1f2937;
  color: #64748b;
  border-bottom-color: #334155;
}
[data-theme="dark"] .positions-table tbody tr:hover,
[data-theme="dark"] .activity-item:hover {
  background: #1f2937;
}
[data-theme="dark"] .positions-table tbody tr {
  border-bottom-color: #1f2937;
}
[data-theme="dark"] .positions-footer,
[data-theme="dark"] .positions-empty {
  background: #1e293b;
  color: #64748b;
}

/* Stats & charts */
[data-theme="dark"] .stat-row    { border-bottom-color: #1f2937; }
[data-theme="dark"] .stat-lbl    { color: #64748b; }
[data-theme="dark"] .stat-val    { color: #f1f5f9; }
[data-theme="dark"] .pf-bar-track { background: #374151; }
[data-theme="dark"] .pf-leg-item  { color: #94a3b8; }
[data-theme="dark"] .eq-filter    { background:#1f2937; border-color:#334155; color:#94a3b8; }
[data-theme="dark"] .eq-filter:hover { border-color:#3b82f6; color:#3b82f6; }
[data-theme="dark"] .eq-filter.active { background:#2563eb; border-color:#2563eb; color:#fff; }

/* Inputs & forms */
[data-theme="dark"] .input,
[data-theme="dark"] .risk-inp {
  background: #1f2937;
  border-color: #374151;
  color: #f1f5f9;
}
[data-theme="dark"] .input:focus,
[data-theme="dark"] .risk-inp:focus {
  border-color: #3b82f6;
  background: #1e293b;
}
[data-theme="dark"] .input::placeholder,
[data-theme="dark"] .risk-inp::placeholder { color: #475569; }
[data-theme="dark"] select.input          { background: #1f2937; color: #f1f5f9; }

/* Buttons */
[data-theme="dark"] .btn.secondary {
  background: #1f2937;
  border-color: #374151;
  color: #94a3b8;
}
[data-theme="dark"] .btn.secondary:hover {
  background: #374151;
  color: #f1f5f9;
}
[data-theme="dark"] .ghost-btn {
  background: #1f2937;
  border-color: #374151;
  color: #94a3b8;
}

/* preBox (spread JSON) */
[data-theme="dark"] .preBox { background: #0a0f1e !important; color: #7dd3fc; }

/* Activity feed */
[data-theme="dark"] .activity-item { border-bottom-color: #1f2937; }
[data-theme="dark"] .activity-sym  { color: #f1f5f9; }
[data-theme="dark"] .activity-row2 { color: #64748b; }
[data-theme="dark"] .activity-sep  { color: #374151; }

/* ctrl-status */
[data-theme="dark"] .ctrl-status {
  background: #1f2937;
  border-color: #334155;
  color: #94a3b8;
}

/* Misc */
[data-theme="dark"] .dash-empty       { color: #475569; }
[data-theme="dark"] .dash-empty-text  { color: #64748b; }
[data-theme="dark"] hr { border-color: #334155; }
[data-theme="dark"] .preBox           { background: #060c18 !important; }

/* Dark mode toggle button */
#darkModeToggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-muted);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  white-space: nowrap;
}
#darkModeToggle:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-light);
}

/* ═══════════════════════════════════════════════════
   Phase 12 Chunk B — Analytics & Risk Center CSS
═══════════════════════════════════════════════════ */

/* ── Analytics summary cards grid ── */
.analytics-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .analytics-summary-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 500px) { .analytics-summary-grid { grid-template-columns: 1fr; } }

.analytics-metric-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 4px rgba(15,23,42,.04);
}
.analytics-metric-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #94a3b8;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.analytics-metric-value {
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -.03em;
  line-height: 1;
  margin-bottom: 4px;
}
.analytics-metric-sub {
  font-size: 11px;
  color: #94a3b8;
}

/* ── Charts grid ── */
.analytics-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 800px) { .analytics-charts-grid { grid-template-columns: 1fr; } }

.analytics-chart-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(15,23,42,.04);
}
.analytics-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  border-bottom: 1px solid #f8fafc;
}
.analytics-chart-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}
.analytics-chart-sub {
  font-size: 11px;
  color: #94a3b8;
}
.analytics-chart-body {
  padding: 10px 14px 14px;
  position: relative;
}

/* ── Coin cards ── */
.coin-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .coin-cards-grid { grid-template-columns: repeat(2,1fr); } }

.coin-perf-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 2px 8px rgba(15,23,42,.05);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .15s, box-shadow .15s;
}
.coin-perf-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(15,23,42,.1);
}
.coin-perf-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}
.coin-perf-sym   { font-size: 15px; font-weight: 800; color: #0f172a; }
.coin-perf-vol   { font-size: 12px; color: #64748b; }
.coin-perf-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.coin-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.coin-buy-pill  { background: #ecfdf5; color: #059669; }
.coin-sell-pill { background: #fef2f2; color: #dc2626; }

/* ── Risk Center ── */
.risk-score-big {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px;
  margin-bottom: 20px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(15,23,42,.05);
}
.risk-gauge-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}
.risk-gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.risk-gauge-score {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -.04em;
  line-height: 1;
}
.risk-gauge-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 2px;
}
.risk-level-LOW    { color: #059669; }
.risk-level-MEDIUM { color: #ea580c; }
.risk-level-HIGH   { color: #dc2626; }

.risk-info { flex: 1; }
.risk-info-title { font-size: 17px; font-weight: 800; color: #0f172a; margin-bottom: 6px; }
.risk-info-desc  { font-size: 13px; color: #64748b; line-height: 1.5; margin-bottom: 12px; }

.risk-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.risk-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}
.risk-pill-low    { background:#ecfdf5; color:#059669; border-color:#a7f3d0; }
.risk-pill-medium { background:#fff7ed; color:#ea580c; border-color:#fed7aa; }
.risk-pill-high   { background:#fef2f2; color:#dc2626; border-color:#fca5a5; }

.risk-center-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 800px) { .risk-center-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 500px) { .risk-center-grid { grid-template-columns: 1fr; } }

.risk-metric-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 4px rgba(15,23,42,.04);
}
.risk-metric-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
  font-size: 15px;
}
.risk-metric-val  { font-size: 22px; font-weight: 800; color: #0f172a; letter-spacing: -.03em; }
.risk-metric-lbl  { font-size: 11px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }

/* ── Dark mode for analytics & risk ── */
[data-theme="dark"] .analytics-metric-card,
[data-theme="dark"] .analytics-chart-card,
[data-theme="dark"] .coin-perf-card,
[data-theme="dark"] .risk-score-big,
[data-theme="dark"] .risk-metric-card {
  background: #1e293b;
  border-color: #334155;
}
[data-theme="dark"] .analytics-chart-head { border-bottom-color: #1f2937; }
[data-theme="dark"] .analytics-metric-value,
[data-theme="dark"] .analytics-chart-title,
[data-theme="dark"] .coin-perf-sym,
[data-theme="dark"] .risk-info-title,
[data-theme="dark"] .risk-metric-val { color: #f1f5f9; }
[data-theme="dark"] .analytics-metric-label,
[data-theme="dark"] .analytics-metric-sub,
[data-theme="dark"] .analytics-chart-sub,
[data-theme="dark"] .coin-perf-vol,
[data-theme="dark"] .risk-info-desc,
[data-theme="dark"] .risk-metric-lbl { color: #64748b; }

/* ═══════════════════════════════════════════════════
   Phase 12 Chunk C — System Health CSS
═══════════════════════════════════════════════════ */

/* ── Overall health banner ── */
.health-overall {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px 28px;
  border-radius: 16px;
  border: 2px solid transparent;
  margin-bottom: 20px;
  transition: all .25s;
}
.health-overall.HEALTHY  { background:#f0fdf4; border-color:#4ade80; }
.health-overall.DEGRADED { background:#fff7ed; border-color:#fb923c; }
.health-overall.ATTENTION{ background:#fef2f2; border-color:#f87171; }

[data-theme="dark"] .health-overall.HEALTHY  { background:#052e16; border-color:#4ade80; }
[data-theme="dark"] .health-overall.DEGRADED { background:#431407; border-color:#fb923c; }
[data-theme="dark"] .health-overall.ATTENTION{ background:#450a0a; border-color:#f87171; }

.health-overall-icon {
  font-size: 36px;
  flex-shrink: 0;
}
.health-overall-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1;
  margin-bottom: 4px;
}
.health-overall.HEALTHY  .health-overall-title { color:#16a34a; }
.health-overall.DEGRADED .health-overall-title { color:#ea580c; }
.health-overall.ATTENTION .health-overall-title { color:#dc2626; }
.health-overall-desc { font-size:13px; color:#64748b; }

[data-theme="dark"] .health-overall-desc { color:#94a3b8; }

/* ── Workers grid ── */
.health-workers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
@media (max-width: 900px) { .health-workers-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 500px) { .health-workers-grid { grid-template-columns: 1fr; } }

/* ── Individual worker card ── */
.health-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 1px 4px rgba(15,23,42,.04);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.health-card:hover {
  box-shadow: 0 4px 14px rgba(15,23,42,.08);
  transform: translateY(-1px);
}
.health-card.health-status-up       { border-left: 4px solid #22c55e; }
.health-card.health-status-degraded { border-left: 4px solid #f97316; }
.health-card.health-status-down     { border-left: 4px solid #ef4444; }

[data-theme="dark"] .health-card {
  background: #1e293b;
  border-color: #334155;
}

/* ── Card header row ── */
.health-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.health-card-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}
[data-theme="dark"] .health-card-name { color: #f1f5f9; }

.health-card-icon { font-size: 18px; }

/* ── Status badge ── */
.health-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}
.health-status-up       .health-status-badge { background:#ecfdf5; color:#059669; border:1px solid #a7f3d0; }
.health-status-degraded .health-status-badge { background:#fff7ed; color:#ea580c; border:1px solid #fed7aa; }
.health-status-down     .health-status-badge { background:#fef2f2; color:#dc2626; border:1px solid #fca5a5; }

/* ── Status dot ── */
.health-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.health-status-up       .health-dot { background:#22c55e; animation:pos-dot-blink 2s ease-in-out infinite; }
.health-status-degraded .health-dot { background:#f97316; animation:pos-dot-blink 1.5s ease-in-out infinite; }
.health-status-down     .health-dot { background:#ef4444; }

/* ── Card detail text ── */
.health-card-detail {
  font-size: 12px;
  color: #64748b;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.5;
  padding: 8px 10px;
  background: #f8fafc;
  border-radius: 8px;
  word-break: break-all;
}
[data-theme="dark"] .health-card-detail {
  background: #0f172a;
  color: #64748b;
}

/* ── Refresh timestamp ── */
.health-ts {
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  font-family: 'JetBrains Mono', monospace;
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════
   Phase 12 Chunk E — Admin Command Center CSS
═══════════════════════════════════════════════════ */

/* ── Admin summary stat cards ── */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .admin-stats-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 500px) { .admin-stats-grid { grid-template-columns: 1fr; } }

.admin-stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 1px 3px rgba(15,23,42,.04);
  transition: box-shadow .15s;
}
.admin-stat-card:hover { box-shadow: 0 4px 12px rgba(15,23,42,.08); }
.admin-stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.admin-stat-val  { font-size: 24px; font-weight: 800; letter-spacing: -.03em; color: #0f172a; line-height: 1; }
.admin-stat-lbl  { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; margin-top: 3px; }

[data-theme="dark"] .admin-stat-card { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .admin-stat-val  { color: #f1f5f9; }

/* ── Admin section card ── */
.admin-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(15,23,42,.04);
}
.admin-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #f1f5f9;
  background: #fafbfc;
}
.admin-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 7px;
}
.admin-section-body { padding: 16px 20px; }

[data-theme="dark"] .admin-section       { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .admin-section-head  { background: #1f2937; border-bottom-color: #334155; }
[data-theme="dark"] .admin-section-title { color: #f1f5f9; }

/* ── Command table ── */
.admin-cmd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.admin-cmd-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #94a3b8;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
}
.admin-cmd-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #f8fafc;
  vertical-align: middle;
  color: #334155;
}
.admin-cmd-table tr:last-child td { border-bottom: none; }
.admin-cmd-table tr:hover td { background: #f8fafc; }

[data-theme="dark"] .admin-cmd-table th { color: #475569; border-bottom-color: #334155; }
[data-theme="dark"] .admin-cmd-table td { color: #94a3b8; border-bottom-color: #1f2937; }
[data-theme="dark"] .admin-cmd-table tr:hover td { background: #1f2937; }

/* ── Command status badges ── */
.cmd-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}
.cmd-badge-done      { background: #ecfdf5; color: #059669; }
.cmd-badge-fail      { background: #fef2f2; color: #dc2626; }
.cmd-badge-new       { background: #eff6ff; color: #2563eb; }
.cmd-badge-processing{ background: #fff7ed; color: #ea580c; }
.cmd-badge-cancelled { background: #f8fafc; color: #94a3b8; }

/* ── Action buttons ── */
.admin-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.admin-action-btn.danger {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fca5a5;
}
.admin-action-btn.danger:hover {
  background: #fee2e2;
}
.admin-action-btn.primary {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}
.admin-action-btn.primary:hover { background: #dbeafe; }
.admin-action-btn.success {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
}
.admin-action-btn.success:hover { background: #d1fae5; }
.admin-action-btn.todo {
  background: #f8fafc;
  color: #94a3b8;
  border-color: #e2e8f0;
  cursor: not-allowed;
  opacity: .7;
}

/* ── Workers mini grid ── */
.admin-workers-mini {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
@media (max-width: 900px) { .admin-workers-mini { grid-template-columns: repeat(3,1fr); } }

.admin-worker-mini {
  text-align: center;
  padding: 12px 8px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fafbfc;
}
.admin-worker-mini-icon { font-size: 20px; margin-bottom: 6px; }
.admin-worker-mini-name { font-size: 10.5px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.admin-worker-mini-status { font-size: 11px; font-weight: 700; }

[data-theme="dark"] .admin-worker-mini { background: #1f2937; border-color: #334155; }
[data-theme="dark"] .admin-worker-mini-name { color: #475569; }

/* ── Filter chips ── */
.admin-filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.admin-filter-chip {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  transition: all .12s;
}
.admin-filter-chip:hover,
.admin-filter-chip.active { background: #2563eb; border-color: #2563eb; color: #fff; }

/* ============================================================
   Phase 14.2 — Sidebar Hamburger Drawer & Overlay Styling
   ============================================================ */

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 8px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.hamburger-btn:hover {
  background: var(--bg-subtle, rgba(0,0,0,0.03));
}
[data-theme="dark"] .hamburger-btn:hover {
  background: rgba(255,255,255,0.05);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(3px);
  z-index: 95;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

@media (max-width: 768px) {
  .hamburger-btn {
    display: inline-flex !important;
  }
  .sidebar {
    position: fixed !important;
    left: -280px !important;
    transition: left 0.3s ease-in-out !important;
    z-index: 100 !important;
  }
  .sidebar.open {
    left: 0 !important;
  }
  .main {
    margin-left: 0 !important;
  }
  .topbar {
    padding: 16px 20px !important;
  }
  body.sidebar-locked {
    overflow: hidden !important;
  }
}

/* ═══════════════════════════════════════════════════
   Phase 15 — Multi-Language Support & RTL Styles
   ═══════════════════════════════════════════════════ */

#langSelect {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  outline: none;
}
#langSelect:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-light);
}

/* RTL (Arabic Layout) Adjustments */
html[dir="rtl"] .sidebar {
  left: auto !important;
  right: 0 !important;
  border-left: 1px solid var(--line) !important;
  border-right: none !important;
}
html[dir="rtl"] .main {
  margin-left: 0 !important;
  margin-right: 250px !important;
}
html[dir="rtl"] .topbar {
  flex-direction: row-reverse !important;
}
html[dir="rtl"] .topbar .row {
  flex-direction: row-reverse !important;
}
html[dir="rtl"] .status-indicator {
  flex-direction: row-reverse !important;
}
html[dir="rtl"] .status-dot {
  margin-left: 6px !important;
  margin-right: 0 !important;
}

@media (max-width: 768px) {
  html[dir="rtl"] .sidebar {
    right: -280px !important;
    left: auto !important;
    transition: right 0.3s ease-in-out !important;
  }
  html[dir="rtl"] .sidebar.open {
    right: 0 !important;
  }
  html[dir="rtl"] .main {
    margin-right: 0 !important;
  }
}

