:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --accent: #0284c7;
    --positive: #22c55e;
    --negative: #ef4444;
    --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

* {
    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:
        linear-gradient(90deg, rgba(14, 165, 233, 0.06), transparent 34rem),
        var(--bg);
    color: var(--text);
}

body.modal-open {
    overflow: hidden;
}

button,
input {
    font: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 18px;
    width: min(1680px, calc(100% - 28px));
    height: calc(100vh - 28px);
    height: calc(100svh - 28px);
    min-height: 720px;
    margin: 14px auto;
}

.side-rail {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
}

.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: 30px;
    line-height: 1;
    letter-spacing: 0;
}

.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: 8px;
    background: #f8fafc;
    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: 8px;
    background: #ffffff;
}

.last-updated-card {
    display: grid;
    gap: 4px;
    margin-bottom: 12px;
    padding: 10px 12px;
}

.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;
}

.tabs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    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: 8px;
    background: #ffffff;
    color: var(--text);
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.tab-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    text-align: left;
}

.tab-button:hover,
.refresh-button:hover {
    transform: translateY(-1px);
    border-color: rgba(56, 189, 248, 0.55);
}

.tab-button.active {
    border-color: rgba(2, 132, 199, 0.35);
    background: #e0f2fe;
    color: #075985;
}

.search-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    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: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 72px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

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

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

.refresh-button {
    padding: 8px 14px;
    background: #0f172a;
    color: #ffffff;
}

.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: 0;
    flex: 1;
    width: 100%;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    border-radius: 0;
    background:
        linear-gradient(135deg, #f8fafc, #eef2f7),
        #f8fafc;
    padding: 0;
}

.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, 10px);
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    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(15, 23, 42, 0.12);
    --pulse-shadow: rgba(15, 23, 42, 0.1);
}

.tile::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.14), transparent 52%),
        linear-gradient(180deg, transparent, rgba(15, 23, 42, 0.16));
    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 12px 24px rgba(15, 23, 42, 0.16);
    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.25;
    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.76);
    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: 8px 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: 5px 10px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    text-align: left;
}

.metric {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    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: 6px 8px;
    border-radius: 6px;
    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.58);
}

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

.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: 6px;
    background: rgba(15, 23, 42, 0.28);
    color: rgba(255, 255, 255, 0.82);
    font-size: 10px;
    font-weight: 800;
}

.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.38);
    backdrop-filter: blur(8px);
}

.modal-panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(1040px, 100%);
    max-height: min(780px, calc(100svh - 40px));
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.24);
}

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

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

.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: 8px;
    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);
    overflow-x: auto;
}

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

.statement-tab.active {
    border-color: rgba(2, 132, 199, 0.35);
    background: #e0f2fe;
    color: #075985;
}

.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: 8px;
    background: #f8fafc;
}

.snapshot-main {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
}

.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: 6px;
    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;
}

.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);
}

.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;
}

.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: 8px;
    background: #ffffff;
}

.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: auto;
}

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

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

.statement-content {
    min-height: 0;
    overflow: auto;
    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 {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.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: #f8fafc;
    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: 240px 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: 14px;
        max-height: none;
    }

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

    h1 {
        font-size: 24px;
    }

    .market-status {
        margin: 10px 0;
    }

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

    .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;
        white-space: nowrap;
    }

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

    .panel-heading {
        align-items: stretch;
        flex-direction: column;
    }

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

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

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

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

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

    .side-rail {
        position: relative;
        padding: 12px;
    }

    .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 {
        font-size: 10px;
    }

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

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

    .refresh-button {
        width: 100%;
    }

    #heatmap {
        grid-template-columns: repeat(8, minmax(0, 1fr));
        grid-auto-rows: 86px;
        min-height: 520px;
    }

    .tile {
        margin: 6px;
        padding: 10px;
    }

    .tile-rank,
    .label,
    .stock-details {
        display: none;
    }

    .tile-top,
    .price-wrap {
        gap: 8px;
    }

    .price-wrap {
        align-items: flex-end;
        margin: 4px 0 0;
    }

    .symbol {
        font-size: 14px;
    }

    .stock-name {
        font-size: 11px;
        -webkit-line-clamp: 1;
    }

    .price {
        font-size: 18px;
    }

    .change {
        padding: 5px 7px;
        font-size: 12px;
    }

    .change small {
        display: none;
    }

    .statement-modal {
        align-items: stretch;
        padding: 0;
    }

    .modal-panel {
        width: 100%;
        max-height: 100svh;
        border: 0;
        border-radius: 0;
    }

    .modal-header {
        padding: 14px;
    }

    .modal-header h2 {
        font-size: 19px;
    }

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

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

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

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

    .side-rail {
        padding: 12px;
    }

    #heatmap {
        grid-template-columns: repeat(8, minmax(0, 1fr));
        grid-auto-rows: 84px;
        min-height: 0;
        padding: 0;
    }

    .tile {
        padding: 10px;
    }

    .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: nowrap;
    }

    .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: 560px;
    }

    .modal-panel {
        max-height: calc(100svh - 20px);
    }
}

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

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

    #heatmap {
        grid-template-columns: repeat(8, minmax(0, 1fr));
        grid-auto-rows: 72px;
        min-height: 520px;
    }

    .tile {
        margin: 5px;
        padding: 9px;
    }

    .tile-top {
        display: block;
    }

    .price-wrap {
        align-items: flex-start;
        justify-content: space-between;
    }

    .stock-name {
        display: none;
    }

    .price {
        font-size: 17px;
    }

    .change {
        font-size: 11px;
    }

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

@media (max-width: 340px) {
    .symbol {
        font-size: 13px;
    }

    .price {
        font-size: 15px;
    }

    .change {
        padding: 4px 6px;
    }
}
