/* =============================================================
   Vision-AI — Components (v-* namespace)
   ============================================================= */

/* ─── Card ─── */
.v-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--t-base) var(--ease);
}
.v-card--glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
.v-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.v-card__head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}
.v-card__head h3 i { color: var(--emerald); font-size: 13px; }
.v-card__body { padding: 16px; }

/* ─── KPI ─── */
.v-kpi {
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--text);
  position: relative;
  overflow: hidden;
  transition: all var(--t-base) var(--ease);
}
.v-kpi:hover {
  border-color: var(--border-emerald);
  transform: translateY(-1px);
}

.v-kpi__icon {
  width: 36px; height: 36px;
  border-radius: var(--r);
  background: var(--emerald-soft);
  color: var(--emerald);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: 0 0 14px rgba(52,211,153,0.20);
}
.v-kpi__icon--cyan   { background: var(--cyan-soft);   color: var(--cyan);   box-shadow: 0 0 14px rgba(34,211,238,0.20); }
.v-kpi__icon--amber  { background: var(--amber-soft);  color: var(--amber);  box-shadow: 0 0 14px rgba(251,191,36,0.20); }
.v-kpi__icon--rose   { background: var(--rose-soft);   color: var(--rose);   box-shadow: 0 0 14px rgba(251,113,133,0.20); }
.v-kpi__icon--violet { background: var(--violet-soft); color: var(--violet); box-shadow: 0 0 14px rgba(167,139,250,0.20); }

.v-kpi__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.v-kpi__value {
  font-family: var(--en);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.v-kpi__label {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
}
.v-kpi__delta {
  font-family: var(--en);
  font-size: 10px;
  font-weight: 700;
  margin-top: 2px;
}
.v-kpi__delta--up   { color: var(--emerald); }
.v-kpi__delta--down { color: var(--rose); }

/* ─── Camera Feed (시그니처) ─── */
.v-camera-feed {
  position: relative;
  background: #000;
  border-radius: var(--r-md);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  transition: border-color var(--t-base);
}
.v-camera-feed:hover { border-color: var(--border-emerald); }

.v-feed-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

/* 그리드 오버레이 (선택적) */
.v-grid-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background-image:
    linear-gradient(rgba(52,211,153,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(52,211,153,0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* 스캔 라인 */
.v-scanline {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--emerald), transparent);
  box-shadow: 0 0 8px var(--emerald);
  z-index: 4;
  pointer-events: none;
  animation: v-scan 3s linear infinite;
}

/* BBox 레이어 */
.v-bbox-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

.v-bbox {
  fill: none;
  stroke-width: 2;
  rx: 2;
  ry: 2;
  animation: v-bbox-appear 280ms var(--ease);
  pointer-events: none;
}
/* 스크립트 트랙(영상에 매칭된 keyframe) — 매 프레임 깜빡이지 않게 등장 애니메이션 끔 */
.v-bbox-layer.is-scripted .v-bbox {
  animation: none;
}
.v-bbox--person  { stroke: var(--bbox-person);  filter: drop-shadow(0 0 6px var(--bbox-person)); }
.v-bbox--defect  { stroke: var(--bbox-defect);  filter: drop-shadow(0 0 8px var(--bbox-defect)); stroke-dasharray: 4 3; }
.v-bbox--product { stroke: var(--bbox-product); }
.v-bbox--vehicle { stroke: var(--bbox-vehicle); filter: drop-shadow(0 0 5px var(--bbox-vehicle)); }
.v-bbox--text    { stroke: var(--bbox-text);    stroke-dasharray: 6 2; }

/* Confidence 낮음(80% 미만)은 점선 */
.v-bbox.--low-conf { stroke-dasharray: 3 3; opacity: 0.7; }

/* 부분 가림(건물 등으로 일부 가려진 검출) — 점선 + 약한 투명도 */
.v-bbox.--occluded { stroke-dasharray: 6 4; opacity: 0.85; }

.v-bbox-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  fill: #000;
  paint-order: stroke;
  stroke: rgba(0,0,0,0.7);
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
}
.v-bbox-label-bg {
  pointer-events: none;
}

/* Feed Overlay (HUD) */
.v-feed-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
.v-feed-tag {
  position: absolute;
  top: 10px; left: 10px;
  padding: 4px 10px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border-emerald);
  border-radius: 4px;
  color: var(--emerald);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.v-feed-stats {
  position: absolute;
  bottom: 10px; left: 10px;
  padding: 4px 10px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}
.v-feed-stats b { color: var(--emerald); font-weight: 700; }

.v-feed-rec {
  position: absolute;
  top: 10px; right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(248,113,113,0.40);
  border-radius: 4px;
  color: var(--rose);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.10em;
}
.v-rec-dot {
  width: 6px; height: 6px;
  background: var(--rose);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--rose);
  animation: v-rec-blink 1.4s ease-in-out infinite;
}

