/* Sector Heatmap (Overview) — theme-aware via the app's CSS variables; light + dark */
.sms-heat {
  --hm-up: var(--bullish, #3FB68B);
  --hm-down: var(--bearish, #E5675F);
  --hm-base: var(--card, #fff);
  --hm-ease: cubic-bezier(.22, 1, .36, 1);
  position: relative;
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--sms-shadow, 0 0 0 1px var(--border));
  border: 1px solid transparent;
  padding: 20px 22px 18px;
  overflow: hidden;
}
html:not([data-theme="smartmoney"]) .sms-heat { border-color: var(--border); border-radius: 14px; }
.sms-heat::before { /* slow ambient sheen across the card */
  content: ""; position: absolute; inset: -40% -10%; pointer-events: none; opacity: .5;
  background: radial-gradient(40% 60% at 15% 0%, color-mix(in srgb, var(--hm-up) 10%, transparent), transparent 70%),
              radial-gradient(35% 55% at 95% 100%, color-mix(in srgb, var(--hm-down) 9%, transparent), transparent 70%);
  animation: hm-ambient 14s ease-in-out infinite alternate;
}
@keyframes hm-ambient { from { transform: translate3d(-2%, 0, 0); } to { transform: translate3d(2%, 3%, 0); } }

.hm-head { position: relative; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 18px; margin-bottom: 14px; }
.hm-eyebrow { font-family: var(--pl-mono, ui-monospace, monospace); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-foreground); display: flex; align-items: center; gap: 8px; }
.hm-live { width: 7px; height: 7px; border-radius: 50%; background: var(--hm-up); box-shadow: 0 0 0 0 color-mix(in srgb, var(--hm-up) 55%, transparent); animation: hm-pulse 2.2s ease-out infinite; }
@keyframes hm-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--hm-up) 55%, transparent); } 80%, 100% { box-shadow: 0 0 0 9px transparent; } }
.hm-title { font-family: var(--pl-serif, Georgia, serif); font-weight: 400; font-size: clamp(1.5rem, 2.4vw, 2rem); line-height: 1.05; margin: 6px 0 4px; color: var(--foreground); }
.hm-sum { font-size: 12.5px; color: var(--muted-foreground); }
.hm-sum b { font-family: var(--pl-mono, monospace); font-weight: 600; }
.hm-u { color: var(--hm-up); } .hm-d { color: var(--hm-down); }
.hm-ctrl { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.hm-range { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--secondary); box-shadow: inset 0 0 0 1px var(--pl-ring, var(--border)); }
.hm-range button { font-family: var(--pl-mono, monospace); font-size: 11.5px; padding: 5px 12px; border-radius: 999px; color: var(--muted-foreground); transition: background .25s, color .25s, box-shadow .25s; }
.hm-range button:hover { color: var(--foreground); }
.hm-range button.active { background: var(--card); color: var(--foreground); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--pl-ring, var(--border)); }
.hm-legend { display: flex; align-items: center; gap: 6px; font-family: var(--pl-mono, monospace); font-size: 10.5px; color: var(--muted-foreground); }
.hm-legend i { width: 120px; height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--hm-down), color-mix(in srgb, var(--hm-down) 15%, var(--hm-base)) 45%, color-mix(in srgb, var(--hm-up) 15%, var(--hm-base)) 55%, var(--hm-up)); }

.hm-nav { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12px; color: var(--muted-foreground); min-height: 22px; }
.hm-crumb { display: flex; align-items: center; gap: 8px; }
.hm-crumb span { font-weight: 500; color: var(--foreground); }
.hm-back { font-family: var(--pl-mono, monospace); font-size: 11.5px; padding: 3px 10px; border-radius: 999px; background: var(--secondary); color: var(--foreground); transition: transform .2s var(--hm-ease), background .2s; }
.hm-back:hover { transform: translateX(-2px); background: color-mix(in srgb, var(--primary) 14%, var(--secondary)); }
.hm-asof { font-family: var(--pl-mono, monospace); font-size: 11px; }

.hm-board { position: relative; height: clamp(300px, 38vw, 440px); border-radius: 14px; overflow: hidden; background: color-mix(in srgb, var(--foreground) 4%, var(--hm-base)); }
.hm-board.hm-zoom-in { animation: hm-zin .5s var(--hm-ease); }
.hm-board.hm-zoom-out { animation: hm-zout .5s var(--hm-ease); }
@keyframes hm-zin { from { transform: scale(.94); opacity: .3; filter: blur(3px); } to { transform: none; opacity: 1; filter: none; } }
@keyframes hm-zout { from { transform: scale(1.05); opacity: .3; filter: blur(3px); } to { transform: none; opacity: 1; filter: none; } }
.sms-heat.hm-loading .hm-live { animation-duration: .8s; }

