/* ===========================================================================
   Alerra.ai — simulator components.
   Operations-console surfaces: dense, squared, monospace where it carries
   meaning. Nothing here is decorative.
   ========================================================================= */

/* ---------- network graph ---------- */
.graph-shell{position:relative;background:var(--surface);border:1px solid var(--line);
  border-radius:6px;overflow:hidden}
.graph-canvas{display:block;width:100%;height:100%;touch-action:pan-y}
.graph-stage{position:relative;width:100%;height:clamp(420px,58vh,660px)}
.graph-hud{position:absolute;top:12px;left:12px;display:flex;flex-direction:column;
  gap:8px;pointer-events:none;z-index:2}
.graph-hud .demo-badge,.graph-hud .live-badge{pointer-events:auto}
/* A strip beneath the canvas rather than an overlay on it: the bottom
   institution's label used to run straight through the legend. */
.graph-legend{display:flex;flex-wrap:wrap;gap:6px 14px;
  padding:11px 14px;border-top:1px solid var(--line);background:var(--surface-3);
  font-family:var(--mono);font-size:10px;letter-spacing:.09em;
  text-transform:uppercase;color:var(--dim-2)}
.graph-legend span{display:inline-flex;align-items:center;gap:5px}
.graph-legend i{width:7px;height:7px;border-radius:50%;display:inline-block}
.graph-empty{position:absolute;inset:0;display:grid;place-items:center;
  font-family:var(--mono);font-size:12px;color:var(--dim-2);text-align:center;padding:20px}

/* Keyboard access: the canvas has an invisible, focusable node list beside it
   so the graph is operable and announced without a mouse. */
.graph-a11y{position:absolute;inset:0;z-index:3;pointer-events:none}
.graph-a11y button{position:absolute;width:26px;height:26px;transform:translate(-50%,-50%);
  border-radius:50%;opacity:0;pointer-events:auto}
.graph-a11y button:focus-visible{opacity:1;outline:2px solid var(--mark-green);outline-offset:2px}

/* ---------- risk gauge ---------- */
.gauge{display:flex;flex-direction:column;gap:9px}
.gauge-top{display:flex;align-items:baseline;justify-content:space-between;gap:10px}
.gauge-val{font-family:var(--mono);font-size:clamp(38px,5.4vw,60px);font-weight:700;
  letter-spacing:-.03em;line-height:1;font-variant-numeric:tabular-nums}
.gauge-max{font-family:var(--mono);font-size:14px;color:var(--dim-2)}
.gauge-track{position:relative;height:6px;background:var(--surface-3);
  border:1px solid var(--line);border-radius:2px;overflow:hidden}
.gauge-fill{position:absolute;inset:0 auto 0 0;width:0;border-radius:1px;
  transition:width .85s var(--ease),background .5s ease}
/* Threshold marker: the score alone means nothing without the line it crosses. */
.gauge-track .thr{position:absolute;top:-3px;bottom:-3px;width:1px;background:var(--dim-2)}
.gauge-meta{display:flex;flex-wrap:wrap;gap:8px 16px;font-family:var(--mono);
  font-size:11px;color:var(--dim);letter-spacing:.06em;text-transform:uppercase}
.gauge.is-low .gauge-val,.gauge.is-low .gauge-fill{color:var(--risk-low)}
.gauge.is-low .gauge-fill{background:var(--risk-low)}
.gauge.is-med .gauge-val{color:var(--risk-med)}.gauge.is-med .gauge-fill{background:var(--risk-med)}
.gauge.is-high .gauge-val{color:var(--risk-high)}.gauge.is-high .gauge-fill{background:var(--risk-high)}
/* Status is never carried by colour alone. */
.gauge-status{display:inline-flex;align-items:center;gap:7px;font-weight:700;font-size:13px}
.gauge-status .mk{font-family:var(--mono);font-size:11px;letter-spacing:.1em;
  border:1px solid currentColor;border-radius:2px;padding:1px 5px}

/* ---------- event stream ---------- */
.stream{display:flex;flex-direction:column;min-height:0}
.stream-list{list-style:none;overflow-y:auto;overscroll-behavior:contain;
  display:flex;flex-direction:column;flex:1 1 auto;min-height:0}
.stream-list::-webkit-scrollbar{width:8px}
.stream-list::-webkit-scrollbar-thumb{background:rgba(120,150,140,.2);border-radius:4px}
.ev{display:grid;grid-template-columns:auto 1fr;gap:3px 12px;padding:9px 14px;
  border-bottom:1px solid rgba(120,150,140,.09);animation:ev-in .42s var(--ease) both}
