:root {
    --bg: #eef3f8;
    --surface: #ffffff;
    --surface-soft: #f7f9fc;
    --surface-muted: #eef4f8;
    --border: #dbe4ee;
    --border-strong: #c7d4e2;
    --text: #111827;
    --muted: #657486;
    --accent: #1367ef;
    --accent-soft: #eaf2ff;
    --positive: #16a34a;
    --negative: #dc2626;
    --shadow: 0 18px 46px rgba(32, 45, 64, 0.1);
    --shadow-soft: 0 10px 28px rgba(32, 45, 64, 0.07);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 16% 0%, rgba(19, 103, 239, 0.12), transparent 34rem),
        radial-gradient(circle at 86% 8%, rgba(20, 184, 166, 0.1), transparent 30rem),
        linear-gradient(180deg, #f8fbff 0%, #eef3f8 48%, #e8eef5 100%),
        var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

body.modal-open {
    overflow: hidden;
}

button,
input {
    font: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    gap: 16px;
    width: min(1760px, calc(100% - 32px));
    height: calc(100vh - 32px);
    height: calc(100svh - 32px);
    min-height: 720px;
    margin: 16px auto;
}

.side-rail {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.brand-block {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: 29px;
    line-height: 1.04;
    letter-spacing: 0;
}

.brand-subtitle {
    max-width: 235px;
    margin-top: 9px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.market-status {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    margin: 16px 0 12px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--muted);
    white-space: nowrap;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #f59e0b;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.12);
}

.market-status.ready .status-dot {
    background: var(--positive);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

.market-status.error .status-dot {
    background: var(--negative);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
}

.last-updated-card,
.dashboard-disclaimer {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #ffffff;
}

.last-updated-card {
    display: grid;
    gap: 4px;
    margin-bottom: 12px;
    padding: 11px 12px;
    box-shadow: var(--shadow-soft);
}

.last-updated-card span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.last-updated-card strong {
    color: var(--text);
    font-size: 13px;
    line-height: 1.25;
}

.dashboard-disclaimer {
    margin-top: 12px;
    padding: 10px 12px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}

.market-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.market-summary div {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background:
        linear-gradient(180deg, #ffffff, #f7fafc);
    box-shadow: var(--shadow-soft);
}

.market-summary span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.market-summary strong {
    display: block;
    margin-top: 5px;
    color: var(--text);
    font-size: 18px;
    line-height: 1;
}

.tabs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
    min-height: 0;
    margin-top: 14px;
    overflow: auto;
    padding-right: 4px;
    scrollbar-width: thin;
}

.tab-button,
.refresh-button {
    min-height: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text);
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.tab-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    color: #334155;
    font-size: 13px;
    font-weight: 750;
    text-align: left;
}

.tab-button:hover,
.refresh-button:hover {
    transform: translateY(-1px);
    border-color: rgba(19, 103, 239, 0.38);
    box-shadow: var(--shadow-soft);
}

.tab-button.active {
    border-color: rgba(19, 103, 239, 0.28);
    background: var(--accent-soft);
    color: #0f4bb8;
    box-shadow: inset 3px 0 0 var(--accent);
}

.search-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #ffffff;
    color: var(--muted);
}

.search-wrap input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
}

.search-wrap input::placeholder {
    color: rgba(148, 163, 184, 0.7);
}

.heatmap-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 78px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    background:
        linear-gradient(180deg, #ffffff, #f8fafc);
}

.panel-heading h2 {
    margin-bottom: 4px;
    font-size: 21px;
}

.panel-heading p {
    color: var(--muted);
    font-size: 13px;
}

.refresh-button {
    padding: 8px 14px;
    border-color: #0f172a;
    background: #0f172a;
    color: #ffffff;
    font-size: 13px;
    font-weight: 850;
}

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

.message {
    display: none;
    margin: 14px 18px 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--muted);
}

.message.visible {
    display: block;
}

.message.error {
    border-color: rgba(239, 68, 68, 0.35);
    color: #fecaca;
}

#heatmap {
    display: grid;
    grid-template-columns: repeat(16, minmax(0, 1fr));
    grid-auto-rows: 78px;
    grid-auto-flow: dense;
    gap: 2px;
    flex: 1;
    width: 100%;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    border-radius: 0;
    background:
        linear-gradient(135deg, #f8fafc, #eef3f8),
        #f8fafc;
    padding: 8px;
}

.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    grid-column: span var(--span-x);
    grid-row: span var(--span-y);
    min-width: 0;
    min-height: 0;
    margin: var(--growth-space, 9px);
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    text-align: center;
    animation: tilePulse var(--pulse-duration, 4.6s) ease-in-out infinite;
    animation-delay: var(--pulse-delay, 0s);
    transform-origin: center;
    transition: box-shadow 160ms ease, filter 160ms ease, transform 160ms ease;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        inset 0 -1px 0 rgba(15, 23, 42, 0.12),
        0 10px 20px rgba(15, 23, 42, 0.1);
    --pulse-shadow: rgba(15, 23, 42, 0.1);
}

.tile::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.2), transparent 32%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.13), transparent 48%),
        linear-gradient(180deg, transparent 42%, rgba(15, 23, 42, 0.18));
    pointer-events: none;
}

.tile:hover {
    border-color: rgba(15, 23, 42, 0.24);
    filter: saturate(1.04) brightness(1.02);
    transform: translateY(-1px);
    animation-play-state: paused;
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.2);
    z-index: 20;
}

.tile:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.82);
    outline-offset: -6px;
    z-index: 21;
}

.tile.positive {
    --pulse-shadow: rgba(21, 128, 61, var(--pulse-glow, 0.18));
    --pulse-color: rgba(22, 163, 74, var(--pulse-glow, 0.25));
}

.tile.negative {
    --pulse-shadow: rgba(190, 18, 60, var(--pulse-glow, 0.18));
    --pulse-color: rgba(220, 38, 38, var(--pulse-glow, 0.25));
}

.tile.neutral {
    --pulse-shadow: rgba(71, 85, 105, var(--pulse-glow, 0.14));
    --pulse-color: rgba(148, 163, 184, var(--pulse-glow, 0.18));
}

.tile-top,
.price-wrap,
.stock-details {
    position: relative;
    z-index: 1;
}

.tile-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    text-align: left;
}

.identity {
    min-width: 0;
}

