/* 통합 이벤트 페이지 — 사이클 56 (2026-05-26)
   .ue-* 네임스페이스, .aw-* 동형 패턴 */

/* ── 2026-06-02: 다른 페이지(카메라 관리 등)와 폭 통일.
   사이클 60 에서 이 페이지만 .container max-width 를 해제(풀폭)했으나,
   운영자 요청으로 다른 페이지처럼 1320px 중앙정렬로 복귀 → 해제 규칙 제거. */

/* ── 로컬 스코프 토큰 */
.unified-events-page {
  --ue-radius-chip: 8px;
  --ue-radius-card: 12px;
  --ue-radius-panel: 16px;
  --ue-shadow-card: 0 6px 24px rgba(17, 24, 39, 0.06);
  --ue-shadow-panel: 0 8px 28px rgba(17, 24, 39, 0.08);
  --ue-danger: #c93058;
  --ue-danger-bg: #ffeaef;
}

.unified-events-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 0 36px;
  background: var(--bg, #f6f7fb);
  min-height: 100%;
  width: 100%;
  min-width: 0;
}

/* ── KPI 그리드 (6 카드: 3열 × 2행) */
.ue-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 4px 0;
}
@media (max-width: 960px) {
  .ue-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .ue-kpi-grid { grid-template-columns: 1fr; }
}