@keyframes ev-in{from{opacity:0;transform:translateY(-5px)}to{opacity:1;transform:none}}
.ev-time{font-family:var(--mono);font-size:11px;color:var(--dim-2);
  font-variant-numeric:tabular-nums;padding-top:1px}
.ev-src{font-family:var(--mono);font-size:10.5px;letter-spacing:.12em;
  text-transform:uppercase;color:var(--dim);font-weight:600}
.ev-body{grid-column:2;font-size:13px;color:var(--ink);line-height:1.45}
.ev-tok{grid-column:2;font-family:var(--mono);font-size:11px;color:var(--dim-2)}
.ev.is-alerra .ev-src{color:var(--cyan)}
.ev.is-alerra{background:linear-gradient(90deg,rgba(90,214,255,.07),transparent 60%)}
.ev.is-risk .ev-src{color:var(--gold)}
.ev.is-risk .ev-body{font-family:var(--mono);font-variant-numeric:tabular-nums}
.ev.is-scam .ev-src{color:var(--mark-red)}
.ev.is-confirmed .ev-src{color:var(--mark-green)}
.ev-arrow{color:var(--dim-2);padding-inline:4px}

/* ---------- metrics ---------- */
.metrics{display:grid;gap:1px;background:var(--line);
  grid-template-columns:repeat(auto-fit,minmax(148px,1fr));
  border:1px solid var(--line);border-radius:6px;overflow:hidden}
.metric{background:var(--surface);padding:15px 16px;display:flex;flex-direction:column;gap:5px}
.metric-val{font-family:var(--mono);font-size:clamp(21px,2.4vw,28px);font-weight:700;
  letter-spacing:-.02em;font-variant-numeric:tabular-nums;line-height:1}
.metric-lbl{font-family:var(--mono);font-size:10px;letter-spacing:.13em;
  text-transform:uppercase;color:var(--dim-2);line-height:1.35}

/* ---------- demo controls ---------- */
.controls-bar{display:flex;flex-wrap:wrap;align-items:center;gap:8px;
  padding:11px 14px;border:1px solid var(--line);border-radius:6px;background:var(--surface)}
.controls-bar .spacer{flex:1 1 auto;min-width:8px}
.seg{display:inline-flex;border:1px solid var(--line);border-radius:4px;overflow:hidden}
.seg button{padding:6px 11px;font-family:var(--mono);font-size:11.5px;color:var(--dim);
  transition:background .16s,color .16s}
.seg button+button{border-left:1px solid var(--line)}
.seg button[aria-pressed="true"]{background:rgba(46,230,168,.13);color:var(--mark-green)}

/* ---------- evidence inspector ---------- */
.inspector{display:flex;flex-direction:column;min-height:0}
.insp-empty{padding:26px 16px;text-align:center;color:var(--dim-2);font-size:13px;line-height:1.6}
.insp-body{overflow-y:auto;overscroll-behavior:contain;padding:16px;display:flex;
  flex-direction:column;gap:18px;min-height:0}
.insp-tok{font-family:var(--mono);font-size:15px;color:var(--ink);word-break:break-all}
.insp-type{font-family:var(--mono);font-size:10.5px;letter-spacing:.13em;
  text-transform:uppercase;color:var(--dim)}
.kv{display:grid;grid-template-columns:1fr auto;gap:7px 14px;font-size:12.5px}
.kv dt{color:var(--dim);font-family:var(--mono);font-size:10.5px;letter-spacing:.1em;
  text-transform:uppercase;align-self:center}
.kv dd{text-align:right;font-family:var(--mono);font-variant-numeric:tabular-nums}

/* "Why this score?" — the explainability ledger. */
.why{display:flex;flex-direction:column;gap:1px;background:var(--line);
  border:1px solid var(--line);border-radius:5px;overflow:hidden}
.why-row{display:grid;grid-template-columns:44px 1fr;gap:12px;align-items:baseline;
  background:var(--surface-3);padding:9px 12px}
.why-pts{font-family:var(--mono);font-size:13px;font-weight:700;color:var(--mark-red);
  font-variant-numeric:tabular-nums;text-align:right}
.why-lbl{font-size:12.5px;line-height:1.4}
.why-detail{font-family:var(--mono);font-size:10.5px;color:var(--dim-2);
  margin-top:2px;word-break:break-word}
.why-total{display:grid;grid-template-columns:44px 1fr;gap:12px;background:var(--surface-2);
  padding:10px 12px;font-weight:700}
.why-total .why-pts{color:var(--ink);font-size:14px}

/* ---------- evidence timeline ---------- */
.timeline{list-style:none;display:flex;flex-direction:column;gap:0;position:relative}
.timeline::before{content:'';position:absolute;left:5px;top:6px;bottom:6px;width:1px;
  background:var(--line)}