.symbol {
    display: inline-flex;
    max-width: 100%;
    margin-bottom: 4px;
    color: #ffffff;
    font-size: clamp(13px, calc(13px + var(--text-boost, 0px)), 20px);
    font-weight: 900;
    line-height: 1.05;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stock-name {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.96);
    font-size: clamp(11px, calc(11px + var(--text-boost, 0px) * 0.28), 14px);
    font-weight: 800;
    line-height: 1.18;
    text-shadow: 0 1px 1px rgba(15, 23, 42, 0.22);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.label {
    color: rgba(255, 255, 255, 0.74);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.price-wrap {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin: 7px 0;
    text-align: left;
}

.price {
    margin-top: 3px;
    font-size: clamp(16px, calc(18px + var(--text-boost, 0px) * 2), 32px);
    font-weight: 900;
    line-height: 1.05;
    color: #ffffff;
    white-space: nowrap;
}

.stock-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 10px;
    margin-top: auto;
    padding-top: 7px;
    border-top: 1px solid rgba(255, 255, 255, 0.22);
    text-align: left;
}

.metric {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    min-height: 15px;
    padding: 0;
}

.stock-details strong {
    color: #ffffff;
    overflow: hidden;
    font-size: clamp(11px, calc(11px + var(--text-boost, 0px) * 0.5), 14px);
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.change {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: fit-content;
    max-width: 100%;
    padding: 7px 9px;
    border-radius: 8px;
    flex-direction: column;
    gap: 0;
    margin: 0;
    color: #ffffff;
    font-size: clamp(12px, calc(12px + var(--text-boost, 0px)), 16px);
    font-weight: 800;
    white-space: nowrap;
}

.change.gain {
    background: rgba(20, 83, 45, 0.62);
}

.change.loss {
    background: rgba(127, 29, 29, 0.62);
}

.change small {
    color: rgba(255, 255, 255, 0.72);
    font-size: 10px;
    line-height: 1;
}

.tile-rank {
    flex: 0 0 auto;
    padding: 4px 7px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.28);
    color: rgba(255, 255, 255, 0.82);
    font-size: 10px;
    font-weight: 800;
}

.mobile-tile {
    display: none;
}

#heatmap.phone-heatmap {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-auto-rows: calc((100vw - 36px) / 3) !important;
    grid-auto-flow: dense;
    gap: 8px !important;
    width: 100%;
    max-width: 100vw;
    padding: 10px !important;
    overflow-x: hidden !important;
}

#heatmap.phone-heatmap .tile {
    display: none !important;
}

#heatmap.phone-heatmap .mobile-tile {
    position: relative;
    display: flex !important;
    flex-direction: column;
    justify-content: space-between;
    grid-column: span 1;
    grid-row: span 1;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
    padding: 11px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 8px;
    overflow: hidden;
    color: #ffffff;
    cursor: pointer;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        inset 0 -26px 40px rgba(15, 23, 42, 0.2),
        0 10px 22px rgba(15, 23, 42, 0.16);
}

#heatmap.phone-heatmap .mobile-tile::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: rgba(255, 255, 255, 0.52);
    opacity: 0.78;
    pointer-events: none;
}

#heatmap.phone-heatmap .mobile-tile.featured {
    grid-column: span 2;
    grid-row: span 2;
}

#heatmap.phone-heatmap .mobile-tile::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.26), transparent 32%),
        radial-gradient(circle at 92% 100%, rgba(15, 23, 42, 0.22), transparent 42%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.13), transparent 46%),
        linear-gradient(180deg, transparent 38%, rgba(15, 23, 42, 0.28));
    pointer-events: none;
}

#heatmap.phone-heatmap .mobile-tile-head,
#heatmap.phone-heatmap .mobile-tile-body {
    position: relative;
    z-index: 1;
    min-width: 0;
}

#heatmap.phone-heatmap .mobile-tile-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 7px;
}

#heatmap.phone-heatmap .mobile-tile-identity {
    display: grid;
    min-width: 0;
    gap: 4px;
}

#heatmap.phone-heatmap .mobile-tile-identity strong {
    display: -webkit-box;
    overflow: hidden;
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 950;
    line-height: 1.08;
    text-wrap: balance;
    overflow-wrap: anywhere;
    text-shadow: 0 1px 2px rgba(15, 23, 42, 0.28);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

#heatmap.phone-heatmap .mobile-tile-identity small {
    width: fit-content;
    max-width: 100%;
    overflow: hidden;
    padding: 3px 6px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.18);
    color: rgba(255, 255, 255, 0.82);
    font-size: 9px;
    font-weight: 850;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#heatmap.phone-heatmap .mobile-change-badge {
    flex: 0 0 auto;
    display: grid;
    justify-items: end;
    min-width: 48px;
    padding: 5px 6px;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.34);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 5px 12px rgba(15, 23, 42, 0.12);
    line-height: 1;
}

#heatmap.phone-heatmap .mobile-change-badge strong {
    color: #ffffff;
    font-size: 10.5px;
    font-weight: 950;
    white-space: nowrap;
}

#heatmap.phone-heatmap .mobile-change-badge small {
    max-width: 58px;
    margin-top: 3px;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.68);
    font-size: 8px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#heatmap.phone-heatmap .mobile-tile-body {
    display: grid;
    justify-items: start;
    gap: 5px;
}

#heatmap.phone-heatmap .mobile-tile-price {
    display: grid;
    gap: 4px;
    max-width: 100%;
}

#heatmap.phone-heatmap .mobile-tile-price span {
    color: rgba(255, 255, 255, 0.66);
    font-size: 8.5px;
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
}

#heatmap.phone-heatmap .mobile-tile-price strong {
    overflow: hidden;
    max-width: 100%;
    font-size: clamp(17px, 5.6vw, 21px);
    font-weight: 950;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 2px 3px rgba(15, 23, 42, 0.2);
}

#heatmap.phone-heatmap .mobile-tile.featured .mobile-tile-identity strong {
    font-size: clamp(20px, 6.5vw, 28px);
    line-height: 1.02;
}

#heatmap.phone-heatmap .mobile-tile.featured .mobile-change-badge {
    min-width: 66px;
    padding: 7px 8px;
}

#heatmap.phone-heatmap .mobile-tile.featured .mobile-change-badge strong {
    font-size: 14px;
}

#heatmap.phone-heatmap .mobile-tile.featured .mobile-change-badge small {
    max-width: 78px;
    font-size: 9px;
}

#heatmap.phone-heatmap .mobile-tile.featured .mobile-tile-price span {
    font-size: 10px;
}

