/* ============================================================
   MOMENTUM MONITOR — Core stylesheet
   A minimal, rich, smooth dashboard.
   ============================================================ */

/* -------- 1. Theme tokens -------- */
:root {
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --gap-2: 4px;
  --gap-3: 6px;
  --gap-4: 8px;
  --gap-5: 12px;
  --gap-6: 16px;
  --gap-7: 20px;
  --gap-8: 24px;
  --gap-9: 32px;
  --gap-10: 40px;

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

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.04), 0 10px 20px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.15);
  --shadow-glow: 0 0 60px rgba(129, 140, 248, 0.15);

  --transition: 180ms cubic-bezier(0.2, 0, 0, 1);
  --transition-slow: 320ms cubic-bezier(0.2, 0, 0, 1);
}

/* DARK THEME — Zerodha Kite dark palette */
:root,
[data-theme='dark'] {
  --bg: #1a1d29;                        /* Kite dark charcoal */
  --bg-subtle: #14161f;
  --bg-elevated: #242a38;               /* card surface */
  --bg-hover: #2a3142;
  --bg-active: #2e3647;

  --border: #2a2f3a;
  --border-strong: #353b48;
  --border-hover: #4a5160;

  --text: #e0e0e0;
  --text-muted: #8a8f98;
  --text-subtle: #666b75;

  --accent: #4a90e2;                    /* Kite dark-mode blue */
  --accent-strong: #5ca0f2;
  --accent-bg: rgba(74, 144, 226, 0.12);
  --accent-border: rgba(74, 144, 226, 0.3);

  --green: #2ebd85;                     /* Kite positive dark */
  --green-bg: rgba(46, 189, 133, 0.12);
  --red: #ef5350;                       /* Kite negative */
  --red-bg: rgba(239, 83, 80, 0.12);
  --yellow: #f7a31b;
  --yellow-bg: rgba(247, 163, 27, 0.12);
  --orange: #ff5722;
  --blue: #4a90e2;

  --grid-line: rgba(255, 255, 255, 0.04);

  color-scheme: dark;
}

/* LIGHT THEME — Zerodha Kite palette (clean white + blue accent) */
[data-theme='light'] {
  --bg: #ffffff;
  --bg-subtle: #f9f9f9;
  --bg-elevated: #ffffff;
  --bg-hover: #f5f5f5;
  --bg-active: #eaf3fb;                 /* pale kite-blue wash */

  --border: #e4e4e4;
  --border-strong: #d4d4d4;
  --border-hover: #bdbdbd;

  --text: #424242;                      /* Kite warm dark gray */
  --text-muted: #777777;
  --text-subtle: #9b9b9b;

  --accent: #387ed1;                    /* Kite primary blue */
  --accent-strong: #2e6cb5;
  --accent-bg: rgba(56, 126, 209, 0.08);
  --accent-border: rgba(56, 126, 209, 0.25);

  --green: #3eb556;                     /* Kite positive */
  --green-bg: rgba(62, 181, 86, 0.1);
  --red: #ef5350;                       /* Kite negative */
  --red-bg: rgba(239, 83, 80, 0.1);
  --yellow: #f7a31b;
  --yellow-bg: rgba(247, 163, 27, 0.1);
  --orange: #ff5722;                    /* Kite brand orange */
  --blue: #387ed1;

  --grid-line: #f0f0f0;

  color-scheme: light;
}

/* -------- 2. Base reset -------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  min-height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(129, 140, 248, 0.08), transparent),
    radial-gradient(ellipse 60% 50% at 80% 120%, rgba(34, 211, 153, 0.05), transparent);
  background-attachment: fixed;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

input {
  font-family: inherit;
  color: inherit;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.01em;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 10px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

::selection {
  background: var(--accent-bg);
  color: var(--text);
}

/* -------- 3. Top navigation bar -------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--gap-6);
  padding: 14px 28px;
  max-width: 100%;
  margin: 0 auto;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.view-switch {
  display: inline-flex;
  padding: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  gap: 2px;
}

.view-switch button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 7px;
  transition: all var(--transition);
  white-space: nowrap;
}

.view-switch button svg { opacity: 0.8; }

.view-switch button:hover {
  color: var(--text);
}

.view-switch button.is-active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.view-switch button.is-active svg {
  color: var(--accent);
  opacity: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  transition: opacity var(--transition);
}

.brand:hover {
  opacity: 0.85;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  color: #fff;
  box-shadow: 0 4px 16px rgba(129, 140, 248, 0.25), 0 0 40px rgba(34, 211, 153, 0.12);
  position: relative;
  transition: transform var(--transition-slow), box-shadow var(--transition-slow);
}

.brand:hover .brand__mark {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 6px 24px rgba(129, 140, 248, 0.35), 0 0 50px rgba(34, 211, 153, 0.2);
}

.brand__mark svg {
  width: 40px;
  height: 40px;
  display: block;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand__name {
  font-weight: 800;
  font-size: 16.5px;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, var(--text) 20%, var(--accent-strong) 70%, var(--green) 110%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.brand__dot {
  color: var(--green);
  -webkit-text-fill-color: var(--green);
}

.brand__tag {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
}

.brand__live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  position: relative;
  cursor: help;
}

.brand__delay {
  font-size: 9px;
  font-weight: 600;
  color: var(--yellow);
  letter-spacing: 0.04em;
  text-transform: none;
  padding-left: 4px;
  border-left: 1px solid var(--border-strong);
  margin-left: 2px;
  opacity: 0.85;
}

.brand__delay-tip {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 340px;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 11.5px;
  font-weight: 500;
  font-style: normal;
  font-family: var(--font-sans);
  line-height: 1.5;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  text-align: left;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand__delay-tip strong {
  display: block;
  color: var(--text);
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 12px;
}

.brand__delay-tip .tip-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 8px;
  line-height: 1.45;
}

.brand__delay-tip .tip-text {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  color: var(--text-muted);
}

.brand__delay-tip .tip-row b {
  color: var(--text);
  font-weight: 700;
}

.brand__delay-tip .tip-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex: 0 0 8px;
}

.brand__delay-tip .tip-dot--live {
  background: var(--green);
  box-shadow: 0 0 6px rgba(34, 211, 153, 0.5);
}

.brand__delay-tip .tip-dot--delay {
  background: var(--yellow);
  box-shadow: 0 0 6px rgba(251, 191, 36, 0.4);
}

.brand__delay-tip .tip-dot--daily {
  background: var(--text-subtle);
}

.brand__live:hover .brand__delay-tip,
.brand__live:focus .brand__delay-tip,
.brand__live:focus-within .brand__delay-tip {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.brand__live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-subtle);
  box-shadow: 0 0 0 0 currentColor;
  transition: background var(--transition), box-shadow var(--transition);
}

.brand__live.is-open .brand__live-dot {
  background: var(--green);
  animation: brand-pulse 1.8s ease-in-out infinite;
}
.brand__live.is-open .brand__live-txt {
  color: var(--green);
}

.brand__live.is-pre .brand__live-dot,
.brand__live.is-post .brand__live-dot {
  background: var(--yellow);
  animation: brand-pulse 2.4s ease-in-out infinite;
}
.brand__live.is-pre .brand__live-txt,
.brand__live.is-post .brand__live-txt {
  color: var(--yellow);
}

.brand__live.is-closed .brand__live-dot {
  background: var(--red);
}
.brand__live.is-closed .brand__live-txt {
  color: var(--red);
}

@keyframes brand-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent);
  }
  50% {
    box-shadow: 0 0 0 6px color-mix(in srgb, currentColor 0%, transparent);
  }
}

/* Real-time indicator */
.brand__delay.is-realtime {
  color: var(--green);
}

