/* ============================================================
   NSE MARKET DASHBOARD — STYLES
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── CSS Custom Properties ── */
:root {
  --bg-primary: #060b14;
  --bg-secondary: #0d1520;
  --bg-card: #0f1a27;
  --bg-card-hover: #162133;
  --bg-elevated: #1a2840;

  --border: rgba(255,255,255,0.07);
  --border-active: rgba(0,200,150,0.3);

  --text-primary: #e8f0fe;
  --text-secondary: #8fa8c8;
  --text-muted: #4a6080;
  --text-accent: #00c896;

  --green: #00e676;
  --green-dim: #00b85a;
  --green-bg: rgba(0,230,118,0.08);
  --red: #ff4d6d;
  --red-dim: #cc2945;
  --red-bg: rgba(255,77,109,0.08);
  --yellow: #ffd60a;
  --blue: #4fc3f7;
  --purple: #b388ff;
  --orange: #ffb347;

  --accent-gradient: linear-gradient(135deg, #00c896 0%, #0080ff 100%);
  --header-gradient: linear-gradient(180deg, #060b14 0%, #0a1628 100%);
  --card-gradient: linear-gradient(145deg, #0f1a27 0%, #0d1822 100%);

  --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-hover: 0 8px 40px rgba(0,200,150,0.1);
  --shadow-glow: 0 0 20px rgba(0,200,150,0.15);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #00c89640; }

/* ── Typography ── */
h1, h2, h3, h4, h5 { line-height: 1.2; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; }

/* ══════════════════════════════════════════════
   HEADER / NAVBAR
══════════════════════════════════════════════ */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(6,11,20,0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  gap: 16px;
}

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

.logo-badge {
  background: var(--accent-gradient);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  letter-spacing: 1px;
}

.logo-sub {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}

.logo-subtitle {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  justify-content: center;
}

.market-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.market-status.open {
  background: rgba(0,230,118,0.12);
  color: var(--green);
  border: 1px solid rgba(0,230,118,0.25);
}

.market-status.closed {
  background: rgba(255,77,109,0.12);
  color: var(--red);
  border: 1px solid rgba(255,77,109,0.25);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

.open .status-dot { background: var(--green); }
.closed .status-dot { background: var(--red); animation: none; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

.header-clock {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.last-updated {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.refresh-btn {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
}

.refresh-btn:hover {
  background: var(--green-bg);
  color: var(--green);
  border-color: var(--border-active);
}

/* ── Nav ── */
.navbar {
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 2px;
  overflow-x: auto;
  border-top: 1px solid var(--border);
}

.nav-link {
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  cursor: pointer;
}

.nav-link:hover { color: var(--text-primary); }
.nav-link.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

/* ══════════════════════════════════════════════
   TICKER MARQUEE
══════════════════════════════════════════════ */
.ticker-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  height: 34px;
  display: flex;
  align-items: center;
}

.ticker-label {
  background: var(--accent-gradient);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 0 12px;
  height: 100%;
  display: flex;
  align-items: center;
  letter-spacing: 1px;
  white-space: nowrap;
  flex-shrink: 0;
}

.ticker-wrapper {
  overflow: hidden;
  flex: 1;
}

.ticker-track {
  display: flex;
  align-items: center;
  gap: 0;
  animation: ticker 60s linear infinite;
  width: max-content;
}

.ticker-track:hover { animation-play-state: paused; }

@keyframes ticker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
  border-right: 1px solid var(--border);
  height: 34px;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}

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

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

.ticker-price {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.ticker-change {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
}

.up { color: var(--green); }
.down { color: var(--red); }
.neutral { color: var(--text-muted); }

/* ══════════════════════════════════════════════
   LAYOUT CONTAINER
══════════════════════════════════════════════ */
.main-content {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Section Header ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.section-title .icon {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.section-badge {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.see-all {
  font-size: 11px;
  color: var(--green);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.see-all:hover { opacity: 0.8; }

/* ── Card ── */
.card {
  background: var(--card-gradient);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(0,200,150,0.15);
  box-shadow: var(--shadow-hover);
}

/* ══════════════════════════════════════════════
   INDEX CARDS GRID
══════════════════════════════════════════════ */
.index-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

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

.index-card {
  background: var(--card-gradient);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
}

.index-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: var(--transition);
}

.index-card:hover {
  border-color: rgba(0,200,150,0.2);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.index-card:hover::before { opacity: 1; }

.index-card.up-card { --card-accent: var(--green); }
.index-card.down-card { --card-accent: var(--red); }

.index-card.up-card::before { background: linear-gradient(90deg, var(--green), transparent); }
.index-card.down-card::before { background: linear-gradient(90deg, var(--red), transparent); }

.index-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.index-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1;
}

.index-change {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.change-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}

.change-pct {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
}

.up .change-pct { background: var(--green-bg); color: var(--green); }
.down .change-pct { background: var(--red-bg); color: var(--red); }

.index-stats {
  display: flex;
  gap: 12px;
  font-size: 10px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 10px;
}

.index-stats span { display: flex; flex-direction: column; gap: 1px; }
.index-stats strong { color: var(--text-secondary); font-size: 11px; }

.sparkline-wrap {
  height: 50px;
  margin-bottom: 8px;
}

/* ══════════════════════════════════════════════
   MARKET OVERVIEW ROW
══════════════════════════════════════════════ */
.overview-row {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 14px;
}

@media (max-width: 1100px) {
  .overview-row { grid-template-columns: 1fr 1fr; }
  .overview-row .breadth-card { grid-column: span 2; }
}

/* Market Breadth */
.breadth-card { }

.breadth-inner {
  display: flex;
  gap: 20px;
  align-items: center;
}

.breadth-chart-wrap {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
  position: relative;
}

.breadth-center-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
}

.breadth-center-text strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--green);
}

.breadth-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-label { color: var(--text-muted); min-width: 80px; }
.legend-val { font-family: var(--font-mono); font-weight: 700; }
.legend-pct { color: var(--text-muted); font-size: 10px; }

.breadth-stats {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

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

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

/* Volume Card */
.vol-card { }

.vol-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

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

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

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

.vol-bar-wrap {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vol-bar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.vol-bar-label { color: var(--text-secondary); width: 60px; }

.vol-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 10px;
  overflow: hidden;
}

.vol-bar-fill {
  height: 100%;
  border-radius: 10px;
  background: var(--accent-gradient);
  transition: width 1s ease;
}

.vol-bar-val {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  width: 45px;
  text-align: right;
}

/* ══════════════════════════════════════════════
   GAINERS / LOSERS TABS
══════════════════════════════════════════════ */
.gl-section { }

.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  width: fit-content;
  margin-bottom: 14px;
}

.tab-btn {
  padding: 6px 14px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  transition: var(--transition);
}

.tab-btn.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.tab-btn:hover:not(.active) { color: var(--text-secondary); }

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

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

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

.data-table th:first-child { text-align: left; }

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

.data-table td:first-child {
  text-align: left;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  color: var(--text-primary);
}

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

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

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  background: var(--bg-elevated);
  color: var(--text-muted);
  margin-right: 6px;
}

.chg-cell { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.chg-arrow { font-size: 10px; }

.pill {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.pill-up { background: var(--green-bg); color: var(--green); }
.pill-down { background: var(--red-bg); color: var(--red); }

.sparkline-cell canvas { vertical-align: middle; }

/* ══════════════════════════════════════════════
   SECTOR HEATMAP
══════════════════════════════════════════════ */
.sector-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

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

.sector-tile {
  border-radius: var(--radius-md);
  padding: 16px 14px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.sector-tile:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
}

.sector-name {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.sector-pct {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
  color: #fff;
}

.sector-val {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(255,255,255,0.65);
}

/* Heatmap color scale */
.heat-strong-up { background: linear-gradient(135deg, #006427, #00a84a); }
.heat-up { background: linear-gradient(135deg, #004d1e, #007d38); }
.heat-mild-up { background: linear-gradient(135deg, #003314, #005528); }
.heat-flat { background: linear-gradient(135deg, #1a2840, #253347); }
.heat-mild-down { background: linear-gradient(135deg, #3d0a12, #5c1020); }
.heat-down { background: linear-gradient(135deg, #5c0a16, #8b1024); }
.heat-strong-down { background: linear-gradient(135deg, #7a0a16, #b31024); }

/* ══════════════════════════════════════════════
   OPTIONS CHAIN
══════════════════════════════════════════════ */
.options-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.option-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 11px;
}

.option-stat-label { color: var(--text-muted); }
.option-stat-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
}

.options-scroll {
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
}

.options-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.options-table th {
  padding: 8px 8px;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
  white-space: nowrap;
}

.options-table th.ce-header { color: var(--green); background: rgba(0,230,118,0.05); }
.options-table th.pe-header { color: var(--red); background: rgba(255,77,109,0.05); }
.options-table th.strike-header { color: var(--yellow); }

.options-table td {
  padding: 6px 8px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  border-bottom: 1px solid rgba(255,255,255,0.02);
  color: var(--text-secondary);
}

.options-table td.ce-col { background: rgba(0,230,118,0.03); color: var(--text-secondary); }
.options-table td.pe-col { background: rgba(255,77,109,0.03); color: var(--text-secondary); }

.options-table td.strike-col {
  background: var(--bg-elevated);
  color: var(--yellow);
  font-weight: 700;
  font-size: 12px;
}

.options-table tr:hover td { filter: brightness(1.3); }

.atm-row td.strike-col {
  background: rgba(255,214,10,0.15);
  color: var(--yellow);
  font-size: 13px;
}

.oi-bar-mini {
  display: flex;
  align-items: center;
  gap: 4px;
}

.oi-mini-fill {
  height: 4px;
  border-radius: 2px;
  min-width: 2px;
  max-width: 60px;
}

.oi-mini-fill.ce { background: var(--green-dim); }
.oi-mini-fill.pe { background: var(--red-dim); }

/* ══════════════════════════════════════════════
   FII / DII SECTION
══════════════════════════════════════════════ */
.fiidii-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 14px;
}

@media (max-width: 1100px) {
  .fiidii-grid { grid-template-columns: 1fr 1fr; }
  .fiidii-chart-card { grid-column: span 2; }
}

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

.fiidii-table th {
  padding: 7px 8px;
  text-align: right;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.fiidii-table th:first-child { text-align: left; }

.fiidii-table td {
  padding: 8px 8px;
  text-align: right;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-family: var(--font-mono);
}

.fiidii-table td:first-child {
  text-align: left;
  font-family: 'Inter', sans-serif;
  color: var(--text-secondary);
  font-size: 11px;
}

.fiidii-table .net-positive { color: var(--green); font-weight: 700; }
.fiidii-table .net-negative { color: var(--red); font-weight: 700; }

.fiidii-chart-wrap { height: 200px; }

/* ══════════════════════════════════════════════
   F&O SECTION
══════════════════════════════════════════════ */
.fo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

@media (max-width: 1100px) { .fo-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .fo-grid { grid-template-columns: 1fr; } }

.pcr-display {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  padding: 20px 0;
}

.pcr-value {
  font-family: var(--font-mono);
  font-size: 40px;
  font-weight: 800;
  color: var(--text-primary);
}

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

.pcr-signal {
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.pcr-signal.bullish { background: var(--green-bg); color: var(--green); border: 1px solid rgba(0,230,118,0.3); }
.pcr-signal.bearish { background: var(--red-bg); color: var(--red); border: 1px solid rgba(255,77,109,0.3); }
.pcr-signal.neutral { background: var(--bg-elevated); color: var(--yellow); border: 1px solid rgba(255,214,10,0.3); }

.pcr-gauge {
  width: 100%;
  height: 8px;
  background: linear-gradient(90deg, var(--red), var(--yellow), var(--green));
  border-radius: 10px;
  margin-top: 10px;
  position: relative;
}

.pcr-needle {
  position: absolute;
  top: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
  transform: translateX(-50%);
  transition: left 1s ease;
}

/* ══════════════════════════════════════════════
   IPO CORNER
══════════════════════════════════════════════ */
.ipo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

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

.ipo-card {
  background: var(--card-gradient);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: var(--transition);
  cursor: pointer;
}

.ipo-card:hover {
  border-color: rgba(0,200,150,0.2);
  box-shadow: var(--shadow-hover);
}

.ipo-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.tag-open { background: var(--green-bg); color: var(--green); border: 1px solid rgba(0,230,118,0.3); }
.tag-upcoming { background: rgba(79,195,247,0.1); color: var(--blue); border: 1px solid rgba(79,195,247,0.3); }
.tag-listed { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }
.tag-sme { background: rgba(179,136,255,0.1); color: var(--purple); border: 1px solid rgba(179,136,255,0.3); }

.ipo-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.ipo-sector {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.ipo-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ipo-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

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

.ipo-progress-bar {
  margin-top: 10px;
  height: 5px;
  background: var(--bg-elevated);
  border-radius: 10px;
  overflow: hidden;
}

.ipo-progress-fill {
  height: 100%;
  border-radius: 10px;
  background: var(--accent-gradient);
  transition: width 1s ease;
}

.ipo-subscribed {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-muted);
}

.ipo-subscribed strong { color: var(--green); }

/* ══════════════════════════════════════════════
   NEWS SECTION
══════════════════════════════════════════════ */
.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

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

.news-card {
  background: var(--card-gradient);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.news-card:hover {
  border-color: rgba(0,200,150,0.2);
  transform: translateY(-1px);
}

.news-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  width: fit-content;
}

.news-headline {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
  flex: 1;
}

.news-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}

.news-source { font-weight: 600; color: var(--text-secondary); }

/* ══════════════════════════════════════════════
   DELIVERY / VOLUME SECTION
══════════════════════════════════════════════ */
.delivery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

/* ══════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════ */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 24px;
  margin-top: 40px;
}

.footer-inner {
  max-width: 1600px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
}

@media (max-width: 900px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

.footer-brand { }
.footer-logo { font-size: 20px; font-weight: 900; color: var(--text-primary); margin-bottom: 8px; }
.footer-desc { font-size: 11px; color: var(--text-muted); line-height: 1.7; }

.footer-col-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}

.footer-links { display: flex; flex-direction: column; gap: 6px; }
.footer-link {
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
.footer-link:hover { color: var(--green); }

.footer-bottom {
  max-width: 1600px;
  margin: 20px auto 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 10px;
  color: var(--text-muted);
}

.disclaimer {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 12px;
  padding: 10px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  line-height: 1.6;
}

/* ══════════════════════════════════════════════
   MARKET TIMING STRIP
══════════════════════════════════════════════ */
.timing-strip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.timing-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.timing-val {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.timing-sep { color: var(--border); }

/* ══════════════════════════════════════════════
   MISC UTILS
══════════════════════════════════════════════ */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.mt-10 { margin-top: 10px; }
.mt-14 { margin-top: 14px; }
.mb-0 { margin-bottom: 0; }

.text-xs { font-size: 10px; }
.text-sm { font-size: 11px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.mono { font-family: var(--font-mono); }

.loading-bar {
  height: 2px;
  background: var(--accent-gradient);
  border-radius: 2px;
  animation: loading 2s linear infinite;
  margin-bottom: 2px;
}

@keyframes loading {
  0% { width: 0%; margin-left: 0; }
  50% { width: 70%; }
  100% { width: 100%; margin-left: 100%; width: 0; }
}

.number-flash {
  animation: flash 0.4s ease;
}

@keyframes flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Tooltip */
.tooltip-wrap { position: relative; display: inline-block; }

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.4s ease forwards; }

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

.col-span-2 { grid-column: span 2; }

/* Tab Content */
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

/* Chart wrap */
.chart-wrap { position: relative; }

/* OI Chart Section */
.oi-wrap { height: 200px; }

/* Responsive */
@media (max-width: 768px) {
  .header-top { flex-wrap: wrap; }
  .main-content { padding: 12px; }
  .index-grid { grid-template-columns: 1fr 1fr; }
  .sector-grid { grid-template-columns: repeat(2, 1fr); }
  .fo-grid { grid-template-columns: 1fr; }
  .fiidii-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════
   SEARCH BAR
══════════════════════════════════════════════ */
.search-bar-wrap {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
}

.search-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  position: relative;
  transition: var(--transition);
}

.search-inner:focus-within {
  border-color: var(--border-active);
  box-shadow: var(--shadow-glow);
}

.search-icon { font-size: 16px; flex-shrink: 0; }

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text-primary);
  caret-color: var(--green);
}

.search-input::placeholder { color: var(--text-muted); }

.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  display: none;
  max-height: 300px;
  overflow-y: auto;
}

.search-suggestions.visible { display: block; }

.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border);
}

.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--bg-card-hover); }

.search-item-sym {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 100px;
}

.search-item-name { font-size: 11px; color: var(--text-secondary); flex: 1; }

.search-item-price {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.search-hints {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.hint-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.3px;
}

.hint-tag:hover {
  color: var(--green);
  border-color: var(--border-active);
  background: var(--green-bg);
}

/* ══════════════════════════════════════════════
   INTRADAY CHART HEADER
══════════════════════════════════════════════ */
.intraday-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.intraday-price {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.intraday-change {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}

.intraday-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.istat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 70px;
}

.istat-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.istat-val {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
}

/* ══════════════════════════════════════════════
   HOLIDAYS GRID
══════════════════════════════════════════════ */
.holidays-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

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

.holiday-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.holiday-date {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--blue);
  min-width: 60px;
}

.holiday-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

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

.holiday-item.past {
  opacity: 0.4;
}

.holiday-item.today {
  border-color: var(--yellow);
  background: rgba(255,214,10,0.05);
}

.holiday-item.upcoming {
  border-color: rgba(79,195,247,0.3);
  background: rgba(79,195,247,0.04);
}

/* ══════════════════════════════════════════════
   SCROLL TO TOP
══════════════════════════════════════════════ */
.scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: var(--accent-gradient);
  color: #fff;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 700;
  z-index: 999;
  box-shadow: 0 4px 16px rgba(0,200,150,0.3);
  opacity: 0;
  transform: translateY(20px);
  transition: var(--transition);
  pointer-events: none;
}

.scroll-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.scroll-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,200,150,0.4);
}

/* ══════════════════════════════════════════════
   ADDITIONAL VISUAL POLISH
══════════════════════════════════════════════ */

/* Glowing accent on section titles */
.section-title .icon {
  box-shadow: 0 0 12px rgba(0,200,150,0.2);
}

/* Table hover row animation */
.data-table tbody tr {
  transition: background 0.15s ease;
}

/* Sector grid improved for 2-col layout */
.sector-section-wrap {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 14px;
  align-items: start;
}

@media (max-width: 1100px) {
  .sector-section-wrap { grid-template-columns: 1fr; }
}

/* 52-week table */
.wk52-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.wk52-table th {
  padding: 7px 8px;
  text-align: right;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.wk52-table th:first-child { text-align: left; }

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

.wk52-table td:first-child {
  text-align: left;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  color: var(--text-primary);
}

.wk52-table tr:hover td { background: var(--bg-card-hover); }
.wk52-table tr:last-child td { border-bottom: none; }

.proximity-bar-track {
  flex: 1;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 10px;
  overflow: hidden;
  display: inline-block;
  width: 50px;
  vertical-align: middle;
  margin-left: 4px;
}

.proximity-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.5s ease;
}

.proximity-fill.high { background: var(--green); }
.proximity-fill.low { background: var(--red); }

/* ══════════════════════════════════════════════
   PORTFOLIO TRACKER CRUD SYSTEM
   ══════════════════════════════════════════════ */
.port-summary-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  margin-bottom: 20px;
}

.port-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 24px;
  flex: 1;
  min-width: 100px;
}

.port-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  white-space: nowrap;
}

.port-stat-val {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.port-stat-val.up { color: var(--green); }
.port-stat-val.down { color: var(--red); }

.port-div {
  width: 1px;
  height: 35px;
  background: var(--border);
  flex-shrink: 0;
}

/* Modal Overlay */
.port-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(6, 11, 20, 0.85);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.port-modal {
  width: 420px;
  background: linear-gradient(135deg, #0c1526, #111c2e);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  animation: portModalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes portModalIn {
  from { opacity: 0; transform: scale(0.9) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.port-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.port-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}

.port-modal-close:hover {
  color: var(--red);
}

.port-form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

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

.port-form-row input, .port-form-row select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}

.port-form-row input:focus, .port-form-row select:focus {
  border-color: var(--border-active);
  box-shadow: var(--shadow-glow);
}

.port-modal-preview {
  display: none;
  background: rgba(0, 230, 118, 0.05);
  border: 1px dashed rgba(0, 230, 118, 0.2);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  text-align: center;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--green);
}

.port-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.port-cancel-btn {
  padding: 7px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.port-cancel-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-active);
}

.port-layout {
  margin-top: 14px;
}

.port-table-wrap {
  padding: 16px;
}
