:root {
  --bg: #0e141c;
  --bg-2: #151d28;
  --panel: #1b2633;
  --line: #31455c;
  --text: #f3f7fb;
  --muted: #b7c6d6;
  --it: #5ad0ff;
  --opip: #f0c14b;
  --ok: #4ee0a0;
  --bad: #ff6b6b;
  --warn: #f0b35a;
  --font: "Segoe UI", "IBM Plex Sans", sans-serif;
  --mono: ui-monospace, "IBM Plex Mono", monospace;
}
* { box-sizing: border-box; }
html, body.handoff-page {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.45;
}
.handoff-disclaimer {
  margin: 0;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: #121a24;
  font-size: 0.92rem;
  color: var(--muted);
}
.handoff-page .app-header {
  position: relative;
  z-index: 40;
}
#app { min-height: 60vh; }

a { color: var(--it); }
button, select, input, textarea {
  font: inherit; color: var(--text); background: #101820; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px;
}
button { cursor: pointer; font-weight: 600; }
button.primary { background: #1d5c82; border-color: var(--it); font-size: 1.05rem; padding: 14px 18px; }
button.opip { background: #5a470f; border-color: var(--opip); font-size: 1.05rem; padding: 14px 18px; }
button.danger { background: #5a2222; border-color: var(--bad); }
button.lang { padding: 8px 12px; }
button.lang.active { border-color: var(--ok); color: var(--ok); }
.top {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 16px 22px; border-bottom: 1px solid var(--line); background: var(--bg-2);
  position: sticky; top: 0; z-index: 30;
}
.inst-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inst-controls button { white-space: nowrap; }
.inst-controls button:disabled { opacity: 0.45; cursor: not-allowed; }
.brand { font-weight: 800; font-size: 1.15rem; }
.brand span { color: var(--muted); font-weight: 500; display: block; font-size: 0.95rem; }
.clock { font-family: var(--mono); font-size: 1.2rem; }
.layout { display: grid; grid-template-columns: 1fr; gap: 16px; padding: 16px 22px 40px; }
@media (min-width: 1100px) {
  .layout.work { grid-template-columns: 1fr 1.05fr; }
  .layout.work.cols3 { grid-template-columns: 0.95fr 1.05fr 0.9fr; }
  .layout.three { grid-template-columns: 1fr 1fr 1fr; }
}
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.panel h2 { margin: 0 0 12px; font-size: 0.85rem; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; }
.hero { font-size: 1.45rem; font-weight: 750; margin: 0 0 10px; line-height: 1.3; }
.lead { font-size: 1.12rem; color: var(--text); margin: 0 0 12px; }
.tone-bad { border-color: var(--bad); box-shadow: inset 4px 0 0 var(--bad); }
.tone-warn { border-color: var(--warn); box-shadow: inset 4px 0 0 var(--warn); }
.tone-ok { border-color: var(--ok); box-shadow: inset 4px 0 0 var(--ok); }
.tone-idle { border-color: var(--line); box-shadow: inset 4px 0 0 var(--muted); }
.list { max-height: 320px; overflow: auto; }
.item { border-bottom: 1px solid var(--line); padding: 12px 0; font-size: 1.02rem; }
.tag { display: inline-block; font-size: 0.85rem; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); margin: 0 6px 6px 0; }
.tag.it { color: var(--it); }
.tag.opip { color: var(--opip); }
.tag.bad { color: var(--bad); border-color: var(--bad); }
.tag.ok { color: var(--ok); border-color: var(--ok); }
.home { max-width: 1080px; margin: 32px auto; padding: 24px; }
.home h1 { font-size: 2rem; margin-bottom: 12px; }
.scenario-filters-label { font-size: 0.85rem; letter-spacing: 0.04em; color: var(--muted); text-transform: uppercase; margin: 4px 0 8px; }
.scenario-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.scenario-filters button {
  padding: 8px 14px; font-size: 0.95rem; font-weight: 600; background: #101820; border-radius: 20px;
}
.scenario-filters button .count { color: var(--muted); font-weight: 500; }
.scenario-filters button.active { border-color: var(--it); color: var(--it); }
.scenario-filters button.active .count { color: var(--it); }
.scenario-filters button.gap-filter { border-color: var(--warn); color: var(--warn); }
.scenario-filters button.gap-filter .count { color: var(--warn); }
.scenario-filters button.gap-filter.active { background: #3a2a10; }
.cards { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 800px) { .cards { grid-template-columns: 1fr 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; cursor: pointer; }
.card.selected { border-color: var(--it); }
.card p { color: var(--muted); font-size: 1.02rem; }
.card .gap-badge {
  display: inline-block; font-size: 0.78rem; font-weight: 700; color: var(--warn);
  border: 1px solid var(--warn); border-radius: 6px; padding: 2px 6px; margin-left: 8px; vertical-align: middle;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.disclaimer { font-size: 1rem; color: var(--muted); border: 1px dashed var(--line); padding: 12px 14px; border-radius: 10px; }
.bar { height: 14px; background: #0e1620; border-radius: 10px; overflow: hidden; margin: 8px 0; }
.bar > i { display: block; height: 100%; background: var(--warn); }
.bar.ok > i { background: var(--ok); }
.ssa { font-size: 2.4rem; font-family: var(--mono); letter-spacing: 0.08em; }
.check { margin: 8px 0; font-size: 1.05rem; }
.check.done { color: var(--ok); }
.check.todo { color: var(--warn); }
table { width: 100%; border-collapse: collapse; font-size: 1rem; }
td, th { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; }
textarea, input { width: 100%; margin: 6px 0; }
textarea { min-height: 110px; }
.siem { font-size: 1.02rem; background: #0a1016; padding: 12px; border-radius: 10px; }
.role-it .brand { color: var(--it); }
.role-opip .brand { color: var(--opip); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: stretch; }
.action-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 180px;
  max-width: 100%;
  transition: filter 0.25s ease, opacity 0.25s ease;
}
.action-wrap button { width: 100%; position: relative; transition: filter 0.25s ease, opacity 0.25s ease, box-shadow 0.2s ease; }
button.btn-ready {
  box-shadow: inset 0 0 0 2px var(--ok);
  opacity: 1;
  filter: none;
}
button.btn-ready.primary { box-shadow: inset 0 0 0 2px var(--it); }
button.btn-ready.opip { box-shadow: inset 0 0 0 2px var(--opip); }
button.btn-blocked,
button:disabled.btn-blocked {
  opacity: 0.4;
  cursor: not-allowed;
  filter: blur(1.35px) grayscale(0.45);
  box-shadow: none;
}
button.btn-used,
button:disabled.btn-used {
  opacity: 0.38;
  cursor: default;
  filter: blur(1.6px) saturate(0.35);
  box-shadow: none;
}
.action-wrap.is-ready { filter: none; opacity: 1; }
.action-wrap.is-blocked,
.action-wrap.is-used { /* wrapper stays sharp; button blurs */ }
.btn-why {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.3;
  min-height: 1.1em;
}
.btn-legend { display: none; }

.flow-strip {
  margin: 0 22px 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #121a24;
}
.turn-banner {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.turn-banner.your-turn {
  border-color: var(--ok);
  background: rgba(78, 224, 160, 0.1);
  color: #b8f5d4;
}
.turn-banner.wait-turn {
  border-color: var(--warn);
  background: rgba(240, 193, 75, 0.1);
  color: #ffe9a8;
}
.turn-banner.idle-turn {
  color: var(--muted);
}
.flow-track {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 4px;
}
.flow-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.86rem;
  color: var(--muted);
  background: #0e1620;
}
.flow-step.done {
  border-color: var(--ok);
  color: #b8f5d4;
  opacity: 0.85;
}
.flow-step.current {
  border-color: #8ab4ff;
  color: #dce9ff;
  box-shadow: 0 0 0 1px rgba(138, 180, 255, 0.35);
  font-weight: 650;
}
.flow-num {
  font-family: var(--mono);
  font-size: 0.78rem;
  opacity: 0.85;
}
.flow-arrow {
  color: var(--muted);
  opacity: 0.55;
  padding: 0 2px;
}
.flow-hint {
  margin: 10px 0 0;
  font-size: 0.9rem;
}
.fn { font-size: 1.15rem; margin-bottom: 6px; }
.bigbtn { width: 100%; margin-top: 8px; }
.muted { color: var(--muted); }
.roles { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 18px 0; }
@media (min-width: 800px) { .roles { grid-template-columns: 1fr 1fr; } }
.rolecard { padding: 18px; border-radius: 14px; border: 1px solid var(--line); }
.rolecard.it { border-color: var(--it); }
.rolecard.opip { border-color: var(--opip); }
.rolecard h3 { margin: 0 0 8px; font-size: 1.3rem; }
pre { white-space: pre-wrap; font-size: 0.95rem; }

/* PBIP 1–3 and TAL 1–5 level badges */
.levels { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.level-badge, .lvl-btn {
  font-weight: 700;
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.lvl-btn { min-width: 2.2rem; cursor: pointer; }
/* PBIP — traffic light (1 green / 2 yellow / 3 red) */
.pbip-1 { background: #0f3d24; border-color: #22c55e; color: #bbf7d0; }
.pbip-2 { background: #4a3b0a; border-color: #eab308; color: #fef08a; }
.pbip-3 { background: #4c1414; border-color: #ef4444; color: #fecaca; }
/* TAL — OK / warning / elevated / critical / DOWN */
.tal-1 { background: #0f3d24; border-color: #22c55e; color: #bbf7d0; }
.tal-2 { background: #3f3a08; border-color: #ca8a04; color: #fde68a; }
.tal-3 { background: #4a3b0a; border-color: #eab308; color: #fef08a; }
.tal-4 { background: #4c1d0a; border-color: #f97316; color: #fed7aa; }
.tal-5 { background: #3f0a0a; border-color: #dc2626; color: #fecaca; box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.35); }

/* Communication lanes */
.lane { position: relative; }
.lane-event { box-shadow: inset 4px 0 0 var(--it); }
.lane-handoff { box-shadow: inset 4px 0 0 #8ab4ff; }
.lane-qa { box-shadow: inset 4px 0 0 var(--opip); }
.lane-close.tone-ok { box-shadow: inset 4px 0 0 var(--ok); }
.lane-close.tone-warn { box-shadow: inset 4px 0 0 var(--warn); }
.lane-close.tone-idle { box-shadow: inset 4px 0 0 var(--muted); }
.thread { display: flex; flex-direction: column; gap: 10px; max-height: 280px; overflow: auto; margin-top: 8px; }
.thread-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #121a24; }
.thread-item.kind-event { border-left: 3px solid var(--it); }
.thread-item.kind-handoff { border-left: 3px solid #8ab4ff; }
.thread-item.kind-question { border-left: 3px solid var(--opip); }
.thread-item.kind-answer { border-left: 3px solid var(--ok); }
.thread-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; font-size: 0.9rem; }
.plain-explain {
  margin-top: 6px;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--muted);
}
.plain-explain .plain-label {
  color: var(--ok);
  font-weight: 600;
  margin-right: 4px;
}

/* Column roles */
.col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.col-head {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #121a24;
}
.col-head h2 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}
.col-head p { margin: 0; font-size: 0.92rem; color: var(--muted); }
.col-situation .col-head { border-left: 4px solid var(--opip); }
.col-comms .col-head { border-left: 4px solid var(--it); }
.col-confirm .col-head { border-left: 4px solid var(--ok); }
.col-confirm { grid-column: 1 / -1; }
@media (min-width: 1100px) {
  .layout.work.cols3 .col-confirm { grid-column: auto; }
}

/* Role identity — entry cards + sticky ribbon (must be unmistakable) */
.role-pick-lead {
  font-size: 1.05rem;
  font-weight: 650;
  margin: 8px 0 14px;
  color: var(--text);
}
.role-entry-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 10px 0 16px;
}
@media (min-width: 900px) {
  .role-entry-grid { grid-template-columns: 1fr 1fr 1fr; }
}
.role-entry-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  text-align: left;
  text-decoration: none;
  padding: 18px 20px;
  border-radius: 14px;
  border: 3px solid;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.role-entry-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px #0006;
}
.role-entry-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0.85;
}
.role-entry-name {
  font-size: 1.55rem;
  font-weight: 850;
  letter-spacing: 0.03em;
  line-height: 1.15;
}
.role-entry-desc {
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0.92;
  line-height: 1.35;
}
.role-entry-cta {
  margin-top: 8px;
  font-size: 1.05rem;
  font-weight: 800;
}
.role-entry-card.role-IT {
  background: linear-gradient(145deg, #0b4a66, #082636);
  border-color: #5ad0ff;
  color: #e7f8ff;
}
.role-entry-card.role-OPIP {
  background: linear-gradient(145deg, #6a5210, #3a2e08);
  border-color: #f0c14b;
  color: #fff6d8;
}
.role-entry-card.role-INSTRUCTOR {
  background: linear-gradient(145deg, #3a4554, #1c2430);
  border-color: #9eb2c7;
  color: #f0f4f8;
}

.role-ribbon {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  padding: 14px 20px;
  border-bottom: 4px solid;
  font-family: var(--font);
}
.role-ribbon-kicker {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0.9;
}
.role-ribbon-name {
  font-size: 1.65rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.1;
}
.role-ribbon-desc {
  flex: 1 1 220px;
  font-size: 1rem;
  font-weight: 600;
  opacity: 0.95;
}
.role-ribbon-code {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  background: #0005;
}
.role-ribbon.role-IT {
  background: linear-gradient(90deg, #08729a, #0a3a4d);
  border-bottom-color: #5ad0ff;
  color: #e8f9ff;
}
.role-ribbon.role-OPIP {
  background: linear-gradient(90deg, #8a6a12, #4a3a0a);
  border-bottom-color: #f0c14b;
  color: #fff8e0;
}
.role-ribbon.role-INSTRUCTOR {
  background: linear-gradient(90deg, #4a5868, #243040);
  border-bottom-color: #9eb2c7;
  color: #f2f6fa;
}

body.console-IT .app-header {
  box-shadow: inset 0 -3px 0 #5ad0ff;
}
body.console-OPIP .app-header {
  box-shadow: inset 0 -3px 0 #f0c14b;
}
body.console-INSTRUCTOR .app-header {
  box-shadow: inset 0 -3px 0 #9eb2c7;
}
.v2-role-title {
  font-size: 1.15rem;
  font-weight: 850;
  letter-spacing: 0.06em;
}
.v2.role-it .v2-top,
.v2.role-it .v2-shell { border-top-color: #5ad0ff; }
.v2.role-opip .v2-top { border-bottom-color: #f0c14b; }

.brief-page h2 {
  margin: 1.6rem 0 0.7rem;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.brief-page .lead { max-width: 46rem; }
.brief-hint { margin: 0 0 10px; font-size: 0.95rem; }
.brief-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px 16px;
}
@media (min-width: 800px) {
  .brief-grid { grid-template-columns: 1fr 1fr; }
}
.brief-page .brief-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--muted);
}
.brief-page .brief-field input,
.brief-page .brief-field select,
.brief-page .brief-field textarea {
  margin: 0;
  font-weight: 500;
  color: var(--text);
  width: 100%;
}
.brief-assets { display: grid; gap: 10px; }
.brief-asset {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--panel);
}
.brief-asset-role {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: baseline;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}
.brief-asset-role code { color: var(--it); }
.brief-asset-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px 16px;
}
@media (min-width: 800px) {
  .brief-asset-fields { grid-template-columns: minmax(0, 1fr) 160px; }
}
.brief-checks, .brief-events {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.brief-page input[type="checkbox"] {
  appearance: auto;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0.2rem 0 0;
  padding: 0;
  flex-shrink: 0;
  align-self: start;
  accent-color: var(--it);
  background: transparent;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}
.brief-check {
  display: grid;
  grid-template-columns: 1.15rem minmax(0, 1fr);
  column-gap: 12px;
  align-items: start;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  font-weight: 500;
}
.brief-check-body {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  min-width: 0;
  line-height: 1.4;
}
.brief-check-body code { color: var(--it); }
.brief-event {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}
@media (min-width: 800px) {
  .brief-event { grid-template-columns: minmax(0, 1fr) 132px; align-items: start; }
}
.brief-event-toggle {
  display: grid;
  grid-template-columns: 1.15rem minmax(0, 1fr);
  column-gap: 12px;
  align-items: start;
  margin: 0;
  cursor: pointer;
  font-weight: 500;
}
.brief-event-body { min-width: 0; }
.brief-event-meta {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}
.brief-event-meta code { color: var(--it); }
.brief-event-text { display: block; line-height: 1.4; }
.brief-at {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--muted);
}
.brief-at input {
  width: 7.5rem;
  margin: 0;
  padding: 8px 10px;
}
.brief-at input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.brief-actions {
  margin-top: 18px;
  align-items: center;
}
.brief-page .brief-json-edit {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.4;
  min-height: 22rem;
  margin: 6px 0 0;
  white-space: pre;
}
.brief-page .brief-file-input {
  width: auto;
  max-width: 18rem;
  margin: 0;
  padding: 8px 10px;
}
.brief-err { color: var(--bad); border: 1px solid var(--bad); border-radius: 10px; padding: 12px 14px; margin-top: 12px; }
.brief-ok { border: 1px solid var(--ok); border-radius: 10px; padding: 12px 14px; margin-top: 12px; }
.brief-preview-list { margin: 8px 0 0; padding-left: 1.2rem; }
