:root {
    color-scheme: dark;
    --bsh-black: #090909;
    --bsh-black-soft: #11100f;
    --bsh-panel: #191613;
    --bsh-panel-raised: #241e19;
    --bsh-border: #4a382c;
    --bsh-orange: #c65d1e;
    --bsh-orange-bright: #e47a32;
    --bsh-orange-dark: #71300f;
    --bsh-cream: #f1eadf;
    --bsh-muted: #aaa097;
    --bsh-body-font: Arial, Helvetica, sans-serif;
    --bsh-display-font: "Arial Narrow", "Roboto Condensed", Impact, Arial, sans-serif;
}

html,
body,
button,
input,
select,
textarea,
option {
    font-family: var(--bsh-body-font);
}

body {
    background: var(--bsh-black) !important;
    color: var(--bsh-cream);
}

h1,
h2,
h3,
.bsh-display {
    font-family: var(--bsh-display-font);
    letter-spacing: 0.025em;
}

select,
select option,
input,
textarea {
    font-size: inherit;
    font-style: normal;
    font-weight: inherit;
    letter-spacing: inherit;
    text-transform: none;
}

select option {
    background: var(--bsh-black-soft);
    color: var(--bsh-cream);
}

/* Theme remap. Tailwind remains the layout system; these shared tokens keep
   every existing workspace in the same black and burnt-orange family. */
.bg-slate-950 { background-color: var(--bsh-black) !important; }
.bg-slate-900 { background-color: var(--bsh-black-soft) !important; }
.bg-slate-800 { background-color: var(--bsh-panel) !important; }
.bg-slate-700 { background-color: var(--bsh-panel-raised) !important; }
[class~="bg-slate-800/80"],
[class~="bg-slate-800/50"] { background-color: rgb(25 22 19 / 0.86) !important; }
[class~="bg-slate-900/95"],
[class~="bg-slate-900/85"],
[class~="bg-slate-900/70"],
[class~="bg-slate-900/60"] { background-color: rgb(17 16 15 / 0.9) !important; }
.border-slate-800,
.border-slate-700,
.border-slate-600 { border-color: var(--bsh-border) !important; }
.text-slate-100,
.text-slate-200 { color: var(--bsh-cream) !important; }
.text-slate-300 { color: #d3c8bd !important; }
.text-slate-400,
.text-slate-500 { color: var(--bsh-muted) !important; }
.bg-orange-600 { background-color: var(--bsh-orange) !important; }
.bg-orange-500 { background-color: var(--bsh-orange-bright) !important; }
.bg-orange-950 { background-color: #2a140a !important; }
.border-orange-500,
.border-orange-600,
.border-orange-700,
.border-orange-800 { border-color: var(--bsh-orange) !important; }
.text-orange-200,
.text-orange-300,
.text-orange-400,
.text-orange-500 { color: var(--bsh-orange-bright) !important; }
.hover\:bg-orange-500:hover { background-color: var(--bsh-orange-bright) !important; }
.hover\:border-orange-500:hover { border-color: var(--bsh-orange-bright) !important; }
.hover\:text-orange-300:hover,
.hover\:text-orange-400:hover { color: #f09a5b !important; }

.brand-banner {
    display: block;
    width: min(100%, 70rem);
    max-height: 28rem;
    margin: 0 auto 1.5rem;
    object-fit: contain;
}

.brand-logo,
.page-graphic {
    display: block;
    flex: none;
    object-fit: contain;
}

.brand-logo--nav {
    width: 3.25rem;
    height: 3.25rem;
}

.brand-logo--login {
    width: 10rem;
    height: 10rem;
}

.page-graphic {
    width: min(100%, 10rem);
    height: 8rem;
    margin: 0 auto 1rem;
    transition: transform 160ms ease;
}

a:hover .page-graphic {
    transform: scale(1.04);
}

.history-label,
.prediction-label {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    color: var(--bsh-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.history-control,
.prediction-control {
    width: 100%;
    border: 1px solid var(--bsh-border);
    border-radius: 0.25rem;
    background: var(--bsh-black);
    padding: 0.55rem 0.7rem;
    color: var(--bsh-cream);
    font-family: var(--bsh-body-font);
    font-size: 0.875rem;
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
}

:focus-visible {
    outline: 3px solid var(--bsh-orange-bright);
    outline-offset: 3px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline-offset: 1px;
}

[aria-busy="true"] {
    cursor: progress;
}

[aria-busy="true"] > * {
    opacity: 0.72;
}

[data-submitting="true"] button[type="submit"] {
    cursor: wait;
    opacity: 0.7;
}

h1.help-subject::after,
h2.help-subject::after,
h3.help-subject::after,
summary.help-subject::after,
th.help-subject::after,
p.help-subject::after,
span.help-subject::after {
    content: "";
    display: inline-block;
    width: 0.85em;
    height: 0.85em;
    margin-left: 0.3em;
    background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='7' fill='none' stroke='%23e47a32' stroke-width='2'/%3E%3Cpath d='M6.3 6.1a1.9 1.9 0 1 1 2.8 1.7c-.8.4-1.1.8-1.1 1.5' fill='none' stroke='%23e47a32' stroke-width='1.6' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='12' r='1' fill='%23e47a32'/%3E%3C/svg%3E");
}

label.help-subject {
    position: relative;
    padding-right: 1.15rem;
}

label.help-subject::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    width: 0.85rem;
    height: 0.85rem;
    background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='7' fill='none' stroke='%23e47a32' stroke-width='2'/%3E%3Cpath d='M6.3 6.1a1.9 1.9 0 1 1 2.8 1.7c-.8.4-1.1.8-1.1 1.5' fill='none' stroke='%23e47a32' stroke-width='1.6' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='12' r='1' fill='%23e47a32'/%3E%3C/svg%3E");
}

.app-tooltip {
    position: fixed;
    z-index: 1000;
    width: max-content;
    max-width: min(22rem, calc(100vw - 1.5rem));
    border: 1px solid var(--bsh-orange);
    border-radius: 0.5rem;
    background: #090909;
    box-shadow: 0 12px 30px rgb(0 0 0 / 0.55);
    color: var(--bsh-cream);
    font-family: var(--bsh-body-font);
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: normal;
    line-height: 1.45;
    opacity: 0;
    padding: 0.65rem 0.75rem;
    pointer-events: none;
    text-align: left;
    text-transform: none;
    transform: translateY(0.25rem);
    transition: opacity 120ms ease, transform 120ms ease;
}

.app-tooltip[data-open="true"] {
    opacity: 1;
    transform: translateY(0);
}

.htmx-request {
    cursor: progress;
}

.scrollable-table:focus-visible {
    border-radius: 0.5rem;
    box-shadow: 0 0 0 3px var(--bsh-orange-bright);
    outline: none;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media (forced-colors: active) {
    :focus-visible {
        outline: 2px solid CanvasText;
    }
}