/* 글리치 효과 */
.v-camera-feed.is-glitching {
  animation: v-glitch 240ms ease-in-out;
}

/* ─── Camera Grid (NVR 분할 뷰) ─── */
.v-camera-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
}
.v-camera-grid--3 { grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr; }
.v-camera-grid--6 { grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr 1fr; }
.v-camera-grid--8 { grid-template-columns: repeat(4, 1fr); grid-template-rows: 1fr 1fr; }

@media (max-width: 960px) {
  .v-camera-grid,
  .v-camera-grid--6,
  .v-camera-grid--8 { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
}
@media (max-width: 600px) {
  .v-camera-grid,
  .v-camera-grid--3,
  .v-camera-grid--6,
  .v-camera-grid--8 { grid-template-columns: 1fr; grid-template-rows: auto; }
}

/* ─── Class Chip (객체 분류 칩) ─── */
.v-class-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid currentColor;
}
.v-class-chip__dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.v-class-chip--person  { color: var(--bbox-person);  background: rgba(251,191,36,0.10); border-color: rgba(251,191,36,0.30); }
.v-class-chip--defect  { color: var(--bbox-defect);  background: rgba(248,113,113,0.10); border-color: rgba(248,113,113,0.30); }
.v-class-chip--product { color: var(--bbox-product); background: rgba(34,211,238,0.10); border-color: rgba(34,211,238,0.30); }
.v-class-chip--vehicle { color: var(--bbox-vehicle); background: rgba(167,139,250,0.10); border-color: rgba(167,139,250,0.30); }
.v-class-chip--text    { color: var(--bbox-text);    background: rgba(52,211,153,0.10); border-color: rgba(52,211,153,0.30); }

/* ─── Confidence Bar ─── */
.v-conf-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
}
.v-conf-bar__track {
  width: 50px;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}
.v-conf-bar__fill {
  height: 100%;
  background: var(--conf-high);
  border-radius: 2px;
  transition: width var(--t-slow) var(--ease);
}
.v-conf-bar__fill.--mid { background: var(--conf-mid); }
.v-conf-bar__fill.--low { background: var(--conf-low); }
.v-conf-bar__val { color: var(--text); }

/* ─── Tag ─── */
.v-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--en);
  font-size: 9px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.v-tag--emerald { background: var(--emerald-soft); color: var(--emerald); }

/* ─── Button ─── */
.v-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  height: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--t-fast) var(--ease);
}
.v-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.v-btn i { font-size: 11px; }

.v-btn--primary {
  background: var(--emerald-grad);
  border-color: transparent;
  color: #022;
  box-shadow: var(--emerald-glow);
}
.v-btn--primary:hover { filter: brightness(1.08); border-color: transparent; }

.v-btn--ghost {
  background: transparent;
  color: var(--text-muted);
}
.v-btn--ghost:hover { color: var(--emerald); border-color: var(--border-emerald); background: var(--emerald-soft); }

