/* deep.css - theme for Deep treemap sidebar and filters using app theme variables */
:root {
  --deep-surface: var(--card-bg);
  --deep-muted: var(--text-secondary);
  --deep-accent: var(--gradient-start);
  --deep-border: var(--border-color);
  --deep-shadow: var(--shadow-color);
  
  /* Treemap padding settings (in pixels) */
  --treemap-padding-outer: 6;       /* Padding around outer edge of treemap */
  --treemap-padding-inner: 5;       /* Gap between stock boxes */
  --treemap-padding-industry: 4;    /* Padding around industry borders */
}

/* Quick Lookup input: make it prominent (large font + glow) */
.deep-lookup-modal .deep-lookup-input {
  width: 100% !important;
  font-size: 3rem !important;
  line-height: 1.05 !important;
  padding: 18px 20px !important;
  border-radius: 10px !important;
  border: 2px solid var(--gradient-start) !important;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 12px 36px rgba(124,58,237,0.22), 0 0 28px rgba(124,58,237,0.12) inset !important;
  outline: none !important;
}

.deep-lookup-modal .deep-lookup-input::placeholder {
  color: var(--hover-bg) !important; /* จางลง */
  opacity: 1 !important; /* บังคับให้แสดงความโปร่งตามที่ตั้ง */
}

.deep-lookup-modal .deep-lookup-input:focus {
  box-shadow: 0 18px 48px rgba(124,58,237,0.28), 0 0 36px rgba(124,58,237,0.18) inset !important;
  transform: translateY(-2px) !important;
}

.deep-lookup-modal {
  /* slightly brighter modal background to draw attention */
  width: 40% !important;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
}

/* Loading spinner animation */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Deep filter panel overrides */
.deep-filter-panel {
  width: 85vh;
}

.deep-filter-panel .chat-config-body {
  padding: 12px;
  overflow-y: auto;
  height: calc(100% - 56px);
}

.deep-filter-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.18);
  opacity: 0;
  transition: opacity 220ms ease;
  pointer-events: none;
  z-index: 1100;
}

/* Filter controls */
.deep-filter-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.deep-filter-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.deep-preset-btn {
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.deep-preset-btn:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.deep-condition-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--card-bg);
}

.deep-condition-row select {
  padding: 4px 6px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 12px;
}

/* Material Design 3 Range Slider Styling */
.deep-condition-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 40px; /* Larger touch target for accessibility */
  background: transparent;
  margin: 0;
  cursor: pointer;
  position: absolute;
  pointer-events: auto !important;
  border: none;
  outline: none;
}

/* Material Design 3 Slider Thumb */
.deep-condition-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px; /* M3 spec: 20px with 2px border = 16px visual */
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--gradient-start);
  box-shadow: 0 2px 6px rgba(16, 24, 40, 0.15);
  cursor: pointer;
  margin-top: -8px; /* Center on track */
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

/* Hover state - Material Design 3 */
.deep-condition-row input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(16, 24, 40, 0.2);
}

/* Active/Dragging state */
.deep-condition-row input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.2);
  box-shadow: 0 6px 12px rgba(16, 24, 40, 0.25);
}

/* Focus state for accessibility */
.deep-condition-row input[type="range"]:focus::-webkit-slider-thumb {
  outline: 2px solid var(--gradient-start);
  outline-offset: 2px;
}

/* Firefox support */
.deep-condition-row input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--gradient-start);
  box-shadow: 0 2px 6px rgba(16, 24, 40, 0.15);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.deep-condition-row input[type="range"]:hover::-moz-range-thumb {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(16, 24, 40, 0.2);
}

.deep-condition-row input[type="range"]:active::-moz-range-thumb {
  transform: scale(1.2);
  box-shadow: 0 6px 12px rgba(16, 24, 40, 0.25);
}

/* Track styling - hide default */
.deep-condition-row input[type="range"]::-webkit-slider-runnable-track {
  background: transparent;
  height: 4px;
  border: none;
}

.deep-condition-row input[type="range"]::-moz-range-track {
  background: transparent;
  border: none;
  height: 4px;
}

.deep-range-box {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.deep-range-label {
  font-size: 13px;
  color: var(--text-primary);
}

.deep-range-values {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  color: var(--gradient-start);
  font-weight: 600;
  margin-bottom: 4px;
}

.deep-range-min, .deep-range-max {
  font-size: 12px;
}

/* Slider rail with histogram */
.deep-slider-rail {
  position: relative;
  height: 44px;
  display: flex;
  align-items: center;
}

.deep-histogram {
  position: absolute;
  left: 6px;
  right: 6px;
  height: 22px;
  top: 8px;
  display: flex;
  gap: 2px;
  align-items: flex-end;
  opacity: 0.36;
}

.deep-histogram .bar {
  flex: 1 1 auto;
  background: var(--text-secondary);
  border-radius: 3px;
}

.deep-range-wrap {
  position: relative;
  width: 100%;
  display: flex;
  gap: 8px;
}

.deep-range-wrap input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  position: absolute;
  margin: 0;
}

.deep-range-wrap input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: transparent;
}

.deep-range-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: #fff;
  border: 2px solid var(--gradient-start);
  box-shadow: 0 2px 6px rgba(16,24,40,0.08);
  margin-top: -9px;
  cursor: pointer;
}

.deep-range-wrap input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: #fff;
  border: 2px solid var(--gradient-start);
  cursor: pointer;
}

.deep-range-wrap .range-filled {
  position: absolute;
  height: 6px;
  top: 14px;
  left: 6px;
  right: 6px;
  background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
  border-radius: 6px;
  pointer-events: none;
}

/* Inputs and buttons */
.deep-filter-controls input[type="number"] {
  border: 1px solid var(--border-color);
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-primary);
}

.deep-filter-controls .option-btn.subtle {
  background: transparent;
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.2s ease, color 0.2s ease;
}

.deep-filter-controls .option-btn.subtle:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.deep-filter-summary {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 6px;
}

.deep-llm-container {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.deep-bot-message {
  margin-top: 8px;
  padding: 5px 20px;
  background: rgba(124, 58, 237, 0.08);
  border-left: 3px solid rgba(124, 58, 237, 0.5);
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-primary);
}

.deep-filter-apply {
  align-self: flex-start;
  padding: 8px 12px;
  background: var(--gradient-start);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s ease;
}

.deep-filter-apply:hover {
  background: var(--gradient-end);
}

.deep-range-container {
  display: flex;
  flex-direction: column;
  width: 220px;
  margin-right: 8px;
}

.deep-val-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.deep-slider-container {
  flex: 1 1 auto;
}

/* Deep treemap canvas and boxes */
.deep-root {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  background: var(--card-bg);
  color: var(--text-primary);
  border-radius: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.deep-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0px;
  padding: 8px;
  flex: 0 0 auto;
}

.deep-legend {
  display: flex;
  gap: 8px;
  align-items: center;
}

.deep-legend .item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.deep-legend .sw {
  width: 14px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.deep-canvas {
  position: relative;
  flex: 1;
  width: 100%;
  max-height: 90vh;
  padding: 2px;
  border: 0px;
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
  display: block;
}

.deep-canvas svg {
  display: block;
  min-width: 100%;
  min-height: 100%;
}

/* Mobile-only sector strip layout used instead of the SVG treemap */
.deep-mobile-sector-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  box-sizing: border-box;
  touch-action: pan-y;
}

.deep-mobile-sector-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.25);
  touch-action: pan-y;
}

.deep-mobile-sector-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: color 0.2s ease;
}

.deep-mobile-sector-label:hover {
  color: var(--gradient-start);
}

.deep-mobile-sector-label span:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
}

.deep-mobile-sector-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.deep-mobile-sector-bars {
  /* Touch/pan note: allow horizontal swipes to start immediately without focusing the row */
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  user-select: none;
}

.deep-mobile-sector-bar {
  flex: 0 0 auto;
  min-width: 80px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  scroll-snap-align: start;
  text-align: left;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.deep-mobile-sector-bar span {
  font-size: 13px;
}

.deep-mobile-sector-bar small {
  font-size: 11px;
  opacity: 0.85;
}

.deep-mobile-sector-bar:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.6);
}

.deep-mobile-sector-empty {
  padding: 32px 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Scrollbar styling for deep-canvas - horizontal and vertical */
.deep-canvas::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.deep-canvas::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}

.deep-canvas::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.4);
  border-radius: 4px;
}

.deep-canvas::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 58, 237, 0.6);
}

/* Firefox scrollbar styling */
.deep-canvas {
  scrollbar-color: rgba(124, 58, 237, 0.4) rgba(0, 0, 0, 0.05);
  scrollbar-width: thin;
}

/* Industry border styling for treemap */
.deep-canvas svg .industry-border {
  fill: none;
  stroke: rgba(100, 50, 200, 0.6);
  stroke-width: 1px;
  stroke-dasharray: 6, 3;
  stroke-linecap: round;
  pointer-events: none;
}

/* Industry label styling for treemap */
.deep-canvas svg .industry-label {
  font-size: 14px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 600;
  fill: var(--text-primary)!important;
  pointer-events: auto;
  user-select: none;
  margin: 8px;
}

.deep-box {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px;
  color: var(--text-primary);
  font-weight: 600;
  border-radius: 4px;
  box-shadow: 0 1px 6px var(--shadow-color);
  transform-origin: center center;
  transition: transform 160ms ease, box-shadow 160ms ease;
  cursor: default;
  user-select: none;
}

.deep-box:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 6px 18px var(--shadow-color);
}

.deep-box .symbol {
  font-size: 12px;
  color: inherit;
}

.deep-box.small .symbol {
  font-size: 10px;
}

.deep-box.large .symbol {
  font-size: 14px;
}