#heatmap.phone-heatmap .mobile-tile.featured .mobile-tile-price strong {
    font-size: clamp(32px, 10vw, 46px);
}

@media (max-width: 340px) {
    #heatmap.phone-heatmap {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-auto-rows: calc((100vw - 28px) / 2) !important;
    }
}

.statement-modal[hidden] {
    display: none;
}

.statement-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.46);
    backdrop-filter: blur(10px);
}

.modal-panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(1040px, 100%);
    max-height: min(780px, calc(100svh - 40px));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 32px 90px rgba(15, 23, 42, 0.28);
}

.modal-panel > .tab-panel.active,
.modal-panel > .financial-panel.active {
    min-height: 0;
    overflow: visible;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px;
    border-bottom: 1px solid var(--border);
    background:
        linear-gradient(180deg, #ffffff, #f8fafc);
}

.modal-header h2 {
    margin-bottom: 6px;
    font-size: 22px;
}

.modal-header p:last-child {
    color: var(--muted);
    font-size: 13px;
}

.statement-source {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.statement-source-note {
    margin-top: 4px;
    color: rgba(148, 163, 184, 0.82);
    font-size: 12px;
}

.statement-source a {
    color: var(--accent);
    text-decoration: none;
}

.statement-source a:hover {
    text-decoration: underline;
}

.icon-button {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
    color: var(--text);
    cursor: pointer;
    font-size: 26px;
    line-height: 1;
}

.statement-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: #ffffff;
    overflow: visible;
}

.statement-tab {
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #ffffff;
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
}

.statement-tab.active {
    border-color: rgba(19, 103, 239, 0.28);
    background: var(--accent-soft);
    color: #0f4bb8;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.stock-snapshot {
    display: grid;
    grid-template-columns: minmax(220px, 0.65fr) minmax(0, 1.3fr);
    gap: 12px;
    padding: 14px 20px 0;
}

.snapshot-main,
.snapshot-metrics,
.snapshot-source {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
}

.snapshot-main {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    box-shadow: var(--shadow-soft);
}

.snapshot-symbol {
    color: #334155;
    font-size: 13px;
    font-weight: 900;
}

.snapshot-main strong {
    color: #0f172a;
    font-size: 22px;
    line-height: 1;
}

.snapshot-change {
    margin-left: auto;
    padding: 5px 8px;
    border-radius: 8px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
}

.snapshot-change.gain {
    background: #15803d;
}

.snapshot-change.loss {
    background: #be123c;
}

.snapshot-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.snapshot-source {
    display: grid;
    grid-column: 1 / -1;
    gap: 5px;
    padding: 12px 14px;
    color: var(--muted);
    font-size: 12px;
}

.snapshot-source span {
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

.snapshot-source strong {
    color: #334155;
    font-size: 12px;
    font-weight: 750;
}

.snapshot-source a {
    color: var(--accent);
    text-decoration: none;
}

.snapshot-source a:hover {
    text-decoration: underline;
}

.snapshot-metrics span {
    display: grid;
    gap: 4px;
    padding: 12px;
    background: #ffffff;
    color: var(--muted);
    font-size: 12px;
}

.snapshot-metrics strong {
    color: #0f172a;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-panel {
    margin-top: 0;
    padding: 14px 20px 0;
    border-top: 1px solid var(--border);
    overflow: visible;
}

.news-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.news-heading h3 {
    margin: 0;
    color: #0f172a;
    font-size: 16px;
}

.news-heading p {
    color: var(--muted);
    font-size: 12px;
}

.chart-panel,
.info-panel {
    padding: 14px 20px 0;
    border-top: 1px solid var(--border);
}

.chart-heading,
.info-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.chart-heading h3,
.info-heading h3 {
    margin: 0;
    color: #0f172a;
    font-size: 16px;
}

.chart-heading p,
.info-heading p {
    color: var(--muted);
    font-size: 12px;
}

.stock-info-list {
    display: grid;
    max-width: 760px;
    margin: 0 auto 20px;
    overflow: hidden;
    border: 1px solid #d8e1ec;
    border-radius: 8px;
    background:
        linear-gradient(180deg, #ffffff, #f8fafc);
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}

.stock-info-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, auto);
    gap: 16px;
    align-items: center;
    min-height: 62px;
    padding: 15px 22px;
    border-bottom: 1px solid #e0e7f0;
    background: rgba(255, 255, 255, 0.72);
}

.stock-info-row:last-child {
    border-bottom: 0;
}

.stock-info-row:nth-child(even) {
    background: rgba(248, 250, 252, 0.9);
}

.stock-info-row span {
    color: #64748b;
    font-size: 16px;
    font-weight: 750;
    line-height: 1.2;
}

.stock-info-row strong {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
    color: #1f2937;
    font-size: 21px;
    font-weight: 850;
    line-height: 1.15;
    text-align: right;
}

.stock-info-row strong span {
    overflow: hidden;
    color: #111827;
    font-size: inherit;
    font-weight: inherit;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stock-info-row small {
    color: #64748b;
    font-size: 13px;
    font-weight: 850;
    line-height: 1;
}

.info-empty {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--muted);
}

.price-chart {
    display: grid;
    gap: 12px;
    padding-bottom: 18px;
}

.chart-visual {
    min-height: 280px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(14, 165, 233, 0.08), transparent 42%),
        #ffffff;
    color: #0284c7;
}

.chart-visual.gain {
    color: #16a34a;
    background:
        linear-gradient(135deg, rgba(34, 197, 94, 0.1), transparent 42%),
        #ffffff;
}

.chart-visual.loss {
    color: #dc2626;
    background:
        linear-gradient(135deg, rgba(239, 68, 68, 0.1), transparent 42%),
        #ffffff;
}

.chart-visual svg {
    display: block;
    width: 100%;
    height: 280px;
}

.chart-grid line {
    stroke: #e2e8f0;
    stroke-width: 1;
}

.chart-scale {
    fill: #64748b;
    font-size: 11px;
    font-weight: 800;
}

.chart-area {
    fill: url("#priceAreaGradient");
}

.chart-line {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 5;
}

.chart-marker line {
    stroke: #cbd5e1;
    stroke-width: 1;
}

.chart-marker circle {
    fill: #ffffff;
    stroke: currentColor;
    stroke-width: 4;
}

