/* ==========================================================================
   BRVM Terminal — Modern Financial Terminal Theme
   ========================================================================== */

:root {
  /* Surfaces — deep charcoal-navy, layered, no pure black */
  --bg-app: #0B0E13;
  --bg-sidebar: #0F131B;
  --bg-card: #12161F;
  --bg-card-hover: #171C28;
  --bg-input: #161B25;
  --border-subtle: #1E2530;
  --border-strong: #2A3340;
  --border-focus: #C9A961;

  /* Text ramp */
  --text-primary: #E6E9EF;
  --text-secondary: #8A93A6;
  --text-muted: #5B6475;

  /* Market moves ONLY */
  --color-green: #2FB47C;
  --color-green-bg: rgba(47, 180, 124, 0.12);
  --color-red: #E5484D;
  --color-red-bg: rgba(229, 72, 77, 0.12);

  /* Restrained gold — the single brand accent (highlights, chart line, active states) */
  --accent-gold: #C9A961;
  --accent-gold-soft: rgba(201, 169, 97, 0.12);
  --accent-gold-border: rgba(201, 169, 97, 0.35);

  /* Legacy aliases repointed to gold so existing rules retint automatically */
  --color-blue: #C9A961;
  --color-blue-bg: rgba(201, 169, 97, 0.12);
  --color-accent: #C9A961;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Roboto Mono", "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --radius-sm: 5px;
  --radius-md: 6px;
  --radius-lg: 10px;

  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.02), 0 6px 20px rgba(0, 0, 0, 0.35);
}

/* Every figure is tabular so columns align to the pixel */
.data-table td, .data-table th,
.metric-value, .price-val, .price-val-inline, .comp-price, .comp-change,
.meter-val, .stat-val, .change-pill, .mover-price, .mover-change,
.ticker-badge, .badge-status-pill, .proof-card-val, .math-formula-box,
.terminal-input, .shariah-basis-badge, code {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ==========================================================================
   Top Navigation Bar
   ========================================================================== */

.top-bar {
  height: 56px;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-bar-left, .top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.logo-badge {
  background: transparent;
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold-border);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
}

.logo-text {
  font-size: 13px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 2px;
}

.nav-tabs {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
  transition: color 0.15s ease, background-color 0.15s ease;
}

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

.nav-tab.active {
  color: var(--text-primary);
  background-color: transparent;
}

.nav-tab.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background-color: var(--accent-gold);
}

.market-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--color-green);
}

.btn-lang {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: border-color 0.15s;
}

.btn-lang:hover {
  border-color: var(--color-blue);
  color: var(--text-primary);
}

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

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #475569, #334155);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #f1f5f9;
  border: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Main Layout & Sidebar
   ========================================================================== */

.app-layout {
  display: flex;
  height: calc(100vh - 56px);
}