.v-btn--danger {
  background: var(--rose-soft);
  border-color: rgba(251,113,133,0.30);
  color: var(--rose);
}
.v-btn--danger:hover { background: rgba(251,113,133,0.16); }

.v-btn--sm  { height: 26px; padding: 0 10px; font-size: 11px; }
.v-btn--lg  { height: 40px; padding: 0 18px; font-size: 13px; }

/* ─── Select / Input ─── */
.v-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 32px 0 12px;
  height: 32px;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='none' stroke='%23a3a3a3' stroke-width='1.5' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: all var(--t-fast) var(--ease);
}
.v-select:hover { border-color: var(--border-strong); }
.v-select:focus {
  outline: none;
  border-color: var(--emerald);
  box-shadow: var(--ring-emerald);
}
.v-select option {
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 12px;
}
.v-select option:checked {
  background: var(--emerald-soft);
  color: var(--emerald);
  font-weight: 600;
}

.v-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 12px;
  height: 32px;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  transition: all var(--t-fast) var(--ease);
}
.v-input:hover { border-color: var(--border-strong); }
.v-input:focus {
  outline: none;
  border-color: var(--emerald);
  box-shadow: var(--ring-emerald);
}
.v-input::placeholder { color: var(--text-faint); }

/* ─── Filter Tabs ─── */
.v-filter-tabs {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 3px;
  gap: 2px;
}
.v-filter-tabs button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 5px;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.v-filter-tabs button:hover { color: var(--text); }
.v-filter-tabs button.is-active {
  background: var(--emerald-soft);
  color: var(--emerald);
}

/* ─── Table ─── */
.v-table-wrap {
  overflow-x: auto;
  border-radius: var(--r-md);
}
.v-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.v-table thead th {
  font-family: var(--en);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.v-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-faint);
  color: var(--text);
  vertical-align: middle;
}
.v-table tbody tr {
  transition: background var(--t-fast) var(--ease);
}
.v-table tbody tr:hover { background: var(--surface); }
.v-table tbody tr:last-child td { border-bottom: none; }

.v-table .--code   { font-family: var(--mono); font-size: 11px; color: var(--text-muted); }
.v-table .--num    { font-family: var(--en); font-variant-numeric: tabular-nums; text-align: right; }
.v-table .--center { text-align: center; }

