/* ==========================================================================
   NVR AI Forensics Workbench — Design System v5.0
   Warm White + Vermilion, aligned to docs/asian_cuisine_UI_design_baseline.md
   The 15 tokens below are the whole palette. Do not add a 16th.
   ========================================================================== */

:root {
  /* ---- Neutral: grounds & strokes ---- */
  --bg: #FBF9F6;            /* page ground (warm white) */
  --surface: #FFFFFF;       /* cards & panels */
  --surface-sub: #F4F1EC;   /* secondary fill, disabled, hover */
  --border: #E7E1D8;        /* card & input stroke */
  --border-soft: #EFE9E0;   /* section hairline */
  --divider: #F4F1EC;       /* list row rule */

  /* ---- Neutral: text ---- */
  --text: #1C1917;          /* headings, figures */
  --text-2: #57534E;        /* body, button labels */
  --text-3: #8A8178;        /* timestamps, footnotes (12px floor) */
  --text-ph: #A8A099;       /* placeholders, unselected tabs */

  /* ---- Brand: vermilion ---- */
  --brand: #C2410C;         /* primary action, selected state */
  --brand-deep: #9A3412;    /* hover / active */
  --brand-tint: #FDF0E8;    /* selected ground, soft notice */
  --brand-tint-border: #F0CDB4;

  /* ---- Semantic quartet — one meaning each, never borrowed ---- */
  --ok-fg: #166534;     --ok-bg: #ECF6EF;     --ok-bd: #C9E2D2;   /* normal / complete */
  --info-fg: #1B4F8F;   --info-bg: #EBF2F9;   --info-bd: #C8DCEE; /* partial / card */
  --warn-fg: #A16207;   --warn-bg: #FBF3E3;   --warn-bd: #EADCBE; /* needs a look */
  --danger-fg: #9F1239; --danger-bg: #FCEDF0; --danger-bd: #F2CFD8; /* missing / error */
  /* Hard rule: vermilion is never an error colour. Errors use crimson above. */

  /* ---- Legacy aliases: kept so existing selectors resolve to the new system ---- */
  --bg-main: var(--bg);
  --bg-surface: var(--surface);
  --bg-card: var(--surface);
  --bg-card-hover: var(--surface-sub);
  --bg-dock: var(--surface-sub);
  --bg-input: var(--surface);

  --border-subtle: var(--border);
  --border-active: var(--brand-tint-border);
  --border-focus: var(--brand);

  --text-main: var(--text);
  --text-muted: var(--text-2);
  --text-dim: var(--text-3);

  --emerald-accent: var(--ok-fg);
  --emerald-glow: var(--ok-bg);
  --amber-accent: var(--warn-fg);
  --amber-glow: var(--warn-bg);
  --blue-accent: var(--brand);
  --red-accent: var(--danger-fg);

  /* ---- Geometry (spec §4) ---- */
  --radius-sm: 10px;   /* buttons, inputs, chips */
  --radius-md: 14px;   /* cards */
  --radius-lg: 14px;   /* modals, large panels */
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow-pop: 0 8px 24px rgba(28, 25, 23, 0.10);
  --focus-ring: 0 0 0 3px rgba(194, 65, 12, 0.10);

  /* ---- Type (spec §2) ---- */
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-serif: "Noto Serif SC", "Songti SC", SimSun, serif;
  --font-mono: var(--font-serif);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  -webkit-font-smoothing: antialiased;
}

/* Every figure aligns in a column — timestamps, counts, scores, durations. */
.card-wallclock, .time-label, .dock-wallclock, .cart-badge, .basket-item-details,
.seg-time-text, .hop-time, .top-time-text, .frame-caption, .card-timestamp,
.session-item-meta, .anchor-meta, .mined-img-meta, .cand-pill-score,
.lifecycle-info-item .val, .vlm-date-badge, .evidence-hash, .basket-item-hash {
  font-variant-numeric: tabular-nums;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: var(--surface-sub);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--surface-sub);
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, 0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  width: 360px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 20px 40px rgba(28, 25, 23, 0.06);
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-header .icon {
  font-size: 36px;
  display: block;
  margin-bottom: 8px;
}

.login-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.login-header .subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.input-group input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 13px;
}

.input-group input:focus {
  border-color: var(--blue-accent);
}

.error-msg {
  color: var(--red-accent);
  font-size: 12px;
  margin-bottom: 12px;
}

/* Image Preview Modal */
.image-preview-box {
  min-width: 360px;
  min-height: 240px;
  max-width: 90vw;
  max-height: 90vh;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 48px rgba(28, 25, 23, 0.06);
}

.preview-header {
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-dock);
}

.preview-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-body {
  padding: 8px;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 240px;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.preview-body img {
  max-width: 85vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
}

.preview-spinner {
  margin: 40px auto;
}

/* Image Preview Zoom Controls & HUD */
.preview-zoom-controls {
  display: inline-flex;
  align-items: center;
  background: var(--surface-sub);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.preview-zoom-controls .btn {
  border-radius: 0;
  border: none;
  background: transparent;
  padding: 5px 8px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1;
}

.preview-zoom-controls .btn:hover:not(:disabled) {
  background: var(--surface-sub);
  color: var(--brand);
}

.preview-zoom-controls .btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-zoom-level {
  min-width: 48px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 11px;
}

.btn-zoom-active {
  color: var(--brand) !important;
  background: var(--brand-tint) !important;
}

.preview-header-divider {
  width: 1px;
  height: 16px;
  background: var(--border-subtle);
  margin: 0 2px;
}

.preview-zoom-hud {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 20;
  box-shadow: 0 4px 14px rgba(28, 25, 23, 0.06);
  white-space: nowrap;
}

.preview-zoom-hud.visible {
  opacity: 1;
}

/* Image Preview Modal Fullscreen Experience */
.image-preview-box:fullscreen,
.image-preview-box:-webkit-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  border: none !important;
  background: #000 !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
  box-shadow: none !important;
  z-index: 99999 !important;
}

.image-preview-box:fullscreen .preview-header,
.image-preview-box:-webkit-full-screen .preview-header {
  height: 48px !important;
  padding: 0 20px !important;
  background: rgba(15, 23, 42, 0.95) !important;
  border-bottom: 1px solid var(--border) !important;
  flex-shrink: 0 !important;
}

.image-preview-box:fullscreen .preview-body,
.image-preview-box:-webkit-full-screen .preview-body {
  flex: 1 !important;
  height: calc(100vh - 48px) !important;
  max-height: calc(100vh - 48px) !important;
  padding: 0 !important;
  background: #000 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  overflow: hidden !important;
}

.image-preview-box:fullscreen .preview-body img,
.image-preview-box:-webkit-full-screen .preview-body img {
  max-width: 100vw !important;
  max-height: calc(100vh - 48px) !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  border-radius: 0 !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand);
  color: #FFFFFF;
  border-color: var(--brand);
}
.btn-primary:hover {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-2);
}
.btn-secondary:hover {
  background: var(--surface-sub);
  border-color: var(--brand-tint-border);
  color: var(--brand);
}