.ue-kpi-card {
  background: var(--panel, #fff);
  border: 1px solid var(--line, #e3e6ed);
  border-radius: var(--ue-radius-card);
  padding: 14px 16px;
  box-shadow: var(--ue-shadow-card);
}
.ue-kpi-label {
  font-size: 11px;
  color: var(--muted, #6b7383);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.ue-kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink, #1a1e2a);
  line-height: 1;
}
.ue-kpi-delta {
  font-size: 11px;
  margin-top: 4px;
  color: var(--muted, #6b7383);
}
.ue-kpi-delta.up   { color: var(--ok, #0f9f6e); }
.ue-kpi-delta.down { color: var(--err, #c93058); }

.ue-kpi-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
}
.ue-kpi-bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}
.ue-kpi-bar-label {
  width: 54px;
  flex-shrink: 0;
  color: var(--muted, #6b7383);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ue-kpi-bar-track {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--line-2, #eef0f5);
  overflow: hidden;
}
.ue-kpi-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent, #ff385c);
  transition: width .4s ease;
}
.ue-kpi-bar-count {
  width: 24px;
  text-align: right;
  color: var(--muted, #6b7383);
  flex-shrink: 0;
}

.ue-kpi-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}
.ue-kpi-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  gap: 6px;
}
.ue-kpi-cam-id {
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 11px;
  color: var(--ink-2, #2a3142);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}
.ue-kpi-cam-count {
  font-weight: 700;
  color: var(--accent, #ff385c);
  flex-shrink: 0;
}

/* ── 필터 바 */
.ue-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px;
  background: var(--panel, #fff);
  border: 1px solid var(--line, #e3e6ed);
  border-radius: var(--ue-radius-card);
  box-shadow: var(--ue-shadow-card);
}
.ue-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 100px;
}
.ue-filter-group label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted, #6b7383);
}
.ue-filter-group select,
.ue-filter-group input {
  padding: 6px 10px;
  border: 1px solid var(--line, #e3e6ed);
  border-radius: var(--ue-radius-chip);
  font-size: 13px;
  background: var(--bg, #f6f7fb);
  color: var(--ink, #1a1e2a);
  min-width: 100px;
}
.ue-filter-group select:focus,
.ue-filter-group input:focus {
  outline: 2px solid color-mix(in oklab, var(--accent, #ff385c) 35%, transparent);
  border-color: var(--accent, #ff385c);
}

/* 첫 필터바(시간/출처/심각도/카메라/이벤트유형) — 바 폭을 채우도록 5개 그룹 균등 분배
   + select 가 그룹 폭을 채움(가로 반응형 최적화). 좁은 폭은 flex-wrap 으로 자동 줄바꿈.
   2번째 바(#uev-vca-meta-filter)는 correlation 입력 flex:1 로 이미 채워져 미적용. */
.ue-filter-bar[data-ue-filter] > .ue-filter-group { flex: 1 1 0; min-width: 120px; }
.ue-filter-bar[data-ue-filter] > .ue-filter-group select { width: 100%; }

/* LIVE 인디케이터 */
.ue-live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--err, #c93058);
  padding: 4px 10px;
  background: var(--ue-danger-bg);
  border-radius: var(--ue-radius-chip);
  border: 1px solid var(--err, #c93058);
  margin-left: auto;
}
.ue-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--err, #c93058);
  border-radius: 50%;
  animation: ue-pulse 1s infinite;
}
.ue-live-pause-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 2px;
  font-size: 14px;
  color: var(--err, #c93058);
  line-height: 1;
}
@keyframes ue-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ── 메인 레이아웃: 리스트 + 드로어 */
.ue-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 16px;
  align-items: start;
  width: 100%;
  min-width: 0;
}
@media (max-width: 1200px) {
  .ue-main { grid-template-columns: minmax(0, 1fr); }
}
/* 드로어가 닫혀(hidden) 있으면 400px 우측 트랙이 빈 채로 예약되어
   리스트가 오른쪽을 못 채운다 → 닫힘 상태에선 단일 컬럼(풀폭)으로.
   row 클릭으로 drawer.hidden=false 가 되면 :has 미매칭 → 2컬럼 복귀. */
.ue-main:has(> .ue-drawer[hidden]) {
  grid-template-columns: minmax(0, 1fr);
}

/* 리스트 */
.ue-list-wrap {
  background: var(--panel, #fff);
  border: 1px solid var(--line, #e3e6ed);
  border-radius: var(--ue-radius-card);
  box-shadow: var(--ue-shadow-card);
  overflow: hidden;
  width: 100%;
  min-width: 0;
}
.ue-list-header {
  display: grid;
  grid-template-columns: 72px 104px 90px 130px 1fr 80px 110px 50px;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line, #e3e6ed);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted, #6b7383);
  background: var(--line-2, #eef0f5);
}
.ue-list {
  max-height: 58vh;
  overflow-y: auto;
}
.ue-empty {
  padding: 40px;
  text-align: center;
  color: var(--muted, #6b7383);
  font-size: 13px;
}
.ue-row {
  display: grid;
  grid-template-columns: 72px 104px 90px 130px 1fr 80px 110px 50px;
  gap: 8px;
  padding: 9px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--line-2, #eef0f5);
  align-items: center;
  font-size: 12px;
  transition: background .1s;
}
.ue-row:last-child { border-bottom: none; }
.ue-row:hover   { background: var(--line-2, #eef0f5); }
.ue-row.is-sel  { background: #fff0f4; }
@keyframes ue-fade-in {
  from { background: #fff0f4; }
  to   { background: transparent; }
}
.ue-row.is-new { animation: ue-fade-in 2s ease-out; }
.ue-row-time {
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 11px;
  color: var(--muted, #6b7383);
  white-space: nowrap;
}
/* 출처 셀 — source 배지 + 장비명(source_id 매핑) 2줄 */
.ue-row-source {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
  min-width: 0;
}
.ue-row-device {
  font-size: 10.5px;
  color: var(--muted, #6b7383);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.ue-row-summary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2, #2a3142);
}
/* 유형 셀 — 130px 컬럼. 긴 class_type(system.health.* 등)이 옆 요약과 겹치지
   않도록 ellipsis 처리(full 텍스트는 title 툴팁). ue-row-summary 와 동일 패턴. */
.ue-row-type {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  color: var(--ink-2, #2a3142);
}
/* 구역 셀 — 구역명(+색 점). 긴 이름은 ellipsis. */
.ue-row-zone {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  color: var(--ink-2, #2a3142);
}
/* 구역 × 심각도 매트릭스 — 각 행이 grid(구역명 1열 + 심각도 5열). 외부는 행 세로 스택. */
.ue-zonesev-grid { display: flex; flex-direction: column; gap: 2px; font-size: 11px; min-width: 280px; }
.ue-zonesev-row { display: grid; grid-template-columns: minmax(76px, 1.3fr) repeat(5, minmax(30px, 1fr)); gap: 2px; align-items: center; }
.ue-zonesev-cell { padding: 3px 4px; line-height: 1.25; }
.ue-zonesev-colhead { text-align: center; font-weight: 700; color: var(--muted, #6b7383); font-size: 9px; text-transform: uppercase; letter-spacing: .02em; }
.ue-zonesev-zone { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2, #2a3142); }
.ue-zonesev-val { text-align: center; border-radius: 3px; font-variant-numeric: tabular-nums; color: var(--ink-2, #2a3142); }
/* cycleL94 vca-19 — VCA 동적 속성 칩 컬럼: 줄바꿈 허용 (nowrap/ellipsis 해제). */
.ue-row-summary-chips {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  display: flex;
  flex-wrap: wrap;
  gap: 3px 0;
  align-items: center;
}
.ue-attr-chip {
  display: inline-block;
  padding: 0 6px;
  margin-right: 3px;
  background: var(--chip-bg, #eef1f7);
  border: 1px solid var(--line, #e3e6ee);
  border-radius: 9px;
  font-size: 10.5px;
  line-height: 1.6;
  white-space: nowrap;
  color: var(--ink, #1a1e2a);
}
.ue-row-chain {
  font-size: 11px;
  color: var(--info, #2563eb);
}
.ue-row-attach {
  font-size: 11px;
}
/* 액션 칸 — 체인/룰 버튼: 1줄(가로) 배치 + 텍스트 줄바꿈 방지. 컬럼 폭 110px 와 함께 적용. */
.ue-row-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: center;
}
.ue-row-chain-btn,
.ue-row-rule-btn {
  white-space: nowrap;
  font-size: 10.5px;
  line-height: 1.4;
  padding: 2px 6px;
  border: 1px solid var(--line, #e3e6ee);
  border-radius: 6px;
  cursor: pointer;
}
/* 색 구분 — 체인 = 파랑(연관 이벤트), 룰 = 초록(자동화 룰 생성) */
.ue-row-chain-btn {
  background: rgba(37, 99, 235, .10);
  border-color: rgba(37, 99, 235, .30);
  color: #2563eb;
}
.ue-row-rule-btn {
  background: rgba(22, 163, 74, .10);
  border-color: rgba(22, 163, 74, .28);
  color: #16a34a;
}
.ue-row-chain-btn:hover { background: rgba(37, 99, 235, .18); }
.ue-row-rule-btn:hover  { background: rgba(22, 163, 74, .18); }

/* 배지 */
.ue-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}

/* source 6종 배지 색 */
.ue-badge-camera    { background: #1e88e5; color: #fff; }
.ue-badge-zigbee    { background: #43a047; color: #fff; }
.ue-badge-relay     { background: #00acc1; color: #fff; }
.ue-badge-system    { background: #757575; color: #fff; }
.ue-badge-operator  { background: #8e24aa; color: #fff; }
.ue-badge-scheduler { background: #fb8c00; color: #fff; }

/* severity 5단계 배지 색 */
.ue-sev-info     { background: #e7eeff; color: #2563eb; }
.ue-sev-low      { background: #f0f0f0; color: #616161; }
.ue-sev-medium   { background: #fff4e0; color: #b96a00; }
.ue-sev-high     { background: #ffe0e7; color: #c93058; }
.ue-sev-critical { background: #c93058; color: #fff; font-weight: 700; }

/* ── 드로어 */
.ue-drawer {
  background: var(--panel, #fff);
  border: 1px solid var(--line, #e3e6ed);
  border-radius: var(--ue-radius-panel);
  padding: 16px;
  position: sticky;
  top: 16px;
  max-height: 82vh;
  overflow-y: auto;
  box-shadow: var(--ue-shadow-panel);
}
.ue-drawer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.ue-drawer-head {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink, #1a1e2a);
}
.ue-drawer-close {
  font-size: 18px;
  color: var(--muted, #6b7383);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  background: none;
  border: none;
  line-height: 1;
}
.ue-drawer-close:hover { background: var(--line-2, #eef0f5); }

/* 타임라인 */
.ue-drawer-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.ue-timeline-node {
  display: flex;
  gap: 12px;
  padding: 10px 0 10px 14px;
  border-left: 2px solid var(--line, #e3e6ed);
  position: relative;
}
.ue-timeline-node::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line, #e3e6ed);
  border: 2px solid var(--panel, #fff);
}
.ue-timeline-node.is-latest { border-left-color: var(--accent, #ff385c); }
.ue-timeline-node.is-latest::before { background: var(--accent, #ff385c); }

.ue-tl-body { flex: 1; min-width: 0; }
.ue-tl-time {
  font-size: 10px;
  color: var(--muted, #6b7383);
  font-family: "JetBrains Mono", "Fira Code", monospace;
  margin-bottom: 4px;
}
.ue-tl-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.ue-tl-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2, #2a3142);
}
.ue-tl-phase {
  font-size: 10px;
  color: var(--muted, #6b7383);
}
.ue-tl-summary {
  font-size: 11px;
  color: var(--muted, #6b7383);
  margin-top: 2px;
  word-break: break-word;
}
.ue-tl-thumb {
  width: 100%;
  max-width: 180px;
  border-radius: 6px;
  margin-top: 6px;
  border: 1px solid var(--line, #e3e6ed);
}

/* 드로어 footer 액션 */
.ue-drawer-foot {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--line, #e3e6ed);
}
.ue-drawer-foot button {
  padding: 7px 12px;
  border-radius: var(--ue-radius-chip);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line, #e3e6ed);
  background: var(--bg, #f6f7fb);
  cursor: pointer;
  color: var(--ink, #1a1e2a);
  transition: background .15s;
}
.ue-drawer-foot button:hover {
  background: var(--line-2, #eef0f5);
}
.ue-btn-danger {
  background: var(--ue-danger, #c93058) !important;
  color: #fff !important;
  border-color: var(--ue-danger, #c93058) !important;
}
.ue-btn-danger:hover {
  background: #a0223e !important;
}

/* ── 토스트 */
.ue-toast-wrap {
  position: fixed;
  bottom: 80px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.ue-toast {
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink, #1a1e2a);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 6px 24px rgba(0,0,0,.18);
  animation: ue-toast-in .25s ease;
  max-width: 340px;
}
@keyframes ue-toast-in {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ── VMP-T07 VCA 메타데이터 상세 (drawer) ───────────────────────────── */
.ue-meta-detail { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.ue-meta-section { border-top: 1px solid var(--line, #e2e6ee); padding-top: 8px; }
.ue-meta-title { font-size: 11px; font-weight: 700; color: var(--muted, #8b93a7); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.ue-meta-obj { margin-bottom: 6px; }
.ue-meta-obj-head { font-size: 12.5px; display: flex; gap: 8px; align-items: baseline; }
.ue-meta-track { font-size: 10.5px; color: var(--muted, #8b93a7); font-family: monospace; }
.ue-meta-obj-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.ue-meta-chip { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--chip-bg, #eef1f7); color: var(--ink, #1a1e2a); white-space: nowrap; }
.ue-meta-row { display: flex; gap: 8px; font-size: 12px; margin: 3px 0; align-items: flex-start; }
.ue-meta-k { font-weight: 600; color: var(--muted, #8b93a7); min-width: 56px; }
.ue-meta-v { flex: 1; }
.ue-meta-heatmap { display: block; max-width: 160px; border-radius: 6px; margin-top: 4px; }
/* bbox 오버레이 */
.ue-bbox-stage { position: relative; width: 100%; border-radius: 8px; overflow: hidden; background: #0a1320; }
.ue-bbox-img { display: block; width: 100%; height: auto; }
.ue-bbox { position: absolute; border: 2px solid #22d3ee; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.4); pointer-events: none; }
.ue-bbox-label { position: absolute; top: -16px; left: 0; font-size: 10px; background: #22d3ee; color: #04121a; padding: 0 4px; border-radius: 3px; white-space: nowrap; font-weight: 700; }
/* raw 토글 */
.ue-meta-raw { font-size: 11px; }
.ue-meta-raw summary { cursor: pointer; color: var(--muted, #8b93a7); font-weight: 600; }
.ue-meta-raw-pre { max-height: 240px; overflow: auto; background: var(--code-bg, #0f1a2b); color: #c8d3e6; padding: 8px; border-radius: 6px; font-size: 10.5px; margin: 6px 0 0; white-space: pre-wrap; word-break: break-all; }

/* ── Phase3 F1 분석 enrich 카드 (drawer) ───────────────────────────── */
.ue-ai-detail { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.ue-ai-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--chip-bg, #eef1f7); color: var(--ink, #1a1e2a); white-space: nowrap; }
.ue-ai-risk-low  { background: #fff4e0; color: #b96a00; }
.ue-ai-risk-med  { background: #ffe0e7; color: #c93058; }
.ue-ai-risk-high { background: #c93058; color: #fff; }
.ue-ai-unverified { background: #f0f0f0; color: #616161; font-weight: 600; }
.ue-ai-chip { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--chip-bg, #eef1f7); color: var(--ink, #1a1e2a); white-space: nowrap; margin-left: 4px; }

/* ── Phase3 F2 타임라인 escalation 커넥터 ───────────────────────────── */
.ue-tl-escalation { margin: 2px 0 2px 14px; padding: 3px 10px; font-size: 11px; font-weight: 700; color: #c93058; background: #ffe0e7; border-radius: 6px; display: inline-block; }
.ue-tl-escalation-gap { font-weight: 500; color: var(--muted, #8b93a7); }

/* ── 구역 alert 상태 스트립 (2026-06-25 확대·동적효과) — /api/zones state, eMap 상태색 정합 ── */
.ue-zone-strip { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 18px; }
.ue-zone-strip:empty { display: none; }
.ue-zone-strip .ue-zs-title { font-size: 14px; font-weight: 800; color: var(--muted, #6b7280); margin-right: 4px; }
.ue-zone-chip { display: inline-flex; align-items: center; gap: 9px; padding: 9px 16px; border-radius: 12px; font-size: 14px; font-weight: 700; border: 1.5px solid var(--line, #e5e7eb); background: var(--panel, #fff); color: var(--ink, #1f2937); transition: transform .15s ease, box-shadow .15s ease; }
.ue-zone-chip:hover { transform: translateY(-1px); }
.ue-zone-chip .ue-zs-dot { width: 12px; height: 12px; border-radius: 50%; background: #9ca3af; flex: 0 0 auto; }
.ue-zone-chip .ue-zs-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.ue-zone-chip .ue-zs-count { font-size: 13px; font-weight: 800; color: var(--muted, #6b7280); }
/* 정상 — 차분한 녹색 + 은은한 호흡(살아있음 표시) */
.ue-zone-chip.zs-normal .ue-zs-dot { background: #16a34a; animation: ue-zs-breathe 3s ease-in-out infinite; }
/* 비정상 — 단계가 올라갈수록 빠른 맥동 + 비상은 칩 전체 발광 */
.ue-zone-chip.zs-warning { border-color: #f59e0b; background: color-mix(in oklab, #f59e0b 12%, transparent); }
.ue-zone-chip.zs-warning .ue-zs-dot { background: #f59e0b; animation: ue-zs-pulse 1.8s ease-in-out infinite; }
.ue-zone-chip.zs-alert { border-color: #d97706; background: color-mix(in oklab, #d97706 16%, transparent); color: #92400e; }
.ue-zone-chip.zs-alert .ue-zs-dot { background: #d97706; animation: ue-zs-pulse 1.4s ease-in-out infinite; }
.ue-zone-chip.zs-emergency { border-color: #dc2626; background: color-mix(in oklab, #dc2626 16%, transparent); color: #991b1b; animation: ue-zs-glow 1.2s ease-in-out infinite; }
.ue-zone-chip.zs-emergency .ue-zs-dot { background: #dc2626; animation: ue-zs-pulse 1s ease-in-out infinite; }
@keyframes ue-zs-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(1.3); } }
@keyframes ue-zs-breathe { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
@keyframes ue-zs-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); } 50% { box-shadow: 0 0 0 5px rgba(220, 38, 38, .2); } }

/* ── 배선 레지스트리 탭 (2026-07-11) ───────────────────────────────── */
.ue-tabs { display:flex; gap:4px; margin:8px 0; }
.ue-tab { padding:6px 14px; border:1px solid #d0d5dd; background:#fff; border-radius:6px 6px 0 0; cursor:pointer; }
.ue-tab.is-active { background:#eef2ff; font-weight:700; border-bottom-color:#eef2ff; }
.ue-reg-sect { margin:12px 0; }
.ue-reg-sect h4 { margin:6px 0; }
.ue-reg-table { width:100%; border-collapse:collapse; font-size:13px; }
.ue-reg-table th, .ue-reg-table td { border-bottom:1px solid #eee; padding:4px 6px; text-align:left; }
.ue-reg-flag { margin:2px 0; }
.ue-reg-conflict b, .ue-reg-broken_wiring b { color:#d92d20; }
.ue-reg-duplicate b, .ue-reg-orphan_trigger b { color:#b54708; }
.ue-reg-drift b { color:#475467; }
.ue-reg-act { display:inline-block; padding:2px 8px; border-radius:10px; background:#ecfdf3; margin:2px; }
.ue-reg-act-unimplemented, .ue-reg-act-stub { background:#fffaeb; }
.ue-reg-ct { display:inline-block; padding:1px 6px; border-radius:8px; background:#f2f4f7; margin:1px; font-size:12px; }
.ue-reg-ct.is-sub { background:#d1fadf; }

/* ── V4 인라인 자동화 사이드카 ─────────────────────────────────────────── */
.as-sidecar-open .ue-main {
  grid-template-columns: minmax(0, 55fr) minmax(420px, 45fr);
}
.as-sidecar-open .ue-drawer { display: none; }
.as-sidecar-host {
  min-width: 0;
  width: 100%;
  max-width: 720px;
  justify-self: end;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: hidden;
  border: 1px solid var(--line, #e3e6ed);
  border-radius: var(--ue-radius-panel, 16px);
  background: var(--panel, #fff);
  box-shadow: var(--ue-shadow-panel);
  z-index: 12;
}
.as-sidecar-host[hidden] { display: none !important; }
.as-sidecar {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 34px);
  min-height: 540px;
  color: var(--ink, #1a1e2a);
}
.as-sidecar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--line, #e3e6ed);
  background: var(--panel, #fff);
}
.as-sidecar-head small { color: var(--accent, #ff385c); font-weight: 800; }
.as-sidecar-head h2 { margin: 3px 0 0; font-size: 20px; }
.as-sidecar-head button {
  border: 0; background: transparent; color: var(--muted, #6b7383);
  font-size: 26px; line-height: 1; cursor: pointer;
}
.as-origin, .as-readonly, .as-error, .as-restore {
  margin: 0; padding: 9px 20px; font-size: 12px;
  border-bottom: 1px solid var(--line-2, #eef0f5);
}
.as-origin { color: var(--muted, #6b7383); }
.as-readonly { color: #475467; background: #f2f4f7; font-weight: 700; }
.as-error { color: var(--err, #c93058); background: var(--err-bg, #ffeaef); }
.as-restore { background: var(--info-bg, #e7eeff); }
.as-restore button { margin-left: 6px; }
.as-sidecar-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 20px 24px;
}
.as-sentence { display: flex; flex-direction: column; gap: 8px; }
.as-sentence-block {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line, #e3e6ed);
  border-radius: 10px;
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.as-sentence-block:hover:not(:disabled), .as-sentence-block:focus-visible {
  border-color: var(--accent, #ff385c);
  outline: 3px solid color-mix(in srgb, var(--accent, #ff385c) 18%, transparent);
}
.as-sentence-block:disabled { cursor: default; opacity: .9; }
.as-sentence-block.has-error { border-color: var(--err, #c93058); }
.as-block-label { font-size: 12px; font-weight: 800; }
.as-block-value { overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.as-review {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.as-review-auto { color: #9a5b00; background: #fff4e0; }
.as-review-confirmed { color: #087451; background: #e8f8f1; }
.as-block-error { grid-column: 2 / 4; color: var(--err, #c93058); font-size: 11px; }
.as-block-editor {
  margin: 12px 0;
  padding: 14px;
  border: 1px solid var(--accent, #ff385c);
  border-radius: 12px;
  background: var(--accent-soft, #fff0f4);
}
.as-block-editor label { display: grid; gap: 4px; margin: 8px 0; font-size: 12px; font-weight: 700; }
.as-block-editor input, .as-block-editor select, .as-block-editor textarea {
  width: 100%;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line, #d0d5dd);
  border-radius: 7px;
  background: #fff;
  font: inherit;
}
.as-block-editor textarea { min-height: 72px; resize: vertical; }
.as-block-editor footer { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }
.as-condition-row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) 82px minmax(80px, 1fr) auto;
  gap: 5px;
  margin: 6px 0;
}
.as-block-editor fieldset { margin: 8px 0; border: 1px solid var(--line); border-radius: 8px; }
.as-block-editor button, .as-replay-lab button, .as-sidecar-foot button, .as-close-choice button {
  border: 1px solid var(--line, #d0d5dd);
  border-radius: 8px;
  background: #fff;
  padding: 7px 10px;
  color: inherit;
  cursor: pointer;
}
.as-block-editor button:disabled, .as-replay-lab button:disabled, .as-sidecar-foot button:disabled {
  opacity: .45; cursor: not-allowed;
}
.as-seed-notes, .as-replay-lab {
  margin-top: 16px;
  border: 1px solid var(--line, #e3e6ed);
  border-radius: 12px;
  padding: 13px;
}
.as-seed-notes { background: #fffaf0; }
.as-seed-notes h3, .as-replay-lab h3 { margin: 0 0 8px; font-size: 14px; }
.as-seed-notes ul, .as-replay-warnings { margin: 0; padding-left: 18px; font-size: 12px; }
.as-replay-lab header { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.as-no-dispatch { margin: 0; color: #9a5b00; font-size: 11px; font-weight: 800; }
.as-permanent-preview { padding: 7px 20px; border-bottom: 1px solid var(--line-2, #eef0f5); background: #fffaf0; }
.as-replay-presets { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0; }
.as-replay-presets [aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 800; }
.as-custom-range { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.as-custom-range label { display: grid; gap: 3px; font-size: 11px; }
.as-replay-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.as-replay-metric { display: grid; gap: 3px; padding: 8px; background: var(--line-2, #eef0f5); border-radius: 8px; }
.as-replay-metric span { font-size: 10px; color: var(--muted); }
.as-replay-metric strong { font-size: 18px; }
.as-sampled { color: #9a5b00; font-size: 11px; }
.as-replay-samples { display: grid; gap: 8px; margin-top: 10px; }
.as-replay-sample { border-left: 4px solid #667085; border-radius: 7px; padding: 8px 10px; background: #f8fafc; font-size: 11px; }
.as-replay-sample.as-kind-matched { border-color: var(--ok, #0f9f6e); }
.as-replay-sample.as-kind-blocked { border-color: var(--err, #c93058); }
.as-replay-sample header { display: flex; justify-content: space-between; gap: 8px; }
.as-replay-sample p { margin: 4px 0; }
.as-replay-sample pre { max-height: 180px; overflow: auto; white-space: pre-wrap; }
.as-kind-label { font-weight: 800; }
.as-sidecar-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
  padding: 12px 16px;
  border-top: 1px solid var(--line, #e3e6ed);
  background: var(--panel, #fff);
}
.as-sidecar-foot [data-as-save-draft], .as-sidecar-foot [data-as-activate] {
  border-color: var(--accent, #ff385c); color: #fff; background: var(--accent, #ff385c);
}
.as-risk-confirm { width: 100%; font-size: 11px; text-align: right; }
.as-close-choice {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 8px;
  padding: 30px;
  background: rgba(255,255,255,.96);
}
.as-close-choice p { width: 100%; text-align: center; font-weight: 800; }

@media (min-width: 960px) and (max-width: 1279px) {
  .as-sidecar-open .ue-main { grid-template-columns: minmax(0, 48fr) minmax(420px, 52fr); }
}
@media (max-width: 959px) {
  .as-sidecar-open .ue-main { grid-template-columns: minmax(0, 1fr); }
  .as-sidecar-host {
    position: fixed;
    inset: 0;
    width: 100vw;
    max-width: none;
    max-height: none;
    border: 0;
    border-radius: 0;
    z-index: 1000;
  }
  .as-sidecar { min-height: 100dvh; max-height: 100dvh; }
  .as-sidecar-head, .as-origin { position: sticky; top: 0; z-index: 2; }
  .as-sidecar-foot { position: sticky; bottom: 0; z-index: 2; }
  .as-sentence-block { grid-template-columns: 88px minmax(0, 1fr); }
  .as-review { grid-column: 2; justify-self: start; }
  .as-condition-row { grid-template-columns: 1fr; }
  .as-replay-metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .as-sidecar-host, .as-sidecar, .as-sentence-block { animation: none !important; transition: none !important; }
}