/* Refresh ago indicator */
.brand__refresh-ago {
  font-size: 9px;
  font-weight: 500;
  color: var(--text-subtle);
  letter-spacing: 0.03em;
  padding-left: 4px;
  margin-left: 2px;
  opacity: 0.7;
}

/* -------- Price flash animations -------- */
@keyframes flash-green {
  0% { background-color: rgba(34, 211, 153, 0.4); }
  100% { background-color: transparent; }
}
@keyframes flash-red {
  0% { background-color: rgba(248, 113, 113, 0.4); }
  100% { background-color: transparent; }
}
@keyframes tick-up {
  0% { color: var(--green); transform: scale(1.08); }
  100% { transform: scale(1); }
}
@keyframes tick-down {
  0% { color: var(--red); transform: scale(1.08); }
  100% { transform: scale(1); }
}

.flash-up {
  animation: flash-green 0.8s ease-out, tick-up 0.5s ease-out;
}
.flash-down {
  animation: flash-red 0.8s ease-out, tick-down 0.5s ease-out;
}

/* Live price row highlight on update */
.sidebar__list li .price__val.flash-up,
.sidebar__list li .price__chg.flash-up {
  animation: tick-up 0.6s ease-out;
  border-radius: 3px;
}
.sidebar__list li .price__val.flash-down,
.sidebar__list li .price__chg.flash-down {
  animation: tick-down 0.6s ease-out;
  border-radius: 3px;
}

.topbar__center {
  display: flex;
  justify-content: center;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 520px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  transition: border-color var(--transition), background var(--transition);
}

.search:focus-within {
  border-color: var(--accent-border);
  background: var(--bg-hover);
  box-shadow: 0 0 0 4px var(--accent-bg);
}

.search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
}

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

.search kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text-muted);
  background: var(--bg-subtle);
}

.topbar__right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.market-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

.market-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-subtle);
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 20%, transparent);
}

.market-status.is-open .dot {
  background: var(--green);
  animation: pulse 2s ease-in-out infinite;
}
.market-status.is-pre .dot,
.market-status.is-post .dot {
  background: var(--yellow);
}
.market-status.is-closed .dot {
  background: var(--red);
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 50%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--green) 0%, transparent); }
}

.clock {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.clock__tz {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all var(--transition);
}

.icon-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  color: var(--text);
}

.icon-btn .icon-sun { display: none; }
[data-theme='light'] .icon-btn .icon-sun { display: block; }
[data-theme='light'] .icon-btn .icon-moon { display: none; }

/* Ticker tape */
.ticker-tape {
  border-top: 1px solid var(--border);
  height: 46px;
  background: var(--bg-subtle);
  overflow: hidden;
}
.ticker-tape .tradingview-widget-container,
.ticker-tape .tradingview-widget-container__widget {
  height: 100%;
}

/* -------- 4. Layout -------- */
.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  align-items: start;
}

.layout[hidden] { display: none !important; }
.mw-layout[hidden] { display: none !important; }

/* -------- 5. Sidebar -------- */
.sidebar {
  position: sticky;
  top: 124px;
  height: calc(100vh - 124px);
  display: flex;
  flex-direction: column;
  padding: 20px 14px 20px 24px;
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sidebar__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.chip-btn {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all var(--transition);
}

.chip-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.sidebar__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.tab {
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 7px;
  transition: all var(--transition);
  white-space: nowrap;
}

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

.tab.is-active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.ticker-list {
  flex: 1;
  overflow-y: auto;
  margin-right: -6px;
  padding-right: 6px;
}

.ticker-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}

.ticker-list li:hover {
  background: var(--bg-hover);
}

.ticker-list li.is-active {
  background: var(--accent-bg);
}

.ticker-list li.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.ticker-list .sym {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ticker-list .sym__tk {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.ticker-list .sym__name {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticker-list .price {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.ticker-list .price__val {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.ticker-list .price__chg {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ticker-list .price__chg.pos { color: var(--green); }
.ticker-list .price__chg.neg { color: var(--red); }

/* -------- 6. Content area -------- */
.content {
  padding: 24px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* -------- 7. Card base -------- */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-slow), transform var(--transition-slow), box-shadow var(--transition-slow);
  position: relative;
  overflow: hidden;
  animation: card-enter 500ms cubic-bezier(0.2, 0, 0, 1) both;
}

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

/* Stagger entrance by row position */
.grid .card:nth-child(1) { animation-delay: 0ms; }
.grid .card:nth-child(2) { animation-delay: 40ms; }
.grid .card:nth-child(3) { animation-delay: 80ms; }
.grid .card:nth-child(4) { animation-delay: 120ms; }

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 40%);
  -webkit-mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

[data-theme='light'] .card::before {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), transparent 60%);
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(129, 140, 248, 0.04);
}

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

.card__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--text);
}

.card__icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent-bg);
  color: var(--accent);
}

.card__meta {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Info icon + tooltip */
.info-icon {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 10px;
  font-style: italic;
  cursor: help;
  margin-left: 6px;
  transition: all var(--transition);
  position: relative;
  vertical-align: middle;
}

.info-icon:hover {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent);
}

.info-tip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 11.5px;
  font-weight: 500;
  font-style: normal;
  font-family: var(--font-sans);
  line-height: 1.5;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  text-align: left;
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}

.info-tip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: var(--border-hover);
}

.info-tip strong {
  color: var(--text);
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
}

.info-icon:hover .info-tip,
.info-icon:focus .info-tip {
  opacity: 1;
  transform: translateX(-50%) translateY(2px);
  pointer-events: auto;
}