.chart-points {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.chart-points span {
    display: grid;
    gap: 5px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

.chart-points strong {
    overflow: hidden;
    color: #0f172a;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chart-empty {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--muted);
}

.news-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.news-card {
    display: grid;
    gap: 8px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-left-width: 5px;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: var(--shadow-soft);
}

.news-card.positive {
    border-left-color: #16a34a;
    background: #f0fdf4;
}

.news-card.negative {
    border-left-color: #dc2626;
    background: #fef2f2;
}

.news-card.neutral {
    border-left-color: #64748b;
    background: #f8fafc;
}

.news-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.news-card-top strong {
    color: #334155;
}

.news-card a {
    color: #0f172a;
    font-size: 13px;
    font-weight: 850;
    line-height: 1.25;
    text-decoration: none;
}

.news-card a:hover {
    text-decoration: underline;
}

.news-summary {
    color: #475569;
    font-size: 13px;
    line-height: 1.35;
}

.statement-message {
    display: none;
    margin: 18px 20px 0;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
}

.financial-panel {
    min-height: 0;
    overflow: visible;
}

.statement-message.visible {
    display: block;
}

.statement-message.error {
    border-color: rgba(239, 68, 68, 0.35);
    color: #fecaca;
}

.statement-content {
    min-height: 0;
    overflow: visible;
    padding: 20px;
}

.statement-disclaimer {
    margin: 0 20px 20px;
    padding: 12px;
    border: 1px solid #fde68a;
    border-radius: 8px;
    background: #fffbeb;
    color: #92400e;
    font-size: 12px;
    line-height: 1.35;
}

.statement-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-soft);
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
    touch-action: none;
}

.statement-table-wrap::-webkit-scrollbar {
    display: none;
}

.statement-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    background: #ffffff;
}

.statement-table th,
.statement-table td {
    padding: 13px 14px;
    border-bottom: 1px solid #e2e8f0;
    text-align: right;
    white-space: nowrap;
}

.statement-table th:first-child,
.statement-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 220px;
    background: #f8fafc;
    text-align: left;
}

.statement-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f3f7fb;
    color: #334155;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.statement-table tbody th {
    color: #0f172a;
    font-weight: 700;
}

.statement-table td {
    color: #334155;
    font-variant-numeric: tabular-nums;
}

@keyframes tilePulse {
    0% {
        transform: scale(1);
        opacity: 1;
        filter: brightness(1);
        box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.12);
    }

    72% {
        transform: scale(var(--bloom-scale, 1.08));
        opacity: 1;
        filter: brightness(1.16) drop-shadow(0 0 14px var(--pulse-color));
        box-shadow:
            inset 0 -1px 0 rgba(15, 23, 42, 0.12),
            0 0 0 3px var(--pulse-shadow);
    }

    83% {
        transform: scale(0.94);
        opacity: 0.16;
        filter: brightness(0.84);
    }

    88% {
        transform: scale(0.98);
        opacity: 1;
        filter: brightness(1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
        filter: brightness(1);
        box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.12);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tile {
        animation: none;
    }
}

@media (max-width: 1180px) {
    .app-shell {
        grid-template-columns: 258px minmax(0, 1fr);
        gap: 12px;
        width: min(100% - 20px, 1680px);
    }

    #heatmap {
        grid-template-columns: repeat(12, minmax(0, 1fr));
    }

    .tile {
        padding: 11px;
    }
}

