/* 부품. 관제 화면과 상세 화면이 같은 것을 쓴다. */

/* ── 배지 ─────────────────────────────────────────────────────────
 * 출처 배지가 이 화면에서 제일 중요한 부품이다. 자동 산출과 관제요원 확인이
 * 같아 보이면 "AI 가 카메라를 넘어 자동으로 찾았다" 로 읽힌다.
 */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 6px; border-radius: var(--r-sm);
  border: 1px solid var(--grey-line); background: var(--grey-soft);
  color: var(--text-2); font-size: 10.5px; line-height: 17px; white-space: nowrap;
}
.badge--auto     { border-color: var(--blue-line);   background: var(--blue-soft);   color: var(--blue); }
.badge--derived  { border-color: var(--orange-line); background: var(--orange-soft); color: var(--orange); }
.badge--operator { border-color: var(--violet-line); background: var(--violet-soft); color: var(--violet); }
.badge--demo     { border-color: var(--line-strong); background: var(--surface-3);   color: var(--text-3); }
.badge--ok       { border-color: var(--green-line);  background: var(--green-soft);  color: var(--green); }
.badge--warn     { border-color: var(--orange-line); background: var(--orange-soft); color: var(--orange); }
.badge--alert    { border-color: var(--red-line);    background: var(--red-soft);    color: var(--red); }
.badge--off      { border-color: var(--line); background: var(--surface-2); color: var(--text-3); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

/* ── 카드 ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.card__head {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px; border-bottom: 1px solid var(--line-soft);
}
.card__head h2, .card__head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card__head .spacer { flex: 1; }
.card__body { padding: 16px; }
.card__note { padding: 8px 12px; border-top: 1px solid var(--line-soft);
              color: var(--text-3); font-size: 11px; background: var(--surface-2);
              border-radius: 0 0 var(--r-lg) var(--r-lg); }

.section-title {
  display: flex; align-items: center; gap: 8px;
  margin: 18px 0 8px; font-size: 12px; font-weight: 600; color: var(--text-2);
  letter-spacing: .04em; text-transform: uppercase;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ── 지표 ─────────────────────────────────────────────────────── */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 1px;
           background: var(--line-soft); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.metric { background: var(--surface); padding: 13px 14px; }
.metric dt { margin: 0 0 4px; color: var(--text-3); font-size: 11px; }
.metric dd { margin: 0; font: 600 17px/1.15 var(--mono); }
.metric dd small { font: 400 11px var(--sans); color: var(--text-3); margin-left: 3px; }

/* ── 표 ───────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 12px; }
table.t th, table.t td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.t th { color: var(--text-3); font-weight: 600; font-size: 11px; background: var(--surface-2); white-space: nowrap; }
table.t tbody tr:hover { background: var(--surface-2); }
table.t td.num { font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }

/* ── ID 링크 — 모든 Person/Facility ID 는 상세로 간다 ──────────── */
.idlink {
  font: 500 11.5px var(--mono); color: var(--blue); text-decoration: none;
  padding: 0 3px; border-radius: var(--r-sm); border: 1px solid transparent;
}
.idlink:hover { background: var(--blue-soft); border-color: var(--blue-line); }
.idlink--muted { color: var(--text-3); }
.idlink--muted:hover { background: var(--surface-3); border-color: var(--line); }

/* ── 카메라 목록 ──────────────────────────────────────────────── */
.rail__head { padding: 10px 12px 8px; border-bottom: 1px solid var(--line-soft); }
.rail__head h2 { margin: 0 0 2px; font-size: 11px; color: var(--text-3); letter-spacing: .05em; text-transform: uppercase; }
.rail__list { overflow: auto; padding: 6px; flex: 1; min-height: 0; }
.cam {
  width: 100%; display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 8px;
  align-items: center; padding: 6px; border: 1px solid transparent; border-radius: var(--r);
  text-align: left; margin-bottom: 3px;
}
.cam:hover { background: var(--surface-2); }
.cam[aria-current="true"] { background: var(--blue-soft); border-color: var(--blue-line); }
.cam__thumb { width: 56px; height: 32px; object-fit: cover; border-radius: var(--r-sm);
              background: var(--surface-3); display: block; }
.cam__name { display: block; font-size: 11.5px; font-weight: 500; white-space: nowrap;
             overflow: hidden; text-overflow: ellipsis; }
.cam__meta { display: block; margin-top: 2px; color: var(--text-3); font: 10px var(--mono); }
.rail__foot { border-top: 1px solid var(--line-soft); padding: 9px 12px; color: var(--text-3); font-size: 11px; }
.rail__foot b { color: var(--text-2); font-family: var(--mono); }

/* ── 영상 무대 ───────────────────────────────────────────────── */
.stage__bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; padding: 6px 10px;
  background: #1a1e23; color: #e6e9ed; border-bottom: 1px solid #2c3238; flex: none;
}
.stage__bar .badge { border-color: #3b434b; background: #262b31; color: #c4cad1; }
.stage__bar .badge--replay { border-color: #6b5a2a; background: #3a3016; color: #f0c469; }
.stage__bar .badge--live { border-color: #1e6b4a; background: #10331f; color: #59d99a; }
.stage__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
                font-size: 12px; font-weight: 500; }
.stage__spacer { flex: 1; }
.stage__toggle {
  padding: 3px 8px; border: 1px solid #3b434b; border-radius: var(--r);
  color: #c4cad1; font-size: 11px; background: #22272c; white-space: nowrap;
}
.stage__toggle[aria-pressed="true"] { background: #e6e9ed; color: #1a1e23; border-color: #e6e9ed; }

.stage__frame {
  position: relative; flex: 1 1 auto; min-height: 160px; display: grid; place-items: center;
  padding: 0; overflow: hidden; background: #0f1215; container-type: size;
}
.stage__media {
  position: relative; display: block; background: #000;
  aspect-ratio: var(--stage-aspect, 1536 / 824);
  width: min(100cqw, calc(100cqh * var(--stage-ratio, 1.864078)));
  height: min(100cqh, calc(100cqw / var(--stage-ratio, 1.864078)));
  max-width: 100%; max-height: 100%;
}
.stage__media[hidden] { display: none; }
.stage__media video {
  display: block; width: 100%; height: 100%; object-fit: contain;
  background: #000;
}
.stage__media video[hidden] { display: none; }
/* width/height 를 반드시 적는다. canvas 의 width/height **속성**은 CSS
 * presentational hint 로 들어가서, 저자 CSS 가 width 를 안 주면 비트맵 크기가
 * 곧 레이아웃 크기가 된다. 그러면 resize() 가 getBoundingClientRect 를 읽어
 * devicePixelRatio 를 곱해 다시 비트맵에 넣는 순간 매 프레임 두 배씩 커진다
 * (실제로 1,228,800px 까지 갔고 오버레이가 화면에서 통째로 사라졌다). */
.stage__overlay { position: absolute; inset: 0; width: 100%; height: 100%;
                  pointer-events: none; display: block; }

.stage__gap {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: #14181c; color: #e6e9ed; text-align: center; padding: 20px;
}
.stage__gap[hidden] { display: none; }
.stage__gap b { display: block; font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.stage__gap span { display: block; color: #98a1aa; font-size: 12px; }
.stage__gap .badge { margin-top: 12px; }

.stage__events {
  flex: 0 0 auto; min-height: 118px; max-height: 42%; overflow: auto;
  padding: 8px 10px 10px; background: #171b20; border-top: 1px solid #2c3238;
  display: flex; flex-direction: column; gap: 6px;
}
.stage__events-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  color: #98a1aa; font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase;
}
.stage__events-head .mono { color: #c4cad1; text-transform: none; letter-spacing: 0; }
.stage__lanes { display: grid; gap: 4px; }
.stage__lane {
  display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px; align-items: center;
}
.stage__lane-label { color: #8b939c; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage__lane-track {
  position: relative; height: 16px; border-radius: 3px; background: #22272d;
  border: 1px solid #2c3238; overflow: hidden;
}
.stage__lane-track[data-lane="person"] { --mark: #42a5ff; --mark-soft: rgba(66,165,255,.22); }
.stage__lane-track[data-lane="facility"] { --mark: #ff9e38; --mark-soft: rgba(255,158,56,.22); }
.stage__lane-track[data-lane="identity"] { --mark: #a985ff; --mark-soft: rgba(169,133,255,.24); }
.stage__lane-track[data-lane="pattern"] { --mark: #59d99a; --mark-soft: rgba(89,217,154,.22); }
.stage__mark {
  position: absolute; top: 2px; bottom: 2px; width: 3px; border-radius: 1px;
  padding: 0; border: 0; background: var(--mark); transform: translateX(-50%); cursor: pointer;
}
.stage__mark:hover { filter: brightness(1.25); width: 4px; }
.stage__mark[data-span="true"] {
  width: auto; transform: none; cursor: default; filter: none;
  background: var(--mark-soft);
  border-left: 2px solid var(--mark); border-right: 2px solid var(--mark);
}
.stage__playhead {
  position: absolute; top: 0; bottom: 0; width: 1px; background: #e6e9ed;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35); transform: translateX(-50%); pointer-events: none; z-index: 2;
}
.stage__events-empty { color: #6d757e; font-size: 11px; padding: 10px 2px; }

.stage__legend {
  display: flex; flex-wrap: wrap; gap: 10px; padding: 6px 10px; flex: none;
  background: #1a1e23; color: #98a1aa; font-size: 10.5px; border-top: 1px solid #2c3238;
}
.stage__legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px;
                   margin-right: 4px; vertical-align: -1px; }

/* ── 이벤트 스트림 ───────────────────────────────────────────── */
.stream__head { display: flex; align-items: center; gap: 8px; padding: 11px 12px;
                border-bottom: 1px solid var(--line-soft); flex: none; }
.stream__head h2 { margin: 0; font-size: 12px; font-weight: 600; }
.stream__count { margin-left: auto; color: var(--text-3); font: 11px var(--mono); }
.stream__filter { display: flex; gap: 4px; padding: 7px 10px; border-bottom: 1px solid var(--line-soft); flex: none; }
.stream__filter button {
  flex: 1; padding: 4px 6px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); color: var(--text-2); font-size: 11px;
}
.stream__filter button[aria-pressed="true"] { background: var(--text); color: var(--text-inv); border-color: var(--text); }
.stream__list { flex: 0 1 36%; min-height: 118px; overflow: auto; padding: 8px 0 18px; }
.stream__empty { padding: 24px 14px; color: var(--text-3); font-size: 12px; text-align: center; }
.stream__resume {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 10px;
  padding: 4px 10px; border-radius: 12px; background: var(--text); color: var(--text-inv);
  font-size: 11px; box-shadow: 0 2px 8px rgba(0,0,0,.25); z-index: 3;
}
.stream { position: relative; }
.stream__accumulation { flex: 1; min-height: 0; overflow: auto; padding: 12px;
                        border-top: 1px solid var(--line); background: var(--surface-2); }

.ev {
  display: block; width: 100%; text-align: left; padding: 10px 12px 11px;
  border-left: 3px solid transparent; border-bottom: 1px solid var(--line-soft);
}
.ev__select { display: block; width: 100%; padding: 0; text-align: left; }
.ev:hover { background: var(--surface-2); }
.ev[aria-selected="true"] { background: var(--blue-soft); border-left-color: var(--blue); }
.ev--auto     { border-left-color: var(--blue-line); }
.ev--derived  { border-left-color: var(--orange-line); }
.ev--operator { border-left-color: var(--violet-line); }
.ev--ambient  { opacity: .62; }
.ev__top { display: flex; align-items: center; gap: 6px; }
.ev__time { font: 11px var(--mono); color: var(--text-3); }
.ev__label { display: block; margin: 5px 0 0; font-size: 14px; font-weight: 600; }
.ev__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 4px;
            color: var(--text-3); font-size: 11px; }
.ev--pop { animation: evpop .28s ease-out; }
@keyframes evpop { from { background: var(--blue-soft); } to { background: transparent; } }

.acc-profiles { display: grid; gap: 8px; }
.acc-profiles__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.acc-profiles__empty { padding: 16px 12px; color: var(--text-3); font-size: 12px;
                       background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-lg); }
.acc-profile { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px;
               padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.acc-profile[data-current="true"] { border-color: var(--blue-line); box-shadow: inset 3px 0 0 var(--blue); }
.acc-profile__visual { width: 64px; height: 82px; display: grid; place-items: center; overflow: hidden;
                       border: 1px dashed var(--blue-line); background: var(--blue-soft); color: var(--blue);
                       border-radius: var(--r); font: 300 24px var(--mono); }
.acc-profile__visual img { width: 100%; height: 100%; object-fit: cover; }
.acc-profile__body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.acc-profile__body strong { margin-top: 2px; font: 650 15px var(--mono); }
.acc-profile__body > span:not(.dock__label), .acc-profile__body small { color: var(--text-3); font-size: 11px; }
.acc-progress { height: 5px; margin: 5px 0 2px; overflow: hidden; background: var(--surface-3); border-radius: 3px; }
.acc-progress i { display: block; height: 100%; background: var(--blue); transition: width .25s ease; }
.acc-facilities { display: grid; gap: 6px; margin-top: 14px; }
.acc-facility { display: grid; gap: 2px; padding: 8px 9px; background: var(--surface);
                border: 1px solid var(--line); border-radius: var(--r); }
.acc-facility a { color: var(--text); text-decoration: none; font-size: 12px; font-weight: 600;
                  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-facility span { color: var(--text-3); font-size: 11px; }
.acc-facility b { color: var(--text-2); font-family: var(--mono); }

/* ── 하단 도크 ───────────────────────────────────────────────── */
.dock__col { min-width: 0; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }
.dock__col + .dock__col { border-left: 1px solid var(--line-soft); }
.dock__label { color: var(--text-3); font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; }

.steps { overflow: auto; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.step { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 6px; align-items: baseline;
        padding: 3px 4px; border-radius: var(--r); text-align: left; width: 100%; }
.step:hover { background: var(--surface-2); }
.step__n { font: 11px var(--mono); color: var(--text-3); }
.step__t { font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step[data-state="done"] .step__n { color: var(--green); }
.step[data-state="current"] { background: var(--blue-soft); }
.step[data-state="current"] .step__t { color: var(--text); font-weight: 600; }

.transport { display: flex; align-items: center; gap: 8px; }
.transport button {
  width: 30px; height: 26px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); color: var(--text-2); display: grid; place-items: center;
}
.transport button:hover { background: var(--surface-2); }
.transport__time { font: 12px var(--mono); color: var(--text-2); white-space: nowrap; }
.transport__rate { margin-left: auto; }
.transport select { height: 26px; border: 1px solid var(--line); border-radius: var(--r);
                    background: var(--surface); padding: 0 6px; font-size: 11px; }

.scrub { position: relative; height: 34px; margin-top: 2px; }
.scrub__track { position: absolute; inset: 8px 0 auto 0; height: 16px; border: 1px solid var(--line);
                border-radius: var(--r-sm); background: var(--surface-2); overflow: hidden; }
.scrub__seg { position: absolute; top: 0; bottom: 0; border-right: 1px solid var(--line); }
.scrub__seg span { position: absolute; left: 4px; top: 1px; font: 9px var(--mono); color: var(--text-3);
                   white-space: nowrap; pointer-events: none; }
.scrub__gap { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(
              45deg, #dfe3e8, #dfe3e8 3px, #eceef1 3px, #eceef1 6px); }
.scrub__fill { position: absolute; top: 0; bottom: 0; left: 0; background: rgba(28,111,224,.14); }
.scrub__tick { position: absolute; top: 0; width: 1px; height: 6px; background: var(--blue-line); }
.scrub__tick--derived { background: var(--orange-line); height: 16px; }
.scrub__tick--operator { background: var(--violet-line); height: 16px; }
.scrub__head { position: absolute; top: 4px; width: 2px; height: 24px; background: var(--text); pointer-events: none; }
.scrub__input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; margin: 0; }
.scrub__input:focus-visible + .scrub__head { outline: var(--focus); }

.signals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; }
.signal { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.signal span { color: var(--text-3); font-size: 11px; }
.signal b { font: 600 13px var(--mono); }

.prio { display: flex; flex-direction: column; gap: 4px; min-height: 0; overflow: auto; }
.prio__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center;
             padding: 5px 6px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); text-align: left; }
.prio__row:hover { background: var(--surface-2); }
.prio__name { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prio__sub { display: block; color: var(--text-3); font: 10px var(--mono); }
.prio__score { font: 600 15px var(--mono); text-align: right; }
.prio__score--pending { font-size: 11px; font-weight: 400; color: var(--text-3); font-family: var(--sans); }
.prio__score[data-level="major"] { color: var(--orange); }
.prio__score[data-level="critical"] { color: var(--red); }
.prio__score[data-level="normal"] { color: var(--green); }

/* ── 근거 · 미구현 신호 ──────────────────────────────────────── */
.reasons { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.reasons li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 8px;
              font-size: 12px; color: var(--text-2); line-height: 1.55; }
.reasons li::before { content: "·"; color: var(--text-3); text-align: center; }
.reasons li.is-unavailable { color: var(--text-3); }
.reasons li.is-unavailable::before { content: "○"; font-size: 10px; }

.parts { display: grid; gap: 6px; }
.part { display: grid; grid-template-columns: 128px minmax(0, 1fr) 46px; gap: 8px; align-items: center; font-size: 11.5px; }
.part__bar { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.part__bar i { display: block; height: 100%; background: var(--blue); }
.part__val { font: 11px var(--mono); text-align: right; color: var(--text-2); }
.part.is-off .part__val, .part.is-off span:first-child { color: var(--text-3); }
.part.is-off .part__bar i { background: var(--line-strong); }

.chips { display: flex; flex-wrap: wrap; gap: 5px; }

.bars { display: grid; gap: 4px; }
.bar { display: grid; grid-template-columns: 70px minmax(0, 1fr) 28px; gap: 8px; align-items: center; font-size: 11.5px; }
.bar__track { height: 10px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.bar__track i { display: block; height: 100%; background: var(--blue); }
.bar__n { font: 11px var(--mono); text-align: right; color: var(--text-2); }

/* ── 타임라인 (상세 화면) ────────────────────────────────────── */
.tl { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.tl li { position: relative; padding: 0 0 14px 16px; }
.tl li::before { content: ""; position: absolute; left: -21px; top: 4px; width: 9px; height: 9px;
                 border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.tl li[data-kind="facility_use"]::before { border-color: var(--orange); }
.tl li[data-kind="observation"]::before { border-color: var(--blue); }
.tl li[data-kind="camera_change"]::before { border-color: var(--violet); }
.tl li[data-kind="loitering"]::before { border-color: var(--orange); background: var(--orange); }
.tl li[data-kind="companion"]::before { border-color: var(--line-strong); background: var(--line-strong); }
.tl li[data-kind="operator_note"]::before { border-color: var(--violet); background: var(--violet); }
.tl li[data-kind="loitering"] .tl__title { color: var(--orange); }
.tl li[data-kind="operator_note"] .tl__title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tl__time { font: 11px var(--mono); color: var(--text-3); }
.tl__title { display: block; font-size: 12.5px; font-weight: 500; margin: 1px 0 2px; }
.tl__meta { color: var(--text-2); font-size: 11.5px; }
.tl li[data-kind="camera_change"], .tl li[data-kind="regap"] { color: var(--text-3); }

/* ── 인물 크롭 ──────────────────────────────────────────────── */
.crop { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-3);
        display: block; object-fit: cover; }
.crop--lg { width: 100%; max-width: 190px; aspect-ratio: 3 / 5; }
.crop--sm { width: 44px; height: 62px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { display: flex; align-items: center; gap: 6px; font-size: 11.5px; }
.swatch i { width: 20px; height: 20px; border-radius: var(--r-sm); border: 1px solid var(--line); }

.figure { margin: 0; }
.figure img { width: 100%; border: 1px solid var(--line); border-radius: var(--r); display: block; background: var(--surface-3); }
.figure figcaption { margin-top: 5px; color: var(--text-3); font-size: 11px; }

.note {
  padding: 8px 10px; border: 1px solid var(--line); border-left: 3px solid var(--line-strong);
  border-radius: var(--r); background: var(--surface-2); color: var(--text-2);
  font-size: 11.5px; line-height: 1.6;
}
.note--warn { border-left-color: var(--orange); background: var(--orange-soft); color: #7a4406; border-color: var(--orange-line); }
.note--info { border-left-color: var(--blue); background: var(--blue-soft); color: #114285; border-color: var(--blue-line); }
.note--operator { border-left-color: var(--violet); background: var(--violet-soft); color: #472e91; border-color: var(--violet-line); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  color: var(--text); font-size: 12px; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn--primary { background: var(--text); color: var(--text-inv); border-color: var(--text); }
.btn--primary:hover { background: #2a2f36; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  max-width: 420px; padding: 10px 14px; border-radius: var(--r-lg);
  background: var(--text); color: var(--text-inv); font-size: 12px; line-height: 1.55;
  box-shadow: 0 6px 24px rgba(0,0,0,.28); z-index: 60;
}
.toast b { display: block; margin-bottom: 2px; }

.state {
  display: grid; place-items: center; gap: 8px; padding: 48px 20px; text-align: center;
  color: var(--text-2);
}
.state b { font-size: 14px; color: var(--text); }
.state p { margin: 0; font-size: 12px; max-width: 420px; }
.state code { font: 11px var(--mono); background: var(--surface-3); padding: 1px 4px; border-radius: var(--r-sm); }

/* ── 상세 화면 조합 ─────────────────────────────────────────── */
.dock__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px;
              color: var(--text-3); font-size: 11px; margin-top: auto; }
.dock__foot .mono { color: var(--text-2); font-size: 12px; }

.person-lead { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 16px;
               padding: 14px; margin-bottom: 12px; align-items: stretch; }
.person-lead__crop { display: flex; align-items: flex-start; }
.person-lead__main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.person-lead__main .metrics { margin-top: auto; }
.detail-grid { margin-top: 12px; }

.facts { margin: 0; display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--r); }
.facts div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 6px 8px; }
.facts div + div { border-top: 1px solid var(--line-soft); }
.facts dt { color: var(--text-3); }
.facts dd { margin: 0; font-family: var(--mono); }

.evidence-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.evidence-grid .figure img { height: 180px; object-fit: cover; }
.clip-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.figure video { width: 100%; display: block; background: #111; border-radius: var(--r); }

.btn--compact { padding: 3px 7px; font-size: 11px; white-space: nowrap; }
.risk-score { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 3px 6px;
              padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
.risk-score b { font: 650 38px/1 var(--mono); color: var(--green); letter-spacing: -.04em; }
.risk-score[data-level="major"] b { color: var(--orange); }
.risk-score[data-level="critical"] b { color: var(--red); }
.risk-score span { color: var(--text-3); }
.risk-score small { grid-column: 1 / -1; color: var(--text-2); }
.missing-signals { margin-top: 10px; }
.detail-copy { margin: 8px 0 0; color: var(--text-2); font-size: 14px; line-height: 1.65; }
.inspection-table { margin-top: 12px; }
.inspection-notes { margin: 12px 0; }

/* 상세 화면에서도 끊기지 않는 리플레이 */
.continuity { display: grid; grid-template-columns: 256px minmax(0, 1fr); gap: 16px;
              padding: 12px; margin: 0 0 18px; background: var(--surface); }
.continuity__media { aspect-ratio: 16 / 9; min-height: 0; background: #161a1f; border-radius: var(--r);
                     overflow: hidden; display: grid; place-items: center; color: #e6e9ed; }
.continuity__media video { width: 100%; height: 100%; object-fit: contain; display: block; }
.continuity__gap { padding: 16px; text-align: center; font-size: 12px; }
.continuity__body { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 7px; }
.continuity__head { display: flex; align-items: center; gap: 8px; }
.continuity__head strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.continuity__head .mono { margin-left: auto; color: var(--text-2); }
.continuity__body p { margin: 0; color: var(--text-2); font-size: 14px; }
.continuity__body input { width: 100%; accent-color: var(--blue); }
.continuity__controls { display: flex; align-items: center; gap: 8px; }
.continuity__controls .mono { color: var(--text-3); }
.continuity__controls a { margin-left: auto; }

@media (max-width: 720px) {
  .person-lead { grid-template-columns: 104px minmax(0, 1fr); }
  .crop--lg { max-width: 104px; }
  .evidence-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .part { grid-template-columns: 104px minmax(0, 1fr) 42px; }
  .continuity { grid-template-columns: minmax(0, 1fr); }
}

/* ── 배회 근거 ────────────────────────────────────────────────────
 * 배회는 '오래 있었다' 가 아니라 '오래 있으면서 맴돌았다' 다. 그래서 카드가
 * 체류시간 하나가 아니라 경로·순변위·구역 출입을 나란히 보여준다.
 */
.loiter { border: 1px solid var(--orange-line); border-radius: var(--r);
          background: var(--orange-soft); padding: 10px; margin-bottom: 10px; }
.loiter:last-child { margin-bottom: 0; }
.loiter__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.loiter__head .mono { color: var(--text-2); font-size: 11.5px; }
.loiter .metrics { margin-bottom: 8px; }
.loiter .reasons { margin-bottom: 10px; }
.loiter .detail-copy { margin: 0 0 10px; font-size: 12px; color: var(--text-2); line-height: 1.6; }

/* 판단 요약 — 항목별 점수가 아니라 "무슨 일이 있었는가" 를 읽는 자리다. */
.risk-narration {
  margin: 0 0 4px; padding: 10px 12px;
  border: 1px solid var(--line); border-left: 3px solid var(--orange);
  border-radius: var(--r); background: var(--surface-2);
  font-size: 12.5px; line-height: 1.75; color: var(--text);
}

/* ── 모델 파이프라인 ─────────────────────────────────────────────
 * 사이드바가 아니라 영상 무대 전체를 덮는다. 시연 중에는 이 화면이 주인공이고,
 * 카메라 목록(왼쪽)과 재생 컨트롤(아래)은 그대로 남아 있어야 손이 닿는다.
 */
.pipe {
  position: absolute; left: var(--rail-w); right: 0; top: 0; bottom: var(--dock-h);
  z-index: 20; display: flex; flex-direction: column; min-height: 0;
  background: var(--bg); border-left: 1px solid var(--line-strong);
  transform: translateY(-4px); opacity: 0; visibility: hidden;
  transition: transform .16s ease, opacity .16s ease, visibility .16s;
}
.pipe[data-open="true"] { transform: none; opacity: 1; visibility: visible; }
.pipe__source { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.pipe__head {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; flex: none;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.pipe__title { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pipe__title b { font-size: 13px; }
.pipe__title span { color: var(--text-3); font-size: 11px; white-space: nowrap; }
.pipe__head select { padding: 3px 6px; border: 1px solid var(--line); border-radius: var(--r);
                     background: var(--surface); font: 600 12px var(--mono); }
.pipe__ghost { padding: 3px 9px; border: 1px solid var(--line); border-radius: var(--r);
               background: var(--surface); color: var(--text-2); font-size: 11.5px; white-space: nowrap; }
.pipe__ghost[aria-pressed="true"] { background: var(--text); color: var(--text-inv); border-color: var(--text); }
.pipe__clock { color: var(--text-3); font-size: 11.5px; }
.pipe__close { width: 26px; height: 26px; border-radius: var(--r); color: var(--text-3); font-size: 13px; }
.pipe__close:hover { background: var(--surface-3); color: var(--text); }

.pipe__modes { display: inline-flex; gap: 4px; margin-left: auto; }
.pipe__modes button { padding: 4px 12px; border: 1px solid var(--line); border-radius: var(--r);
                      background: var(--surface); color: var(--text-2); font-size: 12px; white-space: nowrap; }
.pipe__modes button[aria-pressed="true"] { background: var(--text); color: var(--text-inv); border-color: var(--text); }

.pipe__progress { display: flex; align-items: center; gap: 8px; padding: 6px 12px; flex: none;
                  background: var(--surface); border-bottom: 1px solid var(--line);
                  color: var(--text-3); font-size: 10.5px; letter-spacing: .04em; }
.pipe__progress i { flex: 1; height: 4px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.pipe__progress b { display: block; height: 100%; width: 0; background: var(--blue); transition: width .2s ease; }

.pipe__foot { padding: 6px 12px; border-top: 1px solid var(--line); background: var(--surface);
              color: var(--text-3); font-size: 10.5px; flex: none; }

/* 두 화면은 절대 같이 뜨지 않는다. 겹쳐 보이면 어느 쪽을 읽는지 알 수 없다. */
.pipe__layers[hidden], .pipe__flow[hidden] { display: none !important; }

/* ── 층별 산출 (왼쪽 목록 · 오른쪽 상세) ────────────────────────── */
.pipe__layers { flex: 1; min-height: 0; display: grid; grid-template-columns: 392px minmax(0, 1fr); }
.pipe__layers-list { min-height: 0; overflow: auto; padding: 6px 0 16px;
                     background: var(--surface); border-right: 1px solid var(--line); }
.pipe__layers-detail { min-height: 0; display: flex; flex-direction: column; background: var(--surface); }
.pipe__pane-head { display: flex; align-items: center; gap: 8px; padding: 9px 14px; flex: none;
                   border-bottom: 1px solid var(--line-soft); background: var(--surface-2); }
.pipe__pane-head b { font-size: 13px; }
.pipe__pane-head .mono { color: var(--text-3); font-size: 11px; }
.pipe__pane-head .spacer { flex: 1; }

.pipe-layer { position: relative; padding-left: 12px; }
.pipe-layer::before {
  content: ""; position: absolute; left: 5px; top: 0; bottom: 0;
  border-left: 2px solid var(--line);
}
.pipe-layer[data-state="live"]::before,
.pipe-layer[data-state="done"]::before { border-color: var(--blue-line); }
.pipe-layer:last-child::before { bottom: auto; height: 26px; }

.pipe-layer__head {
  display: grid; grid-template-columns: 22px 34px minmax(0, 1fr) auto;
  align-items: center; gap: 8px; width: 100%; padding: 9px 12px 9px 4px; text-align: left;
}
.pipe-layer__head:hover { background: var(--surface-2); }
.pipe-layer[data-state="idle"] .pipe-layer__head { opacity: .62; }
.pipe-layer[data-state="branch"] .pipe-layer__head { opacity: .72; }
.pipe-layer[data-current="true"] .pipe-layer__head { background: var(--blue-soft); }

.pipe-layer__n { color: var(--text-3); font-size: 10.5px; }
.pipe-layer__plate {
  display: flex; align-items: flex-end; gap: 2px; height: 30px; padding: 3px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2);
}
.pipe-layer__plate i { display: flex; align-items: flex-end; flex: 1; height: 100%;
                       background: var(--surface-3); border-radius: 1px; }
.pipe-layer__plate b { display: block; width: 100%; height: 6%; background: var(--line-strong);
                       border-radius: 1px; transition: height .18s linear; }
.pipe-layer[data-state="live"] .pipe-layer__plate b { background: var(--blue); }
.pipe-layer[data-state="done"] .pipe-layer__plate b { background: var(--blue-line); }
.pipe-layer[data-state="branch"] .pipe-layer__plate b { background: var(--line-strong); }

.pipe-layer__main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pipe-layer__main b { font-size: 12.5px; }
.pipe-layer__main small, .pipe-layer__chips { color: var(--text-3); font-size: 10.5px; }
.pipe-layer__chips { color: var(--text-2); font-family: var(--mono); }
.pipe-layer__status {
  padding: 1px 6px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text-3); font-size: 10.5px; white-space: nowrap;
}
.pipe-layer[data-state="live"] .pipe-layer__status { border-color: var(--blue-line); background: var(--blue-soft); color: var(--blue); }
.pipe-layer[data-state="done"] .pipe-layer__status { border-color: var(--green-line); background: var(--green-soft); color: var(--green); }
.pipe-layer__meter { height: 2px; margin: 0 12px 0 4px; background: var(--surface-3); }
.pipe-layer__meter i { display: block; height: 100%; width: 0; background: var(--blue); transition: width .2s linear; }

.pipe-detail { padding: 10px 12px 14px 4px; display: grid; gap: 10px; }
.pipe-detail--pane { padding: 14px; min-height: 0; overflow: auto;
                     grid-template-columns: minmax(0, 320px) minmax(0, 1fr); align-items: start; gap: 16px; }
.pipe-detail--stack { padding: 0; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.pipe-detail--pane .pipe-detail__visual:empty { display: none; }
.pipe-detail--pane .pipe-detail__visual:empty + .pipe-detail__body { grid-column: 1 / -1; }
.pipe-detail[hidden] { display: none; }
.pipe-detail__visual:empty { display: none; }
.pipe-note { margin: 0; color: var(--text-3); font-size: 11px; line-height: 1.55; }

.pipe-frame { position: relative; margin: 0; border: 1px solid var(--line); border-radius: var(--r);
              overflow: hidden; background: var(--surface-inset); }
.pipe-frame__view { position: relative; width: 100%; }
.pipe-frame__canvas { display: block; width: 100%; height: 100%; }
.pipe-frame img { display: block; width: 100%; }
.pipe-frame--crop { width: 132px; }
.pipe-frame--crop img { height: 168px; object-fit: cover; }
.pipe-frame figcaption { padding: 5px 7px; background: var(--surface-2); color: var(--text-3);
                         font-size: 10.5px; border-top: 1px solid var(--line-soft); }

.pipe-box { position: absolute; border: 1px dashed rgba(255, 255, 255, .9); border-radius: 1px;
            box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.pipe-box--target { border: 2px solid var(--blue); box-shadow: 0 0 0 1px rgba(255, 255, 255, .5); }
.pipe-box--target::after {
  content: attr(data-label); position: absolute; left: 0; top: -15px; padding: 0 3px;
  background: var(--blue); color: #fff; font: 9px/15px var(--mono); white-space: nowrap;
}
.pipe-zone { position: absolute; inset: 0; width: 100%; height: 100%; }
.pipe-zone polygon { fill: rgba(88, 167, 255, .24); stroke: #7ab8ff; stroke-width: 2; vector-effect: non-scaling-stroke; }
.pipe-zone circle { fill: #ffc021; stroke: #14171c; stroke-width: 1.5; vector-effect: non-scaling-stroke; }

.pipe-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 6px 14px; margin: 0; }
.pipe-facts div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
                  padding-bottom: 4px; border-bottom: 1px dotted var(--line); }
.pipe-facts__wide { grid-column: 1 / -1; }
.pipe-facts dt { color: var(--text-3); font-size: 11px; white-space: nowrap; }
.pipe-facts dd { margin: 0; font-size: 11.5px; text-align: right; }

.pipe-rows { display: grid; gap: 3px; }
.pipe-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto auto;
            align-items: center; gap: 8px; padding: 5px 7px; border-radius: var(--r-sm);
            background: var(--surface-2); border-left: 2px solid var(--line);
            font-size: 11px; color: var(--text-2); }
.pipe-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pipe-row[data-state="live"] { border-left-color: var(--blue); background: var(--blue-soft); }
.pipe-row[data-state="done"] { border-left-color: var(--green-line); }
.pipe-row[data-state="idle"] { opacity: .6; }
.pipe-row__state { color: var(--text-3); }

.pipe-parts { display: grid; gap: 5px; }
.pipe-part { display: grid; grid-template-columns: 78px minmax(0, 1fr) 62px; align-items: center; gap: 8px;
             font-size: 11px; color: var(--text-2); }
.pipe-part i { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.pipe-part b { display: block; height: 100%; background: var(--blue); transition: width .2s linear; }
.pipe-part .mono { color: var(--text-3); text-align: right; font-size: 10.5px; }

.pipe-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.pipe-swatch { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px;
               border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2);
               font-size: 10.5px; color: var(--text-3); }
.pipe-swatch b { color: var(--text-2); }
.pipe-swatch i { width: 13px; height: 13px; border-radius: 2px; border: 1px solid var(--line-strong); }

.pipe-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.pipe-chain__node { display: flex; flex-direction: column; padding: 5px 8px; border-radius: var(--r);
                    border: 1px solid var(--line); background: var(--surface-2); }
.pipe-chain__node b { font: 600 11.5px var(--mono); }
.pipe-chain__node .mono { color: var(--text-3); font-size: 10px; }
.pipe-chain__node[data-state="live"] { border-color: var(--blue-line); background: var(--blue-soft); }
.pipe-chain__node[data-state="done"] { border-color: var(--green-line); background: var(--green-soft); }
.pipe-chain__node[data-state="idle"] { opacity: .55; }
.pipe-chain__gap { color: var(--text-3); font-size: 10px; }
.pipe-chain__gap[data-linked="true"] { color: var(--blue); }
.pipe-chain__gap::before { content: "→ "; }

/* ── 데이터 흐름 (한 화면에 전부) ───────────────────────────────── */
/* 상세는 아래가 아니라 옆에 붙인다. 그래프를 한 화면에 담는 데 걸리는 것은
 * 높이라서, 아래를 잘라내면 그래프가 확 쪼그라든다. */
.pipe__flow { flex: 1; min-height: 0; display: grid;
              grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr) auto;
              background: var(--bg); }
.pipe__flow-fit { grid-column: 1; grid-row: 1;
                  min-height: 0; min-width: 0; overflow: hidden; display: grid; place-items: center; padding: 4px; }
.pipe__flow-scale { transform-origin: top left; }
.pipe__flow-detail { grid-column: 2; grid-row: 1 / -1;
                     width: 330px; border-left: 1px solid var(--line-strong); background: var(--surface);
                     display: flex; flex-direction: column; min-height: 0; }
.pipe__flow-detail[hidden] { display: none; }
.pipe__flow-detail > [data-role="flow-detail-body"] { min-height: 0; overflow: auto; padding: 12px 14px 16px; }

/* 9층 요약 밴드 — 흐름 그래프 아래에 깔린다. 층을 누르면 그 층에 속한 연산만
 * 남기고 나머지를 죽여서, 층과 연산의 대응을 눈으로 확인할 수 있다. */
.pipe__stages { grid-column: 1; grid-row: 2; display: grid; grid-auto-flow: column;
                grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 6px 8px;
                background: var(--surface); border-top: 1px solid var(--line); }
.stagechip { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 5px 7px;
             border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2);
             text-align: left; }
.stagechip:hover { border-color: var(--line-strong); }
.stagechip__top { display: flex; align-items: center; gap: 5px; min-width: 0; }
.stagechip__top .mono { color: var(--text-3); font-size: 9.5px; }
.stagechip__top b { font-size: 11px; font-weight: 650; overflow: hidden;
                    text-overflow: ellipsis; white-space: nowrap; }
.stagechip__status { margin-left: auto; padding: 0 4px; border-radius: var(--r-sm); flex: none;
                     border: 1px solid var(--line); background: var(--surface);
                     color: var(--text-3); font-size: 9px; font-style: normal; white-space: nowrap; }
.stagechip__meter { height: 3px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.stagechip__meter i { display: block; height: 100%; width: 0; background: var(--blue); transition: width .2s linear; }
.stagechip__chips { color: var(--text-3); font-size: 9.5px; overflow: hidden;
                    text-overflow: ellipsis; white-space: nowrap; }
.stagechip[data-state="idle"] { opacity: .6; }
.stagechip[data-state="live"] { border-color: var(--blue); background: var(--blue-soft); }
.stagechip[data-state="live"] .stagechip__status { border-color: var(--blue-line); color: var(--blue); }
.stagechip[data-state="done"] { border-color: var(--blue-line); }
.stagechip[data-state="done"] .stagechip__status { border-color: var(--green-line); color: var(--green); }
.stagechip[data-state="branch"] { border-style: dashed; }
.stagechip[data-current="true"] { box-shadow: inset 0 -2px 0 var(--blue); }
.stagechip[aria-pressed="true"] { outline: 2px solid var(--blue); outline-offset: 1px; }

.flow { position: relative; }
.flow__wires { position: absolute; left: 0; top: 0; overflow: visible; }
.flow-col { position: absolute; color: var(--text-3); font-size: 10.5px; letter-spacing: .06em;
            text-transform: uppercase; text-align: center; }
.flow-edge { fill: none; stroke: var(--line-strong); stroke-width: 1.4; stroke-dasharray: 3 4; }
.flow-edge[data-status="done"] { stroke: var(--blue-line); stroke-width: 2; stroke-dasharray: none; }
.flow-edge[data-status="live"] { stroke: var(--blue); stroke-width: 2.4; stroke-dasharray: 8 6;
                                 animation: flowdash 1s linear infinite; }
.flow-edge[data-status="operator"] { stroke: var(--violet-line); stroke-width: 2; stroke-dasharray: none; }
.flow-edge[data-status="branch"] { stroke: var(--line-strong); stroke-dasharray: 2 5; }
@keyframes flowdash { to { stroke-dashoffset: -28; } }

.flow-node {
  position: absolute; display: flex; flex-direction: column; gap: 4px;
  padding: 6px 7px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); text-align: left; overflow: hidden;
}
.flow-node__top { display: flex; align-items: flex-start; gap: 4px; }
.flow-node__title { font-size: 11.5px; font-weight: 650; line-height: 1.2; }
.flow-node__dot { width: 7px; height: 7px; margin: 3px 0 0 auto; border-radius: 50%; flex: none;
                  background: var(--line-strong); }
.flow-node__preview { display: block; width: 100%; height: 56px; border-radius: var(--r-sm);
                      background: var(--surface-3); }
.flow-node__io { color: var(--text-2); font-size: 9.5px; line-height: 1.25;
                 overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.flow-node[data-status="idle"] { background: var(--surface-2); }
.flow-node[data-status="idle"] .flow-node__title,
.flow-node[data-status="idle"] .flow-node__io { color: var(--text-3); }
.flow-node[data-status="branch"] { border-style: dashed; background: var(--surface-2); }
.flow-node[data-status="branch"] .flow-node__dot { background: var(--line-strong); }
.flow-node[data-status="done"] { border-color: var(--blue-line); }
.flow-node[data-status="done"] .flow-node__dot { background: var(--blue-line); }
.flow-node[data-status="live"] { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-soft); }
.flow-node[data-status="live"] .flow-node__dot { background: var(--blue); animation: flowpulse 1.1s ease-in-out infinite; }
.flow-node[data-status="operator"] { border-color: var(--violet-line); background: var(--violet-soft); }
.flow-node[data-status="operator"] .flow-node__dot { background: var(--violet); }
.flow-node[aria-pressed="true"] { outline: 2px solid var(--blue); outline-offset: 1px; }
.flow-node[data-focus="off"] { opacity: .22; }
.flow-node[data-focus="on"] { box-shadow: 0 0 0 2px var(--blue); }
.flow-edge[data-focus="off"] { opacity: .18; }
@keyframes flowpulse { 50% { opacity: .35; } }

.flow-detail { display: grid; gap: 10px; align-items: start; }
.flow-detail__head { display: flex; align-items: center; gap: 8px; }
.flow-detail__head b { font-size: 12.5px; }
.flow-detail__op { color: var(--text-3); font-size: 10.5px; }
.flow-io { display: grid; gap: 4px; }
.flow-io div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
               padding-bottom: 3px; border-bottom: 1px dotted var(--line); }
.flow-io span { color: var(--text-3); font-size: 10.5px; white-space: nowrap; }
.flow-io b { font-size: 11px; text-align: right; }
.flow-detail .pipe-frame { display: block; max-width: 100%; }
.flow-detail .pipe-frame img { display: block; width: 100%; max-height: 190px; object-fit: contain;
                               background: var(--surface-inset); }

@media (max-width: 980px) {
  .pipe { position: fixed; left: 0; top: var(--topbar-h); bottom: 0; }
  .pipe__layers { grid-template-columns: minmax(0, 1fr); grid-template-rows: 200px minmax(0, 1fr); }
  .pipe__layers-list { border-right: 0; border-bottom: 1px solid var(--line); }
  .pipe-detail--pane { grid-template-columns: minmax(0, 1fr); }
  .pipe__flow { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto auto; }
  .pipe__flow-detail { grid-column: 1; grid-row: 3; width: auto; max-height: 40%;
                       border-left: 0; border-top: 1px solid var(--line-strong); }
  .pipe__stages { grid-auto-flow: row; grid-auto-columns: auto; }
}
