/* Bad Marine LLC brand palette, from the company logo (carbon-fiber black hexagon,
   white/silver lettering, cyan-blue accent glow). */
:root {
    /* Deep slate, not pure black - #000 next to a bright basemap and cyan accents was brutal on
       the eyes (2026-08-18 UI pass). Slate-900/800 (Tailwind's palette) keeps the same carbon-
       fiber-black brand feel with actual depth between page and card. */
    --bm-bg: #0f172a;
    --bm-panel: #1e293b;
    --bm-border: #334155;
    --bm-text: #f1f5f9;
    --bm-muted: #94a3b8;
    --bm-accent: #22d3ee;
}

body {
    background: var(--bm-bg);
    color: var(--bm-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
}

a {
    color: var(--bm-accent);
}

h1:focus {
    outline: none;
}

.mode-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.5rem;
    background: var(--bm-panel);
    border-bottom: 1px solid var(--bm-border);
    position: relative;
    /* Above every page's own sticky/fixed elements (Configuration's topbar at 40, RoadwayInventory's
       modal backdrop at 50, etc.) so a nav dropdown (a details[open] child, same stacking context)
       never renders underneath one (2026-08-21, Sean: "the Reports dropdown is dropping right on
       top of the Configuration Section selector below it" - .mode-nav's old z-index of 30 was
       actually LOWER than Configuration's own sticky topbar's 40, so the topbar won the stack even
       though it's later in a page's own content, not the nav). Still below #blazor-error-ui's 1000
       so a real error banner always wins. */
    z-index: 100;
}

.mode-nav .brand-logo {
    height: 36px;
    width: auto;
    margin-right: 0.5rem;
}

.mode-nav .brand-name {
    font-weight: bold;
    font-size: 1.1rem;
    letter-spacing: 0.06em;
    color: var(--bm-text);
    margin-right: 1rem;
}

/* CADRE isn't a strict acronym, but Sean wants the backronym reachable - hover or click/focus (the
   same mechanism, since focusing a tabindex="0" element is what a click/tap does) reveals it below
   the brand name, matching Guided Setup's own .info-tip hover/focus pattern (2026-08-28). */
.mode-nav .brand-name-tip {
    position: relative;
    cursor: help;
}

.mode-nav .brand-name-tip:hover,
.mode-nav .brand-name-tip:focus {
    outline: none;
    color: var(--bm-accent);
}

