:root {
  --brand: #1b2a41;
  --brand-2: #0f4c81;
  --brand-soft: #e8edf4;
}
.bg-brand { background: var(--brand) !important; }
.bg-brand-gradient { background: linear-gradient(160deg, var(--brand) 0%, var(--brand-2) 100%); }
.mw-420 { max-width: 420px; }
.mw-820 { max-width: 820px; margin-left: auto; margin-right: auto; }
.mw-1100 { max-width: 1100px; margin-left: auto; margin-right: auto; }

/* Non-production banner (APP_ENV) */
.env-banner { background: #ffc107; color: #000; font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-align: center; padding: .15rem .5rem; }

/* Case editor */
.step-card { scroll-margin-top: 4.5rem; }
.step-card:target { box-shadow: 0 0 0 .2rem rgba(15, 76, 129, .35) !important; }
.step-unreviewed { border-left: 4px solid var(--bs-warning); }
.presentation p:last-child, .case-presentation p:last-child { margin-bottom: .75rem; }
.options-table .opt-main { min-width: 18rem; }
.options-table .synonyms { color: var(--bs-secondary-color); font-style: italic; }
.options-table tr.collapse > td { border-bottom-width: 1px; }

/* Taking a case: the story so far, then the current step */
.case-turn { padding: 0 .25rem .75rem; margin-bottom: .75rem; border-bottom: 1px dashed var(--bs-border-color); }
.case-answer { display: inline-block; background: var(--brand-soft); border-radius: 1rem; padding: .35rem .85rem; margin: 0 0 .5rem; }
.result-answer { border-top: 1px solid var(--bs-border-color-translucent); padding-top: .5rem; margin-top: .5rem; }

/* A button whose form is waiting on the AI */
.btn[data-busy].is-busy { pointer-events: none; opacity: .85; }

/* Decision tree (scenarios/tree.php). Category colours match the editor's badges. */
.cat-best       { --cat: var(--bs-success); }
.cat-acceptable { --cat: var(--bs-primary); }
.cat-suboptimal { --cat: var(--bs-warning); }
.cat-harmful    { --cat: var(--bs-danger); }
.tree-swatch { display: inline-block; width: .8rem; height: .8rem; border-radius: .2rem; background: var(--cat); margin-right: .35rem; vertical-align: -.1rem; }
.tree-swatch-open { background: none; border: 1px dashed var(--bs-secondary-color); }

.tree-scroll { overflow: auto; max-height: calc(100vh - 11rem); }
.tree-canvas { position: relative; display: flex; align-items: flex-start; gap: 6rem; padding: 2.25rem 1.5rem 2rem; width: max-content; min-width: 100%; }
.tree-edges { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; }
.tree-edges .edge { fill: none; stroke: var(--cat); stroke-width: 1.5; opacity: .55; transition: opacity .12s, stroke-width .12s; }
.tree-edges .arrow { fill: var(--cat); }
.tree-canvas.has-hot .edge { opacity: .15; }
.tree-canvas.has-hot .edge.is-hot { opacity: 1; stroke-width: 2.75; }

.tree-col { display: flex; flex-direction: column; gap: 1.25rem; width: 17rem; flex: none; }
.tree-col-head { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--bs-secondary-color); }

.tree-node { position: relative; z-index: 1; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: .5rem; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); font-size: .8rem; cursor: default; }
.tree-node:focus-visible, .tree-opt:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 1px; }
.tree-node.is-unreviewed { border-left: 4px solid var(--bs-warning); }
.tree-node.is-terminal { background: var(--bs-info-bg-subtle); }
.tree-node.is-hot { box-shadow: 0 0 0 .2rem rgba(15, 76, 129, .35); }
.tree-node-head { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; padding: .4rem .6rem 0; }
.tree-node-head a { font-weight: 600; text-decoration: none; margin-right: auto; }
.tree-node-head .badge { font-size: .62rem; }
.tree-node-text { padding: .25rem .6rem .45rem; color: var(--bs-secondary-color); line-height: 1.3; }
.tree-node-empty { padding: 0 .6rem .5rem; font-style: italic; color: var(--bs-secondary-color); }

.tree-opts { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--bs-border-color-translucent); }
.tree-opt { position: relative; display: flex; gap: .4rem; align-items: baseline; padding: .28rem .6rem .28rem .7rem; border-left: 3px solid var(--cat); line-height: 1.25; }
.tree-opt + .tree-opt { border-top: 1px solid var(--bs-border-color-translucent); }
.tree-opt:hover { background: var(--bs-tertiary-bg); }
.tree-opt-label { flex: 1; }
.tree-opt-pts { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--bs-secondary-color); }
.tree-opt.is-open .tree-opt-label { color: var(--bs-secondary-color); }
.tree-opt-stub { position: absolute; right: -1.6rem; top: 50%; width: 1.4rem; border-top: 1.5px dashed var(--bs-secondary-color); opacity: .6; }

.tree-tip { position: absolute; z-index: 1080; max-width: 26rem; max-height: 70vh; overflow: auto; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: .5rem; box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .15); padding: .65rem .8rem; font-size: .82rem; pointer-events: none; }
.tree-tip p { margin-bottom: .45rem; }
.tree-tip .tip-muted { color: var(--bs-secondary-color); font-size: .76rem; }