/* ─── Detection Stream (실시간 검출 로그) ─── */
.v-stream {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 480px;
  overflow-y: auto;
  padding: 4px;
}
.v-stream__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border-faint);
  border-radius: var(--r-sm);
  font-size: 11px;
  animation: v-fade-up 280ms var(--ease);
}
.v-stream__row.is-new { border-left: 2px solid var(--emerald); }
.v-stream__time {
  font-family: var(--mono);
  color: var(--text-faint);
  font-size: 10px;
  flex-shrink: 0;
  letter-spacing: 0.04em;
}
.v-stream__cam {
  font-family: var(--mono);
  color: var(--emerald);
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.v-stream__body { flex: 1; min-width: 0; color: var(--text-muted); }
.v-stream__thumb {
  width: 36px; height: 24px;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 3px;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}
.v-stream__thumb-bbox {
  position: absolute;
  border: 1px solid currentColor;
  border-radius: 1px;
}

/* ─── Toast ─── */
.v-toast-stack {
  position: fixed;
  top: calc(var(--topbar-h) + 14px);
  right: 14px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 360px;
}
.v-toast {
  pointer-events: auto;
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  font-size: 12px;
  animation: v-fade-up 240ms var(--ease);
  min-width: 240px;
}
.v-toast i { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.v-toast b { display: block; font-weight: 700; color: var(--text); }
.v-toast__sub { color: var(--text-dim); font-size: 11px; margin-top: 2px; }
.v-toast--info  { border-left: 3px solid var(--emerald); }
.v-toast--info i  { color: var(--emerald); }
.v-toast--ok    { border-left: 3px solid var(--conf-high); }
.v-toast--ok i  { color: var(--conf-high); }
.v-toast--warn  { border-left: 3px solid var(--amber); }
.v-toast--warn i  { color: var(--amber); }
.v-toast--crit  { border-left: 3px solid var(--rose); }
.v-toast--crit i  { color: var(--rose); }

/* ─── Empty ─── */
.v-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}
.v-empty i { font-size: 36px; margin-bottom: 12px; color: var(--text-faint); }
.v-empty b  { display: block; color: var(--text); font-size: 13px; margin-bottom: 4px; }
.v-empty span { font-size: 11px; }

/* ─── Mobile PC notice ─── */
.v-mobile-pc-toast {
  display: none;
  position: fixed;
  top: 12px; left: 12px; right: 12px;
  z-index: 99999;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border-radius: var(--r-md);
  border: 1px solid var(--border-emerald);
  box-shadow: var(--shadow-md);
  font-size: 12px;
}
.v-mobile-pc-toast i:first-child { color: var(--emerald); flex-shrink: 0; }
.v-mobile-pc-toast span { color: var(--text); flex: 1; font-weight: 600; }
.v-mobile-pc-toast button {
  background: transparent; border: none; color: var(--text-dim); cursor: pointer;
  padding: 4px 6px; border-radius: 4px;
}
.v-mobile-pc-toast button:hover { background: var(--surface-2); color: var(--text); }
@media (max-width: 768px) {
  .v-mobile-pc-toast { display: flex; }
}

/* ─── Donut chart (클래스 분포) ─── */
.v-donut-wrap {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 8px auto 18px;
}
.v-donut {
  width: 100%; height: 100%;
  transform: rotate(0deg);
}
.v-donut__bg {
  fill: none;
  stroke: var(--surface-3);
  stroke-width: 14;
}
.v-donut__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.v-donut__value {
  font-family: var(--en);
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.v-donut__label {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
  letter-spacing: 0.04em;
}

/* ─── Class List (도넛 옆 리스트) ─── */
.v-class-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.v-class-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border-faint);
  border-radius: var(--r-sm);
  font-size: 12px;
}
.v-class-row__dot {
  width: 8px; height: 8px; border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
}
.v-class-row__name { color: var(--text); font-weight: 600; }
.v-class-row__count {
  font-family: var(--en);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
  min-width: 36px;
  text-align: right;
}
.v-class-row__pct {
  font-family: var(--en);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--text-dim);
  min-width: 44px;
  text-align: right;
}

/* ─── Live page: detection panel ─── */
.v-live-feed-wrap {
  position: relative;
  background: #000;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.v-live-feed-wrap .v-camera-feed {
  border: none;
  border-radius: 0;
  aspect-ratio: auto;
  height: 100%;
}
.v-live-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.v-class-counter {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.v-class-counter__cell {
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.v-class-counter__cell .name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}
.v-class-counter__cell .name .dot {
  width: 8px; height: 8px; border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
}
.v-class-counter__cell .num {
  font-family: var(--en);
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.v-obj-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
}
.v-obj-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  background: var(--surface);
  border-left: 2px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  animation: v-fade-up 240ms var(--ease);
}
.v-obj-list li.is-new { border-left-color: var(--emerald); }
.v-obj-list .trk { font-family: var(--mono); color: var(--text-faint); font-size: 10px; }
.v-obj-list .meta { font-family: var(--mono); color: var(--text-dim); font-size: 10px; margin-left: auto; }

