html, body, .mud-typography, .mud-button-root, .mud-input {
    font-family: "Open Sans", "Segoe UI", sans-serif;
}

h1:focus { outline: none; }

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 10000;
    color: #333;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "An error has occurred."; }

/* ---- shared ---- */
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--mud-palette-success); }
.neg { color: var(--mud-palette-error); }
.muted { color: var(--mud-palette-text-secondary); }
.apex-host { width: 100%; }
.apex-host .apexcharts-tooltip { box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.clickable-row { cursor: pointer; }
.cell-name { font-weight: 600; }
.cell-desc { font-size: .75rem; color: var(--mud-palette-text-secondary); }
a.plain { color: inherit; text-decoration: none; }

/* ---- SiteAnalyst shell (same as the other SiteAnalyst tools) ---- */
.sa-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--mud-palette-background); color: var(--mud-palette-text-primary); }
.sa-topbar { background: #333; color: #ccc; font-size: 13px; padding: 8px 16px; text-align: center; position: relative; }
.sa-topbar a { color: #ccc; text-decoration: none; margin: 0 12px; }
.sa-topbar a:hover { color: #F5A623; }
.sa-divider { color: #666; }
.sa-topbar { position: relative; }
.sa-auth { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 10px; }
.sa-auth form { margin: 0; }
.sa-user { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #ccc; }
.sa-topbar a.sa-login, .sa-login {
    display: inline-block;
    margin: 0;
    padding: 3px 14px;
    border: 1px solid #F5A623;
    border-radius: 4px;
    background: transparent;
    color: #F5A623;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.sa-topbar a.sa-login:hover, .sa-login:hover { background: #F5A623; color: #fff; }
@media (max-width: 1000px) {
    .sa-auth { position: static; transform: none; justify-content: center; margin-top: 6px; }
}
.sa-nav {
    background: var(--mud-palette-appbar-background);
    color: var(--mud-palette-appbar-text);
    border-bottom: 1px solid var(--mud-palette-lines-default);
    box-shadow: 0 1px 6px rgba(0,0,0,.12);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 1100;
}
.sa-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: 0 0 auto; }
.sa-brand img { height: 42px; width: auto; }
.sa-brand span { font-size: 20px; font-weight: 700; color: #2196C8; letter-spacing: -0.3px; }
.sa-brand span.sa-badge, .sa-badge { background: #F5A623; color: #fff; font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; padding: 4px 10px; border-radius: 50px; }
.sa-nav-main { display: flex; align-items: center; gap: 18px; margin-left: auto; min-width: 0; }
.sa-links { display: flex; align-items: center; gap: 20px; }
.sa-links a { text-decoration: none; color: inherit; font-size: 14px; font-weight: 600; padding: 6px 0; white-space: nowrap; }
.sa-links a:hover, .sa-links a.active { color: #2196C8; }
.sa-links a.active { box-shadow: inset 0 -2px 0 #2196C8; }
.sa-tools { display: flex; align-items: center; gap: 4px; }
.sa-burger { display: none; margin-left: auto; width: 40px; height: 36px; border: 1px solid #d7e6f0; border-radius: 6px; background: transparent; padding: 8px; flex-direction: column; justify-content: space-between; cursor: pointer; }
.sa-burger span { display: block; height: 2px; background: #2196C8; border-radius: 1px; }
.sa-main { flex: 1 0 auto; }
.sa-family { background: var(--mud-palette-background); text-align: center; padding: 56px 24px 48px; border-top: 1px solid var(--mud-palette-lines-default); }
.sa-family h2 { font-size: 28px; font-weight: 800; margin: 0 0 36px; }
.sa-family-grid { display: flex; justify-content: center; gap: 56px; flex-wrap: wrap; }
.sa-family-item { text-decoration: none; color: inherit; width: 180px; }
.sa-family-item:hover { transform: translateY(-4px); }
.sa-family-item img { height: 88px; width: auto; max-width: 160px; object-fit: contain; }
.sa-family-item h4 { margin: 12px 0 4px; color: #2196C8; font-size: 16px; font-weight: 700; }
.sa-family-item p { margin: 0; font-size: 14px; font-weight: 600; }
.sa-footer { background: #2a2a2a; color: #bbb; padding: 40px 24px 24px; }
.sa-footer-mark { max-width: 1000px; margin: 0 auto 28px; }
.sa-footer-mark img { height: 46px; width: auto; }
.sa-footer-inner { max-width: 1000px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 36px; }
.sa-footer h5 { color: #fff; font-size: 15px; font-weight: 700; margin: 0 0 16px; }
.sa-footer a { display: block; color: #bbb; text-decoration: none; font-size: 13px; margin-bottom: 8px; }
.sa-footer a:hover { color: #F5A623; }
.sa-footer-bottom { max-width: 1000px; margin: 28px auto 0; padding-top: 20px; border-top: 1px solid #444; text-align: center; font-size: 12px; color: #888; }
.sa-source-note { max-width: 1000px; margin: 12px auto 0; font-size: 12px; color: #888; text-align: center; }

@media (max-width: 1250px) {
    .sa-burger { display: flex; }
    .sa-nav-main { display: none; width: 100%; flex-direction: column; align-items: stretch; margin-left: 0; }
    .sa-nav.open { flex-wrap: wrap; }
    .sa-nav.open .sa-nav-main { display: flex; }
    .sa-links { flex-direction: column; align-items: flex-start; gap: 8px; padding-top: 8px; }
    .sa-tools { justify-content: flex-start; flex-wrap: wrap; }
    .sa-footer-inner { grid-template-columns: repeat(2, 1fr); }
}

/* ---- supply and demand pieces ---- */
:root { --hm-none: var(--mud-palette-gray-light, #aab1bd); }

.kpi-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--mud-palette-text-secondary); }
.kpi-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .78rem; color: var(--mud-palette-text-secondary); font-variant-numeric: tabular-nums; }
.kpi-card {
    height: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--mud-palette-lines-default);
    border-left: 4px solid var(--mud-palette-primary);
    background: var(--mud-palette-surface);
}
.kpi-card.good { border-left-color: #1e9e6a; }
.kpi-card.warn { border-left-color: #F5A623; }
.kpi-card.bad { border-left-color: #d6403f; }
.kpi-card.none { border-left-color: var(--mud-palette-lines-default); }

.panel {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    background: var(--mud-palette-surface);
    padding: 14px 16px;
}
.panel-title { font-weight: 700; font-size: 1rem; margin: 0; }
.panel-sub { font-size: .8rem; color: var(--mud-palette-text-secondary); margin: 2px 0 8px; }

/* Heat map: one row per commodity, supply and demand each now and outlook. */
.hm-wrap { overflow-x: auto; }
.hm-table { width: 100%; border-collapse: separate; border-spacing: 0 3px; min-width: 760px; }
.hm-table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--mud-palette-text-secondary); font-weight: 700; padding: 2px 6px; text-align: center; white-space: nowrap; }
.hm-table th.left, .hm-table td.left { text-align: left; }
.hm-table td { padding: 0 3px; text-align: center; }
.hm-table td.name { padding: 4px 10px 4px 4px; white-space: nowrap; }
.hm-table td.name a { color: inherit; text-decoration: none; font-weight: 600; font-size: .9rem; }
.hm-table td.name a:hover { color: var(--mud-palette-primary); }
.hm-table td.name .grp { display: block; font-size: .7rem; color: var(--mud-palette-text-secondary); font-weight: 400; }
.hm-cell {
    display: block;
    min-width: 74px;
    padding: 6px 8px;
    border-radius: 6px;
    color: #fff;
    font-size: .76rem;
    font-weight: 700;
    line-height: 1.15;
    text-shadow: 0 1px 1px rgba(0,0,0,.25);
    font-variant-numeric: tabular-nums;
}
.hm-cell small { display: block; font-weight: 600; font-size: .66rem; opacity: .92; }
.hm-sep { width: 14px; }
.hm-legend { display: flex; align-items: center; gap: 8px; font-size: .72rem; color: var(--mud-palette-text-secondary); flex-wrap: wrap; }
.hm-ramp { display: inline-block; width: 110px; height: 10px; border-radius: 5px; }
.hm-ramp.supply { background: linear-gradient(90deg, rgb(214,64,63), rgb(128,138,153), rgb(30,158,106)); }
.hm-ramp.demand { background: linear-gradient(90deg, rgb(33,150,200), rgb(128,138,153), rgb(245,166,35)); }
.hm-group td { padding-top: 10px; }
.hm-group-title { text-align: left; font-size: .8rem; font-weight: 800; color: var(--mud-palette-primary); text-transform: uppercase; letter-spacing: .06em; }

/* Tile-grid map of the states. */
.tile-map { display: grid; gap: 4px; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: repeat(8, auto); max-width: 760px; margin: 0 auto; }
.tile {
    aspect-ratio: 1 / 0.82;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1.1;
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-background);
    color: var(--mud-palette-text-disabled);
    cursor: default;
    overflow: hidden;
}
.tile small { font-size: .6rem; font-weight: 600; opacity: .9; }
.tile.has { color: #fff; border-color: transparent; text-shadow: 0 1px 1px rgba(0,0,0,.3); }
.tile.light { color: #12303f; text-shadow: none; }
.tile.has:hover { outline: 2px solid var(--mud-palette-secondary); }
.map-ramp { display: inline-block; width: 120px; height: 10px; border-radius: 5px; background: linear-gradient(90deg, rgb(214,233,245), rgb(18,96,140)); }

/* Alerts */
.alert-row { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-bottom: 1px dashed var(--mud-palette-lines-default); }
.alert-row:last-child { border-bottom: none; }
.alert-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; }
.alert-dot.High { background: #d6403f; }
.alert-dot.Medium { background: #F5A623; }
.alert-dot.Info { background: #2196C8; }
.alert-kind { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--mud-palette-text-secondary); display: block; }
.alert-text { font-size: .88rem; }
.alert-link { color: inherit; text-decoration: none; font-weight: 700; }
.alert-link:hover { color: var(--mud-palette-primary); }

/* Commodity tiles on category pages */
.comm-tile {
    display: block;
    height: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--mud-palette-lines-default);
    border-top: 4px solid var(--mud-palette-primary);
    background: var(--mud-palette-surface);
    color: inherit;
    text-decoration: none;
    transition: transform .08s ease, box-shadow .08s ease;
}
.comm-tile:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.comm-name { font-size: .95rem; font-weight: 700; line-height: 1.25; }
.comm-sub { font-size: .72rem; color: var(--mud-palette-text-secondary); }
.comm-bar { display: flex; gap: 4px; margin-top: 8px; }
.comm-bar .hm-cell { flex: 1; min-width: 0; padding: 4px 6px; }
.comm-facts { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 8px; font-size: .74rem; color: var(--mud-palette-text-secondary); }
.comm-facts b { color: var(--mud-palette-text-primary); font-variant-numeric: tabular-nums; }

/* Balance equation */
.equation { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: .9rem; }
.equation .eq-term { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--mud-palette-lines-default); background: var(--mud-palette-background); text-align: center; }
.equation .eq-term b { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.equation .eq-term span { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--mud-palette-text-secondary); }
.equation .eq-op { font-size: 1.3rem; font-weight: 700; color: var(--mud-palette-text-secondary); }
.equation .eq-total { border-color: var(--mud-palette-primary); }

.bal-table th, .bal-table td { padding: 5px 10px; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.bal-table th:first-child, .bal-table td:first-child { text-align: left; }
.bal-table tr.fc td { background: rgba(245,166,35,.07); }
.bal-table tr.fc td:first-child { box-shadow: inset 3px 0 0 #F5A623; }
.chip-fc { font-size: .62rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #F5A623; margin-left: 6px; }
