/* web/style.css — Ultra-Premium Dark Financial Terminal Design System */

:root {
  --bg-canvas: #070a12;
  --bg-card: rgba(14, 21, 37, 0.7);
  --bg-card-hover: rgba(22, 33, 58, 0.85);
  --bg-input: #0c1220;
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-active: rgba(0, 229, 255, 0.4);

  --text-primary: #f0f4fc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-cyan: #00e5ff;
  --accent-cyan-glow: rgba(0, 229, 255, 0.25);
  --accent-green: #00e676;
  --accent-green-bg: rgba(0, 230, 118, 0.12);
  --accent-amber: #ffab00;
  --accent-amber-bg: rgba(255, 171, 0, 0.12);
  --accent-rose: #ff1744;
  --accent-rose-bg: rgba(255, 23, 68, 0.12);
  --accent-indigo: #7c4dff;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  --transition-fast: 0.15s ease;
  --transition-smooth: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(0, 229, 255, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(124, 77, 255, 0.04) 0%, transparent 40%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

/* 1. Header */
.terminal-header {
  height: 64px;
  background: rgba(10, 15, 27, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #00e5ff 0%, #7c4dff 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: #000;
  position: relative;
  box-shadow: 0 0 16px var(--accent-cyan-glow);
}

.brand-title h1 {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  background: rgba(0, 229, 255, 0.15);
  color: var(--accent-cyan);
  border-radius: var(--radius-pill);
  letter-spacing: 0.05em;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

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

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.header-actions {
  display: flex;
  gap: 8px;
}

.env-pill {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
}

.env-pill.accent {
  background: rgba(124, 77, 255, 0.15);
  border-color: rgba(124, 77, 255, 0.3);
  color: #d1c4e9;
}

/* 2. Layout */
.terminal-layout {
  display: flex;
  flex: 1;
}

.terminal-sidebar {
  width: 250px;
  background: rgba(9, 14, 25, 0.6);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 12px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(0, 229, 255, 0.08);
  border-color: rgba(0, 229, 255, 0.3);
  color: #ffffff;
}

.nav-item.active .nav-icon {
  color: var(--accent-cyan);
}

.nav-label {
  display: flex;
  flex-direction: column;
}

.nav-title {
  font-size: 13px;
  font-weight: 600;
}

.nav-subtitle {
  font-size: 10px;
  color: var(--text-muted);
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.stats-badge {
  background: rgba(14, 21, 37, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}

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

.stat-val {
  color: var(--accent-cyan);
  font-weight: 600;
}

/* 3. Main Content Views */
.terminal-content {
  flex: 1;
  padding: 28px 36px;
  overflow-y: auto;
  max-width: 1400px;
}

.view-panel {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.view-panel.active {
  display: block;
}

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

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.panel-title {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

.panel-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.live-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  background: rgba(0, 230, 118, 0.15);
  border: 1px solid rgba(0, 230, 118, 0.35);
  border-radius: var(--radius-pill);
  color: var(--accent-green);
  letter-spacing: 0.04em;
}

/* 4. KPI Ribbon */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: transform var(--transition-smooth), border-color var(--transition-smooth);
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-active);
  background: var(--bg-card-hover);
}

.kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 8px;
}

.kpi-value-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.kpi-num {
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
}

.kpi-chip {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(0, 229, 255, 0.15);
  color: var(--accent-cyan);
}

.kpi-chip.positive {
  background: var(--accent-green-bg);
  color: var(--accent-green);
}

.kpi-chip.neutral {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.kpi-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
  display: block;
}

/* 5. Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.chart-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
}

.chart-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

.legend-group {
  display: flex;
  gap: 12px;
}

.legend-item {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot.m2 { background: #00e5ff; }
.legend-dot.m1 { background: #ffab00; }
.legend-dot.scissors { background: #00e676; }
.legend-dot.yield10 { background: #7c4dff; }
.legend-dot.yield1 { background: #00e5ff; }

.canvas-wrapper {
  width: 100%;
  height: 280px;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* 6. Sector Radar Grid */
.sector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.sector-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sector-card:hover {
  border-color: var(--accent-cyan);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.sector-name {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 4px;
}

.sector-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

/* 7. Search Boxes & Filter Pills */
.search-box input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  padding: 9px 16px;
  width: 320px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.category-pills, .market-pills {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.pill-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.pill-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-primary);
}

.pill-btn.active {
  background: rgba(0, 229, 255, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* 8. Data Tables */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-responsive {
  max-height: 520px;
  overflow-y: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background: rgba(10, 16, 30, 0.95);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table td {
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.data-table tr:hover td {
  background: rgba(0, 229, 255, 0.03);
}

.code-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  background: rgba(0, 229, 255, 0.1);
  color: var(--accent-cyan);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.tag-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
}

.table-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: rgba(8, 12, 22, 0.9);
  border-top: 1px solid var(--border-subtle);
}

.page-info {
  font-size: 12px;
  color: var(--text-muted);
}

.pagination-btns {
  display: flex;
  gap: 8px;
}

.btn-page {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  padding: 5px 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-page:hover:not(:disabled) {
  background: rgba(0, 229, 255, 0.2);
  border-color: var(--accent-cyan);
}

.btn-page:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.loading-cell {
  text-align: center;
  padding: 40px !important;
  color: var(--text-muted);
}

/* 9. Interactive Row Highlighting */
#table-companies tbody tr {
  cursor: pointer;
  transition: background var(--transition-fast);
}

#table-companies tbody tr:hover td {
  background: rgba(0, 229, 255, 0.08);
}

/* 10. Company Deep-Dive Drawer Modal */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 14, 0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.company-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  max-width: 92vw;
  background: #090e1c;
  border-left: 1px solid var(--border-subtle);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6);
  z-index: 210;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.company-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 24px;
  background: rgba(12, 18, 34, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.code-badge.large {
  font-size: 14px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: rgba(0, 229, 255, 0.15);
  color: var(--accent-cyan);
}

.drawer-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

.drawer-market {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  transition: color var(--transition-fast);
}

.btn-close:hover {
  color: #ffffff;
}

.drawer-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.drawer-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
}

.section-heading {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}

/* Metrics Grid in Drawer */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.metric-box {
  background: rgba(6, 10, 20, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.m-label {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.m-value {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

/* DuPont Formula */
.dupont-formula {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 12px;
}

.dupont-box {
  background: rgba(6, 10, 20, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
  flex: 1;
}

.dupont-box.highlight {
  background: rgba(0, 229, 255, 0.1);
  border-color: rgba(0, 229, 255, 0.3);
}

.dupont-box.highlight .d-val {
  color: var(--accent-cyan);
}

.d-label {
  font-size: 9px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
  text-transform: uppercase;
}

.d-val {
  font-size: 13px;
  font-weight: 700;
}

.d-eq, .d-op {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
}

.dupont-diagnosis {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  border-left: 2px solid var(--accent-cyan);
  padding-left: 10px;
}

/* Cash Quality Card */
.cash-quality-card {
  background: rgba(6, 10, 20, 0.6);
  border: 1px solid rgba(0, 230, 118, 0.25);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.cash-quality-card.warning {
  border-color: rgba(255, 171, 0, 0.35);
}

.cq-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.cq-status {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-green);
}

.cash-quality-card.warning .cq-status {
  color: var(--accent-amber);
}

.cq-ratio {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

.cq-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Valuation Tunnel Percentile Bar */
.tunnel-bar-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tunnel-bar {
  height: 8px;
  background: linear-gradient(90deg, #00e676 0%, #ffab00 50%, #ff1744 100%);
  border-radius: var(--radius-pill);
  position: relative;
}

.tunnel-marker {
  width: 14px;
  height: 14px;
  background: #ffffff;
  border: 2px solid #000;
  border-radius: 50%;
  position: absolute;
  top: -3px;
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
  transition: left 0.3s ease;
}

.tunnel-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}

/* Strategy Selector Pills */
.strategy-selector {
  display: flex;
  gap: 6px;
  background: rgba(15, 23, 42, 0.8);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.btn-strat {
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-strat:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.btn-strat.active {
  background: var(--gradient-accent);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 229, 255, 0.25);
}

/* Piotroski Drawer Scorecard */
.fscore-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.fscore-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fscore-badge.elite {
  background: rgba(0, 230, 118, 0.15);
  border: 1px solid rgba(0, 230, 118, 0.4);
  color: var(--accent-green);
}

.fscore-badge.strong {
  background: rgba(0, 229, 255, 0.15);
  border: 1px solid rgba(0, 229, 255, 0.4);
  color: var(--accent-cyan);
}

.fscore-badge.neutral {
  background: rgba(255, 171, 0, 0.15);
  border: 1px solid rgba(255, 171, 0, 0.4);
  color: var(--accent-amber);
}

.fscore-badge.distress {
  background: rgba(255, 23, 68, 0.15);
  border: 1px solid rgba(255, 23, 68, 0.4);
  color: var(--accent-red);
}

.fscore-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

@media (max-width: 600px) {
  .fscore-grid {
    grid-template-columns: 1fr;
  }
}

.fscore-item {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color var(--transition-fast);
}

.fscore-item.passed {
  border-color: rgba(0, 230, 118, 0.25);
  background: rgba(0, 230, 118, 0.03);
}

.fscore-item.failed {
  border-color: rgba(255, 23, 68, 0.2);
  background: rgba(255, 23, 68, 0.02);
  opacity: 0.7;
}

.fscore-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fscore-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
}

.fscore-status-icon {
  font-size: 11px;
  font-weight: 700;
}

.fscore-item.passed .fscore-status-icon {
  color: var(--accent-green);
}

.fscore-item.failed .fscore-status-icon {
  color: var(--accent-red);
}

.fscore-desc {
  font-size: 9px;
  color: var(--text-muted);
  line-height: 1.2;
}

.fscore-val {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

/* Institutional Crowding Radar Styles */
.sector-crowd-filter {
  display: flex;
  gap: 6px;
  background: rgba(15, 23, 42, 0.8);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.crowd-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  display: inline-block;
  white-space: nowrap;
}

.crowd-badge.extreme {
  background: rgba(255, 23, 68, 0.15);
  border: 1px solid rgba(255, 23, 68, 0.4);
  color: #ff5252;
}

.crowd-badge.heavy {
  background: rgba(255, 171, 0, 0.15);
  border: 1px solid rgba(255, 171, 0, 0.4);
  color: var(--accent-amber);
}

.crowd-badge.moderate {
  background: rgba(0, 229, 255, 0.15);
  border: 1px solid rgba(0, 229, 255, 0.4);
  color: var(--accent-cyan);
}

.crowd-badge.under {
  background: rgba(0, 230, 118, 0.15);
  border: 1px solid rgba(0, 230, 118, 0.4);
  color: var(--accent-green);
}

/* Drawer Crowding Card */
.crowding-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.crowd-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

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

.crowd-stat-box {
  background: rgba(8, 12, 22, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cs-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.cs-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.crowd-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 10px;
}

.crowd-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.crowd-score-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.crowd-mini-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  min-width: 50px;
}

.crowd-mini-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #00e5ff 0%, #ff1744 100%);
}

/* ==========================================================================
   Core Alpha Pillars Command Center Styles
   ========================================================================== */
.pillars-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

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

@media (max-width: 768px) {
  .pillars-grid {
    grid-template-columns: 1fr;
  }
}

.pillar-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.pillar-card:hover {
  border-color: rgba(0, 229, 255, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.pillar-card.active {
  border-color: var(--accent-cyan);
  background: rgba(14, 28, 54, 0.85);
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.18);
}

.pillar-card.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
}

.pillar-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pillar-num-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.15);
  border: 1px solid rgba(0, 229, 255, 0.3);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.pillar-type-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.pillar-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.pillar-card-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: -6px;
}

.pillar-empirical-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
  flex: 1;
}

.pillar-formula-box {
  background: rgba(8, 12, 22, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.p-form-lbl {
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.pillar-formula-box code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-cyan);
  white-space: pre-wrap;
  word-break: break-word;
}

.pillar-stats-ribbon {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

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

.p-stat-item.right {
  text-align: right;
}

.p-stat-lbl {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.p-stat-val {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-inspect-pillar {
  width: 100%;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: var(--accent-cyan);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 4px;
}

.pillar-card.active .btn-inspect-pillar {
  background: var(--accent-cyan);
  color: #060a12;
  border-color: var(--accent-cyan);
}

.btn-inspect-pillar:hover {
  background: var(--accent-cyan);
  color: #060a12;
}

/* Alpha Pillars Ribbon in Company Detail Drawer */
.drawer-pillars-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 0;
}

.pillar-ribbon-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
}

.pillar-ribbon-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.2);
  padding: 1px 5px;
  border-radius: 3px;
}

.pillar-ribbon-name {
  font-size: 11px;
  color: var(--text-primary);
  font-weight: 500;
}

.pillar-none-tag {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}