/* ─── Alerts page ─── */
.v-alert-card {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  align-items: center;
  transition: border-color var(--t-fast) var(--ease);
}
.v-alert-card:hover { border-color: var(--border-strong); }
.v-alert-card.is-crit { border-left: 3px solid var(--rose); }
.v-alert-card.is-warn { border-left: 3px solid var(--amber); }
.v-alert-card.is-info { border-left: 3px solid var(--emerald); }
.v-alert-card__thumb {
  position: relative;
  width: 96px; height: 64px;
  background: #000;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}
.v-alert-card__thumb video {
  width: 100%; height: 100%; object-fit: cover;
}
.v-alert-card__thumb .bbox {
  position: absolute;
  border: 1px solid currentColor;
  border-radius: 1px;
  pointer-events: none;
}
.v-alert-card__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.v-alert-card__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.v-alert-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
}
.v-alert-card__meta b { color: var(--text-muted); font-weight: 700; }
.v-alert-card__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.v-sev-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--en);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}
.v-sev-tag--crit { background: rgba(251,113,133,0.12); color: var(--rose); border: 1px solid rgba(251,113,133,0.3); }
.v-sev-tag--warn { background: rgba(251,191,36,0.12); color: var(--amber); border: 1px solid rgba(251,191,36,0.3); }
.v-sev-tag--info { background: var(--emerald-soft); color: var(--emerald); border: 1px solid var(--border-emerald); }

@media (max-width: 768px) {
  .v-alert-card {
    grid-template-columns: 80px 1fr;
  }
  .v-alert-card__actions { grid-column: 1 / -1; justify-content: flex-end; }
  .v-class-counter { grid-template-columns: 1fr 1fr; }
  .v-donut-wrap { width: 160px; height: 160px; }
}

/* ============================================================
   Phase 3 / 4 — additional components
   ============================================================ */

/* ─── Defect / Safety gallery grid ─── */
.v-defect-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.v-defect-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: all var(--t-fast) var(--ease);
  cursor: pointer;
}
.v-defect-card:hover {
  border-color: var(--border-emerald);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.v-defect-card__thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}
.v-defect-card__thumb video {
  width: 100%; height: 100%; object-fit: cover;
}
.v-defect-card__thumb .bbox {
  position: absolute;
  border: 2px solid var(--bbox-defect);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(248,113,133,0.5);
  pointer-events: none;
  animation: v-bbox-appear 280ms var(--ease);
}
.v-defect-card__thumb .bbox--rose { border-color: var(--rose); box-shadow: 0 0 8px rgba(251,113,133,0.5); }
.v-defect-card__conf {
  position: absolute;
  bottom: 8px; right: 8px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(0,0,0,0.7);
  color: var(--emerald);
  backdrop-filter: blur(4px);
}
.v-defect-card__body {
  padding: 10px 12px;
}
.v-defect-card__type {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.v-defect-card__meta {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-dim);
}

/* ─── Trend chart svg ─── */
.v-trend-chart {
  width: 100%;
  height: auto;
  display: block;
  font-family: var(--mono);
}

/* ─── Bar list (top types, contribution etc.) ─── */
.v-bar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.v-bar-row {
  display: grid;
  grid-template-columns: 110px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border-faint);
  border-radius: var(--r-sm);
  font-size: 12px;
}
.v-bar-row__label { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-bar-row__track {
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
}
.v-bar-row__fill {
  height: 100%;
  background: var(--emerald-grad);
  border-radius: 3px;
  transition: width var(--t-slow) var(--ease);
}
.v-bar-row__count {
  font-family: var(--en);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
  min-width: 36px;
  text-align: right;
}
.v-bar-row__pct {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  min-width: 38px;
  text-align: right;
}

/* ─── Heatmap (day × hour) ─── */
.v-heatmap-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.v-heatmap-axis-x {
  display: grid;
  grid-template-columns: 30px repeat(24, 1fr);
  gap: 2px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-faint);
}
.v-heatmap-corner { width: 30px; }
.v-heatmap-hour { text-align: center; }
.v-heatmap-grid {
  display: grid;
  grid-template-columns: 30px repeat(24, 1fr);
  gap: 2px;
}
.v-heatmap-day {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
}
.v-heat-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: rgba(248,113,113,0.08);
  transition: transform var(--t-fast);
  cursor: pointer;
}
.v-heat-cell:hover { transform: scale(1.3); z-index: 2; position: relative; }
.v-heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-dim);
  justify-content: flex-end;
}
.v-heatmap-legend .v-heat-cell {
  width: 14px; height: 14px;
  cursor: default;
}
.v-heatmap-legend .v-heat-cell:hover { transform: none; }