.mode-nav .brand-name-bubble {
    position: absolute;
    top: calc(100% + 0.6rem);
    left: 0;
    width: 280px;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    background: var(--bm-bg);
    border: 1px solid var(--bm-border);
    color: var(--bm-text);
    font-size: 0.8rem;
    font-weight: normal;
    letter-spacing: normal;
    line-height: 1.4;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease;
    z-index: 25;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.mode-nav .brand-name-tip:hover .brand-name-bubble,
.mode-nav .brand-name-tip:focus .brand-name-bubble {
    opacity: 1;
    visibility: visible;
}

.mode-nav a {
    text-decoration: none;
    color: var(--bm-muted);
    letter-spacing: 0.02em;
}

.mode-nav a.active {
    color: var(--bm-accent);
    font-weight: bold;
}

/* Nav groups (Workspace/Analysis/Reports/Data & Config) - a plain <details>/<summary> disclosure
   needs zero JS, is keyboard-operable out of the box, and the shared `name` attribute (Chromium/
   Firefox/Safari all support it) makes the four groups mutually exclusive, so opening one closes
   any other that's open (2026-08-18, replacing a 12-item flat list that no longer fit). */
.mode-nav details {
    position: relative;
}

.mode-nav summary {
    list-style: none;
    cursor: pointer;
    color: var(--bm-muted);
    letter-spacing: 0.02em;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    user-select: none;
}

.mode-nav summary::-webkit-details-marker {
    display: none;
}

.mode-nav summary::after {
    content: "▾";
    margin-left: 0.35rem;
    font-size: 0.7em;
}

.mode-nav summary:hover,
.mode-nav details[open] summary {
    color: var(--bm-text);
    background: rgba(148, 163, 184, 0.1);
}

.mode-nav details[open] summary {
    color: var(--bm-accent);
}

.mode-nav .nav-group-panel {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    /* bm-bg (slate-900), not bm-panel (slate-800) - a visibly darker/more elevated card than the
       nav bar it's anchored to, not a same-shade blend (2026-08-21, Sean: "zero drop shadow / depth
       ... blends into the dark background beneath it"). */
    background: var(--bm-bg);
    border: 1px solid var(--bm-border);
    border-radius: 8px;
    padding: 0.4rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.mode-nav .nav-group-panel a {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    white-space: nowrap;
}

.mode-nav .nav-group-panel a:hover {
    background: rgba(148, 163, 184, 0.1);
    color: var(--bm-text);
}

.mode-nav .nav-group-panel a.active {
    background: rgba(34, 211, 238, 0.1);
}

.mode-nav .mode-nav-settings {
    margin-left: auto;
}

/* Help link (2026-08-28) - reuses .mode-nav-settings to push right of the nav groups, styled as
   a small pill so it reads as a distinct "get help" action rather than another nav-group item. */
.mode-nav .nav-help-link {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--bm-border);
    border-radius: 999px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.mode-nav .nav-help-link:hover {
    color: var(--bm-text);
    border-color: var(--bm-accent);
}

.mode-nav .nav-help-link.active {
    color: var(--bm-accent);
    border-color: var(--bm-accent);
}

/* MapLibre's stock NavigationControl renders as plain white squares (its default light-theme
   CSS) - jarring next to a dark app shell. Restyle to match the slate/cyan palette rather than
   fighting maplibre-gl.css's specificity with !important everywhere. */
.maplibregl-ctrl-group {
    background: var(--bm-panel) !important;
    border: 1px solid var(--bm-border) !important;
    border-radius: 6px !important;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

.maplibregl-ctrl-group button {
    background: transparent !important;
}

.maplibregl-ctrl-group button + button {
    border-top: 1px solid var(--bm-border) !important;
}

.maplibregl-ctrl-group button:hover {
    background: rgba(148, 163, 184, 0.15) !important;
}

.maplibregl-ctrl-icon {
    filter: invert(1) brightness(1.6);
}

.maplibregl-ctrl-attrib {
    background: rgba(15, 23, 42, 0.75) !important;
}

.maplibregl-ctrl-attrib a {
    color: var(--bm-muted) !important;
}

/* Printed reports (LRSP, Safety Action Plan) build their own letterhead-style print tree - the
   app's own nav bar has no business on a document meant to leave the app (confirmed live,
   2026-08-18: it was bleeding through as faint ghosted text at the top of every exported PDF). */
@media print {
    .mode-nav {
        display: none;
    }
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.crash-map {
    width: 100%;
    border: 1px solid var(--bm-border);
    border-radius: 4px;
    overflow: hidden;
}

.crash-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bm-accent);
    border: 2px solid var(--bm-bg);
    cursor: pointer;
}

.crash-detail-table {
    border-collapse: collapse;
}

.crash-detail-table th {
    text-align: left;
    padding: 0.25rem 1rem 0.25rem 0;
    color: var(--bm-muted);
    font-weight: normal;
    white-space: nowrap;
}

.crash-detail-table td {
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--bm-border);
}

.crash-detail-images {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Crash Inspector - CrashDetail.razor's header + grouped sections (2026-08-21, Sean: "raw
   database debugger... 20+ raw rows in identical typography... primary actions held hostage at
   the bottom"). Shared by Workbench's inline panel and CrashDetailModal, so every consumer gets
   the same badge/chip treatment, not just Workbench. */
.crash-inspector-header { margin-bottom: 1.25rem; }
.crash-inspector-title { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.crash-key { font-size: 1.15rem; font-weight: bold; }
.severity-badge {
    display: inline-flex; align-items: center; padding: 0.2rem 0.65rem; border-radius: 999px;
    font-size: 0.75rem; font-weight: bold;
}
.crash-inspector-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 0; color: var(--bm-muted); font-size: 0.9rem; margin-bottom: 0.9rem; }
.crash-inspector-meta span:not(:last-child)::after { content: "•"; margin-left: 0.9rem; color: var(--bm-border); }
.crash-inspector-header .crash-detail-images { margin-top: 0; }

.crash-inspector-section { margin-top: 1.5rem; }
.crash-inspector-section h4 { margin: 0 0 0.6rem; color: var(--bm-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: bold; }

.active-flags, .condition-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.condition-chip {
    display: inline-block; padding: 0.2rem 0.65rem; border-radius: 999px; font-size: 0.8rem;
    border: 1px solid var(--bm-border); color: var(--bm-text); background: var(--bm-panel);
}
/* Active/triggered chip - canonical home (moved 2026-08-21 from ImportData.razor's own <style>
   block, its first user, now that CrashDetail needs the identical look for CEA/impairment flags). */
.cea-chip {
    display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.75rem;
    border: 1px solid var(--bm-muted); color: var(--bm-muted);
}
.cea-chip.cea-chip-triggered { border-color: #34d399; color: #34d399; }

.crash-kv-list { display: flex; flex-direction: column; gap: 0.45rem; }
.crash-kv-row { display: flex; align-items: baseline; gap: 0.75rem; font-size: 0.9rem; }
.crash-kv-label { flex: 0 0 12rem; color: var(--bm-muted); }

.crash-detail-edit-btn {
    padding: 0.1rem 0.5rem;
    margin-left: 0.5rem;
    border: 1px solid var(--bm-border);
    border-radius: 4px;
    background: transparent;
    color: var(--bm-accent);
    cursor: pointer;
    font-size: 0.85rem;
}

.crash-detail-edit-input {
    background: var(--bm-bg);
    color: inherit;
    border: 1px solid var(--bm-accent);
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    min-width: 14rem;
}

.vehicle-table-saved-note {
    display: inline-block;
    margin-left: 0.75rem;
    color: var(--bm-muted);
    font-size: 0.8rem;
    font-weight: normal;
}

.crash-detail-edit-note {
    display: block;
    color: var(--bm-muted);
    font-size: 0.75rem;
    margin-top: 0.15rem;
}

.crash-images-btn {
    display: inline-block;
    box-sizing: border-box;
    min-width: 11rem;
    text-align: center;
    padding: 0.5rem 1rem;
    border: 1px solid var(--bm-accent);
    border-radius: 4px;
    background: transparent;
    color: var(--bm-accent);
    text-decoration: none;
    cursor: pointer;
    font-weight: bold;
}

.crash-images-btn:disabled {
    border-color: var(--bm-border);
    color: var(--bm-muted);
    cursor: not-allowed;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-panel {
    position: relative;
    background: var(--bm-panel);
    border: 1px solid var(--bm-border);
    border-radius: 8px;
    padding: 1.5rem 2rem;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: transparent;
    border: none;
    color: var(--bm-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

.modal-close:hover {
    color: var(--bm-text);
}

/* "Show the Math" - the deterministic calculation breakdown behind a study's BCR/NPV, on
   GuidedSetup, AfterEvaluation, and LocalRoadSafetyPlan. Defined once here rather than per-page,
   since the print-report look it's modeled on was already copy-pasted three times. */
.math-toggle {
    margin-top: 0.5rem;
}

.math-breakdown {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--bm-border);
    border-radius: 8px;
    background: var(--bm-panel);
}

.math-breakdown h4 {
    margin-top: 1.25rem;
    margin-bottom: 0.25rem;
}

.math-breakdown h4:first-child {
    margin-top: 0;
}

.math-citation {
    color: var(--bm-muted);
    font-size: 0.85rem;
    margin-top: 0;
}

/* Base panel card - background/border/radius/padding shared by Guided Setup's site-picker card and
   Workbench's crash list/detail panels (moved here 2026-08-20 for the same reason as the hero
   scorecards below). */
.card {
    background: var(--bm-panel); border: 1px solid var(--bm-border); border-radius: 10px;
    padding: 1.25rem 1.5rem;
}

/* Hero scorecards - big-number stat cards for headline results (BCR, NPV, site/project recap,
   effectiveness metrics). Originally Guided Setup Step 4's "Executive Dashboard"; moved here
   (2026-08-20) so After Evaluation's recap and results sections draw from the same card language
   instead of inventing a new one - Sean's ask was explicitly to structure After Evaluation like
   the Before Study page. auto-fit (vs. a fixed 3-column grid) lets a 2-card row and a 3-card row
   both fill their width evenly. */
.hero-scorecards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.hero-card {
    display: flex; flex-direction: column; gap: 0.35rem; padding: 1.1rem 1.25rem;
    background: var(--bm-panel); border: 1px solid var(--bm-border); border-radius: 10px;
}
.hero-card-label { color: var(--bm-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.hero-card-value { font-size: 1.9rem; font-weight: bold; color: var(--bm-text); }
/* For prose values (a street address, not a number) - 1.9rem bold was sized for short figures like
   "14.55" or "$16,935,825" and wraps an address to 3-4 dominating lines otherwise. */
.hero-card-value-compact { font-size: 1.15rem; font-weight: bold; color: var(--bm-text); }
.hero-card-sub { color: var(--bm-muted); font-size: 0.8rem; }
.hero-card-status.pass { border-color: var(--bm-accent); background: rgba(34, 211, 238, 0.08); }
.hero-card-status.pass .hero-card-value { color: var(--bm-accent); }
.hero-card-status.fail { border-color: #ff6b6b; background: rgba(255, 90, 90, 0.08); }
.hero-card-status.fail .hero-card-value { color: #ff6b6b; }
@media (max-width: 900px) {
    .hero-scorecards { grid-template-columns: 1fr; }
}

/* Print equivalent of hero-scorecards - @media print forces a light/white page regardless of the
   app's dark theme, so these can't just reuse .hero-card's colors. Also moved here from Guided
   Setup for the same reason as above. */
@media print {
    .print-metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.6rem; margin-bottom: 1rem; page-break-inside: avoid; }
    .print-metric-tile { border: 1px solid #000; border-radius: 4px; padding: 0.5rem 0.75rem; text-align: center; }
    .print-metric-label { display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.03em; color: #555; }
    .print-metric-value { display: block; font-size: 1.3rem; font-weight: bold; }
    .print-metric-sub { display: block; font-size: 0.68rem; color: #555; }
}