.tl-item{display:grid;grid-template-columns:auto 1fr;gap:12px;padding:7px 0;position:relative}
.tl-dot{width:11px;height:11px;border-radius:50%;border:2px solid var(--void);
  background:var(--dim-2);margin-top:3px;z-index:1}
.tl-dot.on-red{background:var(--mark-red)}
.tl-dot.on-green{background:var(--mark-green)}
.tl-dot.on-cyan{background:var(--cyan)}
.tl-when{font-family:var(--mono);font-size:10.5px;color:var(--dim-2)}
.tl-what{font-size:12.5px;line-height:1.45}

/* ---------- entity picker (evidence explorer) ---------- */
.picker{display:flex;flex-wrap:wrap;gap:6px}
.picker button{font-family:var(--mono);font-size:11px;letter-spacing:.09em;
  text-transform:uppercase;color:var(--dim);border:1px solid var(--line);
  border-radius:3px;padding:6px 11px;transition:border-color .16s,color .16s,background .16s}
.picker button:hover{color:var(--ink);border-color:var(--line-strong)}
.picker button[aria-pressed="true"]{color:var(--mark-green);
  border-color:rgba(46,230,168,.4);background:rgba(46,230,168,.09)}
.entity-list{list-style:none;display:flex;flex-direction:column;gap:1px;
  background:var(--line);border:1px solid var(--line);border-radius:5px;
  overflow-y:auto;overscroll-behavior:contain}
.entity-row{display:grid;grid-template-columns:1fr auto auto;gap:12px;align-items:center;
  width:100%;text-align:left;background:var(--surface-3);padding:10px 13px;
  transition:background .14s}
.entity-row:hover,.entity-row[aria-pressed="true"]{background:var(--surface-2)}
.entity-row[aria-pressed="true"]{box-shadow:inset 2px 0 0 var(--mark-green)}
.entity-row .tok{font-family:var(--mono);font-size:12px;overflow:hidden;
  text-overflow:ellipsis;white-space:nowrap}
.entity-row .ty{font-family:var(--mono);font-size:10px;letter-spacing:.1em;
  text-transform:uppercase;color:var(--dim-2)}
.entity-row .rk{font-family:var(--mono);font-size:13px;font-weight:700;
  font-variant-numeric:tabular-nums;min-width:28px;text-align:right}

/* ---------- risk comparison (local vs network) ---------- */
.compare{display:grid;gap:1px;background:var(--line);border:1px solid var(--line);
  border-radius:6px;overflow:hidden;grid-template-columns:1fr 1fr}
@media (max-width:620px){.compare{grid-template-columns:1fr}}
.compare-side{background:var(--surface);padding:clamp(18px,2.6vw,30px);
  display:flex;flex-direction:column;gap:11px}
.compare-side .cap{font-family:var(--mono);font-size:10.5px;letter-spacing:.14em;
  text-transform:uppercase;color:var(--dim)}
.compare-side .num{font-family:var(--mono);font-size:clamp(46px,8vw,86px);font-weight:700;
  line-height:.9;letter-spacing:-.04em;font-variant-numeric:tabular-nums}
.compare-side .sub{font-size:13px;color:var(--dim);line-height:1.5}
.compare-side.local .num{color:var(--dim)}
.compare-side.network .num{color:var(--mark-red)}
.compare-side.network{background:linear-gradient(180deg,rgba(255,79,94,.07),transparent 65%),var(--surface)}

/* ---------- fraud intelligence object ---------- */
.fio{display:flex;flex-direction:column;gap:9px}
.fio-title{display:flex;align-items:center;gap:9px;flex-wrap:wrap}

/* ---------- scenario runner ---------- */
.scn-steps{list-style:none;display:flex;flex-direction:column;gap:1px;
  background:var(--line);border:1px solid var(--line);border-radius:5px;overflow:hidden}
.scn-step{background:var(--surface-3);padding:11px 13px;display:grid;
  grid-template-columns:auto 1fr auto;gap:12px;align-items:start;
  opacity:.34;transition:opacity .35s ease,background .35s ease}
.scn-step .ph{font-family:var(--mono);font-size:10px;letter-spacing:.11em;
  text-transform:uppercase;color:var(--dim-2);padding-top:2px;min-width:62px}
.scn-step .hd{font-size:13px;line-height:1.45}
.scn-step .dt{font-size:11.5px;color:var(--dim);line-height:1.45;margin-top:3px}
.scn-step .rk{font-family:var(--mono);font-size:13px;font-weight:700;
  font-variant-numeric:tabular-nums;color:var(--dim-2)}
