/* ==========================================================================
   ETF Analytics Pro — Modern Dark Theme & Glassmorphism Design System
   ========================================================================== */

:root {
  --bg-main: #07090e;
  --bg-surface: #0f1523;
  --bg-surface-elevated: #162035;
  --bg-card: rgba(18, 26, 43, 0.75);
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-focus: rgba(99, 102, 241, 0.5);

  /* Brand Accents */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);
  
  --emerald: #10b981;
  --emerald-bg: rgba(16, 185, 129, 0.12);
  --rose: #f43f5e;
  --rose-bg: rgba(244, 63, 94, 0.12);
  --sky: #38bdf8;
  --sky-bg: rgba(56, 189, 248, 0.12);
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.12);
  --indigo: #818cf8;

  /* Typography */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px -4px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.15);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Background Ambient Glows */
.glow-bg-top {
  position: absolute;
  top: -150px;
  left: 20%;
  width: 600px;
  height: 450px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(56, 189, 248, 0.05) 50%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

.glow-bg-bottom {
  position: absolute;
  top: 600px;
  right: 5%;
  width: 500px;
  height: 400px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.08) 0%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(7, 9, 14, 0.82);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1rem 2rem;
}

.header-container {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.data-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #34d399;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  outline: none;
  white-space: nowrap;
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: #1e2c48;
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-outline:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.04);
}

.btn-ghost {
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  border: 1px dashed rgba(99, 102, 241, 0.35);
}

.btn-ghost:hover {
  background: rgba(99, 102, 241, 0.22);
  color: #ffffff;
  border-color: #818cf8;
}

.btn-sm {
  font-size: 0.78rem;
  padding: 0.35rem 0.75rem;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-icon:hover:not(:disabled) {
  background: #1e2c48;
  color: var(--text-primary);
}

.btn-icon:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Main Container */
.main-container {
  max-width: 1600px;
  margin: 1.5rem auto 3rem;
  padding: 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
  z-index: 1;
}

/* KPI Summary Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.kpi-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* Control Panel */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.search-bar-row {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1.2fr;
  gap: 1rem;
}

@media (max-width: 900px) {
  .search-bar-row {
    grid-template-columns: 1fr;
  }
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-wrapper input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.75rem 2.5rem 0.75rem 2.85rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.search-input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  background: #121a2c;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-clear-btn {
  position: absolute;
  right: 0.85rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.2rem;
}

.search-clear-btn:hover {
  color: var(--text-primary);
}

select {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--text-primary);
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Quick Presets */
.quick-presets {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.preset-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.preset-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.18);
}

.preset-pill.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
  color: #c7d2fe;
}

/* Filter Builder Card */
.filter-builder-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.filter-builder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.filter-builder-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.filter-rows {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.filter-row {
  display: grid;
  grid-template-columns: 2fr 1.2fr 2fr auto;
  gap: 0.75rem;
  align-items: center;
  background: rgba(15, 21, 35, 0.7);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  animation: fadeIn 0.25s ease;
}

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

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

.filter-row input {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--text-primary);
}

.filter-row input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.filter-remove-btn {
  background: none;
  border: none;
  color: var(--rose);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.filter-remove-btn:hover {
  background: var(--rose-bg);
}

/* Table Section */
.table-section {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.table-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(15, 21, 35, 0.5);
}

.table-title-group {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.table-title-group h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.table-record-info {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.table-view-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.export-btn-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-right: 0.5rem;
}

.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 0.38rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.export-btn:hover {
  transform: translateY(-1px);
}

.page-size-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.table-view-controls select {
  padding: 0.35rem 1.75rem 0.35rem 0.75rem;
  font-size: 0.8rem;
  width: auto;
}

/* Table View Tabs (Bytt mellom nøkkeltall-sett) */
.table-view-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: rgba(11, 15, 25, 0.4);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.table-tab-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.table-tab-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.table-tab-btn.active {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  border-color: var(--primary);
  font-weight: 600;
}

.btn-customize-tab {
  background: rgba(99, 102, 241, 0.15) !important;
  color: #c7d2fe !important;
  border: 1px dashed rgba(99, 102, 241, 0.45) !important;
  margin-left: auto;
}

.btn-customize-tab:hover {
  background: rgba(99, 102, 241, 0.3) !important;
  color: #ffffff !important;
  border-color: #818cf8 !important;
}

/* Custom Column Picker Modal */
.custom-picker-dialog {
  max-width: 850px !important;
}

.custom-picker-body {
  padding: 1.5rem !important;
  max-height: 70vh;
  overflow-y: auto;
}

.picker-name-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.picker-name-label {
  font-weight: 600;
  font-size: 0.88rem;
  color: #c7d2fe;
  white-space: nowrap;
}

.picker-name-input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s ease;
}

.picker-name-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.picker-quick-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.picker-search-box {
  flex: 1;
  min-width: 240px;
}

.picker-search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.85rem;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  outline: none;
}