@media (max-width: 820px) {
    .app-shell {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100svh;
        width: min(100% - 20px, 1220px);
        margin: 10px auto;
    }

    .side-rail {
        position: sticky;
        top: 0;
        z-index: 30;
        padding: 12px;
        max-height: none;
        border-radius: 14px;
    }

    .brand-block {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding-bottom: 10px;
    }

    h1 {
        font-size: 24px;
    }

    .brand-subtitle {
        display: none;
    }

    .market-status {
        min-height: 34px;
        margin: 10px 0 8px;
        padding: 7px 10px;
        font-size: 12px;
    }

    .last-updated-card {
        margin-bottom: 10px;
        padding: 8px 10px;
    }

    .market-summary {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
        margin-top: 10px;
    }

    .market-summary div {
        padding: 8px;
    }

    .market-summary span {
        font-size: 9px;
    }

    .market-summary strong {
        font-size: 14px;
    }

    .dashboard-disclaimer {
        margin-top: 10px;
    }

    .tabs {
        display: flex;
        flex-wrap: nowrap;
        margin-top: 10px;
        overflow-x: auto;
        padding: 0 0 4px;
    }

    .tab-button {
        flex: 0 0 auto;
        min-height: 36px;
        padding: 8px 11px;
        border-radius: 999px;
        font-size: 12px;
        white-space: nowrap;
    }

    .tab-button.active {
        box-shadow: none;
    }

    .heatmap-panel {
        height: auto;
        min-height: 620px;
    }

    .panel-heading {
        align-items: stretch;
        flex-direction: column;
        min-height: 0;
        padding: 13px;
    }

    .refresh-button {
        width: fit-content;
    }

    .panel-actions {
        justify-content: space-between;
    }

    .stock-snapshot {
        grid-template-columns: 1fr;
    }

    .news-list {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 640px) {
    .app-shell {
        width: 100%;
        margin: 0;
        gap: 8px;
    }

    .side-rail,
    .heatmap-panel {
        border-left: 0;
        border-right: 0;
        border-radius: 0;
    }

    .side-rail {
        position: relative;
        padding: 11px;
        border-radius: 0 0 14px 14px;
    }

    .brand-block {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
        padding-bottom: 10px;
    }

    h1 {
        font-size: 22px;
    }

    .market-status,
    .last-updated-card,
    .search-wrap {
        min-height: 38px;
    }

    .last-updated-card {
        padding: 8px 10px;
    }

    .last-updated-card strong {
        font-size: 12px;
    }

    .dashboard-disclaimer {
        display: none;
    }

    .search-wrap {
        min-height: 40px;
        font-size: 12px;
    }

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

    .panel-heading {
        min-height: 0;
        padding: 12px;
    }

    .panel-heading h2 {
        font-size: 18px;
    }

    .refresh-button {
        width: fit-content;
    }

    #heatmap {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-auto-rows: calc((100vw - 36px) / 3);
        grid-auto-flow: dense;
        gap: 8px;
        width: 100%;
        max-width: 100%;
        min-height: 520px;
        padding: 8px;
        overflow: auto;
        overflow-x: hidden;
    }

    #heatmap.phone-heatmap .tile {
        display: none;
    }

    .mobile-tile {
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        grid-column: span 1;
        grid-row: span 1;
        min-width: 0;
        min-height: 0;
        width: 100%;
        height: 100%;
        padding: 9px;
        border: 1px solid rgba(255, 255, 255, 0.18);
        border-radius: 8px;
        overflow: hidden;
        color: #ffffff;
        cursor: pointer;
        box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.14);
    }

    .mobile-tile.featured {
        grid-column: span 2;
        grid-row: span 2;
    }

    .mobile-tile::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent 52%),
            linear-gradient(180deg, transparent, rgba(15, 23, 42, 0.2));
        pointer-events: none;
    }

    .mobile-tile-head,
    .mobile-tile-body {
        position: relative;
        z-index: 1;
        min-width: 0;
    }

    .mobile-tile-head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 5px;
    }

    .mobile-tile-head strong {
        overflow: hidden;
        font-size: 11px;
        line-height: 1.05;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-tile-head span {
        flex: 0 0 auto;
        padding: 3px 5px;
        border-radius: 5px;
        background: rgba(15, 23, 42, 0.28);
        font-size: 10px;
        font-weight: 900;
        line-height: 1;
    }

    .mobile-tile-body {
        display: grid;
        gap: 4px;
    }

    .mobile-tile-body span {
        display: -webkit-box;
        overflow: hidden;
        color: rgba(255, 255, 255, 0.86);
        font-size: 10px;
        font-weight: 750;
        line-height: 1.15;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .mobile-tile-body strong {
        overflow: hidden;
        font-size: 15px;
        font-weight: 950;
        line-height: 1;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-tile.featured .mobile-tile-head strong {
        font-size: 14px;
    }

    .mobile-tile.featured .mobile-tile-body span {
        font-size: 12px;
    }

    .mobile-tile.featured .mobile-tile-body strong {
        font-size: 24px;
    }

    .statement-modal {
        display: flex;
        align-items: stretch;
        justify-content: stretch;
        padding: 0;
        overflow: hidden;
    }

    .modal-panel {
        width: 100%;
        min-height: 100svh;
        max-height: 100svh;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        border: 0;
        border-radius: 0;
    }

    .modal-header {
        flex: 0 0 auto;
        padding: 14px 14px 12px;
    }

    .modal-header h2 {
        max-width: calc(100vw - 86px);
        overflow: hidden;
        font-size: 20px;
        line-height: 1.15;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .icon-button {
        flex: 0 0 auto;
        width: 36px;
        height: 36px;
    }

    .statement-source,
    .statement-source-note {
        display: none;
    }

    .statement-tabs {
        flex: 0 0 auto;
        padding: 10px 14px;
        gap: 8px;
        overflow: visible;
    }

    .statement-tab {
        min-height: 36px;
        padding: 8px 12px;
        white-space: nowrap;
    }

    .stock-snapshot {
        flex: 0 0 auto;
        gap: 8px;
        padding-top: 10px;
    }

    .news-panel,
    .financial-panel.active,
    .tab-panel.active {
        min-height: 0;
        overflow: visible;
    }

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

    .chart-heading,
    .info-heading {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .stock-info-row {
        grid-template-columns: minmax(0, 1fr) minmax(105px, auto);
        min-height: 52px;
        padding: 12px 14px;
    }

    .stock-info-row span {
        font-size: 14px;
    }

    .stock-info-row strong {
        font-size: 16px;
    }

    .stock-info-row small {
        font-size: 11px;
    }

    .statement-table {
        min-width: 620px;
    }

    .snapshot-source {
        font-size: 11px;
    }

    .snapshot-source strong {
        font-size: 11px;
        line-height: 1.35;
    }
}

@media (max-width: 520px) {
    .app-shell {
        width: 100%;
        gap: 10px;
        margin: 0;
    }

    .side-rail {
        padding: 12px;
    }

    #heatmap {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-auto-rows: calc((100vw - 32px) / 3);
        grid-auto-flow: dense;
        min-height: 0;
        padding: 8px;
    }

    .mobile-tile {
        padding: 8px;
    }

    .price {
        font-size: clamp(15px, calc(16px + var(--text-boost, 0px)), 21px);
    }

    .stock-details {
        gap: 5px 8px;
    }

    .metric {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .statement-modal {
        padding: 10px;
    }

    .modal-header {
        padding: 16px;
    }

    .statement-tabs,
    .statement-content {
        padding-inline: 16px;
    }

    .statement-tabs {
        flex-wrap: wrap;
    }

    .statement-tab {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .stock-snapshot {
        padding-inline: 16px;
    }

    .news-panel {
        padding-inline: 16px;
    }

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

    .snapshot-main {
        align-items: flex-start;
        flex-direction: column;
    }

    .snapshot-change {
        margin-left: 0;
    }

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

    .heatmap-panel {
        height: auto;
        min-height: 0;
    }

    .modal-panel {
        max-height: 100svh;
    }
}

@media (max-width: 420px) {
    .tabs {
        gap: 5px;
    }

    .tab-button {
        min-height: 36px;
        padding: 8px 10px;
        font-size: 13px;
    }

    #heatmap {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-auto-rows: calc((100vw - 32px) / 3);
        grid-auto-flow: dense;
        min-height: 0;
    }

    .mobile-tile-body strong {
        font-size: 13px;
    }

    .statement-tabs,
    .statement-content,
    .stock-snapshot,
    .news-panel {
        padding-inline: 12px;
    }
}

@media (max-width: 340px) {
    #heatmap {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-rows: calc((100vw - 28px) / 2);
    }

    .mobile-tile-body strong {
        font-size: 15px;
    }
}

/* Horizontal navigation layout */
.site-header {
    position: sticky;
    top: 0;
    z-index: 70;
    border-bottom: 1px solid rgba(203, 213, 225, 0.72);
    background: rgba(248, 251, 255, 0.9);
    backdrop-filter: blur(18px);
}

.header-inner,
.filter-bar,
.app-shell {
    width: min(1760px, calc(100% - 32px));
    margin-inline: auto;
}

.header-inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 28px;
    min-height: 68px;
}

.brand-logo,
.main-nav a {
    color: var(--text);
    text-decoration: none;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: max-content;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(135deg, #1367ef, #3b82f6);
    color: #ffffff;
    font-size: 13px;
    font-weight: 950;
    box-shadow: 0 10px 24px rgba(19, 103, 239, 0.24);
}

.main-nav {
    display: flex;
    justify-content: center;
    gap: 6px;
    min-width: 0;
}

.main-nav a,
.sector-trigger {
    min-height: 38px;
    border-radius: 999px;
    font-weight: 850;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    padding: 0 15px;
    color: #475569;
    font-size: 14px;
}

.main-nav a:hover,
.main-nav a.active {
    background: #ffffff;
    color: #0f4bb8;
    box-shadow: var(--shadow-soft);
}

.sector-trigger {
    border: 1px solid var(--border);
    cursor: pointer;
}

.sector-trigger:hover {
    transform: translateY(-1px);
}

.filter-bar-wrap {
    position: sticky;
    top: 68px;
    z-index: 60;
    border-bottom: 1px solid rgba(203, 213, 225, 0.58);
    background: rgba(238, 243, 248, 0.88);
    backdrop-filter: blur(16px);
}

.filter-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
    align-items: center;
    gap: 14px;
    min-height: 64px;
}

.filter-scroll.tabs {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    gap: 8px;
    min-height: 0;
    margin: 0;
    overflow-x: auto;
    overflow-y: visible;
    padding: 8px 2px;
    scrollbar-width: thin;
}

.filter-scroll .tab-button,
.sector-trigger {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 15px;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: none;
}

.filter-scroll .tab-button {
    justify-content: center;
    color: #334155;
}

.filter-scroll .tab-button.active,
.sector-trigger.active {
    border-color: rgba(19, 103, 239, 0.36);
    background: #eaf2ff;
    color: #0f4bb8;
    box-shadow: 0 8px 18px rgba(19, 103, 239, 0.12);
}

.sector-menu {
    position: relative;
    flex: 0 0 auto;
}

.sector-trigger {
    background: #ffffff;
    color: #334155;
}

.sector-trigger::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-left: 9px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
}

.sector-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(110px, 1fr));
    gap: 8px;
    width: 276px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.sector-menu:hover .sector-dropdown,