.deep-footer {
  margin-top: 0;
  padding: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  background: var(--card-bg);
  text-align: left;
  flex: 0 0 auto;
  
  /* Horizontal flex layout */
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

/* Footer summary info section */
.deep-table-summary-header {
  display: flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
  flex-shrink: 0;
}

.deep-table-summary-header .summary-info {
  align-items: center;
  white-space: nowrap;
}

.deep-table-summary-header .summary-item {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 4px;
  background: rgba(124, 58, 237, 0.1);
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
}

/* Footer label + selector groups */
.deep-footer label {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.deep-footer select {
  padding: 6px 10px !important;
  font-size: 12px !important;
  background: var(--card-bg) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  white-space: nowrap;
  width: 120px !important;
}

/* Pagination controls */
.deep-pagination {
  display: flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

.deep-pagination .option-btn {
  padding: 6px 12px !important;
  font-size: 12px !important;
  white-space: nowrap;
}

.deep-page-info {
  display: inline-block;
  padding: 4px 8px;
  background: rgba(124, 58, 237, 0.1);
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
  min-width: 50px;
  text-align: center;
}

/* Treemap container layout */
.deep-root-div {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 500px;
  flex: 1;
  overflow-x: hidden;
}

/* Color helpers using theme */
.c-green-light {
  background: #00a334;
  color: #0b4726;
}

.c-green-mid {
  background: #00752b;
  color: #03361e;
}

.c-green-dark {
  background: #ff0000;
  color: #ff8c00;
}

.c-yellow {
  background: #ffdc2f;
  color: #4a3b00;
}

.c-red-mid {
  background: #ff9a8a;
  color: #4b0500;
}

.c-red-dark {
  background: #d02b2b;
  color: #fff0f0;
}

.c-purple-loss {
  background: #7b2b5a;
  color: #fff6fb;
}

/* ========== DETAIL PANEL STYLES ========== */

.deep-detail-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  background: var(--primary-bg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  animation: slideInUp 220ms ease;
  --deep-left-width: 350px;
  overflow: hidden;
}

.deep-detail-split {
  display: flex;
  flex-direction: row;
  flex: 1;
  overflow: hidden;
}

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

@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes bounceIn {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes bounceOut {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.deep-detail-left {
  flex: 0 0 var(--deep-left-width);
  padding: 10px 10px 80px 10px;
  overflow-y: hidden;
  border-right: 1px solid var(--border-color);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Collapse/expand behavior for left panel */
.deep-detail-button {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text-primary);
  padding: 6px 8px;
  margin: 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.deep-detail-button:hover { opacity: 0.95; }

.deep-detail-panel.left-collapsed .deep-detail-left {
  flex: 0 0 0 !important;
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  border-right: none !important;
  transition: flex 180ms ease, width 180ms ease, padding 180ms ease;
}
.deep-detail-panel.left-collapsed .deep-detail-divider {
  display: none !important;
}
.deep-detail-panel.left-collapsed .deep-detail-right {
  flex: 1 1 auto;
}

/* Compact mode: position on right side with 80% width and slide-in animation */
.deep-detail-panel.deep-compact-mode {
  position: fixed;
  top: 0;
  right: 0;
  left: auto;
  width: 80%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  border-radius: 0;
  animation: slideInFromRight 300ms ease-out;
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.3);
}

.deep-detail-panel.deep-compact-mode .deep-detail-left {
  display: none !important;
}

.deep-detail-panel.deep-compact-mode .deep-detail-divider {
  display: none !important;
}

.deep-detail-panel.deep-compact-mode .deep-detail-right {
  flex: 1 1 100%;
  width: 100%;
}

/* Give the split panels a smooth width transition when resizing/collapsing */
.deep-detail-left,
.deep-detail-right {
  transition: flex 180ms ease, width 180ms ease;
}

/* Fullscreen overlay for deep chart */
.deep-chart-fullscreen-overlay {
  height: fit-content;
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: var(--primary-bg, #0b0b0b);
  padding: 14px;
  box-sizing: border-box;
  overflow: auto;
}
.deep-chart-fullscreen-overlay .deep-chart-section {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  max-height: 100%;
}
.deep-chart-fullscreen-close {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 21000;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: 0;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.deep-detail-left h2 {
  margin: 0 0 8px 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.deep-detail-left p {
  margin: 0;
  font-size: 1.0rem;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
    font-family: "Inter", "Prompt", "Sarabun", system-ui, -apple-system, sans-serif;
  font-weight: 400;
  letter-spacing: 0.01em;


  /* 👇 เพิ่มความคม */
  -webkit-font-smoothing: antialiased;   /* สำหรับ WebKit (Chrome, Safari) */
  -moz-osx-font-smoothing: grayscale;    /* สำหรับ macOS / Firefox */
  text-rendering: optimizeLegibility;    /* เร่งการจัดขอบตัวอักษร */
  font-feature-settings: "kern";         /* เปิดการจัดระยะอักษร */
}
.deep-detail-left .info-card {
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.deep-detail-left .info-card .label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.deep-detail-left .info-card .value {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.deep-detail-left .metrics-grid {
  display: grid;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
}

.deep-detail-left .metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.deep-detail-left .metric-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.deep-detail-left .metric-value {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
}

.deep-detail-left .metric-value.positive {
  color: #4ade80;
}

.deep-detail-left .metric-value.negative {
  color: #f87171;
}

/* Chat input container in detail panel */
.deep-detail-chat-container {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  overflow: hidden;
}

.deep-detail-chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 92%;
  padding: 0px;
  margin-bottom: 8px;
}

/* Individual chat message */
.deep-chat-message {
  display: flex;
  animation: slideIn 0.3s ease;
}

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

/* User message (right aligned) */
.deep-chat-user {
  justify-content: flex-end;
}

.deep-chat-user .deep-chat-bubble {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: #fff;
  border-radius: 12px 12px 4px 12px;
}

/* Bot message (left aligned) */
.deep-chat-bot {
  justify-content: flex-start;
}

.deep-chat-bot .deep-chat-bubble {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px 12px 12px 4px;
}

/* Chat bubble */
.deep-chat-bubble {
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.4;
  word-wrap: break-word;
}

.deep-chat-text {
  font-size: 1rem;
  margin-bottom: 4px;
  line-height: 1.6;
}

/* Markdown formatting styles for chat messages */
.deep-chat-text h1,
.deep-chat-text h2,
.deep-chat-text h3,
.deep-chat-text h4,
.deep-chat-text h5,
.deep-chat-text h6 {
  margin: 12px 0 8px 0;
  font-weight: 600;
  color: inherit;
  line-height: 1.3;
}

.deep-chat-text h1 { font-size: 1.5em; }
.deep-chat-text h2 { font-size: 1.3em; }
.deep-chat-text h3 { font-size: 1.1em; }
.deep-chat-text h4 { font-size: 1em; }
.deep-chat-text h5 { font-size: 0.95em; }
.deep-chat-text h6 { font-size: 0.9em; }

.deep-chat-text strong,
.deep-chat-text b {
  font-weight: 600;
  color: var(--gradient-start, inherit);
}

.deep-chat-text em,
.deep-chat-text i {
  font-style: italic;
  opacity: 0.95;
}

.deep-chat-text code {
  background: rgba(0, 0, 0, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', 'Monaco', monospace;
  font-size: 0.9em;
  color: var(--text-primary);
}

.deep-chat-text pre {
  background: rgba(0, 0, 0, 0.15);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  font-family: 'Courier New', 'Monaco', monospace;
  font-size: 0.85em;
  line-height: 1.4;
  margin: 8px 0;
  border-left: 3px solid var(--gradient-start, rgba(124, 58, 237, 0.3));
}

.deep-chat-text pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: inherit;
}

.deep-chat-text ul,
.deep-chat-text ol {
  margin: 8px 0;
  padding-left: 20px;
}

.deep-chat-text li {
  margin: 4px 0;
  line-height: 1.5;
}

.deep-chat-text blockquote {
  border-left: 3px solid var(--gradient-start, rgba(124, 58, 237, 0.3));
  padding-left: 12px;
  margin: 8px 0;
  opacity: 0.85;
  font-style: italic;
  color: var(--text-primary);
}

.deep-chat-text table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0;
  font-size: 0.9em;
}

.deep-chat-text table th,
.deep-chat-text table td {
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px;
  text-align: left;
}

.deep-chat-text table th {
  background: rgba(124, 58, 237, 0.1);
  font-weight: 600;
  color: var(--gradient-start, inherit);
}

.deep-chat-text table tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.05);
}

.deep-chat-text a {
  color: var(--gradient-start, #0066cc);
  text-decoration: none;
  border-bottom: 1px solid rgba(124, 58, 237, 0.3);
  transition: color 0.2s, border-color 0.2s;
}

.deep-chat-text a:hover {
  color: var(--gradient-end, #0052a3);
  border-bottom-color: var(--gradient-start, #0066cc);
}

/* Paragraph spacing */
.deep-chat-text p {
  margin: 6px 0;
}

.deep-chat-text p:first-child {
  color: var(--text-primary);
  margin-top: 0;
}

.deep-chat-text p:last-child {
  margin-bottom: 0;
}

.deep-chat-time {
  font-size: 10px;
  opacity: 0.7;
  text-align: right;
}

/* Scrollbar styling for chat messages */
.deep-detail-chat-messages::-webkit-scrollbar {
  width: 4px;
}

.deep-detail-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.deep-detail-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.3);
  border-radius: 2px;
}

.deep-detail-chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 58, 237, 0.5);
}

.deep-detail-chat-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.deep-detail-chat-input {
  flex: 1 1 auto;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  max-height: 80px;
  min-height: 36px;
  line-height: 1.4;
  transition: background 0.2s, border-color 0.2s;
}

.deep-detail-chat-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(124, 58, 237, 0.4);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

.deep-detail-chat-input::placeholder {
  color: var(--text-secondary);
}

.deep-detail-chat-send-btn {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.deep-detail-chat-send-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.deep-detail-chat-send-btn:active {
  transform: translateY(0);
}

.deep-detail-chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.deep-detail-right {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--card-bg);
}

#deepChartContainer {
  width: 100%;

}

/* Tab navigation for detail sections */
.deep-detail-tabs {
  min-height: 60px;
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-color);
  padding: 0;
  background: var(--primary-bg);
  flex-wrap: nowrap;
  position: sticky;
  top: 0;
  z-index: 100;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.deep-detail-tab {
  padding: 18px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 1.3rem;
  font-weight: 800;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  white-space: nowrap;
  text-transform: capitalize;
}

.deep-detail-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.deep-detail-tab.active {
  color: var(--gradient-start);
  border-bottom-color: var(--gradient-start);
  background: rgba(124, 58, 237, 0.08);
}

/* Tab content area */
.deep-detail-content {
  background: var(--sidebar-bg);
  padding: 20px 10px;
  overflow: hidden;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.deep-detail-right h3 {
  margin: 0 0 12px 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

.deep-detail-right h4 {
  margin: 12px 0 8px 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.deep-detail-right .description-box {
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  border-radius: 8px;
  border-left: 3px solid rgb(124, 58, 237);
}

.deep-detail-right .description-box p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.deep-detail-right ul {
  margin: 0;
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 13px;
}

.deep-detail-right ul li {
  margin: 6px 0;
}

.deep-detail-right ul strong {
  color: var(--text-primary);
}

/* Financial statement table */
.deep-detail-tab-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 12px;
}

.deep-detail-tab-content table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.deep-detail-tab-content table thead tr {
  border-bottom: 2px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

.deep-detail-tab-content table thead th {
  padding: 6px 4px;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  font-size: 1rem;
  letter-spacing: 0.5px;
}

.deep-detail-tab-content table thead th:not(:first-child) {
  text-align: right;
}

.deep-detail-tab-content table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s ease;
}

.deep-detail-tab-content table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.deep-detail-tab-content table tbody td {
  padding: 5px 4px;
  color: var(--text-secondary);
}

.deep-detail-tab-content table tbody td:first-child {
  font-size: 0.9rem;
  color: var(--menu-text);
  font-weight: 300 !important;
}

.deep-detail-tab-content table tbody td:not(:first-child) {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 1rem;
  text-align: right;
  color: var(--text-primary);
}

.deep-detail-tab-content table tbody tr td:last-child {
  padding-right: 12px;
}

/* Highlight total rows */
.deep-detail-tab-content table tbody tr:nth-child(5) td,
.deep-detail-tab-content table tbody tr:nth-child(9) td,
.deep-detail-tab-content table tbody tr:nth-child(10) td {
  font-weight: 600;
  background: rgba(0, 0, 0, 0.15);
  border-top: 1px solid rgba(124, 58, 237, 0.3);
  border-bottom: 1px solid rgba(124, 58, 237, 0.3);
}

/* Form controls */
/* Tab content styling */
.deep-detail-tab-content {
  padding: 0px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: auto;
}

.deep-detail-tab-content select {
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.deep-detail-tab-content select:hover {
  border-color: var(--gradient-start);
  background: rgba(124, 58, 237, 0.05);
}

.deep-detail-tab-content select:focus {
  outline: none;
  border-color: var(--gradient-start);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

/* Controls container */
.deep-detail-tab-content > div:first-of-type {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 6px;
  margin-bottom: 12px;
}

/* Fundamental controls */
.deep-fundamental-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  margin-bottom: 12px;
}

.deep-fundamental-controls label {
  color: var(--text-secondary);
  font-size: 13px;
}

.deep-fundamental-select {
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.deep-fundamental-select:hover {
  border-color: var(--gradient-start);
  background: rgba(124, 58, 237, 0.05);
}

.deep-fundamental-select:focus {
  outline: none;
  border-color: var(--gradient-start);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

/* Horizontal scrolling for table */
.deep-fundamental-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.deep-fundamental-table-wrapper::-webkit-scrollbar {
  height: 6px;
}

.deep-fundamental-table-wrapper::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

.deep-fundamental-table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.4);
  border-radius: 3px;
}

.deep-fundamental-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 58, 237, 0.6);
}

/* Table styling */
.deep-fundamental-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 12px;
}

.deep-fundamental-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.deep-fundamental-table thead tr {
  border-bottom: 2px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

.deep-fundamental-table thead th {
  padding: 12px 8px;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.deep-fundamental-table thead th:not(:first-child) {
  text-align: right;
}

.deep-fundamental-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s ease;
}

.deep-fundamental-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.deep-fundamental-table tbody td {
  padding: 10px 8px;
  color: var(--text-secondary);
}

.deep-fundamental-table tbody td:first-child {
  color: var(--text-secondary);
  font-weight: 500;
}

.deep-fundamental-table tbody td:not(:first-child) {
  text-align: right;
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
}

/* Highlight total rows */
.deep-fundamental-table tbody tr.deep-fundamental-total td {
  font-weight: 600;
  background: rgba(0, 0, 0, 0.15);
  border-top: 1px solid rgba(124, 58, 237, 0.3);
  border-bottom: 1px solid rgba(124, 58, 237, 0.3);
}

/* Chart container */
.deep-chart-container {
  width: 100% !important;
  height: 500px !important;
  min-height: 500px !important;
  overflow: hidden !important;
  border: none;
  position: relative;
}

#deepChartContainer {
  width: 100% !important;
  height: 100% !important;
}

/* Chart section */
.deep-chart-section {
  padding: 12px 0 0 0;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* Chart period buttons */
.deep-chart-controls {
  display: flex;
  gap: 2px;
  margin-bottom: 5px;
  padding: 0px;
}

#deepChartPeriodControls {
  width: 100%;
  overflow: hidden;
  flex: 1 1 auto;
  min-width: 0;
}

.deep-chart-period-btn {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.deep-chart-period-btn:hover {
  border-color: var(--gradient-start);
  color: var(--text-primary);
  background: rgba(124, 58, 237, 0.05);
}

.deep-chart-period-btn.active {
  background: var(--gradient-start);
  border-color: var(--gradient-start);
  color: #fff;
}

/* Chart header with mode toggle and period controls */
.deep-chart-header {
  display: flex;
  justify-content: left;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 5px 0px;
  border-bottom: 1px solid var(--border-color);
  background: transparent;
}

/* Chart mode toggle buttons */
.deep-chart-mode-toggle {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  padding: 4px;
}

.deep-chart-mode-btn {
  padding: 3px 5px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.deep-chart-mode-btn:hover {
  color: var(--text-primary);
  background: rgba(124, 58, 237, 0.1);
}

.deep-chart-mode-btn.active {
  background: var(--gradient-start);
  border-color: var(--gradient-start);
  color: #fff;
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.4);
}

/* Chart Period Controls Wrapper - Horizontal Scroll */
#deepChartPeriodControls > div {
  display: flex;
  overflow-x: auto;
  overflow-y: visible;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  width: 100%;
  padding: 8px 4px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  min-height: 50px;
  min-width: 0;
  max-width: 100%;
}

/* Scrollbar for period controls - Make it visible */
#deepChartPeriodControls > div::-webkit-scrollbar {
  height: 8px;
  background: rgba(0, 0, 0, 0.05);
}

#deepChartPeriodControls > div::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 4px;
}

#deepChartPeriodControls > div::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.6);
  border-radius: 4px;
  min-height: 30px;
}

#deepChartPeriodControls > div::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 58, 237, 0.9);
}