/* Accent = "archive this as evidence". Green means normal/kept, per spec §1. */
.btn-accent {
  background: var(--ok-bg);
  border-color: var(--ok-bd);
  color: var(--ok-fg);
  font-weight: 600;
}
.btn-accent:hover {
  background: var(--ok-fg);
  border-color: var(--ok-fg);
  color: #FFFFFF;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-2);
}
.btn-ghost:hover {
  background: var(--surface-sub);
  border-color: var(--brand-tint-border);
  color: var(--brand);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover {
  background: var(--surface-sub);
  color: var(--brand);
}

.btn:disabled,
.btn[disabled] {
  background: var(--surface-sub);
  border-color: var(--border);
  color: var(--text-ph);
  cursor: not-allowed;
}

/* One focus treatment everywhere: brand ring, never the old blue. */
.btn:focus-visible,
.btn-icon:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

.btn-block {
  width: 100%;
}
.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.badge-domain {
  background: var(--brand-tint);
  color: var(--brand);
  border: 1px solid var(--brand-tint-border);
}

.badge-health {
  background: var(--ok-bg);
  color: var(--ok-fg);
  border: 1px solid var(--ok-bd);
}

.badge-ai {
  background: var(--brand-tint);
  color: var(--brand);
  border: 1px solid var(--brand-tint-border);
}

.badge-case-count {
  background: var(--warn-bg);
  color: var(--warn-fg);
  border: 1px solid var(--warn-bd);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--ok-fg);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ================= TopBar Header ================= */
/* ================= TopBar Header (Unified Compact 46px) ================= */
.app-header {
  height: 46px;
  min-height: 46px;
  max-height: 46px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 8px;
  z-index: 100;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.app-header::-webkit-scrollbar {
  display: none;
}

/* Left Zone */
.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.brand-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.header-divider {
  width: 1px;
  height: 18px;
  background: var(--surface-sub);
  margin: 0 2px;
  flex-shrink: 0;
}

/* View Switch Tabs (Timeline / Copilot) */
.view-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--surface-sub);
  padding: 2px 4px;
  border-radius: 6px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.view-tabs .wing-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
}

.view-tabs .wing-tab:hover {
  color: var(--brand);
  background: var(--surface-sub);
}

.view-tabs .wing-tab.active {
  background: var(--surface);
  color: var(--brand);
  font-weight: 600;
  border: 1px solid var(--brand-tint-border);
  box-shadow: 0 1px 3px rgba(28, 25, 23, 0.06);
}

.badge-ai-mini {
  background: var(--brand);
  color: #FFFFFF;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
  margin-left: 2px;
}

/* Filter Controls in Header */
.filter-controls-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border-bottom: none;
  padding: 0;
  flex-shrink: 0;
}

.filter-controls-bar.hidden {
  display: none !important;
}

