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;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 1rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred.";
    }

/* ---- app styling ---- */
.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); }

.kpi-value { font-size: 1.5rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--mud-palette-text-secondary); }

.range-bar { position: relative; height: 6px; border-radius: 3px; background: var(--mud-palette-lines-default); }
.range-bar > .fill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 3px; background: var(--mud-palette-primary); opacity: .35; }
.range-bar > .marker { position: absolute; top: -4px; width: 4px; height: 14px; border-radius: 2px; background: var(--mud-palette-text-primary); transform: translateX(-2px); }

.tile {
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    color: #fff;
    min-height: 74px;
    transition: transform .08s ease, box-shadow .08s ease;
}
.tile:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.tile .sym { font-weight: 700; font-size: 1.05rem; }
.tile .pct { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: .75rem; opacity: .85; font-variant-numeric: tabular-nums; }

.corr-cell { text-align: center; font-variant-numeric: tabular-nums; font-size: .8rem; min-width: 56px; }
table.corr { border-collapse: separate; border-spacing: 2px; font-size: .8rem; }
table.corr th { font-weight: 600; padding: 4px 8px; text-align: center; white-space: nowrap; }
table.corr td { text-align: center; font-variant-numeric: tabular-nums; min-width: 52px; padding: 6px 4px; border-radius: 4px; }
.sticky-filters { position: sticky; top: 76px; z-index: 5; }

.apex-host { width: 100%; }
.apex-host .apexcharts-tooltip { box-shadow: 0 4px 16px rgba(0,0,0,.3); }

/* SiteAnalyst shell */
.sa-shell { min-height: 100vh; display: flex; flex-direction: column; background: #f8f9fa; color: #333; }
.sa-topbar {
    background: #333;
    color: #ccc;
    font-size: 13px;
    padding: 8px 16px;
    text-align: center;
}
.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-login-card { max-width: 520px; margin: 32px auto; }
.sa-nav {
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
    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-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: 22px; }
.sa-links a {
    text-decoration: none;
    color: #333;
    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: #fff;
    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: #f8f9fa; text-align: center; padding: 56px 24px 48px; border-top: 1px solid #eee; }
.sa-family h2 { font-size: 28px; font-weight: 800; color: #333; 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; color: #333; 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;
}
@media (max-width: 1100px) {
    .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); }
}

/* Purchase entry grid (Portfolio page) */
.entry-grid-wrap { overflow-x: auto; }
.entry-grid { width: 100%; border-collapse: collapse; font-size: .875rem; }
.entry-grid th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--mud-palette-text-secondary); font-weight: 600; padding: 4px 6px; white-space: nowrap; }
.entry-grid th.r, .entry-grid td.r { text-align: right; }
.entry-grid td { padding: 0; border: 1px solid var(--mud-palette-lines-default); vertical-align: middle; }
.entry-grid td.idx, .entry-grid th.idx { width: 32px; text-align: center; color: var(--mud-palette-text-secondary); border: 0; padding: 0 4px; }
.entry-grid td.r:not(:has(input)), .entry-grid td.check { padding: 0 8px; border-color: transparent; font-size: .8rem; }
.entry-grid td:last-child { border: 0; width: 36px; }
.entry-grid input { width: 100%; min-width: 90px; box-sizing: border-box; border: 0; outline: 0; padding: 7px 8px; background: transparent; color: inherit; font: inherit; font-variant-numeric: tabular-nums; }
.entry-grid input.r { text-align: right; }
.entry-grid input:focus { background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent); box-shadow: inset 0 0 0 2px var(--mud-palette-primary); }
.entry-grid tr.bad td:not(.idx):not(:last-child):not(.check) { background: color-mix(in srgb, var(--mud-palette-error) 10%, transparent); }
.entry-grid td.check { min-width: 160px; }
.entry-grid input::placeholder { color: var(--mud-palette-text-disabled); opacity: 1; }

.sa-links a.sa-gear { display: inline-flex; align-items: center; padding: 4px; }
.sa-links a.sa-gear .mud-icon-root { font-size: 1.35rem; }

/* ---------- features: ribbon, allocation, news ---------- */
.event-ribbon { display:flex; flex-wrap:wrap; gap:.5rem .75rem; align-items:center; }
.event-ribbon .ev { display:inline-flex; align-items:center; gap:.35rem; padding:.2rem .6rem; border:1px solid var(--mud-palette-lines-default); border-radius:999px; font-size:.82rem; white-space:nowrap; }
.event-ribbon .ev b { font-weight:600; }
.event-ribbon a.ev { color:inherit; text-decoration:none; cursor:pointer; transition:border-color .12s, box-shadow .12s; }
.event-ribbon a.ev:hover, .event-ribbon a.ev:focus-visible { border-color:var(--mud-palette-primary); box-shadow:0 0 0 1px var(--mud-palette-primary); outline:none; }
.event-ribbon .ev.soon { border-color:var(--mud-palette-warning); background:color-mix(in srgb, var(--mud-palette-warning) 14%, transparent); }
.event-ribbon .ev.good { border-color:var(--mud-palette-success); }
.alloc-row { margin:.35rem 0 .6rem; }
.alloc-row .alloc-head { display:flex; justify-content:space-between; gap:.5rem; font-size:.85rem; }
.news-item { display:block; padding:.55rem .25rem; border-bottom:1px solid var(--mud-palette-lines-default); text-decoration:none; color:inherit; }
.news-item:hover .news-title { text-decoration:underline; }
.news-item .news-title { font-weight:600; }
.news-item .news-meta { font-size:.75rem; opacity:.7; }