/* ─── Camera management cards ─── */
.v-camera-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.v-cam-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--t-fast) var(--ease);
}
.v-cam-card:hover { border-color: var(--border-emerald); }
.v-cam-card.is-offline { opacity: 0.65; }
.v-cam-card__feed {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}
.v-cam-card__feed video {
  width: 100%; height: 100%; object-fit: cover;
}
.v-cam-card__live {
  position: absolute;
  top: 8px; right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(248,113,113,0.4);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--rose);
  letter-spacing: 0.10em;
  backdrop-filter: blur(4px);
}
.v-cam-card__offline {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  color: var(--rose);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.10em;
  gap: 6px;
}
.v-cam-card__offline i { font-size: 24px; }
.v-cam-card__body { padding: 12px 14px; }
.v-cam-card__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.v-cam-card__name { font-size: 14px; font-weight: 700; margin-top: 4px; color: var(--text); }
.v-cam-card__loc { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.v-cam-card__loc i { color: var(--text-faint); margin-right: 4px; }
.v-cam-card__specs {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-faint);
  font-size: 11px;
}
.v-cam-card__specs > div { display: grid; grid-template-columns: 90px 1fr; gap: 8px; align-items: start; }
.v-cam-card__specs .lbl { color: var(--text-faint); font-family: var(--en); font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding-top: 1px; }
.v-cam-card__actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* ─── Inventory cards ─── */
.v-inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.v-inv-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.v-inv-card__feed {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}
.v-inv-card__feed video {
  width: 100%; height: 100%; object-fit: cover;
}
.v-inv-card__live {
  position: absolute; top: 8px; right: 8px;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(248,113,113,0.4);
  border-radius: 4px;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  color: var(--rose); letter-spacing: 0.10em;
}
.v-inv-card__counter {
  position: absolute;
  bottom: 8px; left: 8px;
  font-family: var(--en);
  font-size: 22px;
  font-weight: 800;
  color: var(--emerald);
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  font-variant-numeric: tabular-nums;
}
.v-inv-card__body { padding: 10px 12px; }
.v-inv-card__stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-faint);
}
.v-inv-card__stats > div {
  display: flex; flex-direction: column; gap: 2px;
}
.v-inv-card__stats .lbl {
  font-family: var(--en); font-size: 9px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--text-faint); text-transform: uppercase;
}
.v-inv-card__stats .num {
  font-family: var(--en); font-variant-numeric: tabular-nums;
  font-size: 14px; font-weight: 700;
  color: var(--text);
}
.v-diff--ok   { color: var(--text-muted) !important; }
.v-diff--warn { color: var(--amber) !important; }
.v-diff--crit { color: var(--rose) !important; }