.filter-item {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.header-select {
  background: var(--surface-sub);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 11px;
  height: 28px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.header-select:hover {
  border-color: var(--border);
}

.header-select:focus {
  border-color: var(--brand);
}

.select-site {
  max-width: 135px;
}

.select-channel {
  max-width: 160px;
}

.select-interval {
  max-width: 140px;
}

.header-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  padding: 0 2px;
  flex-shrink: 0;
}

.header-checkbox input[type="checkbox"] {
  accent-color: var(--brand);
  cursor: pointer;
  width: 13px;
  height: 13px;
  margin: 0;
}

.header-checkbox:hover {
  color: var(--text);
}

.time-chips {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.chip {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 11px;
  height: 22px;
  line-height: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
}

.chip:hover {
  background: var(--surface-sub);
  color: var(--brand);
  border-color: var(--border);
}

.chip.active {
  background: var(--brand-tint);
  border-color: var(--brand-tint-border);
  color: var(--brand);
  font-weight: 600;
}

/* Right Zone */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.global-search-box {
  display: flex;
  align-items: center;
  background: var(--surface-sub);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0 4px 0 8px;
  height: 28px;
  width: 240px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.global-search-box:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px rgba(194, 65, 12, 0.10);
  width: 280px;
}

.search-icon {
  font-size: 12px;
  margin-right: 4px;
  color: var(--text-dim);
}

.global-search-box input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 0;
  font-size: 11px;
  outline: none;
  min-width: 0;
}

.btn-xs {
  padding: 2px 7px;
  font-size: 11px;
  height: 22px;
  line-height: 16px;
  border-radius: 4px;
}

.btn-header-refresh {
  height: 28px;
  padding: 0 8px;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 5px;
  color: var(--text-2);
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-header-refresh:hover {
  color: var(--brand);
  background: var(--surface-sub);
  border-color: var(--border);
}

.system-metrics {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

.metric-item {
  display: flex;
  gap: 4px;
}

.metric-item .value {
  color: var(--text);
  font-weight: 600;
  font-family: var(--font-mono);
}

.user-panel {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.user-badge {
  font-size: 11px;
  color: var(--text);
}

.user-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-sub);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0 8px;
  height: 28px;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap;
}

.user-dropdown-btn:hover,
.user-dropdown-btn.active {
  background: var(--surface-sub);
  border-color: var(--brand);
  color: var(--brand);
}

.dropdown-caret {
  font-size: 10px;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.user-dropdown-btn.active .dropdown-caret {
  transform: rotate(180deg);
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  background: var(--surface-sub);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(28, 25, 23, 0.06);
  padding: 6px 0;
  z-index: 1050;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
}

.user-menu-item:hover {
  background: var(--surface-sub);
  color: var(--brand);
}

.user-menu-item.text-danger {
  color: var(--danger-fg);
}

.user-menu-item.text-danger:hover {
  color: var(--danger-fg);
  background: var(--danger-bg);
}

.user-menu-divider {
  height: 1px;
  background: var(--surface-sub);
  margin: 4px 0;
}

.dialog-box {
  width: 380px;
  max-width: 90vw;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* Shopping Cart Style Basket Button in Header */
.btn-basket-cart {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-sub);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0 8px;
  height: 28px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-basket-cart:hover {
  background: var(--surface-sub);
  border-color: var(--brand);
  color: var(--brand);
  box-shadow: 0 2px 10px rgba(28, 25, 23, 0.06);
}

.btn-basket-cart.active {
  background: var(--surface);
  border-color: var(--brand);
  color: var(--brand);
  box-shadow: 0 0 12px rgba(194, 65, 12, 0.10);
}

.btn-basket-cart .basket-icon {
  font-size: 13px;
  line-height: 1;
}

.btn-basket-cart .basket-btn-text {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.cart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: var(--surface-sub);
  color: var(--text-2);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cart-badge.has-items {
  background: var(--ok-fg);
  color: #FFFFFF;
  box-shadow: 0 0 8px rgba(22, 101, 52, 0.10);
}

.cart-badge.badge-pulse {
  animation: cart-badge-pop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes cart-badge-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* ================= Main Forensic Workspace (Expanded Full Width) ================= */
.dual-wing-workspace {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 46px);
  width: 100vw;
  overflow: hidden;
}

/* ----------------- Main Workspace Wing (Full-Width) ----------------- */
.left-wing {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: var(--bg-main);
  border-right: none;
  position: relative;
  overflow: hidden;
}

/* Left Content Views */
.left-content-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

.wing-view {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Events Grid & Cards */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  padding: 14px;
}

.event-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.event-card:hover {
  border-color: var(--brand);
  box-shadow: 0 8px 20px rgba(28, 25, 23, 0.06);
}

@keyframes slideDownFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.event-card.event-card-appear {
  animation: slideDownFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Clean, Flicker-Free Forensic Card Thumbnail & Hover */
.thumb-sprite-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg);
  overflow: hidden;
  cursor: pointer;
}

.thumb-sprite {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), filter 0.25s ease;
}

.event-card:hover .thumb-sprite {
  transform: scale(1.06);
  filter: brightness(1.08);
}

.crop-preview-pip {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 68px;
  height: 68px;
  border-radius: 6px;
  border: 2px solid var(--brand);
  box-shadow: 0 4px 12px rgba(28, 25, 23, 0.06);
  background-size: cover;
  background-position: center;
  background-color: var(--surface);
  z-index: 6;
  cursor: zoom-in;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.thumb-sprite-wrapper::after {
  content: "查看原图";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: rgba(28, 25, 23, 0.72);
  border: none;
  color: #FFFFFF;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 4;
}

.event-card:hover .thumb-sprite-wrapper::after {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.event-card:hover .crop-preview-pip {
  transform: scale(1.15);
  border-color: var(--brand);
}

.card-top-badges {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

/* These two ride on top of the video frame, so they keep a dark scrim and
   white type — the warm palette has nothing legible against live footage. */
.badge-site-channel {
  background: rgba(28, 25, 23, 0.72);
  color: #FFFFFF;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  border: none;
}

.badge-confidence {
  background: rgba(28, 25, 23, 0.72);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 600;
  color: #FFFFFF;
  border: none;
}

.card-info {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.card-time-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.card-wallclock {
  font-family: var(--font-mono);
  color: var(--text);
  font-weight: 500;
}

.card-caption {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-actions-row {
  margin-top: auto;
  padding-top: 10px;
  display: flex;
  align-items: center;
  border-top: 1px solid var(--divider);
}

/* Secondary actions (trace / track / archive) no longer crowd the card foot.
   They rest on the thumbnail and surface on hover. */
.card-hover-tools {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 7;
}

.event-card:hover .card-hover-tools,
.card-hover-tools:focus-within {
  opacity: 1;
}

.card-hover-tools .btn-card-icon {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(28, 25, 23, 0.72);
  border: none;
  border-radius: 8px;
  color: #FFFFFF;
}

.card-hover-tools .btn-card-icon:hover {
  background: var(--brand);
  color: #FFFFFF;
}

.card-hover-tools .btn-card-icon svg {
  width: 15px;
  height: 15px;
}

.btn-extract-clip {
  flex: 1;
  width: 100%;
  min-height: 38px;
  background: var(--brand);
  border-color: var(--brand);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 600;
}
.btn-extract-clip:hover {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
  color: #FFFFFF;
}
.btn-extract-clip.loading {
  background: var(--surface-sub);
  border-color: var(--border);
  cursor: wait;
}

.btn-card-icon {
  background: var(--surface-sub);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
}
.btn-card-icon:hover {
  background: var(--surface-sub);
  color: var(--brand);
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  margin-top: auto;
}

/* Explore Gallery Specifics */
.explore-header {
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.explore-info-title {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
}

.explore-intent-tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--surface-sub);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.explore-intent-tag.tag-person {
  background: var(--brand-tint);
  color: var(--brand);
  border-color: var(--brand-tint-border);
}

.explore-intent-tag.tag-vehicle {
  background: var(--warn-bg);
  color: var(--warn-fg);
  border-color: var(--warn-bd);
}

.explore-intent-tag.tag-all {
  background: var(--brand-tint);
  color: var(--brand);
  border-color: var(--brand-tint-border);
}

/* Health Wall Specifics */
.health-wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  padding: 16px;
}

.nvr-health-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.nvr-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.nvr-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.channel-tags-matrix {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.channel-tag {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.channel-tag:hover {
  border-color: var(--brand);
  background: var(--surface-sub);
}

.channel-tag.online {
  border-left: 3px solid var(--emerald-accent);
}
.channel-tag.offline {
  border-left: 3px solid var(--red-accent);
  opacity: 0.5;
}

/* ================= Video Dock (Bottom Forensics Player) ================= */
.video-dock {
  background: var(--bg-dock);
  border-top: 2px solid var(--brand);
  display: flex;
  flex-direction: column;
  transition: max-height 0.25s ease, transform 0.25s ease;
  overflow: hidden;
  max-height: 480px;
  z-index: 50;
  box-shadow: 0 -8px 24px rgba(28, 25, 23, 0.06);
}

.video-dock.collapsed {
  max-height: 0;
  border-top: none;
  padding: 0;
}

.dock-header {
  height: 38px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border-bottom: 1px solid var(--border-subtle);
}

.dock-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dock-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.dock-wallclock {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--amber-accent);
  font-weight: 600;
  background: var(--warn-bg);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--warn-bd);
}

.dock-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
}

.player-wrapper {
  position: relative;
  width: 100%;
  height: 280px;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.video-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
}

.loading-text {
  font-size: 12px;
  color: var(--brand);
}

.nvr-player {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.08s ease;
}

.nvr-player.active {
  opacity: 1;
  z-index: 2;
  pointer-events: auto;
}

.nvr-player.idle {
  opacity: 0;
  z-index: 1;
  pointer-events: none;
}

/* NLE Scrubber & Controls */
.player-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.time-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  min-width: 42px;
  text-align: center;
}

.progress-bar-container {
  flex: 1;
  height: 8px;
  background: var(--surface-sub);
  border-radius: 4px;
  position: relative;
  cursor: pointer;
}

.progress-buffered {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--surface-sub);
  border-radius: 4px;
  width: 0%;
}

.progress-filled {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--brand);
  border-radius: 4px;
  width: 0%;
  z-index: 2;
}

.progress-handle {
  position: absolute;
  top: -3px;
  width: 14px;
  height: 14px;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(28, 25, 23, 0.06);
  margin-left: -7px;
  z-index: 3;
  pointer-events: none;
  display: none;
}

.progress-bar-container:hover .progress-handle {
  display: block;
}

.controls-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.playback-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.forensic-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shortcuts-hint {
  font-size: 11px;
  color: var(--text-dim);
  cursor: help;
}

/* ----------------- Right Wing (35%) ----------------- */
.right-wing {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-surface);
  overflow: hidden;
}

/* Top 60%: AI Copilot */
.copilot-panel {
  flex: 6;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border-subtle);
}

.copilot-header {
  height: 44px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-dock);
  border-bottom: 1px solid var(--border-subtle);
}