/* -------- 8. Hero (main chart) -------- */
.hero {
  display: grid;
  grid-template-columns: 2.2fr 1fr;
  gap: 20px;
  align-items: stretch;
}

.hero__chart {
  display: flex;
  flex-direction: column;
  min-height: 520px;
}

.hero__title h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
}

.hero__desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 10px;
  font-weight: 500;
}

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

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

.range-group button {
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
  transition: all var(--transition);
}

.range-group button:hover {
  color: var(--text);
}

.range-group button.is-active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.chart-wrap {
  flex: 1;
  min-height: 460px;
  padding: 0;
  position: relative;
}

.chart-wrap .tradingview-widget-container,
.chart-wrap iframe,
.chart-wrap .tv-lightweight-charts {
  width: 100% !important;
  height: 100% !important;
  min-height: 460px;
}

.hero__stats {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stat-card {
  padding: 20px;
}

.stat-card__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-card__value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.1;
}

.stat-card__sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.condition-bar {
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 14px;
}

.condition-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--yellow), var(--green));
  border-radius: 10px;
  width: 50%;
  transition: width var(--transition-slow);
}

.stat-card--mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 18px;
}

.mini {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.mini__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.mini__val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-card--live {
  padding: 18px 20px;
}

/* -------- 9. Grid systems -------- */
.grid {
  display: grid;
  gap: 20px;
}

.grid--1 { grid-template-columns: 1fr; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.widget-card {
  display: flex;
  flex-direction: column;
}

.widget-embed {
  position: relative;
  width: 100%;
  min-height: 240px;
}

.widget-embed--md { min-height: 360px; }
.widget-embed--lg { min-height: 440px; }

.widget-embed iframe,
.widget-embed .tradingview-widget-container,
.widget-embed .tradingview-widget-container__widget {
  width: 100% !important;
  height: 100% !important;
  position: absolute;
  inset: 0;
}

/* -------- 10. Fear & Greed gauge -------- */
.gauge-wrap {
  padding: 20px 20px 8px;
  text-align: center;
  position: relative;
}

.gauge {
  width: 100%;
  max-width: 260px;
  height: auto;
  display: block;
  margin: 0 auto;
}

#gauge-arc {
  transition: stroke-dashoffset var(--transition-slow);
  filter: drop-shadow(0 0 12px color-mix(in srgb, var(--accent) 30%, transparent));
}

#gauge-needle {
  transform-origin: 110px 115px;
  transition: transform 800ms cubic-bezier(0.4, 0, 0.2, 1);
}

.gauge-readout {
  margin-top: -14px;
}