.sector-menu:focus-within .sector-dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.sector-dropdown .tab-button {
    min-height: 36px;
    padding: 0 12px;
}

.search-wrap {
    margin: 0;
}

.app-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 16px;
    height: calc(100vh - 164px);
    height: calc(100svh - 164px);
    min-height: 620px;
    margin-top: 16px;
    margin-bottom: 16px;
}

.side-rail {
    display: none;
}

.heatmap-panel {
    width: 100%;
}

.panel-heading {
    min-height: 86px;
}

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

.panel-actions .market-status,
.panel-actions .last-updated-card {
    margin: 0;
}

.panel-actions .last-updated-card {
    min-height: 42px;
    padding: 8px 12px;
}

.panel-actions .market-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(78px, 1fr));
    gap: 6px;
    margin: 0;
}

.panel-actions .market-summary div {
    min-height: 42px;
    padding: 7px 10px;
}

.panel-actions .market-summary strong {
    font-size: 14px;
}

#heatmap {
    transition: opacity 190ms ease, transform 190ms ease;
    scrollbar-width: none;
}

#heatmap::-webkit-scrollbar {
    display: none;
}

#heatmap.is-switching {
    opacity: 0.45;
    transform: translateY(4px);
}

@media (max-width: 1180px) {
    .header-inner,
    .filter-bar,
    .app-shell {
        width: min(100% - 20px, 1680px);
    }

    .filter-bar {
        grid-template-columns: minmax(0, 1fr);
        padding: 8px 0;
    }

    .filter-bar .search-wrap {
        max-width: 460px;
    }

    .app-shell {
        height: auto;
        min-height: calc(100svh - 150px);
    }
}