.copilot-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.copilot-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.copilot-chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.copilot-welcome {
  text-align: center;
  padding: 24px 16px;
  background: var(--surface-sub);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
}

.welcome-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.copilot-welcome h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.copilot-welcome p {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.copilot-quick-prompts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}

.quick-chip {
  background: var(--surface-sub);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}
.quick-chip:hover {
  background: var(--surface-sub);
  color: var(--brand);
  border-color: var(--brand);
}

.copilot-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.copilot-msg-row {
  display: flex;
  gap: 10px;
  max-width: 95%;
}

.copilot-msg-row.msg-user {
  margin-left: auto;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.msg-bubble-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  line-height: 1.5;
}

.msg-ai .msg-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text);
}

.msg-user .msg-bubble {
  background: var(--brand);
  color: #FFFFFF;
}

.copilot-tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.copilot-tool-pill {
  background: var(--surface-sub);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  color: var(--text-2);
}

/* Copilot Embedded Evidence Cards */
.copilot-evidence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.copilot-evidence-card {
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.copilot-evidence-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: #000;
  cursor: pointer;
}

.copilot-evidence-info {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.copilot-evidence-btn {
  margin-top: 4px;
  width: 100%;
  background: var(--brand-tint);
  border: 1px solid var(--brand-tint-border);
  color: var(--brand);
  font-size: 10px;
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
}
.copilot-evidence-btn:hover {
  background: var(--brand);
  color: #FFFFFF;
}

.copilot-input-container {
  padding: 10px 16px;
  background: var(--bg-dock);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.copilot-status-indicator {
  font-size: 11px;
  color: var(--brand);
  display: flex;
  align-items: center;
  gap: 6px;
}

.copilot-input-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.copilot-input-form textarea {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  outline: none;
  resize: none;
  height: 52px;
}

.copilot-input-form textarea:focus {
  border-color: var(--blue-accent);
}

/* ================= Case Evidence Basket Drawer (Shopping Cart Style) ================= */
.basket-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1500;
  opacity: 1;
  transition: opacity 0.25s ease;
  pointer-events: auto;
}

.basket-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
  display: block !important;
  visibility: hidden;
}

.case-basket-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 100vh;
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 35px rgba(28, 25, 23, 0.06);
  z-index: 1501;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s;
  visibility: visible;
  pointer-events: auto;
}

.case-basket-drawer.closed {
  transform: translateX(100%);
  visibility: hidden;
  pointer-events: none;
}

.case-basket-panel {
  flex: 1;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.basket-header {
  height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.basket-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.basket-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.basket-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-close-drawer {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 14px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-close-drawer:hover {
  background: var(--surface-sub);
  border-color: var(--border);
  color: var(--brand);
}

.basket-items-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.basket-empty-hint {
  text-align: center;
  padding: 30px 16px;
  color: var(--text-dim);
  font-size: 12px;
}

.basket-empty-hint p {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-3);
}

.basket-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.basket-item-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.basket-item-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.basket-item-details {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.basket-item-hash {
  font-size: 9px;
  color: var(--ok-fg);
  font-family: var(--font-mono);
  background: var(--ok-bg);
  padding: 1px 4px;
  border-radius: 2px;
  display: inline-block;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.basket-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Spinner Animation */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-small {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ================= Video Dock Fullscreen Experience ================= */
.video-dock:fullscreen,
.video-dock:-webkit-full-screen {
  max-height: 100vh !important;
  height: 100vh !important;
  width: 100vw !important;
  padding: 0 !important;
  border-top: none !important;
  background: var(--bg) !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  z-index: 99999 !important;
}

.video-dock:fullscreen .dock-header,
.video-dock:-webkit-full-screen .dock-header {
  height: 48px !important;
  padding: 0 24px !important;
  background: rgba(8, 13, 26, 0.95) !important;
  border-bottom: 1px solid var(--border) !important;
}

.video-dock:fullscreen .dock-title,
.video-dock:-webkit-full-screen .dock-title {
  font-size: 15px !important;
}

.video-dock:fullscreen .dock-wallclock,
.video-dock:-webkit-full-screen .dock-wallclock {
  font-size: 14px !important;
  padding: 4px 12px !important;
}

.video-dock:fullscreen .dock-body,
.video-dock:-webkit-full-screen .dock-body {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  padding: 12px 24px 20px !important;
  background: transparent !important;
  gap: 12px !important;
}

.video-dock:fullscreen .player-wrapper,
.video-dock:-webkit-full-screen .player-wrapper {
  flex: 1 !important;
  height: 100% !important;
  border: none !important;
  border-radius: 6px !important;
  background: #000 !important;
  cursor: pointer;
}

.video-dock:fullscreen .player-controls,
.video-dock:-webkit-full-screen .player-controls {
  padding: 10px 18px !important;
  background: rgba(15, 23, 42, 0.9) !important;
  border-radius: 8px !important;
  border: 1px solid var(--border) !important;
}

/* ================= Target Spatiotemporal Trace & Evidence Pipeline ================= */

.preview-trace-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.select-trace-model {
  height: 28px;
  background: var(--surface-sub);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  padding: 0 8px;
  outline: none;
  cursor: pointer;
  max-width: 260px;
}

.select-trace-model:focus {
  border-color: var(--brand);
}

.btn-trace {
  height: 28px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand);
  color: #FFFFFF;
  border: 1px solid var(--brand);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(194, 65, 12, 0.10);
}

.btn-trace:hover {
  background: var(--brand-deep);
  border-color: var(--brand);
  box-shadow: 0 0 10px rgba(194, 65, 12, 0.10);
}

.btn-trace:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Trace Modal Container */
#trace-modal {
  z-index: 10001;
}

.trace-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 95vw;
  max-width: 1120px;
  height: 88vh;
  max-height: 900px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px -15px rgba(28, 25, 23, 0.06);
  animation: modalFadeIn 0.2s ease-out;
}

.trace-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
}

.trace-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.trace-icon {
  font-size: 24px;
}

.trace-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.trace-subtitle {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}

.trace-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Progress indicator */
.trace-progress-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--brand-tint);
  border-bottom: 1px solid var(--brand-tint-border);
  padding: 10px 20px;
  color: var(--brand);
  font-size: 13px;
}

.trace-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--brand);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.trace-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg);
}

/* Anchor purification card */
.anchor-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}

.trace-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.anchor-grid {
  display: flex;
  align-items: center;
  gap: 16px;
}

.anchor-view-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 130px;
  text-align: center;
}

.anchor-label {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 500;
}