/* Indicator Toggles - Horizontal Scroll Container */
.deep-indicator-toggles-wrapper {
  display: flex;
  overflow-x: auto;
  overflow-y: visible;
  gap: 8px;
  flex-direction: row;
  align-items: center;
  padding: 4px 8px;
  min-height: 36px;
  width: auto;
  max-width: 100%;
  /* Allow horizontal scrolling on mobile */
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  flex: 0 0 auto;
  min-width: max-content;
}

/* Scrollbar styling for indicator toggles - Make it visible */
.deep-indicator-toggles-wrapper::-webkit-scrollbar {
  height: 6px;
  background: rgba(0, 0, 0, 0.05);
}

.deep-indicator-toggles-wrapper::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 3px;
}

.deep-indicator-toggles-wrapper::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.6);
  border-radius: 3px;
  min-height: 25px;
}

.deep-indicator-toggles-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 58, 237, 0.9);
}

/* Individual indicator toggle label */
.deep-indicator-toggle-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-primary);
  white-space: nowrap;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.02);
}

.deep-indicator-toggle-label:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: rgba(124, 58, 237, 0.3);
}

.deep-indicator-toggle-label input[type="checkbox"] {
  cursor: pointer;
  accent-color: #7c3aed;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.deep-indicator-toggle-label input[type="checkbox"]:checked {
  accent-color: #7c3aed;
}

/* Checked state for indicator toggle */
.deep-indicator-toggle-label input[type="checkbox"]:checked + * {
  color: #7c3aed;
  font-weight: 600;
}

/* Fundamental Chart Tabs */
.deep-fundamental-tabs {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
}

.deep-fundamental-tab-buttons {
  display: flex;
  flex-direction: row;
  gap: 4px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid var(--border-color);
  overflow-x: scroll;
}

.deep-fundamental-tab-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 6px;
  background: rgba(124, 58, 237, 0.08);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.deep-fundamental-tab-btn:hover {
  background: rgba(124, 58, 237, 0.15);
  border-color: rgba(124, 58, 237, 0.5);
  color: var(--text-primary);
}

.deep-fundamental-tab-btn.active {
  background: var(--gradient-start);
  border-color: var(--gradient-start);
  color: #fff;
  box-shadow: 0 0 8px rgba(124, 58, 237, 0.3);
}

.deep-fundamental-chart-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 0px;
}

/* Peer Analysis Tabs Styling */
.deep-peer-tabs {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.deep-peer-tab-buttons {
  display: flex;
  flex-direction: row;
  gap: 4px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  overflow-x: auto;
}

.deep-peer-tab-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.08);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.deep-peer-tab-btn:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.5);
  color: var(--text-primary);
}

.deep-peer-tab-btn.active {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-color: #2563eb;
  color: #fff;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.deep-peer-chart-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

/* IAA Tab Styles */
.deep-iaa-tabs {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.deep-iaa-tab-buttons {
  display: flex;
  gap: 4px;
  padding: 8px;
  background: rgba(168, 85, 247, 0.05);
  border-radius: 6px;
  flex-wrap: wrap;
}

.deep-iaa-tab-btn {
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid rgba(168, 85, 247, 0.3);
  background: transparent;
  color: rgba(168, 85, 247, 0.8);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.deep-iaa-tab-btn:hover {
  background: rgba(168, 85, 247, 0.1);
}

.deep-iaa-tab-btn.active {
  background: linear-gradient(135deg, #a855f7, #9333ea);
  border-color: #9333ea;
  color: #fff;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.3);
}

/* Dividend Chart Tabs */
.deep-dividend-tabs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  height: 100%;
}

.deep-dividend-tab-buttons {
  display: flex;
  gap: 4px;
  background: rgba(20, 184, 166, 0.05);
  padding: 6px;
  border-radius: 6px;
  border: 1px solid rgba(20, 184, 166, 0.2);
}

.deep-dividend-tab-btn {
  padding: 6px 12px;
  font-size: 12px;
  background: transparent;
  border: 1px solid rgba(20, 184, 166, 0.3);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.deep-dividend-tab-btn:hover {
  background: rgba(20, 184, 166, 0.1);
}

.deep-dividend-tab-btn.active {
  background: linear-gradient(135deg, #14b8a6, #0d9488);
  border-color: #0d9488;
  color: #fff;
  box-shadow: 0 0 8px rgba(20, 184, 166, 0.3);
}

.deep-iaa-chart-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

/* Horizontal scrolling for table */
.deep-detail-tab-content > div:has(table) {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.deep-detail-tab-content > div:has(table)::-webkit-scrollbar {
  height: 6px;
}

.deep-detail-tab-content > div:has(table)::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

.deep-detail-tab-content > div:has(table)::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.4);
  border-radius: 3px;
}

.deep-detail-tab-content > div:has(table)::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 58, 237, 0.6);
}

.deep-detail-close {
  position: absolute;
  top: 3px;
  right: 5px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
  z-index: 1001;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  min-width: 32px;
  min-height: 32px;
  line-height: 1;
  opacity: 1 !important;
  visibility: visible !important;
}

.deep-detail-close:hover {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Button Container for close/fullscreen buttons */
.deep-detail-button-container {
  position: absolute;
  top: 0px;
  right: 0px;
  display: flex;
  gap: 0px;
  z-index: 1001;
}

.deep-detail-button {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 200ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  line-height: 1;
  min-width: 32px;
  min-height: 32px;
}

.deep-detail-button:hover {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.deep-detail-fullscreen {

  font-size: 16px;
}

.deep-detail-chart-collapse {
    margin-right: 60px;
  font-size: 14px;
}

/* Fullscreen mode */
.deep-detail-panel.fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  left: 0 !important;
  top: 0 !important;
  padding-left: 0 !important;
  border-radius: 0 !important;
  max-width: none !important;
  max-height: none !important;
}

.deep-detail-panel.fullscreen .deep-detail-split {
  flex: 1;
}

.deep-detail-panel.fullscreen .deep-detail-left {
  max-width: 400px;
}

/* Highlights Section - Key Metrics Cards */
.deep-highlights-section {
  margin-bottom: 20px;
}

.deep-highlights-title {
  margin: 0 0 12px 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.deep-highlights-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 58, 237, 0.5) transparent;
}

.deep-highlights-grid::-webkit-scrollbar {
  height: 1px;
}

.deep-highlights-grid::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 3px;
}

.deep-highlights-grid::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.5);
  border-radius: 3px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.deep-highlights-grid::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 58, 237, 0.8);
  background-clip: padding-box;
}