/* ─── OCR ─── */
.v-ocr-current {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--emerald);
  border-radius: var(--r-sm);
  transition: background var(--t-fast);
}
.v-ocr-current.is-flash { background: var(--emerald-soft); }
.v-ocr-current__label {
  font-family: var(--en); font-size: 9px; font-weight: 700; letter-spacing: 0.10em;
  color: var(--text-faint); text-transform: uppercase;
}
.v-ocr-current__text {
  font-size: 22px; font-weight: 800;
  color: var(--emerald);
  letter-spacing: 0.04em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.v-ocr-current__meta {
  font-size: 11px; color: var(--text-dim);
  margin-top: 4px;
}

.v-ocr-log {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 460px;
  overflow-y: auto;
}
.v-ocr-row {
  display: grid;
  grid-template-columns: 60px 1fr 60px auto 50px;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--surface);
  border-left: 2px solid var(--border);
  border-radius: 3px;
  font-size: 11px;
}
.v-ocr-row__type {
  font-family: var(--en); font-size: 9px; font-weight: 700; letter-spacing: 0.04em;
  padding: 2px 6px; border-radius: 3px;
  text-align: center;
  text-transform: uppercase;
}
.v-ocr-row__type--plate  { background: rgba(167,139,250,0.12); color: var(--violet); }
.v-ocr-row__type--label  { background: rgba(34,211,238,0.12);  color: var(--cyan); }
.v-ocr-row__type--serial { background: rgba(52,211,153,0.10);  color: var(--emerald); }
.v-ocr-row__text {
  font-weight: 700; color: var(--text);
  letter-spacing: 0.02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.v-ocr-row__cam { color: var(--emerald); font-weight: 700; }
.v-ocr-row__time { color: var(--text-faint); }

/* ─── Heatmap (floor plan) ─── */
.v-floorplan-wrap {
  width: 100%;
  background: var(--bg-deep);
  border-radius: var(--r-sm);
  border: 1px solid var(--border-faint);
  overflow: hidden;
}
.v-floorplan {
  width: 100%;
  height: auto;
  display: block;
}
.v-time-slider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: var(--r-sm);
}

/* Zone list */
.v-zone-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column;
  gap: 8px;
}
.v-zone-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-faint);
  border-radius: var(--r-sm);
}
.v-zone-row__rank {
  font-family: var(--en);
  font-size: 14px;
  font-weight: 800;
  color: var(--emerald);
}
.v-zone-row__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.v-zone-row__name { font-size: 13px; font-weight: 600; color: var(--text); }
.v-zone-row__bar {
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}
.v-zone-row__fill {
  height: 100%;
  background: var(--emerald-grad);
  border-radius: 2px;
}
.v-zone-row__stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.v-zone-row__stats .num {
  font-family: var(--en);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}
.v-zone-row__stats .dwell {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
}

/* ─── Model catalog cards ─── */
.v-model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 14px;
}
.v-model-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  transition: border-color var(--t-fast);
}
.v-model-card:hover { border-color: var(--border-emerald); }
.v-model-card__head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.v-model-card__icon {
  width: 44px; height: 44px;
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.v-model-card__icon--emerald { background: var(--emerald-soft); color: var(--emerald); box-shadow: 0 0 14px rgba(52,211,153,0.18); }
.v-model-card__icon--cyan    { background: var(--cyan-soft);    color: var(--cyan);    box-shadow: 0 0 14px rgba(34,211,238,0.18); }
.v-model-card__icon--amber   { background: var(--amber-soft);   color: var(--amber);   box-shadow: 0 0 14px rgba(251,191,36,0.18); }
.v-model-card__icon--rose    { background: var(--rose-soft);    color: var(--rose);    box-shadow: 0 0 14px rgba(251,113,133,0.18); }
.v-model-card__icon--violet  { background: var(--violet-soft);  color: var(--violet);  box-shadow: 0 0 14px rgba(167,139,250,0.18); }
.v-model-card__title { flex: 1; min-width: 0; }
.v-model-card__name { font-size: 15px; font-weight: 800; color: var(--text); margin-top: 4px; letter-spacing: -0.01em; }
.v-model-card__task { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.v-model-card__metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--border-faint);
  border-bottom: 1px solid var(--border-faint);
  margin-bottom: 12px;
}
.v-model-card__metrics .metric {
  text-align: center;
}
.v-model-card__metrics .metric__label {
  font-family: var(--en); font-size: 9px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--text-faint); text-transform: uppercase;
}
.v-model-card__metrics .metric__value {
  font-family: var(--en);
  font-variant-numeric: tabular-nums;
  font-size: 18px; font-weight: 800;
  color: var(--text);
  margin-top: 2px;
  letter-spacing: -0.02em;
}
.v-model-card__metrics .metric__value .unit {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  margin-left: 2px;
}