.anchor-img-wrap {
  width: 130px;
  height: 150px;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.anchor-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.anchor-view-col.highlight .anchor-img-wrap {
  border: 2px solid var(--brand);
  box-shadow: 0 0 12px rgba(194, 65, 12, 0.10);
}

.anchor-meta {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.anchor-arrow {
  font-size: 22px;
  color: var(--brand);
  font-weight: bold;
}

.anchor-desc-col {
  flex: 1;
  padding-left: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.anchor-desc-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
}

.anchor-desc-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}

.anchor-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

/* Tabs bar */
.trace-tabs-bar {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.trace-tab {
  padding: 8px 16px;
  background: transparent;
  color: var(--text-2);
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.trace-tab:hover {
  color: var(--text);
  background: var(--surface-sub);
}

.trace-tab.active {
  background: var(--surface-sub);
  color: var(--brand);
  border-color: var(--border);
  font-weight: 600;
}

/* Timeline View */
.timeline-narrative {
  background: var(--surface-sub);
  border-left: 4px solid var(--brand);
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 16px;
}

.trace-timeline-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  padding-left: 28px;
}

.trace-timeline-container::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 9px;
  width: 2px;
  background: var(--surface-sub);
}

.timeline-hop-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  gap: 16px;
  transition: border-color 0.2s;
}

.timeline-hop-card:hover {
  border-color: var(--border);
}

.timeline-node-marker {
  position: absolute;
  left: -24px;
  top: 18px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--border);
  box-shadow: 0 0 6px rgba(194, 65, 12, 0.10);
}

.timeline-node-marker.anchor-node {
  background: var(--ok-fg);
  box-shadow: 0 0 8px rgba(22, 101, 52, 0.10);
}

.hop-thumb-col {
  width: 110px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hop-thumb-wrap {
  width: 110px;
  height: 130px;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
}

.hop-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.2s;
}

.hop-thumb-wrap:hover img {
  transform: scale(1.05);
}

.hop-content-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hop-title-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hop-time {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.hop-delta {
  font-size: 12px;
  color: var(--warn-fg);
  background: var(--warn-bg);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--warn-bd);
}

.hop-channel {
  font-size: 13px;
  color: var(--text-2);
}

.hop-verdict-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.verdict-match {
  background: var(--ok-bg);
  color: var(--ok-fg);
  border: 1px solid var(--ok-bd);
}

.verdict-suspect {
  background: var(--warn-bg);
  color: var(--warn-fg);
  border: 1px solid var(--warn-bd);
}

.verdict-anchor {
  background: var(--brand-tint);
  color: var(--brand);
  border: 1px solid var(--brand-tint-border);
}

.hop-reasoning {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
  background: var(--surface-sub);
  padding: 8px 12px;
  border-radius: 6px;
}

.hop-micro-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.micro-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface-sub);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.hop-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

/* Evidence Partition Table */
.evidence-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--ok-bg);
  border: 1px solid var(--ok-bd);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.evidence-banner-icon {
  font-size: 24px;
}

.evidence-banner-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ok-fg);
}

.evidence-banner-sub {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}

.evidence-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.evidence-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.evidence-table th {
  background: var(--surface-sub);
  color: var(--text-2);
  font-weight: 600;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.evidence-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}

.evidence-table tr:hover td {
  background: var(--surface-sub);
}

.evidence-hash {
  font-family: var(--font-mono);
  color: var(--brand);
  background: var(--brand-tint);
  padding: 2px 6px;
  border-radius: 4px;
  word-break: break-all;
}

/* Excluded candidates */
.excluded-intro {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 14px;
}

.excluded-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.excluded-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  gap: 12px;
}

.excluded-card img {
  width: 70px;
  height: 90px;
  object-fit: contain;
  background: #000;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.excluded-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.excluded-reason {
  font-size: 11px;
  color: var(--danger-fg);
  line-height: 1.4;
}

/* ==========================================================================
   Lifecycle Trace & Direct Forensic Styles
   ========================================================================== */

.lifecycle-banner-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
}

.lifecycle-banner-top {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
}

.lifecycle-info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lifecycle-info-item .lbl {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lifecycle-info-item .val {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-mono);
}

.lifecycle-info-item .val.highlight {
  color: var(--brand);
}

.lifecycle-info-item .val.text-success {
  color: var(--ok-fg);
}

.lifecycle-info-item .val.text-danger {
  color: var(--danger-fg);
}

/* Pipeline Card */
.pipeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pipeline-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.pipeline-title-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pipeline-icon {
  font-size: 20px;
}

.pipeline-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.pipeline-subtitle {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}

.pipeline-actions-area {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pipeline-count-badge {
  font-size: 12px;
  color: var(--brand);
  background: var(--brand-tint);
  border: 1px solid var(--brand-tint-border);
  border-radius: 4px;
  padding: 4px 8px;
  font-weight: 600;
}

/* Pipeline Filmstrip */
.pipeline-filmstrip {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 10px 4px 14px 4px;
  align-items: stretch;
}

.pipeline-filmstrip::-webkit-scrollbar {
  height: 6px;
}

.pipeline-filmstrip::-webkit-scrollbar-thumb {
  background: var(--surface-sub);
  border-radius: 3px;
}

.pipeline-segment-card {
  flex: 0 0 160px;
  background: var(--surface-sub);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.pipeline-segment-card:hover {
  border-color: var(--brand);
  background: var(--surface-sub);
  box-shadow: 0 6px 16px rgba(28, 25, 23, 0.06);
}

.pipeline-segment-card.selected {
  border-color: var(--brand);
  background: var(--brand-tint);
  box-shadow: 0 0 12px rgba(194, 65, 12, 0.10);
}

.pipeline-segment-card.is-anchor {
  border-color: var(--warn-bd);
}

.pipeline-segment-card.is-anchor-channel {
  border-color: var(--warn-bd);
}

.seg-header-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.seg-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
}

.seg-badge-anchor {
  font-size: 10px;
  color: var(--warn-fg);
  background: var(--warn-bg);
  border: 1px solid var(--warn-bd);
  border-radius: 3px;
  padding: 1px 4px;
}

.seg-badge-anchor-ch {
  font-size: 10px;
  color: var(--brand);
  background: var(--brand-tint);
  border: 1px solid var(--brand-tint-border);
  border-radius: 3px;
  padding: 1px 4px;
}

.seg-thumb-wrap {
  width: 140px;
  height: 150px;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.seg-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.2s;
}

.pipeline-segment-card:hover .seg-thumb-wrap img {
  transform: scale(1.05);
}

.seg-time-bar {
  text-align: center;
  width: 100%;
}

.seg-time-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-mono);
}

.seg-dur-text {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 2px;
}

/* Results: Mined Segments */
.evidence-intro-bar {
  background: var(--brand-tint);
  border-left: 4px solid var(--brand);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 16px;
}

.mined-segments-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mined-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mined-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.mined-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Top Candidate Frame Switcher */
.cand-switcher-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-sub);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
}

