: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; }
.mw-1400 { max-width: 1400px; 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 .badge-cat { width: 6.25rem; }
.options-table .badge-pts { width: 4.5rem; }
.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; }

/* The tenant switcher: a long organisation name is cut short. */
.tenant-btn { max-width: 18rem; }

/* The meeting: a case's status as a stripe down its left edge. */
.mc-preselected { border-left: 4px solid var(--bs-info); }
.mc-accepted { border-left: 4px solid var(--bs-success); }
.mc-returned { border-left: 4px solid var(--bs-warning); }

/* A row that saves itself: where it says "Saved" (or why not). */
.autosave-status { min-width: 4.5rem; display: inline-block; }
.table-fixed { table-layout: fixed; }
.col-tick { width: 2.75rem; }
.col-num { width: 9rem; }
.col-assigned { width: 11rem; }
.col-stat { width: 6rem; }
.col-bar { width: 12rem; }
.share-bar { width: 100%; height: .6rem; vertical-align: middle; accent-color: var(--bs-primary); }
.tenant-menu { max-height: 70vh; overflow-y: auto; }

/* A tenant's logo: on a white tile in the dark top bar, small in lists, larger on its page. */
.tenant-logo-sm { height: 28px; width: auto; max-width: 56px; object-fit: contain; }
.tenant-logo-lg { height: 72px; width: auto; max-width: 180px; object-fit: contain; }
.tenant-logo-brand { height: 34px; width: auto; max-width: 80px; object-fit: contain; background: #fff; border-radius: 5px; padding: 2px; }

/* Task forces: rows dragged onto a task force's column; an area of expertise lights up its problem areas */
[data-drag]{cursor:grab}
[data-drag].dragging{opacity:.5}
.tf-column.drag-over{outline:2px dashed var(--bs-primary);outline-offset:2px;background:var(--bs-primary-bg-subtle)}
.tf-palette-scroll{max-height:75vh;overflow-y:auto}
.tf-code{display:inline-block;min-width:2.5rem}
.tf-label{font-size:.68rem;letter-spacing:.04em}
.tf-item{padding:.1rem .25rem;border-radius:.25rem}
.tf-item-expertise{background:var(--bs-primary-bg-subtle)}
.expertise-x{font-size:.5rem;padding:.15rem}
.tf-hit{animation:tf-pulse 1.4s ease-out 1;background:var(--bs-warning-bg-subtle)!important;box-shadow:inset 3px 0 0 var(--bs-warning)}
@keyframes tf-pulse{0%{background:var(--bs-warning);transform:scale(1.03)}100%{background:var(--bs-warning-bg-subtle);transform:scale(1)}}
.tf-picked{outline:3px solid var(--bs-primary);outline-offset:2px;animation:tf-picked 1.6s ease-out 1}
@keyframes tf-picked{0%{box-shadow:0 0 0 .75rem rgba(var(--bs-primary-rgb),.35)}100%{box-shadow:0 0 0 0 rgba(var(--bs-primary-rgb),0)}}
[id^="tf-"]{scroll-margin-top:1rem}
@media (prefers-reduced-motion:reduce){.tf-hit,.tf-picked{animation:none}}

/* People: areas of expertise clicked on and off */
.expertise-toggle{font-size:.75rem}
.expertise-add{cursor:pointer}
.people-name{width:14rem;flex:0 0 14rem}
.people-role{width:8rem;flex:0 0 8rem}
.people-pos{width:10.5rem;flex:0 0 10.5rem}
.people-areas{min-width:12rem}
.expertise-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(13rem,1fr));gap:.5rem}
.expertise-cell{min-height:3.25rem;font-size:.8rem;line-height:1.2;white-space:normal}
.req-n { width: 4.5rem; }
.price-n { width: 6rem; }
.price-model { min-width: 11rem; }
@media print {
  .navbar, .env-banner { display: none !important; }
  body { background: #fff !important; }
  .card { box-shadow: none !important; break-inside: avoid; }
  a { color: inherit !important; text-decoration: none !important; }
}
.bill-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .5rem; }
.bill-uses { max-width: 36rem; }
.welcome { max-width: 46rem; }
.exam-progress { height: .5rem; }
.exam-row { position: relative; }
.report-bar { height: .6rem; min-width: 6rem; }
.report-pct { width: 2.75rem; text-align: right; }
.report-col { width: 26%; }
.legend-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; vertical-align: middle; margin-right: .2rem; }
.proctor-answer { padding: .6rem .75rem; border-left: 3px solid var(--bs-border-color); margin-bottom: .6rem; }
.proctor-answer.flagged { border-left-color: var(--bs-danger); background: var(--bs-danger-bg-subtle); }
.proctor-answer + .proctor-answer { margin-top: .25rem; }
.proctor-alerts { position: fixed; right: 1rem; bottom: 1rem; z-index: 1080; display: flex; flex-direction: column; gap: .5rem; max-width: 22rem; }
.proctor-alert { border-left: 4px solid var(--bs-warning); animation: tf-pulse 1.2s ease-out 1; }
.proctor-chat { width: 24rem; }
.chat-card { min-height: 22rem; }
.chat-card .chat-log { max-height: 26rem; }
.chat-log { overflow-y: auto; display: flex; flex-direction: column; gap: .4rem; background: var(--bs-tertiary-bg); }
.chat-msg { max-width: 85%; }
.chat-msg.mine { align-self: flex-end; text-align: right; }
.chat-msg.theirs { align-self: flex-start; }
.chat-msg.system { align-self: center; font-size: .8rem; color: var(--bs-secondary-color); font-style: italic; }
.chat-msg .chat-body { display: inline-block; padding: .35rem .65rem; border-radius: .8rem; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); white-space: pre-wrap; text-align: left; }
.chat-msg.mine .chat-body { background: var(--bs-primary); color: #fff; border-color: var(--bs-primary); }
.chat-msg.system .chat-body { background: none; border: 0; padding: 0; }
.chat-who { font-size: .72rem; color: var(--bs-secondary-color); margin-bottom: .1rem; }
.screen-copy { border: 1px solid var(--bs-border-color); border-radius: .5rem; overflow: hidden; background: var(--bs-body-bg); }
.screen-bar { padding: .35rem .6rem; background: var(--bs-tertiary-bg); border-bottom: 1px solid var(--bs-border-color); }
.screen-body { padding: .75rem; max-height: 34rem; overflow-y: auto; }
.screen-dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--bs-secondary); display: inline-block; }
.screen-dot.on { background: var(--bs-success); box-shadow: 0 0 0 .2rem rgba(25, 135, 84, .25); }
.screen-draft { min-height: 3rem; margin-top: .35rem; padding: .4rem .6rem; border: 1px solid var(--bs-border-color); border-radius: .375rem; background: var(--bs-body-bg); white-space: pre-wrap; font-size: .9rem; }
.screen-caret { display: inline-block; width: 1px; height: 1em; background: var(--bs-body-color); vertical-align: text-bottom; margin-left: 1px; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.screen-watched .bi-eye-fill { animation: caret 1.6s ease-in-out infinite; }
.tf-people { display: flex; align-items: center; padding: .35rem 1rem; gap: .5rem; flex-wrap: wrap; }
.tf-person { flex: 1 1 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tf-people-sep { color: var(--bs-secondary-color); }
.tf-people-toggle .bi { display: inline-block; transition: transform .2s; }
.tf-people-toggle[aria-expanded="false"] .bi { transform: rotate(180deg); }
.navbar .nav-link { white-space: nowrap; }
@media (max-width: 1399.98px) { .navbar .nav-link { padding-left: .45rem !important; padding-right: .45rem !important; } }

/* The step editor (scenarios/show_v2.php): a drawer per step */
.step-drawer.offcanvas-end { --bs-offcanvas-width: min(920px, 100vw); }
.step-drawer .vignette { font-family: Georgia, 'Times New Roman', serif; font-size: 1rem; line-height: 1.6; }
.step-drawer .response-list .list-group-item { border: 0; margin-bottom: 2px; }
.step-drawer .min-w-0 { min-width: 0; }
.step-drawer .ref-pending { background: var(--bs-warning-bg-subtle); }
.cat-dot { display: inline-block; flex: none; width: .65rem; height: .65rem; border-radius: 50%; background: var(--cat); }
.comment-avatar { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-2); font-size: .75rem; font-weight: 700; }