.scn-step[data-state="active"]{opacity:1;background:var(--surface-2);
  box-shadow:inset 2px 0 0 var(--mark-green)}
.scn-step[data-state="done"]{opacity:.72;background:var(--surface-3)}
.scn-step[data-state="active"] .ph{color:var(--mark-green)}
.scn-step[data-state="done"] .rk,.scn-step[data-state="active"] .rk{color:var(--ink)}

.scn-result{display:flex;flex-direction:column;gap:14px;padding:clamp(16px,2.4vw,24px);
  border:1px solid rgba(255,79,94,.3);border-radius:6px;
  background:linear-gradient(180deg,rgba(255,79,94,.08),transparent 70%),var(--surface);
  animation:result-in .6s var(--ease) both}
@keyframes result-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
.scn-result ul{list-style:none;display:flex;flex-direction:column;gap:7px}
.scn-result li{display:grid;grid-template-columns:auto 1fr;gap:10px;font-size:13px;
  line-height:1.5;color:var(--ink)}
.scn-result li::before{content:'';width:5px;height:5px;border-radius:50%;
  background:var(--mark-red);margin-top:8px}

/* ---------- stage flow (How it works) ---------- */
.stages{display:flex;flex-direction:column;gap:1px;background:var(--line);
  border:1px solid var(--line);border-radius:6px;overflow:hidden}
.stage{background:var(--surface);display:grid;
  grid-template-columns:clamp(70px,8vw,110px) 1fr;gap:clamp(16px,3vw,38px);
  padding:clamp(20px,3.2vw,38px);align-items:start;
  opacity:.5;transition:opacity .6s var(--ease),background .6s var(--ease)}
.stage.is-active{opacity:1;background:var(--surface-2)}
.stage-no{font-family:var(--mono);font-size:clamp(26px,3.6vw,44px);font-weight:700;
  color:var(--dim-2);letter-spacing:-.03em;line-height:1;transition:color .6s var(--ease)}
.stage.is-active .stage-no{color:var(--mark-green)}
.stage-main{display:flex;flex-direction:column;gap:13px;min-width:0}
.stage-t{font-size:clamp(18px,2.2vw,27px);font-weight:800;letter-spacing:-.025em;line-height:1.15}
.stage-d{font-size:14px;color:var(--dim);line-height:1.6;max-width:56ch}
@media (max-width:640px){.stage{grid-template-columns:1fr;gap:12px}}

/* ---------- security boundary ---------- */
.boundary{position:relative;border:1px solid rgba(255,79,94,.42);border-radius:6px;
  background:linear-gradient(180deg,rgba(255,79,94,.05),transparent 60%),var(--surface);
  padding:clamp(18px,2.6vw,28px);display:flex;flex-direction:column;gap:14px}
.boundary::before{content:attr(data-label);position:absolute;top:-9px;left:16px;
  background:var(--void);padding:0 9px;font-family:var(--mono);font-size:10px;
  letter-spacing:.15em;text-transform:uppercase;color:var(--mark-red)}
.boundary.is-network{border-color:rgba(46,230,168,.42);
  background:linear-gradient(180deg,rgba(46,230,168,.05),transparent 60%),var(--surface)}
.boundary.is-network::before{color:var(--mark-green)}
.boundary.is-gateway{border-color:rgba(90,214,255,.4);
  background:linear-gradient(180deg,rgba(90,214,255,.05),transparent 60%),var(--surface)}
.boundary.is-gateway::before{color:var(--cyan)}
.bx-grid{display:grid;gap:9px;grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}
.bx-item{border:1px solid var(--line);border-radius:4px;padding:10px 12px;
  background:var(--surface-3);display:flex;flex-direction:column;gap:4px}
.bx-item .t{font-size:12.5px;font-weight:600}
.bx-item .d{font-size:11px;color:var(--dim-2);line-height:1.45}

/* The arrow between boundary layers, with the payload that crosses it. */
.bx-flow{display:flex;flex-direction:column;align-items:center;gap:7px;padding-block:6px}
.bx-flow .line{width:1px;height:26px;background:linear-gradient(var(--line),var(--mark-green))}
.bx-flow .cap{font-family:var(--mono);font-size:10.5px;letter-spacing:.11em;
  text-transform:uppercase;color:var(--dim);text-align:center;max-width:44ch;line-height:1.5}

/* Two-column "does not leave / may be shared" ledger. */
.ledger{display:grid;gap:1px;background:var(--line);border:1px solid var(--line);
  border-radius:6px;overflow:hidden;grid-template-columns:1fr 1fr}