.cand-switcher-title {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 600;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.cand-pills-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cand-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-2);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.cand-pill:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-tint);
}

.cand-pill.active {
  border-color: var(--brand);
  background: var(--brand-tint);
  color: var(--brand);
  box-shadow: 0 0 10px rgba(194, 65, 12, 0.10);
  font-weight: 600;
}

.cand-pill-rank {
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--brand);
}

.cand-pill.active .cand-pill-rank {
  color: var(--warn-fg);
}

.cand-pill-pose {
  font-size: 11px;
}

.cand-pill-score {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  background: var(--surface-sub);
  padding: 1px 5px;
  border-radius: 3px;
}

.cand-pill.active .cand-pill-score {
  color: var(--warn-fg);
}

.mined-card-images {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-start;
}

.mined-img-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.mined-img-col .img-label {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 500;
}

.mined-img-box {
  width: 150px;
  height: 160px;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mined-img-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mined-img-box.focus-box {
  border: 2px solid var(--brand);
  box-shadow: 0 0 10px rgba(194, 65, 12, 0.10);
}

.mined-img-meta {
  font-size: 10px;
  color: var(--text-3);
  font-family: var(--font-mono);
  text-align: center;
}

.mined-video-col {
  flex: 1;
  min-width: 280px;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.mined-video-col video {
  width: 100%;
  display: block;
  max-height: 220px;
  background: #000;
}

.mined-video-footer {
  padding: 6px 12px;
  font-size: 11px;
  color: var(--text-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
}

/* VLM Report Card */
.vlm-report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.vlm-report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.vlm-model-badge {
  font-size: 12px;
  color: var(--brand);
  background: var(--brand-tint);
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 600;
}

.vlm-date-badge {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.vlm-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vlm-sec-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}

.vlm-sec-content {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}

.vlm-sec-content.highlight-box {
  background: var(--surface-sub);
  border-left: 4px solid var(--brand);
  padding: 10px 14px;
  border-radius: 4px;
  color: var(--text);
  font-size: 13.5px;
}

.vlm-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.vlm-timeline-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vlm-timeline-item {
  background: var(--surface-sub);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12.5px;
  display: flex;
  gap: 10px;
}

.vlm-timeline-time {
  font-weight: 700;
  color: var(--brand);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.vlm-timeline-action {
  color: var(--text-2);
  line-height: 1.4;
}

/* Trace Mode Toggle (Face vs Plate) */
.trace-mode-toggle {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.btn-mode {
  background: transparent;
  border: none;
  color: var(--text-2);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-mode:hover {
  color: var(--text);
}

.btn-mode.active {
  background: var(--brand);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(28, 25, 23, 0.06);
}

.btn-toggle-enhanced {
  margin-top: 6px;
  font-size: 11px;
  padding: 3px 8px;
  background: var(--surface-sub);
  border: 1px solid var(--brand);
  border-radius: 4px;
  color: var(--brand);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-toggle-enhanced:hover {
  background: var(--brand);
  color: var(--text);
  font-weight: 600;
}

/* Dual-Track Trace Fidelity Controls */
.trace-fidelity-ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 11.5px;
  color: var(--text-2);
}

.trace-fidelity-ctrl .fidelity-label strong {
  color: var(--brand);
  font-family: var(--font-mono);
}

.trace-fidelity-ctrl input[type="range"] {
  width: 70px;
  accent-color: var(--brand);
  cursor: pointer;
}

/* Dual-Track Mined Cards & Images */
.img-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  width: 100%;
}

.badge-physical {
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--brand-tint);
  color: var(--brand);
  border: 1px solid var(--brand-tint-border);
  font-weight: 600;
}

.badge-ai {
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--brand-tint);
  color: var(--brand);
  border: 1px solid var(--brand-tint-border);
  font-weight: 600;
}

.badge-subtle {
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--surface-sub);
  color: var(--text-2);
  border: 1px solid var(--border);
}

/* AI Enhanced Box with Hover-to-Compare */
.mined-img-box.ai-box {
  position: relative;
  border: 2px solid var(--brand);
  box-shadow: 0 0 12px rgba(194, 65, 12, 0.10);
  cursor: pointer;
  background: var(--bg);
  overflow: hidden;
}

.mined-img-box.ai-box .ai-enhanced-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: filter 0.15s ease;
}

.mined-img-box.ai-box .ai-original-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.mined-img-box.ai-box:hover .ai-original-img {
  opacity: 1;
}

.hover-compare-pill {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(15, 23, 42, 0.85);
  color: var(--brand);
  border: 1px solid var(--brand-tint-border);
  font-size: 9.5px;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  transition: opacity 0.12s ease;
  font-weight: 500;
}

.mined-img-box.ai-box:hover .hover-compare-pill {
  opacity: 0;
}

.hover-active-pill {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger-fg);
  color: #FFFFFF;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(28, 25, 23, 0.06);
}

.mined-img-box.ai-box:hover .hover-active-pill {
  opacity: 1;
}

/* License Plate Text Pill */
.plate-text-pill {
  margin-top: 4px;
  font-size: 11px;
  background: var(--brand-tint);
  border: 1px solid var(--brand);
  color: var(--brand);
  padding: 2px 8px;
  border-radius: 4px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(28, 25, 23, 0.06);
}

.plate-text-pill strong {
  color: var(--warn-fg);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.5px;
}

/* Fidelity Adjustment Widget in Card */
.fidelity-widget {
  margin-top: 6px;
  background: var(--surface-sub);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 8px;
  width: 150px;
  box-sizing: border-box;
}

.fidelity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--text-2);
  margin-bottom: 3px;
}

.fidelity-header strong {
  color: var(--brand);
  font-family: var(--font-mono);
}

.fidelity-hint {
  font-size: 9px;
  color: var(--text-3);
}

.fidelity-slider-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fidelity-slider {
  flex: 1;
  height: 4px;
  accent-color: var(--brand);
  cursor: pointer;
}

.btn-apply-fidelity {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--brand-tint);
  border: 1px solid var(--brand);
  border-radius: 3px;
  color: var(--brand);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-apply-fidelity:hover {
  background: var(--brand);
  color: #FFFFFF;
  font-weight: 600;
}

.btn-apply-fidelity:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Ensure Image Preview Modal displays above Trace Modal */
#image-preview-modal {
  z-index: 10005 !important;
}

/* Activity Segment Cards */
.pipeline-segment-card {
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border);
  position: relative;
}

.pipeline-segment-card:hover {
  border-color: var(--brand);
  box-shadow: 0 8px 20px -4px rgba(194, 65, 12, 0.10);
}

.pipeline-segment-card.active-card {
  border-color: var(--brand) !important;
  background: var(--brand-tint) !important;
  box-shadow: 0 0 0 2px rgba(194, 65, 12, 0.10), 0 8px 24px -4px rgba(194, 65, 12, 0.10) !important;
}

.seg-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: rgba(15, 23, 42, 0.75);
}