.deep-metric-card {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid;
  flex-shrink: 0;
  min-width: 120px;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.deep-metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.deep-metric-card.positive {
  background: rgba(74, 222, 128, 0.1);
  border-color: #4ade80;
}

.deep-metric-card.warning {
  background: rgba(255, 193, 7, 0.1);
  border-color: #ffc107;
}

.deep-metric-card.negative {
  background: rgba(239, 83, 80, 0.1);
  border-color: #ef5350;
}

.deep-metric-card.neutral {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.deep-metric-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.2;
}

.deep-metric-value {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1;
}

.deep-metric-value.positive {
  color: #4ade80;
}

.deep-metric-value.warning {
  color: #ffc107;
}

.deep-metric-value.negative {
  color: #ef5350;
}

.deep-metric-value.neutral {
  color: #999;
}

.deep-metric-status {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.2;
}

/* Resizable divider */
.deep-detail-divider {
  flex: 0 0 8px;
  background: transparent;
  cursor: col-resize;
  position: relative;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.deep-detail-divider:hover {
  background: rgba(124, 58, 237, 0.3);
}

.deep-detail-divider::after {
  content: '';
  position: absolute;
  width: 2px;
  height: 40px;
  background: var(--border-color);
  border-radius: 2px;
  opacity: 0.6;
  transition: opacity 0.2s ease, height 0.2s ease;
}

.deep-detail-divider:hover::after {
  opacity: 1;
  height: 60px;
}

.deep-detail-divider.dragging {
  background: rgba(124, 58, 237, 0.5);
}

.deep-detail-divider.dragging::after {
  opacity: 1;
  background: rgb(124, 58, 237);
  height: 80px;
}

/* Responsive */
@media (max-width: 1024px) {
  .deep-detail-left {
    flex: 0 0 300px;
  }
}

/* ====== INFO SECTIONS (Price, Dividend, Company, Health, Risk) ====== */

.deep-info-section {
  margin-top: 24px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.deep-info-section:first-of-type {
  margin-top: 0;
}

.deep-info-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 16px 0;
  color: var(--text-primary);
  text-transform: none;
}

/* 2x2 Grid Layout */
.deep-info-grid-2x2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

/* 3x2 Grid Layout (Dividend) */
.deep-info-grid-3x2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

/* 2x3 Grid Layout (Company) */
.deep-info-grid-2x3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.deep-info-card {
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.deep-info-card:hover {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.4);
  transform: translateY(-2px);
}

.deep-info-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.deep-info-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.3;
}

.deep-info-value.positive {
  color: #4ade80;
}

.deep-info-value.negative {
  color: #ef5350;
}

.deep-info-change {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 4px;
  opacity: 0.8;
}

.deep-info-change.positive {
  color: #4ade80;
  opacity: 1;
}

.deep-info-change.negative {
  color: #ef5350;
  opacity: 1;
}

/* ====== HEALTH SCORE SECTION ====== */

.deep-health-score-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 0;
}

.deep-health-overall {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.1) 0%, rgba(124, 58, 237, 0.05) 100%);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 8px;
}

.deep-health-score-big {
  font-size: 36px;
  font-weight: 700;
  color: rgb(124, 58, 237);
  line-height: 1;
  margin-bottom: 8px;
}

.deep-health-stars {
  font-size: 20px;
  margin-bottom: 8px;
  letter-spacing: 2px;
}

.deep-health-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.deep-health-components {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.deep-health-item {
  display: flex;
  flex-direction: column;
}

.deep-health-bar-container {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.deep-health-label-small {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.2px;
  grid-column: 1;
}

.deep-health-bar {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  overflow: hidden;
  grid-column: 1;
}

.deep-health-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.deep-health-value-small {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  grid-column: 2;
  text-align: right;
  white-space: nowrap;
}

.deep-health-warning {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(239, 83, 80, 0.1);
  border: 1px solid rgba(239, 83, 80, 0.3);
  border-radius: 4px;
  font-size: 12px;
  color: #ef5350;
  line-height: 1.4;
}

/* ====== RISK ASSESSMENT SECTION ====== */

.deep-risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.deep-risk-card {
  padding: 14px;
  border-radius: 6px;
  border: 1px solid;
  transition: all 0.2s ease;
  text-align: center;
}

.deep-risk-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.deep-risk-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.deep-risk-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.deep-risk-level {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.2;
}

.deep-risk-description {
  font-size: 10px;
  color: var(--text-secondary);
  opacity: 0.8;
}

/* Risk Levels - Color Coding */
.deep-risk-low {
  background: rgba(74, 222, 128, 0.1);
  border-color: #4ade80;
}

.deep-risk-low .deep-risk-level {
  color: #4ade80;
}

.deep-risk-low .deep-risk-icon {
  opacity: 1;
}

.deep-risk-medium {
  background: rgba(255, 193, 7, 0.1);
  border-color: #ffc107;
}

.deep-risk-medium .deep-risk-level {
  color: #ffc107;
}

.deep-risk-high {
  background: rgba(239, 83, 80, 0.1);
  border-color: #ef5350;
}

.deep-risk-high .deep-risk-level {
  color: #ef5350;
}

/* When Deep is visible, expand container to full viewport width (overrides max-width) */
body.deep-visible .container {
  max-width: 100vw !important;
  width: 100vw !important;
  overflow-x: hidden;
}

body.deep-visible .main-content {
  max-width: 100vw !important;
  width: 100vw !important;
  overflow-x: hidden;
}

#deepSectionRoot {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
}

/* ✅ Deep Toggle Marks Button - Matching Favorites.js styling pattern */
.deep-toggle-marks-btn {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: var(--text-primary, #ffffff);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 150ms ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.deep-toggle-marks-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.deep-toggle-marks-btn.active {
  background: linear-gradient(135deg, var(--gradient-start, #7c3aed), var(--gradient-end, #38bdf8));
  border-color: rgba(124, 58, 237, 0.6);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.deep-toggle-marks-btn.active:hover {
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.4);
}

@media (max-width: 768px) {
  .deep-chart-container {
    min-height: 350px !important;
    
  }

  .deep-canvas {
    flex: 1;
  }
  .deep-detail-chat-messages{
    max-height: 89%;

  }
  .deep-detail-panel {
    flex-direction: column;
  }

  .deep-detail-left {
    flex: 0 0 auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
  }

  .deep-detail-right {
    flex: 1 1 auto;
  }

  /* Stack health score vertically on mobile */
  .deep-health-score-card {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Adjust grid layouts for mobile */
  .deep-info-grid-2x2,
  .deep-info-grid-3x2,
  .deep-info-grid-2x3 {
    grid-template-columns: repeat(2, 1fr);
  }

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

  /* ✅ FIX: Prevent footer reflow on mobile when sector filter changes */
  .deep-footer {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    min-height: auto;
    overflow-x: visible;
    overflow-y: visible;
  }

  .deep-footer label,
  .deep-footer select,
  .deep-footer > div {
    flex: 0 1 auto;
    min-width: auto;
  }

  /* Ensure summary container and pagination don't cause shifts */
  #deepFooterSummary {
    flex: 1 1 100%;
    min-width: 100%;
    overflow-x: auto;
  }

  .deep-pagination {
    flex: 0 0 auto;
    min-width: fit-content;
  }
}

@media (max-width: 640px) {
  .deep-filter-panel {
    width:85vh;
  }

  .deep-detail-left {
    flex: 0 0 auto;
    padding: 16px 5px;
  }

  .deep-detail-right {
    padding: 0px;
  }

  .deep-detail-left h2 {
    font-size: 18px;
  }

  .deep-detail-right h3 {
    font-size: 14px;
  }
}

/* ============================================
   IAA (Analyst Consensus) TAB STYLING
   ============================================ */

.iaa-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px 12px;
  max-width: 100%;
  width: 100%;
}

.iaa-section {
  min-width: 100%;
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 8px;
  padding: 16px;
  background: var(--primary-bg);
  display: flex;
  flex-direction: column;
}

.iaa-section-title {
  margin: 0 0 16px 0;
  padding: 0 0 12px 0;
  border-bottom: 1px solid rgba(124, 58, 237, 0.15);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Consensus Summary Section */
.iaa-consensus-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
  width: 100%;
}

.iaa-stat-card {
  background: var(--bg-primary);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 6px;
  padding: 12px;
  text-align: center;
  transition: all 200ms ease;
  flex: 1;
}

.iaa-stat-card:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: rgba(124, 58, 237, 0.6);
}

.iaa-stat-label {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.iaa-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #7c3aed;
  margin-bottom: 4px;
}

.iaa-stat-meta {
  font-size: 10px;
  color: var(--text-primary);
}

/* Recommendation Distribution */
.iaa-recommendation-summary {
  padding-top: 16px;
  border-top: 1px solid rgba(124, 58, 237, 0.2);
}

.iaa-rec-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.iaa-rec-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.iaa-rec-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.iaa-rec-buy {
  background: rgba(76, 175, 80, 0.2);
  color: #4CAF50;
  border: 1px solid rgba(76, 175, 80, 0.5);
}

.iaa-rec-outperform {
  background: rgba(33, 150, 243, 0.2);
  color: #2196F3;
  border: 1px solid rgba(33, 150, 243, 0.5);
}

.iaa-rec-neutral {
  background: rgba(255, 193, 7, 0.2);
  color: #FFC107;
  border: 1px solid rgba(255, 193, 7, 0.5);
}

.iaa-rec-hold {
  background: rgba(255, 193, 7, 0.2);
  color: #FFC107;
  border: 1px solid rgba(255, 193, 7, 0.5);
}

.iaa-rec-reduce {
  background: rgba(244, 67, 54, 0.2);
  color: #F44336;
  border: 1px solid rgba(244, 67, 54, 0.5);
}

.iaa-rec-sell {
  background: rgba(229, 57, 53, 0.2);
  color: #E53935;
  border: 1px solid rgba(229, 57, 53, 0.5);
}

/* Price Target Gauge */
.iaa-gauge-container {
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
}

.iaa-gauge-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 11px;
  color: var(--text-secondary);
}

.iaa-gauge-track {
  position: relative;
  height: 40px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  border: 1px solid rgba(124, 58, 237, 0.3);
  display: flex;
  align-items: center;
}

.iaa-gauge-range {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #ef5350, #FFC107, #4ade80);
  border-radius: 2px;
}

/* ensure track is a positioning context for absolute markers */
.iaa-gauge-track {
  position: relative;
  min-height: 36px;
}

.iaa-gauge-marker {
  position: absolute;
  width: 24px;
  height: 24px;
  background: #7c3aed;
  border: 2px solid #fff;
  border-radius: 50%;
  left: calc(var(--position) - 12px);
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  transition: all 200ms ease;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}

.iaa-gauge-marker:hover {
  width: 28px;
  height: 28px;
  left: calc(var(--position) - 14px);
}

.iaa-gauge-marker-label {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 10px;
  font-weight: 700;
  color: #7c3aed;
  background: rgba(0, 0, 0, 0.8);
  padding: 4px 8px;
  border-radius: 3px;
  pointer-events: none;
}

/* Broker timeline shown between min/max labels above the gauge */
.iaa-gauge-timeline {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  overflow-x: auto;
  padding: 6px 8px;
  max-width: 60%;
}

.iaa-gauge-timeline-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 88px;
}

.iaa-broker-name-small {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.iaa-broker-date-small {
  font-size: 11px;
  color: var(--text-secondary);
}

.iaa-broker-target-small {
  font-size: 11px;
  color: var(--text-primary);
  font-weight: 600;
}

/* Broker marker (dot) that sits on the gauge track */
.iaa-gauge-broker-marker {
  position: absolute;
  top: 6px; /* place above the track bar */
  transform: translateX(-50%);
  pointer-events: auto;
}

.iaa-gauge-broker-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gradient-start);
  border: 2px solid rgba(0,0,0,0.35);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