.sidebar {
  width: 310px;
  min-width: 290px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sidebar-search {
  padding: 12px 14px;
  position: relative;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-search input {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  padding: 8px 12px 8px 30px;
  outline: none;
  transition: border-color 0.15s;
}

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

.search-icon {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  opacity: 0.6;
}

.sidebar-meta {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-subtle);
}

.company-list {
  flex: 1;
  overflow-y: auto;
}

.company-item {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.company-item:hover {
  background-color: var(--bg-card-hover);
}

.company-item.active {
  background-color: var(--bg-card-hover);
  box-shadow: inset 2px 0 0 var(--accent-gold);
}

.comp-item-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 160px;
}

.comp-ticker {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
}

.comp-name {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.comp-price {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.comp-change {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: var(--radius-sm);
}

.change-pos {
  color: var(--color-green);
  background-color: var(--color-green-bg);
}

.change-neg {
  color: var(--color-red);
  background-color: var(--color-red-bg);
}

.change-zero {
  color: var(--text-muted);
  background-color: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 40px;
  background-color: var(--bg-app);
}

.screen-view {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.screen-view.active {
  display: flex;
}

/* ==========================================================================
   Company Header Card
   ========================================================================== */

.company-header-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  flex-wrap: wrap;
  gap: 12px;
}

.company-title {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.company-meta-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.ticker-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-gold);
  background: var(--accent-gold-soft);
  border: 1px solid var(--accent-gold-border);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.price-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.price-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.price-val {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 800;
  color: #fff;
}

.price-currency {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.change-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Key Metrics Strip
   ========================================================================== */

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.metric-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.metric-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-sub {
  font-size: 10px;
  color: var(--text-secondary);
}

/* ==========================================================================
   Panels & Charts
   ========================================================================== */

.panel {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
}

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

.panel-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.panel-badge {
  font-size: 11px;
  color: var(--text-muted);
  background-color: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 12px;
}

.chart-panel {
  min-height: 320px;
}

.chart-container {
  height: 250px;
  position: relative;
  width: 100%;
}

.range-selector {
  display: flex;
  gap: 2px;
  background-color: var(--bg-input);
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.range-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.range-btn.active {
  background-color: var(--accent-gold-soft);
  color: var(--accent-gold);
  box-shadow: inset 0 0 0 1px var(--accent-gold-border);
}

/* ==========================================================================
   Tables & Financial Data
   ========================================================================== */

.data-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.data-table tr:hover td {
  background-color: var(--bg-card-hover);
  color: var(--text-primary);
}

.text-right {
  text-align: right !important;
}

.text-center {
  text-align: center !important;
}

.source-icon-btn {
  background: transparent;
  border: none;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s, transform 0.15s;
}

.source-icon-btn:hover {
  opacity: 1;
  transform: scale(1.2);
}

/* ==========================================================================
   Profile & Knowledge Graph Panel
   ========================================================================== */

.profile-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.profile-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.profile-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 4px;
}

.profile-box {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-box-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  cursor: default;
}

.tag-clickable {
  background-color: var(--accent-gold-soft);
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold-border);
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.tag-clickable:hover {
  background-color: rgba(201, 169, 97, 0.22);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.profile-single-val {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 600;
}

/* ==========================================================================
   Screen B: Market Movers & Table
   ========================================================================== */

.movers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.mover-card {
  padding: 14px 16px;
}

.mover-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mover-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background-color: var(--bg-input);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s;
}

.mover-item:hover {
  background-color: var(--bg-card-hover);
}

.mover-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mover-ticker {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  color: var(--text-primary);
}

.mover-name {
  font-size: 11px;
  color: var(--text-secondary);
}

.mover-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mover-price {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
}

.mover-change {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  min-width: 50px;
  text-align: right;
}

.text-green { color: var(--color-green) !important; }
.badge-green { background-color: var(--color-green-bg); color: var(--color-green); }
.text-red { color: var(--color-red) !important; }
.badge-red { background-color: var(--color-red-bg); color: var(--color-red); }

.price-val-inline {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 800;
  color: var(--color-accent);
  margin-left: 8px;
}

/* ==========================================================================
   Evidence Quote Modal
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 540px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.modal-close-btn:hover {
  color: #fff;
}

.modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quote-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.quote-box {
  background-color: var(--bg-input);
  border-left: 3px solid var(--color-accent);
  padding: 12px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px;
  font-style: italic;
  color: var(--text-primary);
  line-height: 1.5;
}

.modal-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10px;
  color: var(--text-muted);
}

.modal-meta code {
  font-family: var(--font-mono);
  background-color: rgba(255, 255, 255, 0.05);
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

/* ==========================================================================
   Responsive Adaptations (Tablets, Smartphones, Foldables)
   ========================================================================== */

@media (max-width: 1024px) {
  .metrics-strip {
    grid-template-columns: repeat(3, 1fr);
  }
  .data-grid-2col {
    grid-template-columns: 1fr;
  }
  .profile-meta-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .top-bar {
    padding: 0 10px;
  }
  .market-status {
    display: none;
  }
  .app-layout {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 56px);
  }
  .sidebar {
    width: 100%;
    height: 180px;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .main-content {
    padding: 12px 10px 40px;
  }
  .company-header-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px;
  }
  .price-box {
    align-items: flex-start;
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
  .price-val {
    font-size: 22px;
  }
  .metrics-strip {
    grid-template-columns: 1fr 1fr;
  }
  .profile-meta-grid {
    grid-template-columns: 1fr;
  }
  .movers-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Shariah Compliance Cockpit & Institutional Module Styles
   Theme: Midnight Emerald & Forest Slate (Strictly Zero Emojis)
   ========================================================================== */

:root {
  --emerald-primary: #10b981;
  --emerald-dark: #064e3b;
  --emerald-subtle: #0f2e24;
  --emerald-border: #134e3a;
  
  --crimson-primary: #ef4444;
  --crimson-dark: #450a0a;
  --crimson-subtle: #2a1111;
  --crimson-border: #7f1d1d;
  
  --amber-primary: #f59e0b;
  --gold-primary: #d97706;
  --blue-primary: #38bdf8;
}

.text-emerald { color: var(--emerald-primary) !important; }
.text-crimson { color: var(--crimson-primary) !important; }
.text-gold { color: var(--gold-primary) !important; }
.text-blue { color: var(--blue-primary) !important; }

/* Status Badges */
.badge-status-pill,
.shariah-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

.badge-status-pill.status-compliant,
.shariah-status-badge.status-compliant {
  background-color: var(--emerald-subtle);
  color: var(--emerald-primary);
  border: 1px solid var(--emerald-border);
}

.badge-status-pill.status-non-compliant,
.shariah-status-badge.status-non-compliant {
  background-color: var(--crimson-subtle);
  color: var(--crimson-primary);
  border: 1px solid var(--crimson-border);
}

.badge-status-pill.status-indeterminate,
.shariah-status-badge.status-indeterminate,
.badge-status-pill.status-provisional,
.shariah-status-badge.status-provisional {
  background-color: var(--amber-subtle);
  color: var(--amber-primary);
  border: 1px solid var(--amber-border);
}

.standard-pill {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

/* Framework Selector Bar */
.framework-selector-panel {
  padding: 12px 16px;
  background: linear-gradient(180deg, #0d1e17 0%, var(--bg-card) 100%);
  border-color: var(--emerald-border);
}

.framework-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.framework-select-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.framework-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--emerald-primary);
  white-space: nowrap;
}

.terminal-select {
  background-color: var(--bg-input);
  border: 1px solid var(--emerald-border);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  min-width: 260px;
}

.terminal-select:focus {
  border-color: var(--emerald-primary);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.framework-desc-box {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  max-width: 600px;
  line-height: 1.4;
}

/* Shariah Strip */
.shariah-strip .metric-card {
  border-top: 2px solid var(--border-subtle);
}

.shariah-strip .metric-card:first-child {
  border-top-color: var(--emerald-primary);
}

.shariah-strip .metric-card:nth-child(2) {
  border-top-color: var(--crimson-primary);
}

.shariah-strip .metric-card:nth-child(3) {
  border-top-color: var(--blue-primary);
}

.shariah-strip .metric-card:nth-child(4) {
  border-top-color: var(--gold-primary);
}

/* Cockpit Split Grid */
.shariah-cockpit-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  margin-top: 16px;
}

.shariah-filter-pills {
  display: flex;
  gap: 4px;
}

.pill-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill-btn:hover {
  color: #fff;
  border-color: var(--text-muted);
}

.pill-btn.active {
  background: var(--emerald-dark);
  color: var(--emerald-primary);
  border-color: var(--emerald-border);
}

/* Shariah Meters & Audit UI */
.shariah-company-card {
  border-color: var(--emerald-border);
  background: linear-gradient(180deg, #091a13 0%, var(--bg-card) 100%);
}

.shariah-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 14px 16px;
}

.meter-group {
  margin-bottom: 12px;
}

.meter-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 11px;
}

.meter-label {
  color: var(--text-muted);
  font-weight: 600;
}

.meter-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
}

.meter-track {
  height: 6px;
  background-color: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.meter-fill.fill-pass {
  background-color: var(--emerald-primary);
}

.meter-fill.fill-fail {
  background-color: var(--crimson-primary);
}

.meter-fill.fill-amber {
  background-color: var(--amber-primary);
}

.provenance-note {
  font-size: 11px;
  color: var(--text-secondary);
  background-color: rgba(255, 255, 255, 0.02);
  border-left: 2px solid var(--emerald-primary);
  padding: 8px 10px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 10px;
  line-height: 1.4;
}

/* Portfolio Purification Calculator */
.purification-calculator-col,
.dossier-calc-section {
  background: rgba(0, 0, 0, 0.2);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.purif-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--gold-primary);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.purif-input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
}

.purif-input-row label {
  font-size: 12px;
  color: var(--text-muted);
}

.terminal-input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  width: 110px;
  text-align: right;
  outline: none;
}

.terminal-input:focus {
  border-color: var(--emerald-primary);
}

.purif-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.purif-stat-item {
  background: var(--bg-input);
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

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

.highlight-amber { color: var(--amber-primary) !important; }
.highlight-green { color: var(--emerald-primary) !important; }
.highlight-gold { color: var(--gold-primary) !important; }

.btn-terminal-action {
  width: 100%;
  background: var(--emerald-dark);
  border: 1px solid var(--emerald-border);
  color: var(--emerald-primary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-terminal-action:hover {
  background: var(--emerald-primary);
  color: #000;
}

/* Dossier Panel */
.dossier-content {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dossier-stock-header {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
}

.dossier-company-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.dossier-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.dossier-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.dossier-notes-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dossier-notes-list li {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  position: relative;
  padding-left: 12px;
}

.dossier-notes-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--emerald-primary);
}

@media (max-width: 1024px) {
  .shariah-cockpit-grid {
    grid-template-columns: 1fr;
  }
  .shariah-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Mathematical Proof & Granular Breakdown Modal Styles
   ========================================================================== */

.modal-card-wide {
  max-width: 880px;
  width: 95%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.modal-card-wide .modal-body {
  overflow-y: auto;
  max-height: calc(88vh - 120px);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.header-action-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.framework-mini-select {
  padding: 4px 8px;
  font-size: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  outline: none;
  cursor: pointer;
  max-width: 220px;
}

.framework-mini-select:focus {
  border-color: var(--emerald-primary);
}

.btn-proof-btn {
  width: auto !important;
  padding: 4px 10px !important;
  font-size: 10px !important;
  white-space: nowrap;
}

.btn-proof-badge {
  background: var(--emerald-subtle);
  border: 1px solid var(--emerald-border);
  color: var(--emerald-primary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-proof-badge:hover {
  background: var(--emerald-primary);
  color: #000;
}

.denom-callout-box {
  background: var(--emerald-subtle);
  border: 1px solid var(--emerald-border);
  border-left: 3px solid var(--emerald-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.denom-callout-highlight {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--emerald-primary);
}

.proof-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.proof-summary-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.proof-card-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.proof-card-val {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.proof-card-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.proof-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.proof-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
}

.proof-table th {
  font-size: 11px;
  padding: 8px 10px;
}

.proof-table td {
  font-size: 11px;
  padding: 8px 10px;
}

.proof-math-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.proof-math-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.math-formula-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.math-formula-box {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 6px 10px;
  border-radius: 4px;
  margin: 4px 0;
  word-break: break-all;
}

.math-formula-result {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

.proof-legal-box {
  background: var(--bg-input);
  border: 1px solid var(--emerald-border);
  border-left: 3px solid var(--emerald-primary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .proof-summary-strip {
    grid-template-columns: 1fr 1fr;
  }
  .proof-math-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Terminal V2 UI Additions
   ========================================================================== */

/* Basis Year Badge in Shariah Panel */
.shariah-basis-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.3px;
}

/* Shock Annotations on Financials Table */
.fy-cell-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.shock-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: help;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}

.shock-pill.shock-drop {
  background-color: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.shock-pill.shock-surge {
  background-color: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.shock-pill.shock-info {
  background-color: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.shock-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Shock Tooltip Box */
.shock-tooltip-box {
  display: none;
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 8px;
  width: 280px;
  background-color: #0b1512;
  border: 1px solid var(--emerald-border);
  border-left: 3px solid #f59e0b;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  z-index: 1000;
  text-align: left;
  font-family: var(--font-sans);
  pointer-events: none;
}

.shock-pill:hover .shock-tooltip-box {
  display: block;
}

.shock-tooltip-title {
  font-size: 11px;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 3px;
  line-height: 1.3;
}

.shock-tooltip-meta {
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 4px;
  margin-top: 4px;
}

/* Provenance Tooltip Hover */
.provenance-hover-wrapper {
  position: relative;
  display: inline-block;
}

.provenance-tooltip-box {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 6px;
  width: 320px;
  background-color: #091410;
  border: 1px solid var(--emerald-border);
  border-left: 3px solid var(--emerald-primary);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75);
  z-index: 1000;
  text-align: left;
  pointer-events: none;
}

.provenance-hover-wrapper:hover .provenance-tooltip-box {
  display: block;
}

.provenance-quote-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.06);
  padding: 6px 8px;
  border-radius: 3px;
  border: 1px solid rgba(16, 185, 129, 0.15);
  line-height: 1.4;
  margin-bottom: 6px;
}

.provenance-source-info {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  word-break: break-all;
}

/* Exposure Peers Chips */
.tag-exposure-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--text-primary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag-exposure-chip:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--emerald-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
}

.exposure-comm-label {
  color: #34d399;
  font-weight: 600;
  text-transform: capitalize;
}

.exposure-ticker-label {
  background: var(--bg-card);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border-subtle);
  font-weight: 700;
  color: #f1f5f9;
}

/* ==========================================================================
   Cosmetic Overhaul — Finish & Polish (quiet-luxury pass)
   ========================================================================== */

/* Consistent keyboard focus ring in the brand gold */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 1px;
  border-radius: var(--radius-sm);
}

/* Text-input focus → gold, not blue */
.sidebar-search input:focus,
.terminal-input:focus,
.terminal-select:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px var(--accent-gold-soft);
}

/* Section titles: quieter, letter-spaced, muted (per design system) */
.panel-title {
  letter-spacing: 0.2px;
  color: var(--text-primary);
}

/* Header price — the single focal figure */
.price-val { letter-spacing: -0.5px; }

/* Panels lift very slightly on hover for tactility, no heavy shadow */
.panel { transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.panel:hover { border-color: var(--border-strong); }

/* Market-status dot reads gold/amber when the market is closed */
.market-status .status-dot { background-color: var(--accent-gold); }

/* Refined, unobtrusive scrollbars */
.company-list, .main-content, .table-responsive, .modal-card-wide .modal-body {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.company-list::-webkit-scrollbar,
.main-content::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar,
.modal-card-wide .modal-body::-webkit-scrollbar { width: 9px; height: 9px; }
.company-list::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb,
.modal-card-wide .modal-body::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.company-list::-webkit-scrollbar-thumb:hover,
.main-content::-webkit-scrollbar-thumb:hover { background: #3a4553; background-clip: padding-box; }
.company-list::-webkit-scrollbar-track,
.main-content::-webkit-scrollbar-track { background: transparent; }

/* Table rows: smoother hover, subtle separators */
.data-table tr { transition: background-color 0.12s ease; }

/* Panel badges: hairline instead of grey fill for a cleaner look */
.panel-badge {
  background-color: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}

/* User avatar: quiet, bordered, no bright gradient */
.user-avatar {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}

/* Metric cards: hairline top-rule for a "reading rail" feel */
.metric-card { transition: border-color 0.15s ease; }
.metric-card:hover { border-color: var(--border-strong); }

/* Bridge link on Company Screen to Shariah Tab */
.bridge-shariah-link {
  font-size: 11px;
  font-family: var(--font-sans);
  color: var(--accent-gold);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.15s ease, text-decoration 0.15s ease;
}

.bridge-shariah-link:hover {
  text-decoration: underline;
  opacity: 0.85;
}

/* ==========================================================================
   Screen D: Assistant (Grounded Knowledge-Graph Chat)
   ========================================================================== */

.intel-screen-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 80px);
  padding: 16px;
}

.intel-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  overflow: hidden;
}

.intel-panel .panel-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

.intel-chat-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.intel-chips-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  flex-shrink: 0;
}

.chips-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.chips-list {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}

.intel-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.intel-chip:hover {
  background: rgba(212, 160, 23, 0.1);
  border-color: var(--accent-gold);
  color: var(--text-primary);
}

.intel-log {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.intel-msg {
  display: flex;
  max-width: 80%;
  animation: fadeIn 0.15s ease;
}

.intel-msg.msg-user {
  align-self: flex-end;
}

.intel-msg.msg-assistant {
  align-self: flex-start;
  max-width: 85%;
}

.msg-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
}

.msg-user .msg-bubble {
  background: var(--accent-gold-soft);
  border: 1px solid var(--accent-gold);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.msg-assistant .msg-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-bottom-left-radius: 2px;
}

.msg-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-text strong {
  color: #f1f5f9;
}

/* Receipts collapsible */
.msg-receipts-toggle {
  margin-top: 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  user-select: none;
  background: var(--bg-input);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  transition: color 0.15s;
}

.msg-receipts-toggle:hover {
  color: var(--accent-gold);
}

.msg-receipts-box {
  display: none;
  margin-top: 8px;
  padding: 10px;
  background: #08100d;
  border: 1px solid var(--border-subtle);
  border-left: 2px solid var(--emerald-primary);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  max-height: 200px;
  overflow-y: auto;
}

.msg-receipts-box.open {
  display: block;
}

.receipt-item {
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.receipt-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.receipt-tool-name {
  color: #34d399;
  font-weight: 700;
  margin-bottom: 2px;
}

.receipt-payload {
  color: var(--text-muted);
  word-break: break-all;
  white-space: pre-wrap;
}

/* Chat Input Bar */
.intel-input-area {
  padding: 14px 20px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.intel-form {
  display: flex;
  gap: 10px;
}

.intel-input-field {
  flex: 1;
  padding: 10px 14px;
  font-size: 13px;
}

.btn-intel-send {
  background: var(--accent-gold);
  color: #0b1512;
  border: none;
  font-size: 12px;
  font-weight: 700;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.btn-intel-send:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-intel-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Typing state */
.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

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


/* Two-Source Grounded RAG & Web Citation Styles */
.intel-status-line {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.highlight-certified {
  color: #34d399;
  font-weight: 700;
  display: inline-block;
  margin-top: 4px;
}

.highlight-context {
  color: #38bdf8;
  font-weight: 700;
  display: inline-block;
  margin-top: 6px;
}

.chat-markdown-link {
  color: #38bdf8;
  text-decoration: underline;
  font-weight: 600;
}

.chat-markdown-link:hover {
  color: #7dd3fc;
}

.sources-subgroup {
  margin-bottom: 10px;
}

.sources-subgroup:last-child {
  margin-bottom: 0;
}

.sources-subgroup-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.web-sources-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.web-source-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-left: 2px solid #38bdf8;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

.web-source-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.web-tier-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 1px 5px;
  border-radius: 2px;
  white-space: nowrap;
}

.web-source-link {
  font-size: 11px;
  font-weight: 600;
  color: #f1f5f9;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-source-link:hover {
  color: #38bdf8;
  text-decoration: underline;
}

.web-source-meta {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ==========================================================================
   Table Sorting & Caret Styles (Screen B Marché)
   ========================================================================== */
.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease, background-color 0.15s ease;
  position: relative;
}

.sortable-th:hover {
  color: var(--accent-gold);
  background-color: rgba(201, 169, 97, 0.05);
}

.sortable-th:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: -2px;
}

.sort-caret {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.35;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.sortable-th:hover .sort-caret {
  opacity: 0.7;
}

.sortable-th.sort-asc .sort-caret {
  opacity: 1;
  color: var(--accent-gold);
}

.sortable-th.sort-desc .sort-caret {
  opacity: 1;
  color: var(--accent-gold);
}

/* ==========================================================================
   Skeleton Shimmer Loaders (Cold-Load Polish)
   ========================================================================== */
.skeleton-box {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 25%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.03) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin: 4px 0;
  display: inline-block;
}

.skeleton-row td {
  padding: 12px 10px;
}

.skeleton-chart {
  width: 100%;
  height: 100%;
  min-height: 200px;
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