.seg-ch-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
}

.seg-meta-text {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 2px;
}

.seg-dur {
  color: var(--text);
  font-weight: 600;
}

.seg-ev-count {
  color: var(--brand);
}

.seg-action-bar {
  padding: 6px 8px;
  background: rgba(15, 23, 42, 0.9);
  text-align: center;
  border-top: 1px solid var(--border);
}

.seg-cta-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand);
  transition: color 0.15s ease;
}

.pipeline-segment-card:hover .seg-cta-text,
.pipeline-segment-card.active-card .seg-cta-text {
  color: var(--brand);
}

/* Segment Gallery Card */
.segment-gallery-card {
  margin-top: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: modalFadeIn 0.25s ease-out;
}

.gallery-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.gallery-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gallery-icon {
  font-size: 22px;
}

.gallery-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.gallery-subtitle {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}

.gallery-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gallery-sub-heading {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Top 8 最清真瞬间 Grid */
.top-frames-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}

.top-frame-card {
  background: var(--surface);
  border: 1.5px solid var(--warn-bd);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px -2px rgba(161, 98, 7, 0.10);
}

.top-frame-card:hover {
  border-color: var(--warn-bd);
  box-shadow: 0 8px 24px -2px rgba(161, 98, 7, 0.10);
}

.top-rank-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--warn-fg);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(28, 25, 23, 0.06);
}

.top-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.top-thumb-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.frame-tag-overlay {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(15, 23, 42, 0.85);
  color: var(--brand);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--brand-tint-border);
}

.top-info-bar {
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid var(--warn-bd);
}

.top-score-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--warn-fg);
}

.top-time-text {
  font-size: 10px;
  color: var(--text-2);
  font-family: var(--font-mono);
}

/* All Frames Contact Sheet Grid */
.all-frames-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 6px;
}

.frame-contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.frame-contact-card:hover {
  border-color: var(--brand);
  box-shadow: 0 4px 12px rgba(194, 65, 12, 0.10);
}

.frame-contact-card.is-top-pick {
  border-color: var(--warn-bd);
}

.frame-thumb-box {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.frame-thumb-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.frame-top-star {
  position: absolute;
  top: 3px;
  right: 3px;
  background: var(--warn-fg);
  color: var(--text);
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
}

.frame-caption {
  padding: 4px 6px;
  font-size: 10px;
  color: var(--text-2);
  background: var(--bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
}

.frame-offset {
  color: var(--text-3);
  font-size: 9px;
}

.loading-state {
  padding: 24px;
  color: var(--brand);
  text-align: center;
  font-size: 13px;
  grid-column: 1 / -1;
}

/* ================= Standalone Copilot Studio ================= */
.copilot-page-body {
  background: var(--bg-main);
  overflow: hidden;
  height: 100vh;
}

.copilot-app-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.copilot-studio-container {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  height: calc(100vh - 46px);
  width: 100vw;
  overflow: hidden;
}

/* Copilot Studio Sidebar */
.copilot-studio-sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
  border-right: 1px solid var(--border-subtle);
  overflow: hidden;
}

.copilot-sidebar-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg);
}

.btn-new-session {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  width: 100%;
}

.copilot-sessions-header-label {
  padding: 12px 16px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.copilot-sessions-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.copilot-session-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.copilot-session-item:hover {
  background: var(--surface-sub);
  border-color: var(--border);
}

.copilot-session-item.active {
  background: var(--surface-sub);
  border-color: var(--brand);
  box-shadow: 0 2px 6px rgba(28, 25, 23, 0.06);
}

.session-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 22px;
}

.session-item-meta {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.btn-session-del {
  position: absolute;
  right: 8px;
  top: 10px;
  background: transparent;
  border: none;
  color: var(--text-3);
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s ease;
  border-radius: 4px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.copilot-session-item:hover .btn-session-del {
  opacity: 1;
}

.btn-session-del:hover {
  color: var(--danger-fg);
  background: var(--danger-bg);
}

.sessions-empty-hint {
  padding: 24px 12px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.6;
}

.copilot-sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg);
}

.copilot-capability-card {
  background: var(--surface-sub);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.capability-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

.capability-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.6;
}

/* Copilot Studio Main */
.copilot-studio-main {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-main);
  overflow: hidden;
}

.copilot-studio-chat-header {
  height: 50px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-dock);
  flex-shrink: 0;
}

.copilot-studio-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.badge-online {
  background: var(--ok-bg);
  color: var(--ok-fg);
  border: 1px solid var(--ok-bd);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.copilot-studio-chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Studio Chat Welcome */
.copilot-studio-chat-area .copilot-welcome {
  max-width: 680px;
  margin: 40px auto;
  padding: 36px 28px;
  text-align: center;
  background: var(--surface-sub);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.copilot-studio-chat-area .copilot-welcome h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.copilot-studio-chat-area .copilot-welcome p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.copilot-studio-chat-area .copilot-quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.copilot-studio-chat-area .quick-chip {
  background: var(--surface-sub);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.copilot-studio-chat-area .quick-chip:hover {
  background: var(--surface-sub);
  color: var(--brand);
  border-color: var(--brand);
}

/* Markdown formatting inside bubbles */
.copilot-markdown-content {
  line-height: 1.6;
  font-size: 13px;
  color: var(--text);
}

.inline-code {
  background: var(--surface-sub);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--brand);
}

.code-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  margin: 8px 0;
  color: var(--text-2);
}

.table-responsive {
  overflow-x: auto;
  margin: 10px 0;
}

.copilot-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
}

.copilot-table th {
  background: var(--surface-sub);
  color: var(--text-2);
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
}

.copilot-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}

.copilot-table tr:hover td {
  background: var(--surface-sub);
}

.md-ul {
  margin: 6px 0;
  padding-left: 20px;
}

.md-li {
  margin-bottom: 4px;
}

.md-h2, .md-h3, .md-h4 {
  color: var(--text);
  margin: 10px 0 4px;
  font-weight: 600;
}

/* Copilot Evidence Cards in Studio */
.copilot-studio-chat-area .copilot-evidence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.copilot-evidence-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.15s ease;
}

.copilot-evidence-card:hover {
  border-color: var(--brand);
  box-shadow: 0 4px 12px rgba(28, 25, 23, 0.06);
}

.copilot-evidence-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #000;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  transition: opacity 0.15s ease;
}

.copilot-evidence-thumb:hover {
  opacity: 0.9;
}