/* Custom tooltip panel shown when hovering markers */
.iaa-broker-tooltip {
  position: absolute;
  background: rgba(12,12,14,0.95);
  color: #fff;
  padding: 8px 10px;
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  font-size: 13px;
  line-height: 1.2;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  opacity: 0;
}
.iaa-broker-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}
.iaa-broker-tooltip .iaa-broker-tooltip-title {
  font-weight: 700;
  margin-bottom: 6px;
  color: #ffdca3;
}
.iaa-broker-tooltip .iaa-broker-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #e6e6e6;
  margin-bottom: 4px;
}
.iaa-broker-tooltip .iaa-broker-tooltip-row span { color: #9aa3b2; }

.iaa-gauge-broker-marker[title]:hover .iaa-gauge-broker-dot {
  transform: scale(1.2);
}

/* Ensure gauge labels layout nicely (min, timeline, max) */
.iaa-gauge-labels {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.iaa-gauge-side {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 64px;
  text-align: center;
}

@media (max-width: 720px) {
  .iaa-gauge-timeline { max-width: 48%; gap: 8px; }
  .iaa-gauge-timeline-item { min-width: 72px; }
}

/* Broker Grid (Horizontal Scroll) */
.iaa-broker-grid-section {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
}

.iaa-broker-grid-section::-webkit-scrollbar {
  height: 8px;
}

.iaa-broker-grid-section::-webkit-scrollbar-track {
  background: rgba(124, 58, 237, 0.1);
  border-radius: 4px;
}

.iaa-broker-grid-section::-webkit-scrollbar-thumb {
  background: #7c3aed;
  border-radius: 4px;
  cursor: grab;
}

.iaa-broker-grid-section::-webkit-scrollbar-thumb:hover {
  background: #a855f7;
}

.iaa-broker-grid {
  display: flex;
  gap: 12px;
  flex-wrap: nowrap;
  padding: 12px 16px;
  min-width: min-content;
}

.iaa-broker-grid::-webkit-scrollbar {
  height: 0;
}

.iaa-broker-card {
  flex: 0 0 180px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
  transition: all 200ms ease;
}

.iaa-broker-card:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: rgba(124, 58, 237, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
}

.iaa-broker-header {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(124, 58, 237, 0.2);
}

.iaa-broker-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.iaa-broker-analyst {
  font-size: 10px;
  color: var(--text-secondary);
}

.iaa-broker-target,
.iaa-broker-change,
.iaa-broker-yield {
  margin-bottom: 8px;
}

.iaa-broker-label {
  font-size: 9px;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.iaa-broker-price {
  font-size: 16px;
  font-weight: 700;
  color: #7c3aed;
}

.iaa-broker-pct {
  font-size: 14px;
  font-weight: 600;
}

.iaa-broker-pct.positive {
  color: #4ade80;
}

.iaa-broker-pct.negative {
  color: #ef5350;
}

.iaa-broker-pct.neutral {
  color: #FFC107;
}

.iaa-broker-div {
  font-size: 13px;
  font-weight: 700;
  color: #2196F3;
}

.iaa-broker-rec {
  margin-top: 8px;
}

.iaa-broker-date {
  font-size: 9px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* Broker Comparison Table */
.iaa-table-section {
  padding: 16px;
  overflow-x: auto;
}

.iaa-table-wrapper {
  overflow-x: auto;
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 6px;
}

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

.iaa-broker-table thead {
  background: rgba(124, 58, 237, 0.1);
  border-bottom: 2px solid rgba(124, 58, 237, 0.3);
}

.iaa-broker-table th {
  padding: 12px;
  text-align: left;
  font-weight: 700;
  color: #7c3aed;
  user-select: none;
  cursor: pointer;
  position: relative;
}

.iaa-sortable::after {
  content: ' ⇅';
  opacity: 0.3;
  font-size: 10px;
}

.iaa-sortable.asc::after {
  content: ' ▲';
  opacity: 1;
  color: #4ade80;
}

.iaa-sortable.desc::after {
  content: ' ▼';
  opacity: 1;
  color: #ef5350;
}

.iaa-broker-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(124, 58, 237, 0.1);
  color: var(--text-primary);
}

.iaa-broker-table tbody tr:hover {
  background: rgba(124, 58, 237, 0.05);
}

.iaa-broker-table td.positive {
  color: #4ade80;
  font-weight: 600;
}

.iaa-broker-table td.negative {
  color: #ef5350;
  font-weight: 600;
}

.iaa-broker-table td.neutral {
  color: #FFC107;
  font-weight: 600;
}

/* Broker Details Accordion */
.iaa-details-section {
  padding: 16px;
}

.iaa-accordion {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.iaa-accordion-item {
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 6px;
  overflow: hidden;
}

.iaa-accordion-header {
  width: 100%;
  padding: 12px;
  background: rgba(124, 58, 237, 0.05);
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 200ms ease;
}

.iaa-accordion-header:hover {
  background: rgba(124, 58, 237, 0.1);
}

.iaa-accordion-toggle {
  display: inline-block;
  font-size: 10px;
  transition: transform 200ms ease;
}

.iaa-accordion-meta {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-secondary);
}

.iaa-accordion-content {
  padding: 16px;
  background: rgba(124, 58, 237, 0.02);
  border-top: 1px solid rgba(124, 58, 237, 0.1);
}

.iaa-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.iaa-detail-item {
  display: flex;
  flex-direction: column;
}

.iaa-detail-item label {
  font-size: 10px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
}

.iaa-detail-value {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.iaa-detail-full {
  grid-column: 1 / -1;
}

.iaa-research-link {
  display: inline-block;
  padding: 8px 12px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  transition: all 200ms ease;
}

.iaa-research-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

.iaa-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-secondary);
}

/* ====== DIVIDEND TAB STYLES ====== */

.dividend-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 16px 0;
}

.dividend-section-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 16px 0;
  padding: 0 0 12px 0;
  border-bottom: 1px solid rgba(124, 58, 237, 0.15);
  color: #fff;
}

/* Summary Cards */
.dividend-summary-section {
  min-width: 100%;
  background: rgba(124, 58, 237, 0.05);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 8px;
  padding: 16px;
}

.dividend-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  width: 100%;
}

.dividend-summary-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 6px;
  padding: 12px;
  text-align: center;
  transition: all 200ms ease;
}

.dividend-summary-card:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: rgba(124, 58, 237, 0.6);
}

.dividend-summary-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dividend-summary-value {
  font-size: 18px;
  font-weight: 700;
  color: #7c3aed;
  margin-bottom: 4px;
}

.dividend-summary-meta {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
}

/* Chart Section */
.dividend-chart-section {
  min-width: 100%;
  background: rgba(124, 58, 237, 0.05);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 8px;
  padding: 16px;
}

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

.dividend-chart-header .dividend-section-title {
  margin: 0;
  padding: 0;
  border: none;
}

.dividend-chart-toggle {
  background: rgba(124, 58, 237, 0.2);
  border: 1px solid rgba(124, 58, 237, 0.4);
  color: #7c3aed;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 200ms ease;
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.dividend-chart-toggle:hover {
  background: rgba(124, 58, 237, 0.35);
  border-color: rgba(124, 58, 237, 0.6);
  transform: scale(1.05);
}

.dividend-chart-content {
  transition: max-height 300ms ease, opacity 300ms ease;
  max-height: 500px;
  opacity: 1;
  overflow: hidden;
}

.dividend-chart-content[style*="display: none"] {
  max-height: 0;
  opacity: 0;
}

#dividend-chart {
  border-radius: 6px;
  background: rgba(124, 58, 237, 0.02);
}

/* History Table */
.dividend-history-section {
  min-width: 100%;
  background: rgba(124, 58, 237, 0.05);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 8px;
  padding: 16px;
}

.dividend-table-wrapper {
  overflow-x: auto;
  border-radius: 6px;
  border: 1px solid rgba(124, 58, 237, 0.15);
}

.dividend-table-wrapper::-webkit-scrollbar {
  height: 8px;
}

.dividend-table-wrapper::-webkit-scrollbar-thumb {
  background: #7c3aed;
  border-radius: 4px;
}

.dividend-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #a855f7;
}

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

.dividend-table thead {
  background: rgba(124, 58, 237, 0.1);
  position: sticky;
  top: 0;
}

.dividend-table th {
  padding: 12px;
  text-align: left;
  font-weight: 700;
  color: #fff;
  border-bottom: 2px solid rgba(124, 58, 237, 0.3);
  white-space: nowrap;
}

.dividend-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(124, 58, 237, 0.15);
  color: var(--text-secondary);
}

.dividend-table tbody tr:hover {
  background: rgba(124, 58, 237, 0.08);
}

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

.dividend-table strong {
  color: #7c3aed;
}

.dividend-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 1024px) {
  .dividend-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .dividend-summary-grid {
    grid-template-columns: 1fr;
  }
  
  .dividend-table {
    font-size: 12px;
  }
  
  .dividend-table th,
  .dividend-table td {
    padding: 8px;
  }
}

/* NEWS TAB STYLING */
.news-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.news-summary-section {
  min-width: 100%;
  margin-bottom: 8px;
}

.news-section-title {
  margin: 0 0 12px 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  font-weight: 600;
}

.news-summary-box {
  padding: 14px;
  border-radius: 8px;
  border: 1px solid rgba(124, 58, 237, 0.2);
  background: rgba(124, 58, 237, 0.05);
  transition: all 200ms ease;
}

.news-summary-box:hover {
  border-color: rgba(124, 58, 237, 0.35);
  background: rgba(124, 58, 237, 0.08);
}

.news-summary-text {
  margin: 0 0 10px 0;
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.news-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.news-count,
.news-period {
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.news-timeline-section {
  min-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.news-date-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(124, 58, 237, 0.15);
}

.news-date-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.news-date-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 8px 0;
  border-bottom: 1px solid rgba(124, 58, 237, 0.1);
}

.news-date-label {
  font-size: 12px;
  font-weight: 600;
  color: #7c3aed;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.news-date-count {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(124, 58, 237, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
}

.news-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.news-item {
  padding: 12px;
  border-radius: 6px;
  border-left: 3px solid rgba(124, 58, 237, 0.3);
  background: rgba(0, 0, 0, 0.3);
  transition: all 200ms ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.news-item:hover {
  border-left-color: #7c3aed;
  background: rgba(124, 58, 237, 0.08);
  transform: translateX(2px);
}

.news-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.news-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  flex-wrap: wrap;
}

.news-source-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.news-source-iaa {
  color: #2196F3;
  background: rgba(33, 150, 243, 0.15);
  border: 1px solid rgba(33, 150, 243, 0.3);
}

.news-source-social {
  color: #FF9800;
  background: rgba(255, 152, 0, 0.15);
  border: 1px solid rgba(255, 152, 0, 0.3);
}

.news-source-other {
  color: #9E9E9E;
  background: rgba(158, 158, 158, 0.15);
  border: 1px solid rgba(158, 158, 158, 0.3);
}

.news-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  margin-left: auto;
  white-space: nowrap;
}

.news-item-title {
  display: block;
  margin: 0 0 8px 0;
  line-height: 1.4;
}

.news-item-title a {
  display: inline-block;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  line-height: 1.4;
  transition: all 200ms ease;
  word-break: break-word;
  overflow-wrap: break-word;
}

.news-item-title a:hover {
  color: #7c3aed;
  text-decoration: underline;
}

.news-title {
  display: block;
  margin: 0 0 8px 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #7c3aed;
  text-decoration: none;
  line-height: 1.3;
  transition: color 200ms ease;
  flex-grow: 1;
}

.news-title:hover {
  color: #9f7aea;
  text-decoration: underline;
}

.news-snippet {
  margin: 0;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.4;
  flex-grow: 1;
}

.news-read-more {
  font-size: 11px;
  color: rgba(124, 58, 237, 0.8);
  text-decoration: none;
  font-weight: 500;
  transition: all 200ms ease;
  display: inline-block;
}

.news-read-more:hover {
  color: #7c3aed;
  text-decoration: underline;
}

.news-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

/* Responsive news styling */
@media (max-width: 768px) {
  .news-item {
    padding: 10px;
  }

  .news-item-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .news-time {
    margin-left: 0;
  }

  .news-title {
    font-size: 12px;
  }

  .news-snippet {
    font-size: 11px;
  }
}