@media (max-width:700px){.ledger{grid-template-columns:1fr}}
.ledger-col{background:var(--surface);padding:clamp(16px,2.4vw,24px);
  display:flex;flex-direction:column;gap:13px}
.ledger-col h3{display:flex;align-items:center;gap:9px;font-size:13px;font-weight:700;
  letter-spacing:.02em}
.ledger-col ul{list-style:none;display:flex;flex-direction:column;gap:8px}
.ledger-col li{display:grid;grid-template-columns:16px 1fr;gap:9px;font-size:13px;
  line-height:1.45;color:var(--ink)}
.ledger-col li .ic{margin-top:3px}
.ledger-col.stays li .ic{color:var(--mark-red)}
.ledger-col.shared li .ic{color:var(--mark-green)}

/* ---------- principles ---------- */
.principles{display:grid;gap:1px;background:var(--line);border:1px solid var(--line);
  border-radius:6px;overflow:hidden;grid-template-columns:repeat(auto-fit,minmax(252px,1fr))}
.principle{background:var(--surface);padding:clamp(18px,2.4vw,26px);
  display:flex;flex-direction:column;gap:11px}
.principle .ic{width:26px;height:26px;color:var(--mark-green)}
.principle h3{font-size:14.5px;font-weight:700;letter-spacing:-.01em}
.principle p{font-size:13px;color:var(--dim);line-height:1.6}

/* ---------- pipeline (security demo) ---------- */
.pipe{display:flex;flex-direction:column;gap:2px}
.pipe-stage{border:1px solid var(--line);border-radius:4px;padding:11px 13px;
  background:var(--surface-3);display:flex;align-items:center;gap:11px;
  opacity:.4;transition:opacity .4s ease,border-color .4s ease,background .4s ease}
.pipe-stage[data-state="done"]{opacity:1;border-color:rgba(90,214,255,.34);background:var(--surface-2)}
.pipe-stage .n{font-family:var(--mono);font-size:10px;color:var(--dim-2);min-width:16px}
.pipe-stage .t{font-family:var(--mono);font-size:11.5px;letter-spacing:.1em;text-transform:uppercase}
.pipe-arrow{align-self:center;color:var(--dim-2);font-size:12px;line-height:1}

/* ---------- evidence atlas ---------- */
/* The explorable map on the Network page. The canvas fills the stage and the
   controls sit over it; everything here is positioned against .graph-stage. */

.atlas-canvas{cursor:grab;touch-action:none;outline:none}
.atlas-canvas:focus-visible{outline:2px solid var(--mark-green);outline-offset:-2px}

.atlas-controls{position:absolute;top:12px;right:12px;z-index:3;display:flex;gap:6px}
.atlas-btn{font-family:var(--mono);font-size:12px;line-height:1;color:var(--dim);
  background:rgba(13,18,17,.86);border:1px solid var(--line);border-radius:4px;
  min-width:30px;height:30px;padding:0 9px;backdrop-filter:blur(8px);
  transition:color .18s,border-color .18s}
.atlas-btn:hover{color:var(--ink);border-color:var(--line-strong)}
.atlas-btn:focus-visible{outline:2px solid var(--mark-green);outline-offset:2px}

.atlas-hud{position:absolute;left:12px;bottom:12px;z-index:3;display:flex;
  flex-direction:column;gap:3px;pointer-events:none}
.atlas-readout{font-size:10.5px;letter-spacing:.09em;text-transform:uppercase;
  color:var(--dim-2)}
.atlas-hint{font-family:var(--mono);font-size:10px;letter-spacing:.08em;
  text-transform:uppercase;color:rgba(117,132,126,.7)}

/* Hover label. Follows the pointer, so it must never eat pointer events. */
.atlas-tip{position:absolute;z-index:4;pointer-events:none;
  font-family:var(--mono);font-size:11px;letter-spacing:.04em;color:var(--ink);
  background:rgba(7,11,10,.94);border:1px solid var(--line-strong);border-radius:4px;
  padding:6px 9px;white-space:nowrap;max-width:240px;overflow:hidden;
  text-overflow:ellipsis}

/* On a phone the hint is noise and the controls want to be thumb-reachable.
   Moving the controls to the bottom puts them over the readout, so the readout
   gives up the width they take. */
@media (max-width:640px){
  .atlas-hint{display:none}
  .atlas-controls{top:auto;bottom:12px;right:12px}
  .atlas-btn{min-width:38px;height:38px}
  /* Above the controls rather than beside them: at 390px there is not enough
     width for both on one line. */
  .atlas-hud{bottom:62px;right:12px}
  .atlas-readout{line-height:1.35}
}