.copilot-evidence-info {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-site-channel {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.card-timestamp {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.card-btns-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.card-btns-row .btn {
  flex: 1;
  justify-content: center;
  font-size: 11px;
  padding: 4px 8px;
  text-decoration: none;
}

/* Copilot Studio Input Area */
.copilot-studio-input-area {
  padding: 12px 28px 20px;
  background: var(--bg);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.copilot-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--brand);
  margin-bottom: 8px;
  padding: 0 4px;
}

.spinner-small {
  width: 14px;
  height: 14px;
  border: 2px solid var(--brand-tint-border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

.copilot-studio-input-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  transition: border-color 0.15s;
}

.copilot-studio-input-form:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px rgba(194, 65, 12, 0.10);
}

.copilot-studio-input-form textarea {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  resize: none;
  outline: none;
  width: 100%;
  min-height: 52px;
  font-family: inherit;
}

.copilot-input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.input-hint {
  font-size: 11px;
  color: var(--text-dim);
}

/* Copilot Video Modal */
.copilot-video-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  width: 860px;
  max-width: 95vw;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(28, 25, 23, 0.06);
  display: flex;
  flex-direction: column;
}

.copilot-video-body {
  position: relative;
  padding: 12px;
  background: #000;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 10;
  color: var(--brand);
  font-size: 13px;
}


/* In-Workbench AI Copilot View */
#view-copilot {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

#view-copilot .copilot-panel {
  flex: 1;
  min-height: 0;
  height: 100%;
  border-bottom: none;
  background: var(--bg-surface);
}

#view-copilot .copilot-chat-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

#view-copilot .copilot-input-container {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.copilot-session-select {
  background: var(--surface-sub);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
}

.copilot-session-select:focus {
  border-color: var(--blue-accent);
}

/* Responsive Compact TopBar Breakpoints */
@media (max-width: 1440px) {
  .global-search-box {
    width: 200px;
  }
  .global-search-box:focus-within {
    width: 240px;
  }
  .select-site {
    max-width: 115px;
  }
  .select-channel {
    max-width: 130px;
  }
  .select-interval {
    max-width: 125px;
  }
}

@media (max-width: 1200px) {
  .brand-title {
    display: none;
  }
  .basket-btn-text {
    display: none;
  }
  .global-search-box {
    width: 160px;
  }
  .global-search-box:focus-within {
    width: 200px;
  }
  .select-channel {
    max-width: 110px;
  }
  .select-interval {
    max-width: 110px;
  }
}

@media (max-width: 992px) {
  .header-left {
    gap: 4px;
  }
  .header-right {
    gap: 4px;
  }
}

/* ==========================================================================
   Icon system — inline line-drawn SVG only (spec §3). No emoji anywhere.
   Every icon inherits its colour from the text beside it, so a white-on-brand
   button gets a white icon for free and can never invert.
   ========================================================================== */
svg.ico {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -0.125em;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ico-14 { width: 14px; height: 14px; }
.ico-17 { width: 17px; height: 17px; }
.ico-19 { width: 19px; height: 19px; }
.ico-22 { width: 22px; height: 22px; }
.ico-24 { width: 24px; height: 24px; }

.brand-mark {
  width: 19px;
  height: 19px;
  color: var(--brand);
}

.menu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--text-3);
}

.user-menu-item:hover .menu-icon { color: var(--brand); }
.user-menu-item.text-danger .menu-icon { color: var(--danger-fg); }

.login-header .icon,
.welcome-icon,
.copilot-icon,
.dock-status-icon,
.trace-icon,
.pipeline-icon,
.gallery-icon,
.basket-icon,
.search-icon,
.evidence-banner-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
}

.login-header .icon,
.welcome-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 10px;
  border-radius: var(--radius-md);
  background: var(--brand-tint);
}

.login-header .icon svg,
.welcome-icon svg { width: 22px; height: 22px; }

.btn-icon-only {
  padding: 5px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   States & small surfaces that had no rule of their own
   ========================================================================== */
.error-state {
  padding: 24px;
  text-align: center;
  font-size: 13px;
  grid-column: 1 / -1;
  color: var(--danger-fg);
  background: var(--danger-bg);
  border: 1px solid var(--danger-bd);
  border-radius: var(--radius-md);
}

.loading-state {
  color: var(--text-2);
}

.explore-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-tint);
  border: 1px solid var(--brand-tint-border);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
}

.trace-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.trace-progress-text {
  font-size: 13px;
  color: var(--text-2);
}

.copilot-actions,
.dock-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-warning {
  background: var(--warn-bg);
  color: var(--warn-fg);
  border: 1px solid var(--warn-bd);
}

/* ==========================================================================
   Typography — figures in Noto Serif SC, the ledger feel (spec §2).
   12px is the floor; nothing smaller is allowed to carry meaning.
   ========================================================================== */
.brand-title,
.login-header h2,
.trace-title,
.gallery-title,
.basket-title,
.nvr-card-title {
  font-family: var(--font-sans);
  color: var(--text);
}

.lifecycle-info-item .val,
.hop-time,
.seg-time-text {
  font-family: var(--font-serif);
  font-weight: 700;
}

.basket-empty-hint p,
.fidelity-hint,
.frame-offset,
.anchor-meta,
.mined-img-meta,
.cand-pill-score,
.vlm-date-badge {
  font-size: 12px;
}

/* Cards carry the whisper-thin shadow from the spec, never a glow. */
.event-card,
.nvr-health-card,
.basket-item-card,
.copilot-evidence-card,
.top-frame-card,
.frame-contact-card,
.pipeline-segment-card {
  box-shadow: var(--shadow-card);
}

/* Inputs share one resting state and one focus state. */
.input-group input,
.header-select,
.copilot-input-form textarea,
.copilot-studio-input-form,
.global-search-box,
.select-trace-model,
.copilot-session-select {
  font-family: var(--font-sans);
}

.input-group input::placeholder,
.global-search-box input::placeholder,
textarea::placeholder {
  color: var(--text-ph);
}

.global-search-box:focus-within,
.copilot-studio-input-form:focus-within {
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

/* ==========================================================================
   Cross-page header parity
   copilot.html renders its tabs as <a>, index.html as <button>. Both must
   look and measure identically, so the tab rule covers either element.
   ========================================================================== */
.view-tabs .wing-tab,
.view-tabs a.wing-tab {
  text-decoration: none;
}

.view-tabs a.wing-tab:visited { color: var(--text-2); }
.view-tabs a.wing-tab.active:visited { color: var(--brand); }

.user-dropdown-btn.active,
.user-dropdown-btn:hover {
  background: var(--brand-tint);
  border-color: var(--brand-tint-border);
}

.user-badge {
  font-weight: 600;
  color: inherit;
}

/* The capability list carries its own marker; the hand-typed "•" is gone. */
.capability-list li {
  position: relative;
  padding-left: 12px;
}

.capability-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brand-tint-border);
}

/* Segment cards: selected state is a tint, and the label rides a light chip,
   so the "click to inspect" text is never dark-on-dark. */
.seg-header-bar,
.seg-action-bar {
  background: var(--surface-sub);
}

.pipeline-segment-card.active-card .seg-action-bar,
.pipeline-segment-card:hover .seg-action-bar {
  background: var(--brand);
}

.pipeline-segment-card:hover .seg-cta-text {
  color: #FFFFFF;
}