.v-model-card__body {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 11px;
}
.v-model-card__body .row { display: grid; grid-template-columns: 90px 1fr; gap: 8px; align-items: start; }
.v-model-card__body .lbl { color: var(--text-faint); font-family: var(--en); font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding-top: 1px; }

.v-model-card__progress {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--emerald-soft);
  border: 1px solid var(--border-emerald);
  border-radius: var(--r-sm);
}
.v-model-card__progress-label {
  font-size: 10px; color: var(--emerald); font-weight: 700;
  margin-bottom: 6px;
}
.v-model-card__progress-bar {
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}
.v-model-card__progress-bar .fill {
  height: 100%;
  background: var(--emerald-grad);
  border-radius: 2px;
  width: 0%;
  transition: width var(--t-base);
}
.v-model-card__progress-step {
  font-size: 10px;
  letter-spacing: 0.02em;
}

.v-model-card__actions {
  display: flex;
  gap: 6px;
}

/* ─── Settings page ─── */
.v-conf-hint {
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: var(--r-sm);
  font-size: 11px;
  color: var(--text-muted);
}
.v-conf-hint i { margin-right: 4px; }

.v-class-toggle-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column;
  gap: 6px;
}
.v-class-toggle-row {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border-faint);
  border-radius: var(--r-sm);
}
.v-class-toggle-row__chip { display: flex; }
.v-class-toggle-row__desc { font-size: 11px; color: var(--text-dim); }

.v-notif-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column;
  gap: 6px;
}
.v-notif-list li {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-faint);
  border-radius: var(--r-sm);
}
.v-notif-list__icon {
  width: 36px; height: 36px;
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.v-notif-list__name { font-size: 13px; font-weight: 700; color: var(--text); }
.v-notif-list__desc { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* Custom switch */
.v-switch {
  position: relative;
  display: inline-block;
  width: 38px; height: 22px;
  flex-shrink: 0;
}
.v-switch input {
  opacity: 0;
  width: 0; height: 0;
}
.v-switch span {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--surface-3);
  border-radius: 11px;
  transition: background var(--t-fast);
}
.v-switch span::before {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: all var(--t-fast);
}
.v-switch input:checked + span {
  background: var(--emerald);
  box-shadow: 0 0 8px rgba(52,211,153,0.4);
}
.v-switch input:checked + span::before {
  transform: translateX(16px);
  background: #fff;
}

/* ROI editor */
.v-roi-editor {
  position: relative;
  background: #000;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.v-roi-editor__feed {
  position: absolute;
  inset: 0;
}
.v-roi-editor__feed .v-camera-feed {
  border: none;
  border-radius: 0;
  aspect-ratio: auto;
  height: 100%;
}
.v-roi-editor__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  cursor: crosshair;
}
.v-roi-editor__actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* ─── Phase 3/4 mobile responsive ─── */
@media (max-width: 768px) {
  .v-defect-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
  .v-camera-cards { grid-template-columns: 1fr; }
  .v-inv-grid { grid-template-columns: 1fr; }
  .v-model-grid { grid-template-columns: 1fr; }
  .v-model-card__metrics { grid-template-columns: repeat(2, 1fr); }
  .v-bar-row { grid-template-columns: 80px 1fr 32px 36px; gap: 6px; font-size: 11px; }
  .v-heatmap-grid, .v-heatmap-axis-x { grid-template-columns: 26px repeat(24, 1fr); }
  .v-heatmap-day { font-size: 9px; }
  .v-class-toggle-row { grid-template-columns: 1fr auto; }
  .v-class-toggle-row__desc { display: none; }
  .v-ocr-row { grid-template-columns: 50px 1fr auto; gap: 6px; }
  .v-ocr-row__cam, .v-ocr-row__time { display: none; }
}