.hm-tile {
  --hm-mix: 0%;
  position: absolute; box-sizing: border-box; padding: 9px 10px; border: 0; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; justify-content: space-between; gap: 2px; overflow: hidden;
  color: var(--foreground);
  background: var(--hm-base);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hm-base) 70%, transparent);
  border-radius: 6px;
  outline: 2px solid var(--hm-base); outline-offset: -1px;
  transition: left .7s var(--hm-ease), top .7s var(--hm-ease), width .7s var(--hm-ease), height .7s var(--hm-ease),
              background-color .7s ease, color .4s ease, transform .25s var(--hm-ease), box-shadow .25s ease, opacity .45s ease, filter .25s ease;
  transition-delay: var(--hm-delay, 0ms), var(--hm-delay, 0ms), var(--hm-delay, 0ms), var(--hm-delay, 0ms), 0ms, 0ms, 0ms, 0ms, 0ms, 0ms;
}
/* the theme rounds every <button> in <main> into a pill (html[data-theme] main button): tiles stay rectangles */
.sms-heat .hm-board .hm-tile { border-radius: 6px; }
.hm-tile.hm-up { background: color-mix(in srgb, var(--hm-up) var(--hm-mix), var(--hm-base)); }
.hm-tile.hm-down { background: color-mix(in srgb, var(--hm-down) var(--hm-mix), var(--hm-base)); }
.hm-tile.hm-strong { color: #fff; }
.hm-tile.hm-strong .hm-meta, .hm-tile.hm-strong .hm-spark line { color: rgba(255,255,255,.82); stroke: rgba(255,255,255,.5); }
.hm-tile:hover, .hm-tile:focus-visible { z-index: 3; transform: scale(1.035); box-shadow: 0 14px 30px -12px rgba(0,0,0,.35), inset 0 0 0 1px color-mix(in srgb, var(--foreground) 22%, transparent); filter: saturate(1.15) brightness(1.03); }
.hm-board:hover .hm-tile:not(:hover) { filter: saturate(.85); }
.hm-tile.hm-enter { opacity: 0; transform: scale(.6); }
.hm-tile.hm-leave { opacity: 0; transform: scale(.85); pointer-events: none; }
.hm-name { font-weight: 600; font-size: 13px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-val { font-family: var(--pl-mono, monospace); font-size: clamp(14px, 1.7vw, 20px); font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.hm-meta { font-family: var(--pl-mono, monospace); font-size: 10.5px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-bar { display: block; height: 3px; border-radius: 99px; background: color-mix(in srgb, currentColor 16%, transparent); overflow: hidden; }
.hm-bar i { display: block; height: 100%; border-radius: inherit; background: currentColor; opacity: .7; transition: width .8s var(--hm-ease); }
.hm-sparkwrap { order: 2; flex: 1 1 auto; min-height: 0; max-height: 46px; margin: 2px 0; pointer-events: none; opacity: .6; }
.hm-sparkwrap:empty { display: none; }
.hm-meta { order: 3; } .hm-bar { order: 4; }
.hm-spark { width: 100%; height: 100%; }
.hm-spark path { fill: none; stroke: currentColor; stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-dasharray: 400; stroke-dashoffset: 400; animation: hm-draw 1.4s .3s var(--hm-ease) forwards; }
.hm-spark line { stroke: currentColor; stroke-dasharray: 2 3; stroke-width: 1; vector-effect: non-scaling-stroke; opacity: .35; }
@keyframes hm-draw { to { stroke-dashoffset: 0; } }
.hm-tile.hm-small { padding: 6px 7px; }
.hm-tile.hm-small .hm-name { font-size: 11.5px; }
.hm-tile.hm-small .hm-val { font-size: 13px; }
.hm-tile.hm-small .hm-meta, .hm-tile.hm-small .hm-bar { display: none; }
.hm-tile.hm-tiny { padding: 4px 5px; justify-content: center; }
.hm-tile.hm-tiny .hm-val { display: none; }
.hm-tile.hm-tiny .hm-name { font-size: 10px; }
.hm-stock .hm-name { font-family: var(--pl-mono, monospace); font-size: 12px; }

/* live refresh: a tile whose move changed glows briefly in its new direction */
.hm-tile.hm-flash-up { animation: hm-flash-up 1.4s ease-out; }
.hm-tile.hm-flash-down { animation: hm-flash-down 1.4s ease-out; }
@keyframes hm-flash-up { 0% { box-shadow: inset 0 0 0 2px var(--hm-up), 0 0 22px color-mix(in srgb, var(--hm-up) 60%, transparent); } 100% { box-shadow: inset 0 0 0 1px transparent; } }
@keyframes hm-flash-down { 0% { box-shadow: inset 0 0 0 2px var(--hm-down), 0 0 22px color-mix(in srgb, var(--hm-down) 60%, transparent); } 100% { box-shadow: inset 0 0 0 1px transparent; } }

.hm-tip { position: absolute; left: 0; top: 0; z-index: 10; min-width: 190px; max-width: 260px; padding: 10px 12px; border-radius: 12px; pointer-events: none;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 0 0 1px var(--pl-ring-strong, var(--border)), 0 18px 40px -18px rgba(0,0,0,.45); font-size: 12px; color: var(--foreground);
  transition: transform .12s ease-out; }
.hm-tip b:first-child { font-size: 13px; }
.hm-tip-g { display: block; color: var(--muted-foreground); font-size: 11px; margin: 1px 0 6px; }
.hm-tip-row { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; color: var(--muted-foreground); }
.hm-tip-row b { font-family: var(--pl-mono, monospace); color: var(--foreground); font-weight: 600; }
.hm-tip-row b.hm-u { color: var(--hm-up); } .hm-tip-row b.hm-d { color: var(--hm-down); }
.hm-tip-foot { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--pl-ring, var(--border)); font-size: 10.5px; color: var(--muted-foreground); }
.hm-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted-foreground); font-size: 13px; }
.hm-foot { position: relative; margin-top: 10px; font-size: 10.5px; color: var(--muted-foreground); font-family: var(--pl-mono, monospace); }

@media (max-width: 640px) {
  .sms-heat { padding: 16px 14px; border-radius: 18px; }
  .hm-ctrl { align-items: flex-start; }
  .hm-board { height: 360px; }
  .hm-legend i { width: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  .sms-heat::before, .hm-live, .hm-spark path { animation: none; stroke-dashoffset: 0; }
  .hm-tile { transition: background-color .2s; }
}
