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 bits ---- */
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--mud-palette-text-secondary); }
.small { font-size: .8rem; }
.apex-host { width: 100%; }
.apex-host .apexcharts-tooltip { box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.clickable { cursor: pointer; }
.nowrap { white-space: nowrap; }
.fl-section { font-size: 1.05rem; font-weight: 700; margin: 0 0 2px; }
.fl-sub { font-size: .8rem; color: var(--mud-palette-text-secondary); margin: 0 0 8px; }
.fl-table td, .fl-table th { white-space: nowrap; }
.fl-table td.wrap { white-space: normal; min-width: 220px; }
.fl-chip { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 9px; border-radius: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fl-kv { display: grid; grid-template-columns: minmax(130px, 40%) 1fr; gap: 5px 14px; margin: 0; }
.fl-kv dt { color: var(--mud-palette-text-secondary); font-size: .85rem; }
.fl-kv dd { margin: 0; font-weight: 600; word-break: break-word; }

/* ---- the disclaimer strip under the header: on every page ---- */
.fl-disclaimer { background: #fff4e0; color: #5a3b00; border-bottom: 1px solid #f0d49b; font-size: 12.5px; line-height: 1.4; padding: 7px 24px; text-align: center; }
.fl-disclaimer b { color: #8a4b00; }
.fl-disclaimer a { color: inherit; text-decoration: underline; }
.mud-theme-dark .fl-disclaimer, .fl-dark .fl-disclaimer { background: #3a2b10; color: #f4dcae; border-bottom-color: #5a4220; }
.fl-fineprint { font-size: .78rem; line-height: 1.45; color: var(--mud-palette-text-secondary); }

/* ---- search ---- */
.fl-search { max-width: 760px; margin: 0 auto; }
.fl-hero { text-align: center; padding: 28px 12px 18px; }
.fl-hero h1 { font-size: 2.1rem; font-weight: 800; margin: 0 0 6px; letter-spacing: -.5px; }
.fl-hero h1 span { color: #F5A623; }
.fl-hero p { margin: 0 auto 18px; max-width: 760px; color: var(--mud-palette-text-secondary); }
.fl-hit { display: flex; flex-direction: column; line-height: 1.25; }
.fl-hit .detail { font-size: .75rem; color: var(--mud-palette-text-secondary); }

/* ---- score hero ---- */
.fl-score { display: flex; align-items: stretch; gap: 20px; flex-wrap: wrap; }
.fl-gauge { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 190px; padding: 16px 22px; border-radius: 12px; }
.fl-gauge .value { font-size: 4.2rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.fl-gauge .band { font-size: 1.25rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; margin-top: 4px; }
.fl-gauge .of { font-size: .75rem; opacity: .85; margin-top: 2px; }
.fl-score-body { flex: 1 1 320px; min-width: 0; }

.fl-side { border-radius: 10px; border: 1px solid var(--mud-palette-lines-default); background: var(--mud-palette-surface); padding: 14px 16px; height: 100%; border-top: 5px solid var(--side, #9aa3b2); }
.fl-side .title { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--mud-palette-text-secondary); font-weight: 700; }
.fl-side .big { font-size: 2.2rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.fl-side .hint { font-size: .8rem; color: var(--mud-palette-text-secondary); line-height: 1.35; }

.fl-meter { position: relative; height: 12px; border-radius: 6px; background: linear-gradient(90deg, #37c58f 0 20%, #a7d44a 20% 40%, #F5A623 40% 60%, #e5593f 60% 80%, #a3202c 80% 100%); opacity: .95; }
.fl-meter .pin { position: absolute; top: -5px; width: 4px; height: 22px; margin-left: -2px; background: var(--mud-palette-text-primary); border-radius: 2px; box-shadow: 0 0 0 2px var(--mud-palette-surface); }
.fl-meter-labels { display: flex; justify-content: space-between; font-size: .66rem; color: var(--mud-palette-text-secondary); margin-top: 3px; }

.fl-pointbar { height: 9px; border-radius: 5px; background: rgba(128,128,128,.2); overflow: hidden; min-width: 90px; }
.fl-pointbar .fill { height: 100%; border-radius: 5px; }

/* ---- lab notebook ---- */
.fl-note td.rule { white-space: normal; min-width: 240px; font-size: .8rem; color: var(--mud-palette-text-secondary); }
.fl-note tr.off td { opacity: .5; }
.fl-note .tag { font-size: .66rem; font-weight: 700; padding: 1px 7px; border-radius: 9px; background: rgba(128,128,128,.25); text-transform: uppercase; letter-spacing: .04em; }
.fl-note .formula { font-family: Consolas, "Courier New", monospace; font-size: .8rem; }

.fl-leg { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: .72rem; }
.fl-leg .sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }

/* ---- national map ---- */
.fl-map { width: 100%; height: calc(100vh - 290px); min-height: 460px; border-radius: 10px; border: 1px solid var(--mud-palette-lines-default); z-index: 0; background: #cfd8e3; }
.fl-map-mini { height: 280px; min-height: 280px; }
.leaflet-container { font-family: "Open Sans", "Segoe UI", sans-serif; }
.fl-map-tip b { font-size: .9rem; }
.fl-map-ctl { background: var(--mud-palette-surface); color: var(--mud-palette-text-primary); padding: 6px 10px; border-radius: 8px; box-shadow: 0 1px 6px rgba(0,0,0,.35); font-size: .75rem; line-height: 1.5; }
.fl-map-ctl .sw { display: inline-block; width: 14px; height: 12px; margin-right: 6px; vertical-align: -1px; border-radius: 2px; }

/* ---- SiteAnalyst shell ---- */
.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-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; }
.sa-source-note a { display: inline; }

@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); }
    .impact .dom { flex-basis: 110px; }
}

/* ---- KPI tiles ---- */
.fl-kpi { display: block; height: 100%; padding: 10px 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); color: inherit; text-decoration: none; }
.fl-kpi .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--mud-palette-text-secondary); }
.fl-kpi .value { font-size: 1.55rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.fl-kpi .unit { font-size: .8rem; font-weight: 400; color: var(--mud-palette-text-secondary); margin-left: 3px; }
.fl-kpi .note { font-size: .75rem; color: var(--mud-palette-text-secondary); line-height: 1.3; }
.fl-kpi.warn { border-left-color: #F5A623; }
.fl-kpi.alarm { border-left-color: #d6403f; }
.fl-kpi.good { border-left-color: #1e9e6a; }