/* SHAREHOLDER TAB STYLING */
.shareholder-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.shareholder-section-title {
  margin: 0 0 12px 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  font-weight: 600;
}

.shareholder-summary-section {
  min-width: 100%;  
  margin-bottom: 8px;
}

/* Movement Summary Grid */
.shareholder-movement-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.shareholder-movement-card {
  padding: 14px;
  border-radius: 8px;
  border: 1px solid rgba(124, 58, 237, 0.2);
  background: rgba(124, 58, 237, 0.05);
  text-align: center;
  transition: all 200ms ease;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.shareholder-movement-card:hover {
  border-color: rgba(124, 58, 237, 0.35);
  background: rgba(124, 58, 237, 0.08);
  transform: translateY(-2px);
}

.movement-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #7c3aed;
}

.movement-stat-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.movement-stat-icon {
  font-size: 16px;
  font-weight: 700;
}

/* Highlights Section */
.shareholder-highlights {
  padding: 12px;
  background: rgba(124, 58, 237, 0.08);
  border-radius: 6px;
  border-left: 3px solid #7c3aed;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.highlight-item {
  display: flex;
  gap: 10px;
  font-size: 12px;
  flex-wrap: wrap;
}

.highlight-label {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  white-space: nowrap;
}

.highlight-value {
  color: #7c3aed;
  font-weight: 600;
}

/* Dates Info */
.shareholder-dates {
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  flex-wrap: wrap;
}

.shareholder-dates span {
  display: flex;
  gap: 4px;
}

.shareholder-dates strong {
  color: #7c3aed;
  font-weight: 700;
}

.shareholder-table-section {
  min-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shareholder-table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid rgba(124, 58, 237, 0.2);
}

.shareholder-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(0, 0, 0, 0.3);
  font-size: 12px;
}

.shareholder-table th {
  padding: 12px;
  text-align: left;
  font-weight: 700;
  color: #fff;
  background: rgba(124, 58, 237, 0.2);
  border-bottom: 2px solid rgba(124, 58, 237, 0.3);
  white-space: nowrap;
}

.shareholder-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(124, 58, 237, 0.15);
  color: var(--text-secondary);
  vertical-align: middle;
}

.shareholder-table tbody tr {
  transition: all 200ms ease;
}

.shareholder-table tbody tr:hover {
  background: rgba(124, 58, 237, 0.08);
}

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

/* Row Status Coloring */
.shareholder-table tbody tr.increase {
  background: rgba(76, 175, 80, 0.03);
}

.shareholder-table tbody tr.increase:hover {
  background: rgba(76, 175, 80, 0.08);
}

.shareholder-table tbody tr.decrease {
  background: rgba(244, 67, 54, 0.03);
}

.shareholder-table tbody tr.decrease:hover {
  background: rgba(244, 67, 54, 0.08);
}

.shareholder-table tbody tr.new {
  background: rgba(33, 150, 243, 0.03);
}

.shareholder-table tbody tr.new:hover {
  background: rgba(33, 150, 243, 0.08);
}

/* Column Styling */
.col-rank {
  width: 70px;
  text-align: center;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
}

.rank-change {
  font-size: 10px;
  margin-left: 4px;
  color: #7c3aed;
  font-weight: 600;
}

.col-name {
  flex: 1;
  min-width: 200px;
}

.shareholder-name {
  font-size: 1rem;
  display: block;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(255, 255, 255, 0.85);
}

.col-type {
  width: 110px;
  text-align: center;
}

.shareholder-type {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.shareholder-type.individual {
  background: rgba(33, 150, 243, 0.2);
  color: #2196F3;
  border: 1px solid rgba(33, 150, 243, 0.3);
}

.shareholder-type.thai-company {
  background: rgba(76, 175, 80, 0.2);
  color: #4CAF50;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.shareholder-type.fund {
  background: rgba(255, 193, 7, 0.2);
  color: #FFC107;
  border: 1px solid rgba(255, 193, 7, 0.3);
}

.col-current {
  width: 120px;
}

.col-volume {
  width: 100px;
  text-align: right;
  color: #7c3aed;
  font-weight: 600;
}

.volume-text {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.pct-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.pct-fill {
  height: 20px;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.8), rgba(168, 85, 247, 0.6));
  min-width: 2px;
  transition: width 200ms ease;
}

.pct-value {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  min-width: 40px;
}

.col-change {
  width: 90px;
  text-align: center;
}

.change-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.change-badge.increase {
  background: rgba(76, 175, 80, 0.2);
  color: #4CAF50;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.change-badge.decrease {
  background: rgba(244, 67, 54, 0.2);
  color: #F44336;
  border: 1px solid rgba(244, 67, 54, 0.3);
}

.change-badge.same {
  background: rgba(158, 158, 158, 0.2);
  color: #9E9E9E;
  border: 1px solid rgba(158, 158, 158, 0.3);
}

.change-badge.new {
  background: rgba(33, 150, 243, 0.2);
  color: #2196F3;
  border: 1px solid rgba(33, 150, 243, 0.3);
}

.col-rank-change {
  width: 80px;
  text-align: center;
}

.rank-change-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.rank-change-badge.up {
  color: #4CAF50;
  background: rgba(76, 175, 80, 0.15);
}

.rank-change-badge.down {
  color: #F44336;
  background: rgba(244, 67, 54, 0.15);
}

.rank-change-badge.none {
  color: #9E9E9E;
  background: rgba(158, 158, 158, 0.15);
}