@media (max-width: 820px) {
    .header-inner {
        grid-template-columns: 1fr;
        gap: 12px;
        min-height: 62px;
    }

    .main-nav {
        grid-column: 1 / -1;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 8px;
    }

    .filter-bar-wrap {
        top: 104px;
    }

    .panel-heading {
        align-items: stretch;
    }

    .panel-actions {
        justify-content: flex-start;
    }

    .panel-actions .market-summary {
        width: 100%;
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .header-inner,
    .filter-bar,
    .app-shell {
        width: 100%;
    }

    .header-inner,
    .filter-bar {
        padding-inline: 12px;
    }

    .brand-logo {
        font-size: 15px;
    }

    .main-nav a {
        min-height: 34px;
        padding: 0 12px;
        font-size: 13px;
    }

    .filter-bar-wrap {
        top: 102px;
    }

    .filter-scroll.tabs {
        padding-bottom: 4px;
    }

    .sector-dropdown {
        position: fixed;
        inset: auto 12px auto auto;
        top: 160px;
        left: 12px;
        width: calc(100vw - 24px);
    }

    .app-shell {
        margin: 0;
        min-height: 0;
    }

    .heatmap-panel {
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .panel-actions .market-status,
    .panel-actions .last-updated-card {
        display: none;
    }
}

@media (max-width: 420px) {
    .panel-actions .market-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Refined screener header */
body {
    position: relative;
    background:
        radial-gradient(circle at 18% 6%, rgba(19, 103, 239, 0.12), transparent 32rem),
        radial-gradient(circle at 88% 12%, rgba(20, 184, 166, 0.1), transparent 34rem),
        linear-gradient(180deg, #edf5ff 0%, #f8fbff 42%, #eef6fb 100%),
        var(--bg);
}

body::before {
    content: "";
    position: fixed;
    inset: 76px 0 auto;
    z-index: -1;
    height: 420px;
    background:
        repeating-radial-gradient(ellipse 82% 44% at 50% 100%, rgba(19, 103, 239, 0.12) 0 2px, transparent 3px 18px);
    opacity: 0.62;
    transform: translateY(-78px);
    pointer-events: none;
}

.site-header {
    background: rgba(244, 249, 255, 0.92);
}

.header-inner {
    min-height: 62px;
}

.brand-logo {
    font-size: 17px;
}

.main-nav {
    gap: 22px;
}

.main-nav a {
    position: relative;
    min-height: 62px;
    padding: 0 2px;
    border-radius: 0;
    background: transparent;
    color: #475569;
    box-shadow: none;
}

.main-nav a::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 3px;
    border-radius: 999px 999px 0 0;
    background: #1367ef;
    opacity: 0;
    transform: scaleX(0.55);
    transition: opacity 180ms ease, transform 180ms ease;
}

.main-nav a:hover,
.main-nav a.active {
    background: transparent;
    box-shadow: none;
}

.main-nav a:hover::after,
.main-nav a.active::after {
    opacity: 1;
    transform: scaleX(1);
}

.filter-bar-wrap {
    top: 62px;
    overflow: visible;
    background: rgba(235, 244, 255, 0.78);
}

.index-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 12px;
    width: min(1060px, calc(100% - 32px));
    margin: 18px auto 10px;
}

.index-card {
    display: grid;
    gap: 5px;
    min-height: 58px;
    padding: 11px 14px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 12px 28px rgba(32, 45, 64, 0.06);
}

.index-card span {
    color: #64748b;
    font-size: 11px;
    font-weight: 850;
}

.index-card strong {
    color: #334155;
    font-size: 15px;
}

.index-card em {
    color: #ff5a5f;
    font-size: 12px;
    font-style: normal;
    font-weight: 800;
}

.filter-bar {
    min-height: 58px;
}

.filter-scroll.tabs {
    overflow: visible;
    scrollbar-width: none;
}

.filter-scroll.tabs::-webkit-scrollbar {
    display: none;
}

.filter-scroll .tab-button,
.sector-trigger {
    background: rgba(255, 255, 255, 0.88);
}

.filter-scroll .tab-button.active,
.sector-trigger.active {
    border-color: rgba(19, 103, 239, 0.42);
    background: #e8f1ff;
    color: #0f4bb8;
}

.sector-dropdown {
    z-index: 120;
}

.sector-menu.open .sector-dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.heatmap-panel {
    background: rgba(255, 255, 255, 0.9);
}

.panel-heading {
    background: rgba(255, 255, 255, 0.9);
}

.panel-actions {
    gap: 10px;
}

.panel-actions .market-summary {
    display: none;
}

.last-updated-card {
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #ffffff;
}

.last-updated-card span {
    display: block;
    color: #64748b;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

@media (max-width: 1180px) {
    .index-strip {
        width: min(100% - 20px, 1060px);
        overflow-x: auto;
        scrollbar-width: none;
    }

    .index-strip::-webkit-scrollbar {
        display: none;
    }
}

@media (max-width: 820px) {
    .filter-bar-wrap {
        top: 104px;
    }

    .filter-scroll.tabs {
        overflow-x: auto;
        overflow-y: visible;
    }

    .index-strip {
        grid-template-columns: repeat(5, minmax(150px, 1fr));
    }

    .sector-dropdown {
        position: fixed;
        top: 198px;
        left: 12px;
        width: min(420px, calc(100vw - 24px));
    }
}

@media (max-width: 640px) {
    body::before {
        inset: 122px 0 auto;
        height: 300px;
        opacity: 0.48;
    }

    .filter-bar-wrap {
        top: 102px;
    }

    .index-strip {
        width: 100%;
        padding-inline: 12px;
        margin-top: 10px;
    }

    .sector-dropdown {
        top: 208px;
    }

}

/* Tickertape-inspired dark top band and clean content background */
:root {
    --tt-bg: #f7f8fa;
    --tt-ink: #17212f;
    --tt-muted: #7d8a99;
    --tt-dark: #121c27;
    --tt-dark-soft: #192635;
    --tt-dark-card: #1d2a3a;
    --tt-line: #e7ebf0;
    --tt-blue: #1473e6;
    --tt-green: #17b26a;
    --tt-red: #f04455;
    --tt-shadow: 0 18px 42px rgba(18, 28, 39, 0.08);
}

body {
    background:
        linear-gradient(180deg, var(--tt-dark) 0 156px, var(--tt-bg) 156px 100%) !important;
    color: var(--tt-ink);
}

body::before {
    display: none !important;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 80;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: var(--tt-dark) !important;
    color: #ffffff;
    backdrop-filter: none;
}

.header-inner {
    min-height: 54px !important;
}

.brand-logo,
.main-nav a {
    color: #ffffff !important;
}

.brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #ffffff !important;
    color: var(--tt-dark) !important;
    box-shadow: none !important;
}

.main-nav a {
    min-height: 54px !important;
    color: rgba(255, 255, 255, 0.78) !important;
}

.main-nav a:hover,
.main-nav a.active {
    color: #ffffff !important;
}

.main-nav a::after {
    background: #ffffff !important;
}

.filter-bar-wrap {
    top: 54px !important;
    overflow: visible;
    border-bottom: 0 !important;
    border-radius: 0 0 14px 14px;
    background: var(--tt-dark) !important;
    box-shadow: 0 16px 34px rgba(18, 28, 39, 0.14);
    backdrop-filter: none;
}

.index-strip {
    grid-template-columns: repeat(5, minmax(132px, 1fr)) !important;
    gap: 8px !important;
    width: min(1024px, calc(100% - 32px)) !important;
    margin: 6px auto 10px !important;
}

.index-card {
    min-height: 58px !important;
    padding: 11px 13px !important;
    border: 1px solid rgba(255, 255, 255, 0.04) !important;
    border-radius: 8px !important;
    background: var(--tt-dark-card) !important;
    box-shadow: none !important;
}

.index-card span {
    color: rgba(255, 255, 255, 0.48) !important;
}

.index-card strong {
    color: #ffffff !important;
}

.index-card em {
    color: var(--tt-red) !important;
}

.filter-bar {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 346px) !important;
    min-height: 52px !important;
    padding-bottom: 14px;
}

.filter-scroll .tab-button,
.sector-trigger {
    border-color: rgba(255, 255, 255, 0.08) !important;
    background: var(--tt-dark-soft) !important;
    color: rgba(255, 255, 255, 0.78) !important;
}

.filter-scroll .tab-button.active,
.sector-trigger.active {
    border-color: rgba(255, 255, 255, 0.18) !important;
    background: #ffffff !important;
    color: var(--tt-dark) !important;
    box-shadow: none !important;
}

.search-wrap {
    border-color: rgba(255, 255, 255, 0.08) !important;
    background: var(--tt-dark-soft) !important;
    color: rgba(255, 255, 255, 0.56) !important;
}

.search-wrap input {
    color: #ffffff !important;
}

.search-wrap input::placeholder {
    color: rgba(255, 255, 255, 0.46) !important;
}

.sector-dropdown {
    border: 1px solid var(--tt-line) !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    box-shadow: var(--tt-shadow) !important;
}

.sector-dropdown .tab-button {
    border-color: var(--tt-line) !important;
    background: #ffffff !important;
    color: var(--tt-ink) !important;
}

.app-shell {
    width: min(1024px, calc(100% - 32px)) !important;
    height: auto !important;
    min-height: calc(100svh - 210px) !important;
    margin-top: 32px !important;
}

.heatmap-panel {
    overflow: hidden;
    border: 1px solid var(--tt-line) !important;
    border-radius: 14px !important;
    background: rgba(255, 255, 255, 0.98) !important;
    box-shadow: var(--tt-shadow) !important;
}

.panel-heading {
    min-height: 72px !important;
    border-bottom: 1px solid var(--tt-line) !important;
    background: #ffffff !important;
}

.panel-heading h2 {
    color: var(--tt-ink);
}

.panel-heading p,
.last-updated-card span {
    color: var(--tt-muted) !important;
}

.market-status,
.last-updated-card {
    border-color: var(--tt-line) !important;
    border-radius: 8px !important;
    background: #fbfcfd !important;
    box-shadow: none !important;
}

.refresh-button {
    border-color: var(--tt-dark) !important;
    border-radius: 8px !important;
    background: var(--tt-dark) !important;
    color: #ffffff !important;
}

#heatmap {
    background: #fbfcfd !important;
    padding: 10px !important;
}