.picker-search-input:focus {
  border-color: var(--primary);
}

.picker-btn-group {
  display: flex;
  gap: 0.4rem;
}

.picker-badge {
  margin-left: auto;
  font-size: 0.82rem;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
}

.picker-group-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin: 1.25rem 0 0.6rem 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.picker-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.6rem;
}

.picker-checkbox-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.picker-checkbox-card:hover {
  background: var(--bg-surface-elevated);
  border-color: rgba(255, 255, 255, 0.2);
}

.picker-checkbox-card.selected {
  background: rgba(99, 102, 241, 0.12);
  border-color: var(--primary);
}

.picker-checkbox-card input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.picker-checkbox-label {
  font-size: 0.82rem;
  color: var(--text-primary);
  cursor: pointer;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background: rgba(15, 21, 35, 0.6);
}

/* Table */
.table-wrapper {
  overflow-x: auto;
  max-height: 650px;
  position: relative;
}

.etf-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
  white-space: nowrap;
}

.etf-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #111726;
}

.etf-table th {
  padding: 0.85rem 1rem;
  font-weight: 700;
  color: #cbd5e1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  letter-spacing: 0.02em;
  user-select: none;
}

.etf-table th.sortable {
  cursor: pointer;
  transition: color 0.15s ease;
}

.etf-table th.sortable:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
}

.sort-icon {
  font-size: 0.7rem;
  margin-left: 0.3rem;
  color: var(--primary);
}

.etf-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.15s ease;
  cursor: pointer;
}

.etf-table tbody tr:hover {
  background-color: rgba(99, 102, 241, 0.06);
}

.etf-table td {
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
}

/* Column Specific Styling */
.col-isin {
  font-family: var(--font-mono);
  font-weight: 600;
  color: #38bdf8 !important;
}

.col-ticker {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.col-name {
  color: var(--text-primary) !important;
  font-weight: 500;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-cat {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.78rem;
}

.col-num {
  text-align: right;
  font-family: var(--font-mono);
}

.col-status {
  text-align: center;
}

.col-actions {
  text-align: center;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-official {
  background: var(--emerald-bg);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-calc {
  background: var(--sky-bg);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-na {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.badge-rating {
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}

/* Text Colors */
.text-emerald { color: var(--emerald) !important; }
.text-rose { color: var(--rose) !important; }
.text-sky { color: var(--sky) !important; }
.text-amber { color: var(--amber) !important; }
.text-indigo { color: var(--indigo) !important; }

/* Pagination Footer */
.pagination-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background: rgba(15, 21, 35, 0.5);
}

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

.pagination-buttons {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.page-display {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  color: var(--text-primary);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

.modal-dialog {
  background: #0f1627;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  overflow: hidden;
  animation: scaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleUp {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 1.5rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--border-subtle);
  background: #131b2e;
}

.modal-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.4rem;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.75rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
  transition: color 0.15s ease;
}

.modal-close-btn:hover {
  color: var(--text-primary);
}

/* Modal Tabs */
.modal-tabs {
  display: flex;
  padding: 0 1.75rem;
  background: #111728;
  border-bottom: 1px solid var(--border-subtle);
  gap: 1rem;
  overflow-x: auto;
}

.modal-tab-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.85rem 0.25rem;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.modal-tab-btn:hover {
  color: var(--text-primary);
}

.modal-tab-btn.active {
  color: var(--primary);
}

.modal-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}

.modal-body {
  padding: 1.5rem 1.75rem;
  overflow-y: auto;
  flex: 1;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Metrics Grid in Modal */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.metric-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

.metric-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.drawdown-banner {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.25);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.drawdown-item-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #fda4af;
  font-weight: 600;
}

.drawdown-item-val {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
}