.gauge-readout__num {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.gauge-readout__lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.fg-history {
  padding: 12px 20px 20px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.fg-row span:first-child {
  color: var(--text-muted);
}

.fg-row span:last-child {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text);
}

/* -------- 11. Breadth card -------- */
.breadth {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.breadth__ratio {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.breadth__num {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.breadth__num span {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.breadth__num:first-child span { color: var(--green); }
.breadth__num:last-child span { color: var(--red); }

.breadth__num small {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.breadth__sep {
  font-size: 11px;
  color: var(--text-subtle);
  font-weight: 600;
}

.breadth__bar {
  display: flex;
  width: 100%;
  height: 8px;
  border-radius: 8px;
  overflow: hidden;
  gap: 2px;
}

.breadth__bar-adv {
  background: var(--green);
  border-radius: 4px 0 0 4px;
  transition: width var(--transition-slow);
}

.breadth__bar-dec {
  background: var(--red);
  border-radius: 0 4px 4px 0;
  transition: width var(--transition-slow);
}

.breadth__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.breadth__stats > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-subtle);
  border-radius: 8px;
}

.breadth__stats .lbl {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.breadth__stats .val {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.breadth__stats .val.pos { color: var(--green); }
.breadth__stats .val.neg { color: var(--red); }

/* -------- 12. Fed Watch -------- */
.fed {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fed__current {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  gap: 4px;
}

.fed__curlbl {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.fed__curval {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

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

.fed__dlbl {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.fed__date {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.fed__countdown {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.fed__probs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.fed__problbl {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.fed-bar {
  display: grid;
  grid-template-columns: 80px 1fr 48px;
  align-items: center;
  gap: 10px;
  font-size: 11px;
}

.fed-bar__lbl {
  font-weight: 600;
  color: var(--text);
}

.fed-bar__track {
  position: relative;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 10px;
  overflow: hidden;
}

.fed-bar__fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 10px;
  transform-origin: left;
  transition: transform var(--transition-slow);
}

.fed-bar__pct {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* -------- 13. Top movers -------- */
.seg {
  display: inline-flex;
  padding: 3px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  gap: 2px;
}

.seg button {
  padding: 5px 10px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
  transition: all var(--transition);
}

.seg button:hover {
  color: var(--text);
}

.seg button.is-active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.movers {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.movers li {
  display: grid;
  grid-template-columns: 40px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.movers li:hover {
  background: var(--bg-hover);
}

.movers .rk {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-subtle);
  text-align: center;
  padding: 2px 6px;
  background: var(--bg-subtle);
  border-radius: 4px;
}

.movers .tk {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.movers .tk__s {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
}

.movers .tk__n {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movers .pr {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
}

.movers .ch {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  min-width: 60px;
  text-align: right;
}

.movers .ch.pos { color: var(--green); background: var(--green-bg); }
.movers .ch.neg { color: var(--red); background: var(--red-bg); }

/* -------- 15. Treasury yields -------- */
.yields {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  padding: 18px 20px;
}

.yield-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}

.yield-cell__t {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.yield-cell__v {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.yield-cell__c {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
}
.yield-cell__c.pos { color: var(--green); }
.yield-cell__c.neg { color: var(--red); }

.yield-curve {
  width: 100%;
  height: 120px;
  padding: 0 20px 20px;
  display: block;
}

/* -------- 16. Footer -------- */
.footer {
  border-top: 1px solid var(--border);
  margin-top: 24px;
  padding: 20px 0;
}

.footer__inner {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: var(--text-muted);
}

.footer__left,
.footer__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand__mini {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--text);
}

.sep {
  color: var(--text-subtle);
}

/* -------- 17. Toast -------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  z-index: 100;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* -------- 18. Sidebar collapsed state -------- */
.layout.is-collapsed {
  grid-template-columns: 0px 1fr;
}

.layout.is-collapsed .sidebar {
  display: none;
}

/* -------- 19. Responsive -------- */
@media (max-width: 1400px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    max-height: 380px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
  }
  .hero { grid-template-columns: 1fr; }
  .hero__chart { min-height: 420px; }
  .topbar__inner {
    grid-template-columns: auto 1fr auto;
  }
  .topbar__center { display: none; }
}

@media (max-width: 780px) {
  .topbar__inner { padding: 12px 16px; gap: 10px; }
  .brand__tag { display: none; }
  .market-status .label { display: none; }
  .clock .clock__tz { display: none; }
  .content { padding: 16px; gap: 16px; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .yields { grid-template-columns: repeat(2, 1fr); }
  .hero__title h1 { font-size: 18px; }
  .range-group button { padding: 5px 7px; font-size: 10.5px; }
  .footer__inner { flex-direction: column; gap: 6px; padding: 0 16px; }
}

/* -------- 20. Utility -------- */
.pos { color: var(--green); }
.neg { color: var(--red); }
.muted { color: var(--text-muted); }

.skeleton {
  background: linear-gradient(90deg, var(--bg-subtle) 25%, var(--bg-hover) 50%, var(--bg-subtle) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}

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

.fade-in {
  animation: fadeIn 500ms cubic-bezier(0.2, 0, 0, 1) both;
}

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

/* ============================================================
   MARKET WATCH VIEW — Split layout (tables + chart)
   ============================================================ */
.mw-layout {
  display: block;
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
}

.mw-layout[hidden] { display: none; }

.mw-split {
  display: grid;
  grid-template-columns: minmax(560px, 42%) 1fr;
  gap: 18px;
  padding: 18px 22px 28px;
  align-items: start;
}

.mw-left {
  min-width: 0;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.mw-right {
  position: sticky;
  top: 130px;
  height: calc(100vh - 150px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mw-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  gap: 14px;
  flex-wrap: wrap;
}

.mw-chart-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mw-chart-title h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.mw-chart-title span#mw-chart-name {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.mw-chart-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mw-chart-stats {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.mw-chart-stats .cmstat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
  border-right: 1px solid var(--border);
}
.mw-chart-stats .cmstat:last-child { border-right: none; }

.mw-chart-stats .cmstat__lbl {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mw-chart-stats .cmstat__val {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.mw-chart-stats .cmstat__val.pos { color: var(--green); }
.mw-chart-stats .cmstat__val.neg { color: var(--red); }

.mw-chart-body {
  flex: 1;
  min-height: 0;
  background: var(--bg);
}

.mw-chart-body .tradingview-widget-container,
.mw-chart-body iframe {
  width: 100% !important;
  height: 100% !important;
}

.mw-chart-empty {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 13px;
  padding: 40px;
  text-align: center;
}

.mw-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.mw-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.1;
}

.mw-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

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

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-hover);
  background: var(--bg-hover);
}

/* Column guide */
.mw-guide {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
  overflow: hidden;
}

.mw-guide summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.mw-guide summary::-webkit-details-marker { display: none; }
.mw-guide summary svg { color: var(--accent); }
.mw-guide summary::after {
  content: '';
  margin-left: auto;
  width: 8px; height: 8px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform var(--transition);
}
.mw-guide[open] summary::after { transform: rotate(-135deg); }

.mw-guide__body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 20px;
  padding: 4px 20px 18px;
  border-top: 1px solid var(--border);
}

.mw-guide__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
}

.mw-guide__item strong {
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
}

.mw-guide__item span {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Loading */
.mw-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 60px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
}
.mw-loading[hidden] { display: none !important; }

.mw-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: mw-spin 800ms linear infinite;
}

@keyframes mw-spin { to { transform: rotate(360deg); } }

.mw-loading__text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.mw-loading__progress {
  width: 280px;
  height: 4px;
  background: var(--bg-subtle);
  border-radius: 4px;
  overflow: hidden;
}

.mw-loading__progress > div {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 4px;
  transition: width 400ms ease;
}

/* Cohort sections */
.mw-cohorts {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.mw-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.mw-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.mw-section__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.mw-section__title small {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 3px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.mw-section__actions {
  display: flex;
  gap: 8px;
}

.mw-multichart-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  transition: all var(--transition);
}

.mw-multichart-btn:hover {
  background: var(--bg-hover);
  transform: translateY(-1px);
}

/* Table */
.mw-table-wrap {
  overflow-x: auto;
}

.mw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  table-layout: fixed;
}

.mw-table thead th {
  text-align: left;
  padding: 9px 6px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color var(--transition);
}

.mw-table thead th:first-child { padding-left: 14px; }
.mw-table thead th:last-child { padding-right: 14px; }

.mw-table tbody td:first-child { padding-left: 14px; }
.mw-table tbody td:last-child { padding-right: 14px; }

/* Column widths within compact split layout */
.mw-table colgroup col.c-ticker  { width: 68px; }
.mw-table colgroup col.c-grade   { width: 42px; }
.mw-table colgroup col.c-daily   { width: 56px; }
.mw-table colgroup col.c-intra   { width: 56px; }
.mw-table colgroup col.c-d5      { width: 56px; }
.mw-table colgroup col.c-d20     { width: 56px; }
.mw-table colgroup col.c-atrpct  { width: 46px; }
.mw-table colgroup col.c-atrx    { width: 50px; }
.mw-table colgroup col.c-vars    { width: 74px; }
.mw-table colgroup col.c-spark   { width: 66px; }
.mw-table colgroup col.c-letf    { width: 70px; }

.mw-table thead th:hover {
  color: var(--text);
}

.mw-table thead th.is-sorted {
  color: var(--accent);
}

.mw-table thead th.is-sorted::after {
  content: ' ▾';
  font-size: 10px;
}
.mw-table thead th.is-sorted.asc::after { content: ' ▴'; }

.mw-table tbody td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mw-table tbody tr {
  cursor: pointer;
  transition: background var(--transition);
}

.mw-table tbody tr:hover {
  background: var(--bg-hover);
}

.mw-table tbody tr.is-active {
  background: var(--accent-bg);
  position: relative;
}

.mw-table tbody tr.is-active td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

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

.mw-table .t-ticker {
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.mw-table .t-name {
  display: block;
  font-size: 9.5px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 1px;
  letter-spacing: 0;
  text-transform: none;
  font-family: var(--font-sans);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60px;
}

.grade-badge {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 11px;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.grade-A { background: linear-gradient(135deg, #22d399, #10b981); }
.grade-B { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.grade-C { background: linear-gradient(135deg, #f87171, #ef4444); }

.mw-table .num {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 10.5px;
}

.mw-table .num.pos { color: var(--green); }
.mw-table .num.neg { color: var(--red); }
.mw-table .num.neu { color: var(--text-muted); }

/* VARS percentile cell */
.vars-pct {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vars-pct__val {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 10px;
  min-width: 26px;
  text-align: right;
}

.vars-pct__bar {
  flex: 1;
  height: 4px;
  background: var(--bg-subtle);
  border-radius: 4px;
  overflow: hidden;
  min-width: 24px;
}

.vars-pct__fill {
  height: 100%;
  border-radius: 5px;
  transition: width var(--transition-slow);
}

/* Sparkline */
.sparkline {
  display: block;
  width: 60px;
  height: 22px;
}

.sparkline rect {
  transition: opacity var(--transition);
}

/* LETF cell */
.letf {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: normal;
  line-height: 1.3;
}

.letf .letf-bull { color: var(--green); }
.letf .letf-bear { color: var(--red); }

.letf-empty {
  color: var(--text-subtle);
}

/* ============================================================
   CORRELATION MATRIX
   ============================================================ */
.corr-matrix {
  padding: 16px 20px 20px;
  display: grid;
  gap: 3px;
}

.corr-row {
  display: grid;
  gap: 3px;
  align-items: center;
}

.corr-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: right;
  padding-right: 6px;
  letter-spacing: -0.01em;
}

.corr-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  border-radius: 4px;
  color: #fff;
  transition: transform var(--transition);
  cursor: default;
  position: relative;
}

.corr-cell:hover {
  transform: scale(1.1);
  z-index: 2;
}

.corr-cell.corr-diag {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px dashed var(--border);
}

.corr-header {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  padding: 4px 0;
  letter-spacing: -0.01em;
}

/* ============================================================
   RISK RATIOS
   ============================================================ */
.risk-ratios {
  padding: 12px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.risk-ratios li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.risk-ratios li:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  transform: translateX(2px);
}

.risk-ratios .rr-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.risk-ratios .rr-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.risk-ratios .rr-what {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.risk-ratios .rr-values {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.risk-ratios .rr-val {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.risk-ratios .rr-change {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.risk-ratios .rr-change.pos { color: var(--green); }
.risk-ratios .rr-change.neg { color: var(--red); }

/* ============================================================
   CHART MODAL
   ============================================================ */
.chart-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.chart-modal[hidden] { display: none !important; }

.chart-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: cm-fade 220ms cubic-bezier(0.2, 0, 0, 1);
  cursor: pointer;
}

.chart-modal__content {
  position: relative;
  width: 100%;
  max-width: 1500px;
  height: 86vh;
  max-height: 920px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-xl);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6), var(--shadow-glow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: cm-slideup 380ms cubic-bezier(0.2, 0, 0, 1);
}

@keyframes cm-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cm-slideup {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.chart-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

.chart-modal__title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chart-modal__title h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
}

.chart-modal__title span#chart-modal-name {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.chart-modal__grade {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 11px;
  color: #fff;
}
.chart-modal__grade:empty { display: none; }

.chart-modal__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.chart-modal__stats {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.chart-modal__stats .cmstat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
  border-right: 1px solid var(--border);
}
.chart-modal__stats .cmstat:last-child { border-right: none; }

.chart-modal__stats .cmstat__lbl {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chart-modal__stats .cmstat__val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.chart-modal__stats .cmstat__val.pos { color: var(--green); }
.chart-modal__stats .cmstat__val.neg { color: var(--red); }

.chart-modal__body {
  flex: 1;
  min-height: 0;
  background: var(--bg);
}

.chart-modal__body .tradingview-widget-container,
.chart-modal__body iframe {
  width: 100% !important;
  height: 100% !important;
}

/* Responsive modal */
@media (max-width: 900px) {
  .chart-modal { padding: 12px; }
  .chart-modal__content { height: 94vh; border-radius: var(--radius-lg); }
  .chart-modal__stats { grid-template-columns: repeat(4, 1fr); }
  .chart-modal__stats .cmstat:nth-child(4n) { border-right: none; }
  .chart-modal__stats .cmstat { padding: 6px 8px; }
  .chart-modal__actions .range-group { display: none; }
  .chart-modal__title span#chart-modal-name { display: none; }
}

/* Responsive */
@media (max-width: 1400px) {
  .mw-split { grid-template-columns: minmax(520px, 46%) 1fr; }
  .mw-guide__body { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1200px) {
  .mw-split { grid-template-columns: 1fr; }
  .mw-left { max-height: none; overflow: visible; }
  .mw-right {
    position: static;
    height: 600px;
  }
  .mw-guide__body { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 780px) {
  .mw-split { padding: 14px; }
  .mw-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .mw-guide__body { grid-template-columns: 1fr; }
  .mw-title { font-size: 20px; }
  .mw-right { height: 460px; }
  .mw-chart-stats { grid-template-columns: repeat(4, 1fr); }
  .mw-chart-stats .cmstat:nth-child(4n) { border-right: none; }
  .topbar__left { gap: 10px; }
  .view-switch button { padding: 6px 9px; font-size: 11px; }
  .view-switch button svg { display: none; }
}

/* ============================================================
   17. Kite-style overhaul — flat, minimal, fast
   Zerodha Kite design language: thin borders, small radius,
   subdued grays, blue CTAs, no gradients, no heavy shadows,
   no hover transforms. Optimized for rendering speed.
   ============================================================ */
[data-theme='light'] {
  --radius-sm: 3px;
  --radius-md: 4px;
  --radius-lg: 6px;
  --radius-xl: 6px;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Kill expensive effects globally in light mode */
[data-theme='light'] *,
[data-theme='light'] *::before,
[data-theme='light'] *::after {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Remove card entrance animation + hover lift */
[data-theme='light'] .card {
  animation: none !important;
  transform: none !important;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: none;
  transition: border-color 120ms ease;
}
[data-theme='light'] .card:hover {
  transform: none !important;
  box-shadow: none;
  border-color: var(--border-strong);
}

/* Body + global text */
[data-theme='light'] body {
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

/* Topbar — flat white rail */
[data-theme='light'] .topbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}

/* Brand name — Kite-like medium weight */
[data-theme='light'] .brand__name {
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0;
  font-size: 15px;
}
[data-theme='light'] .brand__dot { color: var(--orange); }

/* Live pill — subtle green (Kite success-tone) */
[data-theme='light'] .brand__live {
  background: transparent;
  color: var(--green);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 6px;
  font-weight: 500;
  font-size: 11px;
}
[data-theme='light'] .brand__live-dot {
  background: var(--green) !important;
  box-shadow: none !important;
  animation: none !important;
}
[data-theme='light'] .brand__live-txt { color: var(--green); font-weight: 600; }
[data-theme='light'] .brand__delay { color: var(--text-subtle); }

/* View switch + range group — flat segmented, small radius */
[data-theme='light'] .view-switch,
[data-theme='light'] .range-group {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0;
  gap: 0;
  overflow: hidden;
}
[data-theme='light'] .view-switch button,
[data-theme='light'] .range-group button {
  border: none !important;
  border-radius: 0 !important;
  color: var(--text-muted);
  font-weight: 500;
  padding: 6px 12px;
  font-size: 12px;
  background: transparent;
  transition: none;
}
[data-theme='light'] .view-switch button.is-active,
[data-theme='light'] .range-group button.is-active {
  background: var(--accent-bg) !important;
  color: var(--accent) !important;
  box-shadow: none;
}
[data-theme='light'] .view-switch button:not(.is-active):hover,
[data-theme='light'] .range-group button:not(.is-active):hover {
  background: var(--bg-hover);
  color: var(--text);
  transform: none !important;
}

/* Search — small, clean */
[data-theme='light'] .search {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  transition: border-color 120ms ease;
}
[data-theme='light'] .search:focus-within {
  border-color: var(--accent);
  box-shadow: none;
}
[data-theme='light'] .search input { color: var(--text); font-size: 13px; }
[data-theme='light'] .search input::placeholder { color: var(--text-subtle); }
[data-theme='light'] .search kbd {
  background: var(--bg-subtle);
  border-color: var(--border);
  color: var(--text-muted);
}

/* Icon buttons — square flat */
[data-theme='light'] .icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 3px;
  transition: background 120ms ease, color 120ms ease;
}
[data-theme='light'] .icon-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
  border-color: var(--border-strong);
  transform: none !important;
}

/* Ticker tape — thin rail */
[data-theme='light'] .ticker-tape {
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* Sidebar */
[data-theme='light'] .sidebar {
  background: var(--bg);
  border-right: 1px solid var(--border);
}
[data-theme='light'] .sidebar__title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
[data-theme='light'] .sidebar__tabs {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0;
  gap: 0;
  overflow: hidden;
}
[data-theme='light'] .sidebar__tabs .tab {
  border: none;
  background: transparent;
  border-radius: 0;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 10px;
  font-size: 11px;
  transition: none;
}
[data-theme='light'] .sidebar__tabs .tab.is-active {
  background: var(--accent-bg);
  color: var(--accent);
}
[data-theme='light'] .sidebar__tabs .tab:not(.is-active):hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* Ticker list rows — dense Kite-style watchlist */
[data-theme='light'] .ticker-list li {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 8px 12px;
  transition: background 100ms ease;
}
[data-theme='light'] .ticker-list li:hover {
  background: var(--bg-hover);
  transform: none !important;
}
[data-theme='light'] .ticker-list li.is-active {
  background: var(--accent-bg);
  border-color: var(--border);
  border-left: 2px solid var(--accent);
}

/* Hero — moderate, Kite-scale */
[data-theme='light'] .hero__chart.card {
  background: var(--bg-elevated);
}
[data-theme='light'] .hero__title h1 {
  font-size: 22px !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em !important;
  color: var(--text);
  line-height: 1.2;
}
[data-theme='light'] .hero__desc {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
}

/* Stat card values — like Kite's big totals: 28px semibold, tabular */
[data-theme='light'] .stat-card__value {
  font-size: 22px !important;
  font-weight: 600 !important;
  letter-spacing: 0;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
[data-theme='light'] .stat-card__label {
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  font-size: 12px;
}
[data-theme='light'] .stat-card__sub {
  color: var(--text-muted);
  font-size: 11px;
}

/* Mini stats */
[data-theme='light'] .mini__val {
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
[data-theme='light'] .mini__label {
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  font-size: 11px;
}

/* Card heads */
[data-theme='light'] .card__head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
[data-theme='light'] .card__title {
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0;
  font-size: 13px;
}
[data-theme='light'] .card__meta {
  color: var(--text-subtle);
  font-weight: 400;
  font-size: 11px;
}
[data-theme='light'] .card__icon {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  width: 24px;
  height: 24px;
}

/* Positive / negative values — Kite green/red */
[data-theme='light'] .pos,
[data-theme='light'] .val.pos { color: var(--green); }
[data-theme='light'] .neg,
[data-theme='light'] .val.neg { color: var(--red); }

/* Breadth */
[data-theme='light'] .breadth__bar { background: var(--bg-subtle); border-radius: 2px; }
[data-theme='light'] .breadth__bar-adv { background: var(--green); }
[data-theme='light'] .breadth__bar-dec { background: var(--red); }

/* Yield cells */
[data-theme='light'] .yield-cell {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 3px;
  transition: none;
}
[data-theme='light'] .yield-cell:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  transform: none !important;
}
[data-theme='light'] .yield-curve path,
[data-theme='light'] .yield-curve polyline { stroke: var(--accent); }
[data-theme='light'] .yield-curve circle { fill: var(--accent); }

/* Fed Watch */
[data-theme='light'] .fed__current {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 3px;
}
[data-theme='light'] .fed__curval { color: var(--text); font-weight: 600; }
[data-theme='light'] .fed__date { color: var(--text); font-weight: 600; }

/* Movers rows */
[data-theme='light'] .movers li {
  border-bottom: 1px solid var(--border);
  transition: background 100ms ease;
}
[data-theme='light'] .movers li:hover {
  background: var(--bg-hover);
  transform: none !important;
}
[data-theme='light'] .seg {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0;
  gap: 0;
  overflow: hidden;
}
[data-theme='light'] .seg button {
  border: none !important;
  border-radius: 0 !important;
  font-weight: 500;
  color: var(--text-muted);
  padding: 4px 10px;
  font-size: 11px;
  transition: none;
}
[data-theme='light'] .seg button.is-active {
  background: var(--accent-bg);
  color: var(--accent);
}

/* Market status + clock */
[data-theme='light'] .market-status,
[data-theme='light'] .clock {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
}
[data-theme='light'] .market-status .dot { box-shadow: none; }
[data-theme='light'] .clock__tz { color: var(--text-subtle); }

/* Condition bar */
[data-theme='light'] .condition-bar {
  background: var(--bg-subtle);
  border-radius: 2px;
}
[data-theme='light'] .condition-bar__fill {
  background: linear-gradient(90deg, var(--red), var(--yellow), var(--green));
  background: var(--green);
}

/* Footer */
[data-theme='light'] .footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
}
[data-theme='light'] .footer .sep { color: var(--text-subtle); }
[data-theme='light'] .brand__mini { color: var(--text); font-weight: 500; }

/* Info tips */
[data-theme='light'] .info-icon {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
[data-theme='light'] .info-tip {
  background: #2a2a2a;
  color: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}

/* Market Watch */
[data-theme='light'] .mw-title {
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text);
  font-size: 20px;
}
[data-theme='light'] .btn-ghost {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 3px;
  font-weight: 500;
  padding: 6px 12px;
  font-size: 12px;
  transition: background 120ms ease;
}
[data-theme='light'] .btn-ghost:hover {
  background: var(--accent-strong);
  transform: none !important;
}

/* Focus ring */
[data-theme='light'] button:focus-visible,
[data-theme='light'] a:focus-visible,
[data-theme='light'] input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Scrollbar */
[data-theme='light'] ::-webkit-scrollbar { width: 10px; height: 10px; }
[data-theme='light'] ::-webkit-scrollbar-thumb {
  background: #d4d4d4;
  border-radius: 3px;
}
[data-theme='light'] ::-webkit-scrollbar-thumb:hover { background: #bdbdbd; }
[data-theme='light'] ::-webkit-scrollbar-track { background: transparent; }

/* Risk ratios */
[data-theme='light'] .risk-ratios li {
  border-bottom: 1px solid var(--border);
  transition: background 100ms ease;
}
[data-theme='light'] .risk-ratios li:hover { background: var(--bg-hover); }

/* Gauge */
[data-theme='light'] #gauge-needle line { stroke: var(--text); }
[data-theme='light'] #gauge-needle circle { fill: #fff; stroke: var(--text); }

/* TradingView quick-link button — Kite blue CTA */
.tv-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  background: var(--accent);
  color: #fff;
  border: none;
  transition: background 120ms ease;
}
.tv-link:hover {
  background: var(--accent-strong);
  transform: none;
  box-shadow: none;
}

/* Speed: lazy-render below-fold widgets */
.widget-embed--md,
.widget-embed--lg,
.corr-matrix,
.risk-ratios {
  content-visibility: auto;
  contain-intrinsic-size: 520px;
}
.hero__chart .chart-wrap { content-visibility: visible; }

/* Disable card stagger animation sitewide in light mode for speed */
[data-theme='light'] .grid .card { animation: none !important; }

/* Remove body halo/gradient */
[data-theme='light'] body {
  background-image: none;
}

/* Reduce general hover transform effects globally */
[data-theme='light'] .ticker-list li:hover,
[data-theme='light'] .movers li:hover,
[data-theme='light'] .yield-cell:hover,
[data-theme='light'] .icon-btn:hover,
[data-theme='light'] .risk-ratios li:hover {
  transform: none !important;
}

/* Borders more subtle for widgets */
[data-theme='light'] .widget-embed { border: 1px solid var(--border); border-radius: 3px; }

/* ============================================================
   18. Kite DARK-mode overhaul — flat, dense, fast
   Matches the Kite light overhaul but for the dark palette.
   ============================================================ */
[data-theme='dark'] {
  --radius-sm: 3px;
  --radius-md: 4px;
  --radius-lg: 6px;
  --radius-xl: 6px;
  --shadow-sm: none;
  --shadow-md: none;
}
[data-theme='dark'] *,
[data-theme='dark'] *::before,
[data-theme='dark'] *::after {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
[data-theme='dark'] .card {
  animation: none !important;
  transform: none !important;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: none;
  transition: border-color 120ms ease;
}
[data-theme='dark'] .card:hover {
  transform: none !important;
  box-shadow: none;
  border-color: var(--border-strong);
}
[data-theme='dark'] body {
  background: var(--bg) !important;
  background-image: none !important;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}
[data-theme='dark'] .topbar {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}
[data-theme='dark'] .brand__name {
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0;
  font-size: 15px;
}
[data-theme='dark'] .brand__dot { color: var(--orange); }

/* Live pill — subtle green chip */
[data-theme='dark'] .brand__live {
  background: transparent;
  color: var(--green);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 6px;
  font-weight: 500;
  font-size: 11px;
}
[data-theme='dark'] .brand__live-dot {
  background: var(--green) !important;
  box-shadow: none !important;
  animation: none !important;
}
[data-theme='dark'] .brand__live-txt { color: var(--green); font-weight: 600; }
[data-theme='dark'] .brand__delay { color: var(--text-subtle); }

/* Flat segmented groups */
[data-theme='dark'] .view-switch,
[data-theme='dark'] .range-group {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0;
  gap: 0;
  overflow: hidden;
}
[data-theme='dark'] .view-switch button,
[data-theme='dark'] .range-group button {
  border: none !important;
  border-radius: 0 !important;
  color: var(--text-muted);
  font-weight: 500;
  padding: 6px 12px;
  font-size: 12px;
  background: transparent;
  transition: none;
}
[data-theme='dark'] .view-switch button.is-active,
[data-theme='dark'] .range-group button.is-active {
  background: var(--accent-bg) !important;
  color: var(--accent) !important;
  box-shadow: none;
}
[data-theme='dark'] .view-switch button:not(.is-active):hover,
[data-theme='dark'] .range-group button:not(.is-active):hover {
  background: var(--bg-hover);
  color: var(--text);
  transform: none !important;
}

/* Search */
[data-theme='dark'] .search {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 3px;
}
[data-theme='dark'] .search:focus-within {
  border-color: var(--accent);
  box-shadow: none;
}
[data-theme='dark'] .search input { color: var(--text); font-size: 13px; }
[data-theme='dark'] .search input::placeholder { color: var(--text-subtle); }
[data-theme='dark'] .search kbd {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text-muted);
}

/* Icon buttons */
[data-theme='dark'] .icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 3px;
}
[data-theme='dark'] .icon-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
  border-color: var(--border-strong);
  transform: none !important;
}

/* Ticker tape */
[data-theme='dark'] .ticker-tape {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* Sidebar */
[data-theme='dark'] .sidebar {
  background: var(--bg);
  border-right: 1px solid var(--border);
}
[data-theme='dark'] .sidebar__title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
[data-theme='dark'] .sidebar__tabs {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0;
  gap: 0;
  overflow: hidden;
}
[data-theme='dark'] .sidebar__tabs .tab {
  border: none;
  background: transparent;
  border-radius: 0;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 10px;
  font-size: 11px;
  transition: none;
}
[data-theme='dark'] .sidebar__tabs .tab.is-active {
  background: var(--accent-bg);
  color: var(--accent);
}
[data-theme='dark'] .sidebar__tabs .tab:not(.is-active):hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* Watchlist rows — dense */
[data-theme='dark'] .ticker-list li {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 8px 12px;
  transition: background 100ms ease;
}
[data-theme='dark'] .ticker-list li:hover {
  background: var(--bg-hover);
  transform: none !important;
}
[data-theme='dark'] .ticker-list li.is-active {
  background: var(--accent-bg);
  border-color: var(--border);
  border-left: 2px solid var(--accent);
}

/* Hero */
[data-theme='dark'] .hero__chart.card {
  background: var(--bg-elevated);
  background-image: none;
}
[data-theme='dark'] .hero__title h1 {
  font-size: 22px !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em !important;
  color: var(--text);
  line-height: 1.2;
}
[data-theme='dark'] .hero__desc {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
}

/* Stat cards */
[data-theme='dark'] .stat-card__value {
  font-size: 22px !important;
  font-weight: 600 !important;
  letter-spacing: 0;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
[data-theme='dark'] .stat-card__label {
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  font-size: 12px;
}
[data-theme='dark'] .stat-card__sub {
  color: var(--text-muted);
  font-size: 11px;
}
[data-theme='dark'] .mini__val {
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
[data-theme='dark'] .mini__label {
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  font-size: 11px;
}

/* Card heads */
[data-theme='dark'] .card__head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
[data-theme='dark'] .card__title {
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0;
  font-size: 13px;
}
[data-theme='dark'] .card__meta {
  color: var(--text-subtle);
  font-weight: 400;
  font-size: 11px;
}
[data-theme='dark'] .card__icon {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  width: 24px;
  height: 24px;
}

/* Positive / negative */
[data-theme='dark'] .pos,
[data-theme='dark'] .val.pos { color: var(--green); }
[data-theme='dark'] .neg,
[data-theme='dark'] .val.neg { color: var(--red); }

/* Breadth */
[data-theme='dark'] .breadth__bar { background: var(--bg-subtle); border-radius: 2px; }
[data-theme='dark'] .breadth__bar-adv { background: var(--green); }
[data-theme='dark'] .breadth__bar-dec { background: var(--red); }

/* Yields */
[data-theme='dark'] .yield-cell {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 3px;
  transition: none;
}
[data-theme='dark'] .yield-cell:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  transform: none !important;
}
[data-theme='dark'] .yield-curve path,
[data-theme='dark'] .yield-curve polyline { stroke: var(--accent); }
[data-theme='dark'] .yield-curve circle { fill: var(--accent); }

/* Fed Watch */
[data-theme='dark'] .fed__current {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 3px;
}
[data-theme='dark'] .fed__curval { color: var(--text); font-weight: 600; }
[data-theme='dark'] .fed__date { color: var(--text); font-weight: 600; }

/* Movers */
[data-theme='dark'] .movers li {
  border-bottom: 1px solid var(--border);
  transition: background 100ms ease;
}
[data-theme='dark'] .movers li:hover {
  background: var(--bg-hover);
  transform: none !important;
}
[data-theme='dark'] .seg {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0;
  gap: 0;
  overflow: hidden;
}
[data-theme='dark'] .seg button {
  border: none !important;
  border-radius: 0 !important;
  font-weight: 500;
  color: var(--text-muted);
  padding: 4px 10px;
  font-size: 11px;
  transition: none;
}
[data-theme='dark'] .seg button.is-active {
  background: var(--accent-bg);
  color: var(--accent);
}

/* Market status + clock */
[data-theme='dark'] .market-status,
[data-theme='dark'] .clock {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
}
[data-theme='dark'] .market-status .dot { box-shadow: none; }
[data-theme='dark'] .clock__tz { color: var(--text-subtle); }

/* Condition bar */
[data-theme='dark'] .condition-bar {
  background: var(--bg-subtle);
  border-radius: 2px;
}
[data-theme='dark'] .condition-bar__fill {
  background: var(--green);
}

/* Footer */
[data-theme='dark'] .footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
}
[data-theme='dark'] .footer .sep { color: var(--text-subtle); }
[data-theme='dark'] .brand__mini { color: var(--text); font-weight: 500; }

/* Info tips */
[data-theme='dark'] .info-icon {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
[data-theme='dark'] .info-tip {
  background: #0f1117;
  color: #e0e0e0;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.45);
}

/* Market Watch */
[data-theme='dark'] .mw-title {
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text);
  font-size: 20px;
}
[data-theme='dark'] .btn-ghost {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 3px;
  font-weight: 500;
  padding: 6px 12px;
  font-size: 12px;
  transition: background 120ms ease;
}
[data-theme='dark'] .btn-ghost:hover {
  background: var(--accent-strong);
  transform: none !important;
}

/* Focus */
[data-theme='dark'] button:focus-visible,
[data-theme='dark'] a:focus-visible,
[data-theme='dark'] input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Scrollbar */
[data-theme='dark'] ::-webkit-scrollbar { width: 10px; height: 10px; }
[data-theme='dark'] ::-webkit-scrollbar-thumb {
  background: #353b48;
  border-radius: 3px;
}
[data-theme='dark'] ::-webkit-scrollbar-thumb:hover { background: #4a5160; }
[data-theme='dark'] ::-webkit-scrollbar-track { background: transparent; }

/* Risk ratios */
[data-theme='dark'] .risk-ratios li {
  border-bottom: 1px solid var(--border);
  transition: background 100ms ease;
}
[data-theme='dark'] .risk-ratios li:hover { background: var(--bg-hover); }

/* Gauge */
[data-theme='dark'] #gauge-needle line { stroke: var(--text); }
[data-theme='dark'] #gauge-needle circle { fill: var(--bg-elevated); stroke: var(--text); }

/* Kill card entrance animation in dark too */
[data-theme='dark'] .grid .card { animation: none !important; }

/* Widget border */
[data-theme='dark'] .widget-embed { border: 1px solid var(--border); border-radius: 3px; }

/* ============================================================
   NEWS LIST — Custom Yahoo RSS feed (replaces TV timeline)
   Kite-dense row style, live relative timestamps.
   ============================================================ */
.widget-embed .news-list {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
}
.news-item {
  display: block;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background 80ms ease;
}
.news-item:last-child { border-bottom: 0; }
.news-item:hover { background: var(--bg-hover); }
.news-item__title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 5px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.news-item:hover .news-item__title { color: var(--accent); }
.news-item__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.news-item__source { font-weight: 500; }
.news-item__dot { opacity: 0.5; }
.news-item__time { color: var(--text-subtle); }
.news-item__tickers {
  display: inline-flex;
  gap: 4px;
  margin-left: auto;
}
.news-item__ticker {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  color: var(--accent);
  background: var(--accent-bg);
  letter-spacing: 0.3px;
}
.news-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  background: var(--bg-elevated);
}

/* Light-mode tweak */
[data-theme='light'] .widget-embed .news-list,
[data-theme='light'] .news-empty { background: var(--bg); }
[data-theme='light'] .news-item:hover { background: #f5f7fb; }