.tile,
#heatmap.phone-heatmap .mobile-tile {
    border-radius: 8px !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        0 8px 16px rgba(18, 28, 39, 0.08) !important;
}

.message {
    border-color: var(--tt-line) !important;
    border-radius: 10px !important;
    background: #fbfcfd !important;
}

.modal-panel {
    border-color: var(--tt-line) !important;
    border-radius: 14px !important;
    box-shadow: 0 28px 80px rgba(18, 28, 39, 0.22) !important;
}

@media (max-width: 820px) {
    body {
        background:
            linear-gradient(180deg, var(--tt-dark) 0 190px, var(--tt-bg) 190px 100%) !important;
    }

    .filter-bar-wrap {
        top: 102px !important;
    }

    .index-strip {
        margin-top: 8px !important;
        padding-inline: 10px;
    }
}

/* React-ready StockCard design ported to current vanilla dashboard */
#heatmap.stock-card-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-auto-rows: auto !important;
    grid-auto-flow: row !important;
    gap: 16px !important;
    padding: 16px !important;
    overflow: auto !important;
    background: #fbfcfd !important;
}

.stock-card {
    display: block !important;
    min-width: 0;
    min-height: 0;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-left-width: 2px;
    border-radius: 12px;
    background: #ffffff !important;
    color: #111827;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    opacity: 0;
    transform: translateY(8px);
    animation: stockCardIn 200ms ease-out forwards;
    animation-delay: var(--mount-delay, 0ms);
    transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

.stock-card.positive {
    border-left-color: #16a34a;
}

.stock-card.negative {
    border-left-color: #dc2626;
}

.stock-card:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.stock-card:active {
    transform: scale(0.98);
}

.stock-card:focus-visible {
    outline: 3px solid rgba(20, 115, 230, 0.24);
    outline-offset: 2px;
}

.stock-card-header,
.stock-card-price-row,
.stock-card-metrics {
    display: flex;
    align-items: center;
}

.stock-card-header {
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
}

.stock-card-name {
    min-width: 0;
    overflow: hidden;
    color: #111827;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stock-card-rank {
    flex: 0 0 auto;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 12px;
    font-weight: 700;
}

.stock-card-price-row {
    gap: 8px;
    margin-top: 4px;
}

.stock-card-price-row strong {
    color: #030712;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.15;
}

.stock-card-change {
    font-size: 14px;
    font-weight: 700;
}

.stock-card-change.gain {
    color: #16a34a;
}

.stock-card-change.loss {
    color: #dc2626;
}

.stock-card-sparkline {
    display: block;
    width: 100%;
    height: 32px;
    margin-top: 8px;
}

.stock-card-metrics {
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.2;
}

.stock-card-metrics span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stock-card-insight {
    display: inline-block;
    max-width: 100%;
    margin-top: 8px;
    padding: 4px 8px;
    overflow: hidden;
    border-radius: 6px;
    background: #f1f5f9;
    color: #334155;
    font-size: 12px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@keyframes stockCardIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 980px) {
    #heatmap.stock-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 640px) {
    #heatmap.stock-card-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 10px !important;
        padding: 12px !important;
    }

    .stock-card {
        min-height: 126px;
    }
}

/* Standalone stock detail page */
body.stock-detail-page {
    background: #f7f8fa !important;
}

body.stock-detail-page .site-header,
body.stock-detail-page .filter-bar-wrap,
body.stock-detail-page .app-shell {
    display: none !important;
}

body.stock-detail-page .statement-modal {
    position: static !important;
    display: block !important;
    min-height: 100vh !important;
    padding: clamp(12px, 3vw, 28px) !important;
}

body.stock-detail-page .modal-backdrop {
    display: none !important;
}

body.stock-detail-page .modal-panel {
    width: min(1180px, 100%) !important;
    max-height: none !important;
    min-height: calc(100vh - clamp(24px, 6vw, 56px)) !important;
    margin: 0 auto !important;
    overflow: visible !important;
    border-color: #e7ebf0 !important;
    border-radius: 14px !important;
    box-shadow: 0 18px 42px rgba(18, 28, 39, 0.08) !important;
}

body.stock-detail-page .modal-header {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #ffffff !important;
}

body.stock-detail-page .icon-button[data-close-statements] {
    border-color: #e7ebf0;
    background: #f8fafc;
}

.tradingview-chart-shell {
    height: min(620px, 64svh);
    min-height: 430px;
    overflow: hidden;
    border: 1px solid #e7ebf0;
    border-radius: 12px;
    background: #ffffff;
}

.tradingview-chart {
    width: 100%;
    height: 100%;
}

.chart-source-note {
    margin: 10px 0 0;
    color: #667085;
    font-size: 12px;
}

.chart-source-note a {
    color: #1473e6;
    font-weight: 850;
    text-decoration: none;
}

@media (max-width: 640px) {
    body.stock-detail-page .statement-modal {
        padding: 0 !important;
    }

    body.stock-detail-page .modal-panel {
        min-height: 100vh !important;
        border: 0 !important;
        border-radius: 0 !important;
    }

    .tradingview-chart-shell {
        min-height: 420px;
        height: 62svh;
        border-radius: 10px;
    }
}

@media (max-width: 640px) {
    .filter-bar {
        grid-template-columns: minmax(0, 1fr) !important;
        padding-inline: 12px !important;
    }

    .search-wrap {
        max-width: none !important;
    }

    .app-shell {
        width: 100% !important;
        margin-top: 18px !important;
    }

    .heatmap-panel {
        border-radius: 14px 14px 0 0 !important;
        border-left: 0 !important;
        border-right: 0 !important;
    }
}