.col-status {
  width: 100px;
  text-align: center;
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.status-badge.increase {
  background: rgba(76, 175, 80, 0.2);
  color: #4CAF50;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.status-badge.decrease {
  background: rgba(244, 67, 54, 0.2);
  color: #F44336;
  border: 1px solid rgba(244, 67, 54, 0.3);
}

.status-badge.same {
  background: rgba(158, 158, 158, 0.2);
  color: #9E9E9E;
  border: 1px solid rgba(158, 158, 158, 0.3);
}

.status-badge.new {
  background: rgba(33, 150, 243, 0.2);
  color: #2196F3;
  border: 1px solid rgba(33, 150, 243, 0.3);
}

.shareholder-row:hover .shareholder-name {
  color: #7c3aed;
}

/* Legend Styling */
.shareholder-legend {
  display: flex;
  gap: 20px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  flex-wrap: wrap;
}

.legend-section {
  flex: 1;
  min-width: 250px;
}

.legend-title {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.legend-color {
  font-weight: 700;
  font-size: 12px;
  min-width: 14px;
}

.legend-color.increase {
  color: #4CAF50;
}

.legend-color.decrease {
  color: #F44336;
}

.legend-color.same {
  color: #9E9E9E;
}

.legend-color.new {
  color: #2196F3;
}

.legend-symbol {
  font-weight: 700;
  font-size: 12px;
  min-width: 14px;
  color: #7c3aed;
}

.legend-text {
  color: rgba(255, 255, 255, 0.7);
}

.shareholder-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

/* Responsive shareholder styling */
@media (max-width: 1024px) {
  .shareholder-movement-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .shareholder-legend {
    flex-direction: column;
  }
}

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

  .shareholder-table {
    font-size: 10px;
  }

  .shareholder-table th,
  .shareholder-table td {
    padding: 8px;
  }

  .col-name {
    min-width: 120px;
  }

  .shareholder-name {
    max-width: 100px;
  }

  .col-rank {
    width: 50px;
  }

  .col-type {
    width: 80px;
    font-size: 9px;
  }

  .col-current {
    width: 100px;
  }

  .rank-badge {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }

  .shareholder-legend {
    gap: 10px;
    font-size: 10px;
  }

  .shareholder-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* View tabs for deep-canvas */
.deep-view-tabs {
  display: flex;
  gap: 8px;
  padding: 8px;
}

.deep-view-tabs button {
  padding: 6px 12px;
  font-size: 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background-color: transparent;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.deep-view-tabs button:hover {
  background-color: var(--hover-bg, #f0f0f0);
}

.deep-view-tabs button.active {
  background-color: var(--accent-color, #1e88e5);
  color: #fff;
}

/* Icon-only buttons with Font Awesome */
.deep-view-tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  min-width: 10px;
  min-height: 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background-color: transparent;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.deep-view-tabs button i {
  font-size: 18px;
}

.deep-view-tabs button:hover {
  background-color: var(--hover-bg, #f0f0f0);
}

.deep-view-tabs button.active {
  background-color: var(--accent-color, #1e88e5);
  color: #fff;
}

.deep-view-tabs .option-btn svg path,
.deep-view-tabs .option-btn svg circle,
.deep-view-tabs .option-btn svg rect {
  stroke: var(--text-primary) !important;
  fill: var(--text-primary) !important;
}

/* Deep canvas table styling */
.deep-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  position: relative;
}

.deep-data-table thead {
  background-color: var(--sidebar-bg, #f5f5f5);
  position: sticky;
  top: 0;
  z-index: 25;
}

.deep-data-table th {
  font-size: 1.1rem;
  padding: 10px;
  text-align: right;
  font-weight: 600;
  border-bottom: 2px solid var(--border-color, #e5e5e5);
  white-space: nowrap;
  color: antiquewhite;
  background: rgb(4 6 44);
}

.deep-data-table thead .deep-freeze-col {
  text-align: left !important;
}

/* Freeze column for body cells */
.deep-data-table tbody .deep-freeze-col {
  position: sticky !important;
  left: 0 !important;
  z-index: 4 !important;
  background-color: var(--bg-secondary) !important;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.2);
}

.deep-table-row:hover .deep-freeze-col {
  background-color: var(--bg-primary) !important;
}

.deep-data-table td {
  font-size: 1rem;
  text-wrap-mode: nowrap;
  padding: 10px;
  border-bottom: 1px solid var(--border-color, #e5e5e5);
  background-color: rgba(0, 0, 0, 0.02);
}

.deep-table-row {
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid var(--border-color, #e5e5e5);
}

.deep-table-row:nth-child(odd) {
  background-color: rgba(0, 0, 0, 0.02);
}

.deep-table-row:nth-child(even) {
  background-color: rgb(88 88 88 / 20%);
}

.deep-table-row:hover {
  background-color: rgba(0, 0, 0, 0.08) !important;
}

/* Cell color styling for positive/negative values */
.deep-table-cell {
  padding: 10px;
  border-bottom: 1px solid var(--border-color, #e5e5e5);
  text-align: right;
}

.deep-cell-positive {
  color: #0ab613;
  font-weight: 500;
}

.deep-cell-negative {
  color: #ff3939;
  font-weight: 500;
}

/* Freeze first column (Symbol) */
.deep-freeze-col {
  position: sticky;
  left: 0;
  z-index: 5 !important;
  background: rgb(4 6 44) !important;
}

.deep-data-table thead .deep-freeze-col {
  z-index: 30 !important;
  position: sticky !important;
  left: 0 !important;
  background: rgb(4 6 44) !important;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.2);
}

/* Table container and scrolling */
.deep-table-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0px;
  justify-content: space-around;
  background: var(--card-bg);
}

.deep-table-summary-header {
  padding: 2px;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.summary-info {
  display: flex;
  gap: 3px;
  align-items: center;
  flex-wrap: wrap;
  color: #ffffff;
  font-size: 0.85rem;
}

.summary-item {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.summary-item strong {
  font-weight: 600;
  opacity: 0.95;
}

.deep-table-scroll-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 170px);
  border: 1px solid var(--border-color, #e5e5e5);
  border-radius: 4px;
  -webkit-overflow-scrolling: touch;
}

.deep-table-scroll-wrapper table {
  background: var(--bg-deep-fund-table);
  width: 100%;
  min-width: 800px;
}

/* Pagination controls */
.deep-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px;
}

.deep-page-info {
  font-size: 14px;
  color: var(--text-secondary);
  min-width: 50px;
  text-align: center;
}

.deep-pagination button {
  padding: 6px 12px;
  font-size: 14px;
  border: 1px solid var(--border-color, #e5e5e5);
  border-radius: 4px;
  cursor: pointer;
  background-color: var(--card-bg);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.deep-pagination button:hover:not(:disabled) {
  background-color: var(--hover-bg, #f0f0f0);
  border-color: var(--accent-color, #1e88e5);
}

.deep-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  color: var(--text-secondary);
}

/* Deep row tooltip panel */
.deep-row-tooltip-panel {
  position: fixed;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  z-index: 2000;
  pointer-events: auto;
  min-width: 200px;
  animation: tooltipFadeIn 0.15s ease;
}

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

.tooltip-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tooltip-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tooltip-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tooltip-value {
  font-size: 13px;
  color: var(--text-primary);
  word-break: break-word;
  max-width: 180px;
}

/* Treemap Box Border Styles */
.treemap-box-positive {
  stroke: #4ade80 !important;
  stroke-width: 1.5px !important;
  opacity: 0.9 !important;
  filter: drop-shadow(0 2px 4px rgba(74, 222, 128, 0.2)) !important;
}

.treemap-box-positive:hover {
  stroke: #4ade80 !important;
  stroke-width: 2px !important;
  opacity: 1.0 !important;
  filter: drop-shadow(0 4px 8px rgba(74, 222, 128, 0.3)) !important;
}

.treemap-box-negative {
  stroke: #ef5350 !important;
  stroke-width: 1.5px !important;
  opacity: 0.8 !important;
  filter: drop-shadow(0 2px 4px rgba(239, 83, 80, 0.2)) !important;
}

.treemap-box-negative:hover {
  stroke: #ef5350 !important;
  stroke-width: 2px !important;
  opacity: 1.0 !important;
  filter: drop-shadow(0 4px 8px rgba(239, 83, 80, 0.3)) !important;
}

.treemap-box-warning {
  stroke: #ffc107 !important;
  stroke-width: 1.5px !important;
  opacity: 0.8 !important;
  filter: drop-shadow(0 2px 4px rgba(255, 193, 7, 0.2)) !important;
}

.treemap-box-warning:hover {
  stroke: #ffc107 !important;
  stroke-width: 2px !important;
  opacity: 1 !important;
  filter: drop-shadow(0 4px 8px rgba(255, 193, 7, 0.3)) !important;
}

.treemap-box-neutral {
  stroke: rgba(255, 255, 255, 0.3) !important;
  stroke-width: 1.5px !important;
  opacity: 0.9 !important;
  filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.1)) !important;
}

.treemap-box-neutral:hover {
  stroke: rgba(255, 255, 255, 0.5) !important;
  stroke-width: 2px !important;
  opacity: 1 !important;
  filter: drop-shadow(0 4px 8px rgba(255, 255, 255, 0.2)) !important;
}

/* ====== FUNDAMENTAL TABLE STYLING ====== */

.fundamental-table-wrapper {
  background: var(--bg-deep-fund-table);
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 12px;
  width: 100%;
  max-width: 100%;
  position: relative;

}

.fundamental-table-wrapper::-webkit-scrollbar {
  height: 6px;
}

.fundamental-table-wrapper::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

.fundamental-table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.4);
  border-radius: 3px;
}

.fundamental-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 58, 237, 0.6);
}

/* Table structure */
.fundamental-table {
  min-width: 100%;
  table-layout: fixed;
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}

/* Table header - sticky positioning */
.fundamental-table thead {
  position: sticky;
  top: 0;
  background: rgba(0, 0, 0, 0.2);
  z-index: 100;
  backdrop-filter: blur(8px);
  display: table-header-group;
}

.fundamental-table-header-cell {
  padding: 8px;
  border: 1px solid var(--border-color);
  font-weight: bold;
  color: var(--text-primary);
}

.fundamental-table-header-label {
  width: 250px;
  text-align: left;
}

.fundamental-table-header-period {
  width: 120px;
  text-align: right;
}

/* Table body rows */
.fundamental-table-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s ease;
}

.fundamental-table-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.fundamental-table-row-header {
  font-weight: bold;
  background: rgba(255, 255, 255, 0.08);
}

/* Table cells */
.fundamental-table-cell {
  padding: 8px;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.fundamental-table-cell-label {
  width: 250px;
  text-align: left;
  color: var(--text-primary);
  font-weight: 500;
}

.fundamental-table-cell-value {
  width: 120px;
  text-align: right;
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

/* Table note */
.fundamental-table-note {
  margin-top: 10px;
  font-size: 0.85em;
  color: var(--text-secondary);
  padding: 0 12px;
}

.fundamental-table-note p {
  margin: 0;
  line-height: 1.4;
}

/* === DEEP DETAIL TAB STYLES === */

/* Detail panel main container */
.deep-detail-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Detail content wrapper */
.deep-detail-content-wrapper {
  flex: 1;
  overflow-y: auto;
  padding:2px;
}

/* Detail section containers */
.deep-detail-section {
  margin-bottom: 2px;
  padding: 2px;
  background: rgba(211, 81, 81, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.deep-detail-section:last-child {
  margin-bottom: 0;
}

/* Detail section title */
.deep-detail-title {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Detail grid layout */
.deep-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.deep-detail-grid.full-width {
  grid-template-columns: 1fr;
}

/* Detail row item */
.deep-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  font-size: 13px;
}

.deep-detail-row label {
  color: var(--text-secondary);
  font-weight: 500;
  flex: 0 0 auto;
}

.deep-detail-row span {
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
  flex: 1;
  margin-left: 0px;
  font-family: 'Courier New', monospace;
}

/* Detail summary text */
.deep-detail-summary {
  margin: 0;
  line-height: 1.6;
  color: var(--text-secondary);
  font-size: 13px;
}

/* Detail error message */
.deep-detail-error {
  padding: 16px;
  text-align: center;
  color: var(--text-secondary);
  background: rgba(255, 0, 0, 0.1);
  border: 1px solid rgba(255, 0, 0, 0.3);
  border-radius: 4px;
  margin: 12px;
}


/* ===================== PEER TAB STYLES ===================== */
.peer-container {
  display: block;
  gap: 16px;
}
.peer-header {
  width: 100%;
  padding: 20px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(139, 92, 246, 0.1));
  border-radius: 12px;
  border-left: 6px solid #7c3aed;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.peer-header-main { margin-bottom: 16px; }
.peer-header-title { font-size: 24px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.peer-header-subtitle { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.peer-chips { display:flex; gap:8px; flex-wrap:wrap; }
.peer-chip { padding:4px 12px; border-radius:16px; font: size 0.9rem; font-weight:600; }
.peer-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; }
.peer-stat-card { padding: 12px; background: rgba(255,255,255,0.06); border-radius: 8px; }
.peer-stat-card .label { font-size:1rem; color:var(--text-secondary); margin-bottom:4px; font-weight:500; }
.peer-stat-card .value { font-weight:700; font-size:18px; }

.peer-section { margin-bottom: 24px; width: 100%;}
.peer-section-title { font-size:18px; font-weight:700; margin-bottom:16px; display:flex; align-items:center; gap:8px; }
.peer-metrics-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap:16px; }
.peer-metric-card { padding:20px; background:var(--card-bg); border:2px solid var(--border-color); border-radius:12px; box-shadow:0 2px 4px rgba(0,0,0,0.06); }
.peer-metric-card .metric-emoji { font-size:28px; margin-bottom:8px; }
.peer-metric-card .metric-label { font-size:1rem; color:var(--text-secondary); margin-bottom:6px; font-weight:600; }
.peer-metric-card .metric-value { font-weight:700; font-size:28px; margin-bottom:8px; }
.peer-metric-note { font-size:1rem; color:var(--text-secondary); padding:6px 10px; border-radius:6px; background:rgba(124,58,237,0.05); }

.peer-position-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap:16px; }
.peer-position-card { padding:20px; border-radius:12px; border:2px solid rgba(255,255,255,0.04); }

/* Additional peer utilities */
.peer-position-row { display:flex; align-items:center; gap:12px; margin-bottom:8px; }
.peer-position-emoji { font-size:32px; }
.peer-position-label { font-size:12px; color:var(--text-secondary); font-weight:600; }
.peer-position-value { font-weight:700; font-size:32px; }
.peer-position-meta { font-size:11px; color:var(--text-secondary); padding:8px 12px; background:rgba(255,255,255,0.03); border-radius:6px; }

.peer-table-container { background:var(--card-bg); border:2px solid var(--border-color); border-radius:12px; overflow:hidden; box-shadow:0 2px 8px rgba(0,0,0,0.06); }
.peer-table-wrapper { overflow-x:auto; }
.peer-table { width:100%; font-size:13px; border-collapse:collapse; }
.peer-table thead tr { background: rgba(124,58,237,0.06); border-bottom:2px solid var(--border-color); }
.peer-table th, .peer-table td { padding:14px 12px; color:var(--text-secondary); }
.peer-table th { font-weight:700; white-space:nowrap; }
.peer-table td { color:var(--text-primary); }
.peer-table.compact th, .peer-table.compact td { padding:10px; font-size:12px; }

.peer-rank-badge { width:28px; height:28px; display:inline-flex; align-items:center; justify-content:center; border-radius:50%; font-weight:700; font-size:12px; background: rgba(124,58,237,0.15); color: #a78bfa; }
.peer-rank-badge.highlight { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #000; }
.peer-table tr.highlight { background: rgba(124,58,237,0.05); transition: background 0.2s; }

.peer-symbol { font-weight:700; font-size:14px; color:#a78bfa; }
.peer-symbol-small { font-weight:600; color:#a78bfa; }
.peer-text-small { color:var(--text-secondary); font-size:12px; }
.peer-text-sm { color:var(--text-secondary); font-size:11px; }
.peer-text-xsmall { color:var(--text-secondary); font-size:10px; }

.peer-expand-row { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:8px; }
.peer-expand-btn { padding:10px 18px; background: linear-gradient(135deg, #7c3aed, #8b5cf6); border: none; border-radius:8px; color: white; font-weight:600; font-size:13px; cursor:pointer; display:flex; align-items:center; gap:8px; transition: all 0.25s; box-shadow: 0 2px 4px rgba(124,58,237,0.2); }
.peer-expand-btn .peer-expand-icon { font-size:14px; transition: transform 0.3s; display:inline-block; }

.peer-collapsed { max-height:0; opacity:0; overflow:hidden; transition: all 0.3s ease; }
.peer-collapsed.open { max-height:1000px; opacity:1; margin-top:16px; }

.peer-footer-block { text-align:center; }
.peer-footer .peer-legend-grid .dot { width:12px; height:12px; border-radius:50%; display:inline-block; margin-right:8px; }

.peer-table-wrapper.peer-scroll-y { overflow-y:auto; max-height:600px; }

/* Peer empty / error helpers */
.peer-empty-centered { padding:20px; text-align:center; }
.peer-empty-msg { color: var(--text-secondary); font-weight:600; }
.peer-empty-sub { font-size:12px; color: var(--text-secondary); margin-top:6px; }
.peer-position-card.green { background: linear-gradient(135deg, rgba(16,185,129,0.06), rgba(5,150,105,0.03)); border-color: rgba(16,185,129,0.22); }
.peer-position-card.blue { background: linear-gradient(135deg, rgba(59,130,246,0.06), rgba(37,99,235,0.03)); border-color: rgba(59,130,246,0.22); }
.peer-position-card .pos-row { display:flex; align-items:center; gap:12px; margin-bottom:12px; }
.peer-position-card .pos-icon { font-size:32px; }
.peer-position-card .pos-rank { font-weight:700; font-size:32px; }

.peer-table-container { background:var(--card-bg); border:2px solid var(--border-color); border-radius:12px; overflow:hidden; box-shadow:0 2px 8px rgba(0,0,0,0.06); }
.peer-table-wrapper { overflow-x:auto; }
.peer-table { width:100%; font-size:13px; border-collapse:collapse; }
.peer-table thead tr { background: rgba(124,58,237,0.06); border-bottom:2px solid var(--border-color); }
.peer-table th, .peer-table td { padding:14px 12px; color:var(--text-secondary); }
.peer-table th { font-weight:700; white-space:nowrap; }
.peer-row { border-bottom:1px solid var(--border-color); transition: background 0.2s; }
.peer-row.highlight { background: rgba(124,58,237,0.05); }
.peer-rank-badge { width:28px; height:28px; display:flex; align-items:center; justify-content:center; border-radius:50%; font-weight:700; font-size:12px; }
.peer-rank-badge.highlight { background: linear-gradient(135deg, #fbbf24, #f59e0b); color:#000; }
.peer-rank-badge.default { background: rgba(124,58,237,0.15); color: #a78bfa; }

.peer-expand-btn { padding:10px 20px; background: linear-gradient(135deg, #7c3aed, #8b5cf6); border: none; border-radius:8px; color:white; font-weight:600; font-size:13px; cursor:pointer; display:flex; align-items:center; gap:8px; transition:all 0.3s; box-shadow: 0 2px 4px rgba(124,58,237,0.18); }
.peer-expand-icon { font-size:14px; transition: transform 0.3s; }
.peer-collapsed { max-height:0; opacity:0; overflow:hidden; transition: all 0.3s ease; }
.peer-collapsed.open { max-height:1000px; opacity:1; margin-top:16px; }

.peer-footer { padding:20px; background: linear-gradient(135deg, rgba(30,41,59,0.5), rgba(51,65,85,0.3)); border:2px solid var(--border-color); border-radius:12px; box-shadow:0 2px 8px rgba(0,0,0,0.06); }
.peer-footer-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap:16px; margin-bottom:20px; padding-bottom:20px; border-bottom:1px solid var(--border-color); }
.peer-legend-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap:10px; }
.peer-legend-item { display:flex; align-items:center; gap:10px; padding:8px 12px; border-radius:8px; }
.peer-legend-item .dot { width:16px; height:16px; border-radius:50%; flex-shrink:0; }
.peer-legend-item.good { background: rgba(34,197,94,0.08); border-left:4px solid #22c55e; }
.peer-legend-item.mid { background: rgba(234,179,8,0.08); border-left:4px solid #eab308; }
.peer-legend-item.bad { background: rgba(248,113,113,0.08); border-left:4px solid #f87171; }
.peer-legend-item.na { background: rgba(153,153,153,0.08); border-left:4px solid #999; }

@media (max-width: 720px) {
  .peer-stats-grid, .peer-metrics-grid, .peer-position-grid, .peer-footer-grid { grid-template-columns: 1fr !important; }
  .peer-table th, .peer-table td { padding:10px; font-size:12px; }
}



/* Additional moved styles from inline templates */

/* Fundamental controls and form elements */
.fundamental-controls-section {
  margin-bottom: 20px;
  padding: 16px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
}
.fundamental-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.5fr auto;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-end;
}
.fundamental-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.fundamental-statement-type-select,
.fundamental-years-select,
.fundamental-period-select,
.fundamental-search-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 12px;
}

.fundamental-statement-type-select {
  border-color: var(--gradient-start);
  border-width: 2px;
  background: linear-gradient(135deg, rgba(124,58,237,0.08), rgba(124,58,237,0.04));
  font-weight: 600;
}

.fundamental-statement-type-select:hover {
  background: linear-gradient(135deg, rgba(124,58,237,0.12), rgba(124,58,237,0.08));
}

/* Unavailable statement type options */
.fundamental-statement-type-select option[data-available="false"] {
  color: #888;
  font-style: italic;
}

.fundamental-search-input { cursor: text; }
.fundamental-info-text {
  margin: 0;
  font-size: 11px;
  color: var(--text-secondary);
}

.fundamental-pjx-container {
  width: 100%;
  overflow-x: auto;
}

.fundamental-note-section {
  margin-bottom: 20px;
  padding: 16px;
  background: rgba(124, 58, 237, 0.1);
  border-left: 3px solid rgb(124, 58, 237);
  border-radius: 4px;
}
.fundamental-note {
  margin: 8px 0 0 0;
  font-size: 13px;
  line-height: 1.6;
}

/* Dividend charts helpers */
.dividend-charts-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 20px 0;
}
.dividend-canvas {
  max-width: 100%;
  height: auto;
}
.dividend-type-badge {
  font-size: 0.9em;
  padding: 2px 8px;
  border-radius: 4px;
}
.dividend-type-cash {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}
.dividend-type-stock {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

/* Movement/stat icons */
.movement-stat-icon { font-size: 14px; }
.movement-stat-icon.up { color: #4CAF50; }
.movement-stat-icon.down { color: #F44336; }
.movement-stat-icon.neutral { color: #9E9E9E; }
.movement-stat-icon.star { color: #2196F3; }

/* Shareholder pct bar uses CSS variable for dynamic width */
.pct-bar { position: relative; background: rgba(0,0,0,0.04); border-radius: 6px; height: 18px; display:flex; align-items:center; }
.pct-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end)); width: var(--pct, 0%); transition: width 0.36s ease; }
.pct-value { position: absolute; right: 8px; font-size: 12px; color: var(--text-primary); }

#deepSectionRoot > div > div.deep-canvas > svg > rect {
  color: #7c3aed;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

fundamental-detailed-section{
  background: var(--card-bg);
}

#fundamentalChartContainer{
  height: 100% !important;
}

/* Chat loading spinner */
.deep-chat-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: rgba(124, 58, 237, 0.08);
  border-radius: 4px;
  margin: 8px 0;
}

.deep-chat-loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(124, 58, 237, 0.2);
  border-top-color: var(--gradient-start);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.deep-chat-loading-text {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}

.deep-chart-tooltip {
  background: var(--glow-color) !important;
  border: 2px solid var(--glow-color-soft) !important;
  color: var(--text-primary)  !important;
}

.deep-chart-tooltip div{
  color: var(--text-primary)  !important;
}

.deep-lookup-suggestion-row {
  background: var(--card-bg);
  font-size: 0.85rem;
}
body > div.deep-lookup-modal > div.deep-lookup-suggestions > div:nth-child(1) {
  font-size: 1.1rem;
  padding: 10px !important;
  color: #fff0f0 !important;
  background: var(--bg-secondary, #f3e8ff) !important;
}

/* ===== SORTABLE TABLE HEADERS ===== */
.deep-data-table thead th {
  cursor: pointer;
  user-select: none;
  position: sticky !important;
  top: 0;
  transition: background 0.15s ease;
  white-space: nowrap;
  z-index: 20 !important;
}

.deep-data-table thead th:hover {
  background: rgba(0, 0, 0, 0.7) !important;
}

.deep-data-table thead th .sort-indicator {
  margin-left: 6px;
  font-size: 12px;
  color: #7c3aed;
  font-weight: bold;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ===== SECTOR BACK BUTTON ===== */
.deep-sector-back-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.deep-sector-back-btn:hover:not(:disabled) {
  background: rgba(124, 58, 237, 0.2);
  border-color: #7c3aed;
  color: #7c3aed;
  box-shadow: 0 2px 4px rgba(124, 58, 237, 0.15);
}

.deep-sector-back-btn:active:not(:disabled) {
  transform: scale(0.95);
}

/* SVG Back Button Styling */
.deep-sector-back-btn-svg {
  background: transparent;
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: system-ui, -apple-system, sans-serif;
}

.deep-sector-back-btn-svg:hover:not(:disabled) {
  background: rgba(124, 58, 237, 0.2);
  border-color: #7c3aed;
  color: #7c3aed;
  box-shadow: 0 2px 4px rgba(124, 58, 237, 0.15);
}

.deep-sector-back-btn-svg:active:not(:disabled) {
  transform: scale(0.95);
}
body > div.global-lookup-modal > div.global-lookup-suggestions > div:nth-child(1) {
  font-size: 1.7rem;
}
.global-lookup-name {
  font-size: 0.6rem;
  font-weight: 600;
}
.global-lookup-price {
  font-size: 0.8rem;
  font-weight: 700;
}
.global-lookup-change {
  font-size: 0.8rem;
  font-weight: 700;
}

/* PjX Table QoQ/YoY Styling */
.pjx-qoq {
  position: absolute;
  font-size: 9px !important;
  margin-top: 18px;
  opacity: 0.8;
  left: 10px !important;
  /* Color set inline in JavaScript: green for positive, red for negative */
}
.pjx-number {
  font-size: 1.1rem !important;
  font-weight: 300;
  padding: 10px 0px;
}
.pjx-yoy {
  font-size: 11px;
  margin-top: 2px;
  position: absolute;
  right: 0px;
  opacity: 0.7;
  /* Color set inline in JavaScript: green for positive, red for negative */
}

/* Text success and danger colors */
:root {
  --text-success: #4ade80;
  --text-danger: #f87171;
}

/* ============================================================
   MOBILE PORTRAIT RESPONSIVE - Extra small screens (< 480px)
   ============================================================ */
@media (max-width: 479px) {
  /* Treemap SVG scaling for very small screens */
  .deep-canvas {
    flex: 1;
    max-height: 70vh;
    padding: 0px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .deep-canvas svg {
    display: block;
    width: 100%;
    height: auto;
    min-width: 100%;
    min-height: 100%;
    /* Ensure SVG scales responsively */
    max-width: none;
  }

  /* Reduce font sizes for mobile treemap labels */
  .deep-canvas svg text {
    font-size: 15px !important;
  }

  .deep-canvas svg .industry-label {
    font-size: 19px !important;
  }

  /* Smaller boxes on mobile */
  .deep-box {
    min-width: 40px;
    min-height: 40px;
  }

  /* Stack detail panel vertically */
  .deep-detail-panel {
    flex-direction: column;
  }

  .deep-detail-left {
    flex: 0 0 auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;

    padding: 12px 4px;
  }

  .deep-detail-right {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Adjust grid for tiny screens */
  .deep-info-grid-2x2,
  .deep-info-grid-3x2,
  .deep-info-grid-2x3 {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .deep-risk-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* Reduce padding in controls */
  .deep-controls {
    padding: 4px;
    gap: 6px;
    flex-wrap: wrap;
  }

  .deep-legend {
    gap: 4px;
  }

  .deep-legend .item {
    font-size: 10px;
  }

  /* Headers smaller on mobile */
  .deep-detail-left h2,
  .deep-detail-right h3 {
    font-size: 14px;
    margin: 8px 0;
  }

  /* Reduce table font size */
  .deep-data-table {
    font-size: 11px;
  }

  .deep-data-table thead {
    font-size: 10px;
  }

  .deep-data-table td,
  .deep-data-table th {
    padding: 4px 2px;
  }

  /* Filter panel adjustments */
  .deep-filter-panel {
    width: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}