/* Web UI 自动化 · 运行记录页 v5 — 回放侧栏 + 稳定性主区横向布局 */
.uia-hist-page {
  --uia-hist-accent: #2563eb;
  --uia-hist-accent-deep: #1d4ed8;
  --uia-hist-accent-soft: #eff6ff;
  --uia-hist-accent-border: #bfdbfe;
  --uia-hist-surface-bg: #fff;
  --uia-hist-border: #dbeafe;
  --uia-hist-border-subtle: #e2e8f0;
  --uia-hist-muted: #64748b;
  --uia-hist-text: #1e293b;
  --uia-hist-section-title: #1d4ed8;
  --uia-hist-layout-gap: 1rem;
  --uia-hist-sidebar-width: 20.5rem;
  max-width: 76rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.75rem;
}

body.uia-hist-page-body {
  background:
    radial-gradient(ellipse 88% 52% at 50% -6%, rgba(59, 130, 246, 0.1), transparent 58%),
    linear-gradient(180deg, #f8fbff 0%, #f1f5f9 100%);
  min-height: 100vh;
}

/* —— Hero —— */
.uia-hist-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem 1.125rem;
  border-radius: 14px;
  border: 1px solid var(--uia-hist-border);
  background: linear-gradient(180deg, #eef4ff 0%, #fff 100%);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.06);
  position: relative;
  overflow: hidden;
}

.uia-hist-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 50%, #93c5fd 100%);
}

.uia-hist-hero__brand {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
}

.uia-hist-hero__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.375rem;
  height: 2.375rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--uia-hist-accent-border);
  color: var(--uia-hist-accent);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.1);
}

.uia-hist-hero__icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.uia-hist-hero__eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--uia-hist-muted);
  margin: 0 0 0.25rem;
}

.uia-hist-hero__title {
  margin: 0;
  font-size: clamp(1.25rem, 2.2vw, 1.625rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #1e3a5f;
  line-height: 1.2;
}

.uia-hist-hero__sub {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  color: var(--uia-hist-muted);
  line-height: 1.5;
  max-width: 32rem;
}

.uia-hist-hero__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.uia-hist-back {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4375rem 0.875rem;
  border-radius: 8px;
  border: 1px solid var(--uia-hist-accent-border);
  background: #fff;
  color: var(--uia-hist-accent-deep);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.uia-hist-back svg {
  width: 1rem;
  height: 1rem;
  opacity: 0.85;
}

.uia-hist-back:hover {
  background: var(--uia-hist-accent-soft);
  border-color: #93c5fd;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

/* —— Notices strip —— */
.uia-hist-notices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.uia-hist-notices .uia-hist-notice {
  margin-bottom: 0;
}

.uia-hist-notice--inline {
  margin-bottom: 0.625rem !important;
  padding: 0.5625rem 0.75rem;
  font-size: 0.75rem;
}

/* —— Two-column layout: sidebar replay + main stability —— */
.uia-hist-layout {
  display: grid;
  grid-template-columns: var(--uia-hist-sidebar-width) minmax(0, 1fr);
  gap: var(--uia-hist-layout-gap);
  align-items: start;
}

.uia-hist-layout__sidebar {
  position: sticky;
  top: 0.875rem;
  min-width: 0;
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
}

.uia-hist-layout__sidebar .uia-hist-surface--replay {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.uia-hist-layout__main {
  display: flex;
  flex-direction: column;
  gap: var(--uia-hist-layout-gap);
  min-width: 0;
}

/* legacy aliases — no-op if unused */
.uia-hist-layout__metrics,
.uia-hist-layout__workspace {
  min-width: 0;
}

@media (max-width: 1080px) {
  .uia-hist-layout {
    grid-template-columns: 1fr;
  }

  .uia-hist-layout__sidebar {
    position: static;
    max-height: none;
  }
}

/* —— Surfaces —— */
.uia-hist-surface {
  background: var(--uia-hist-surface-bg);
  border: 1px solid var(--uia-hist-border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.04), 0 6px 20px rgba(30, 64, 175, 0.05);
  overflow: hidden;
}

.uia-hist-surface--detail {
  border-color: #93c5fd;
  box-shadow:
    0 0 0 1px rgba(37, 99, 235, 0.06),
    0 8px 28px rgba(37, 99, 235, 0.1);
}

.uia-hist-surface-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e8f0fe;
  background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
}

.uia-hist-surface-head__label {
  display: flex;
  align-items: flex-start;
  gap: 0.5625rem;
  min-width: 0;
}

.uia-hist-section-idx {
  flex-shrink: 0;
  margin-top: 0.125rem;
  font-size: 0.625rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  color: #60a5fa;
  line-height: 1;
}

.uia-hist-surface-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--uia-hist-section-title);
  line-height: 1.3;
}

.uia-hist-surface-sub {
  margin: 0.15rem 0 0;
  font-size: 0.6875rem;
  color: var(--uia-hist-muted);
  line-height: 1.4;
}

.uia-hist-btn-ghost {
  flex-shrink: 0;
  border: 1px solid var(--uia-hist-border-subtle);
  background: #fff;
  color: #475569;
  border-radius: 7px;
  padding: 0.3125rem 0.6875rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.uia-hist-btn-ghost:hover {
  background: var(--uia-hist-accent-soft);
  border-color: var(--uia-hist-accent-border);
  color: var(--uia-hist-accent-deep);
}

.uia-hist-btn-ghost:disabled {
  opacity: 0.55;
  cursor: wait;
}

/* —— Stability panel (wide main column) —— */
.uia-hist-stab-body {
  padding: 0.75rem 0.875rem 0.875rem;
}

.uia-hist-stab-body--wide {
  padding: 0.875rem 1rem 1rem;
}

.uia-hist-stab-hint {
  margin: 0 0 0.875rem;
  font-size: 0.6875rem;
  line-height: 1.55;
  color: #94a3b8;
}

.uia-hist-stab-scenario-zone {
  margin-bottom: 0.875rem;
  padding: 0.625rem 0.75rem;
  border-radius: 10px;
  background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
  border: 1px solid #e8f0fe;
}

.uia-hist-stab-scenario-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.uia-hist-stab-aside-label {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #475569;
}

.uia-hist-stab-scenario-count {
  font-size: 0.625rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #64748b;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
}

.uia-hist-stab-rail,
.uia-hist-stab-list {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.125rem 0.125rem 0.375rem;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: rgba(37, 99, 235, 0.28) transparent;
}

.uia-hist-stab-rail::-webkit-scrollbar,
.uia-hist-stab-list::-webkit-scrollbar {
  height: 5px;
}

.uia-hist-stab-rail::-webkit-scrollbar-thumb,
.uia-hist-stab-list::-webkit-scrollbar-thumb {
  background: rgba(37, 99, 235, 0.25);
  border-radius: 999px;
}

.uia-hist-stab-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 0.75rem;
  min-width: 0;
}

@media (max-width: 900px) {
  .uia-hist-stab-detail-grid {
    grid-template-columns: 1fr;
  }
}

.uia-hist-stab-chart-card {
  padding: 0.75rem 0.875rem;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e8f0fe;
  min-width: 0;
}

.uia-hist-stab-chart-card--heat {
  background: #fff;
}

.uia-hist-stab-heat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.uia-hist-detail-label--inline {
  margin: 0;
}

.uia-hist-stab-heat-hint {
  font-size: 0.625rem;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.uia-hist-stab-heat-rail-wrap {
  min-width: 0;
}

.uia-stab-row,
.uia-stab-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  flex: 0 0 auto;
  width: auto;
  min-width: 9.5rem;
  max-width: 13.5rem;
  text-align: left;
  padding: 0.5625rem 0.6875rem;
  scroll-snap-align: start;
  border-radius: 10px;
  border: 1px solid var(--uia-hist-border-subtle);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.12s;
}

.uia-stab-row:hover,
.uia-stab-chip:hover {
  border-color: #93c5fd;
  background: var(--uia-hist-accent-soft);
}

.uia-stab-row.is-active,
.uia-stab-chip.is-active {
  border-color: #3b82f6;
  background: linear-gradient(180deg, #eff6ff 0%, #fff 100%);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.14), 0 4px 12px rgba(37, 99, 235, 0.08);
  transform: translateY(-1px);
}

.uia-stab-row-title,
.uia-stab-chip-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--uia-hist-text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 100%;
}

.uia-stab-row-meta,
.uia-stab-chip-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.625rem;
  color: var(--uia-hist-muted);
  font-variant-numeric: tabular-nums;
}

.uia-stab-chip-flaky {
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  font-weight: 700;
}

.uia-stab-chip-flaky.is-low {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

.uia-hist-detail-label {
  margin: 0 0 0.5625rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
}

.uia-flaky-chart {
  margin-top: 0;
}

.uia-flaky-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4375rem;
  margin-bottom: 0.75rem;
}

@media (max-width: 520px) {
  .uia-flaky-metrics {
    grid-template-columns: 1fr;
  }
}

.uia-flaky-metrics > div {
  padding: 0.5625rem 0.625rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e8f0fe;
}

.uia-flaky-metrics strong {
  display: block;
  font-size: 0.9375rem;
  margin-top: 0.1rem;
  color: #1e293b;
}

.uia-flaky-label {
  font-size: 0.625rem;
  color: var(--uia-hist-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.uia-flaky-bar-track {
  display: flex;
  height: 0.5rem;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
}

.uia-flaky-bar-pass {
  background: linear-gradient(90deg, #34d399, #10b981);
}

.uia-flaky-bar-fail {
  background: linear-gradient(90deg, #f87171, #ef4444);
}

.uia-flaky-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.6875rem;
  color: var(--uia-hist-muted);
}

.uia-dot {
  display: inline-block;
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 999px;
  margin-right: 0.2rem;
  vertical-align: middle;
}

.uia-dot--pass {
  background: #10b981;
}

.uia-dot--fail {
  background: #ef4444;
}

.uia-heat-wrap {
  min-width: 0;
}

.uia-heat-rail {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.375rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.125rem 0.125rem 0.375rem;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: rgba(37, 99, 235, 0.28) transparent;
}

.uia-heat-rail::-webkit-scrollbar {
  height: 5px;
}

.uia-heat-rail::-webkit-scrollbar-thumb {
  background: rgba(37, 99, 235, 0.25);
  border-radius: 999px;
}

.uia-heat-bar {
  display: flex;
  gap: 0.375rem;
  flex-wrap: nowrap;
}

.uia-heat-cell {
  flex: 0 0 auto;
  min-width: 4.25rem;
  max-width: 5.5rem;
  padding: 0.4375rem 0.375rem;
  border-radius: 8px;
  text-align: center;
  border: 1px solid rgba(37, 99, 235, 0.1);
  font-size: 0.625rem;
  line-height: 1.25;
  background: #f8fafc;
  scroll-snap-align: start;
  transition: transform 0.12s, box-shadow 0.12s;
}

.uia-heat-cell:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.1);
}

.uia-heat-cell-idx {
  display: block;
  font-weight: 700;
  color: #334155;
}

.uia-heat-cell-rate {
  display: block;
  color: var(--uia-hist-muted);
  font-variant-numeric: tabular-nums;
}

.uia-heat-cell-label {
  display: block;
  font-weight: 600;
  font-size: 0.5625rem;
  line-height: 1.2;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#uia-stab-panel .text-sm.text-slate-400,
#uia-stab-summary-list .text-sm.text-slate-400 {
  font-size: 0.75rem;
  color: #94a3b8 !important;
  flex: 1 1 100%;
  padding: 0.75rem 0;
}

#uia-stab-panel .text-sm.text-red-600,
#uia-stab-summary-list .text-sm.text-red-600 {
  font-size: 0.75rem;
  color: #dc2626 !important;
  flex: 1 1 100%;
}

/* —— Notices —— */
.uia-hist-notice {
  padding: 0.625rem 0.875rem;
  border-radius: 9px;
  border: 1px solid var(--uia-hist-accent-border);
  background: var(--uia-hist-accent-soft);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: #1e40af;
}

.uia-hist-notice--warn {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.uia-hist-notice a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}

.uia-hist-notice code {
  font-size: 0.75rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.7);
}

/* —— Replay list (sidebar) —— */
.uia-hist-replay-body {
  padding: 0.5625rem 0.75rem 0.75rem;
}

.uia-hist-replay-body--sidebar {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  max-height: min(70vh, 42rem);
  scrollbar-width: thin;
  scrollbar-color: rgba(37, 99, 235, 0.22) transparent;
}

.uia-hist-cards--sidebar {
  gap: 0.4375rem;
}

.uia-hist-replay-body--sidebar .uia-hist-card {
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.5625rem;
}

.uia-hist-replay-body--sidebar .uia-hist-card__actions {
  grid-column: 1 / -1;
  justify-content: flex-start;
  padding-top: 0.25rem;
  border-top: 1px dashed #e8f0fe;
  margin-top: 0.125rem;
}

.uia-hist-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 2.5rem 1rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--uia-hist-muted);
}

.uia-hist-state--empty::before {
  content: "";
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  background: var(--uia-hist-accent-soft);
  border: 1px solid var(--uia-hist-accent-border);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75'%3E%3Cpath d='M4 6h16M4 12h16M4 18h10'/%3E%3C/svg%3E") center / 1.25rem no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75'%3E%3Cpath d='M4 6h16M4 12h16M4 18h10'/%3E%3C/svg%3E") center / 1.25rem no-repeat;
  background-color: #dbeafe;
}

.uia-hist-state__spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid #dbeafe;
  border-top-color: var(--uia-hist-accent);
  border-radius: 50%;
  animation: uia-hist-spin 0.7s linear infinite;
}

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

.uia-hist-cards {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.uia-hist-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6875rem 0.8125rem;
  border-radius: 10px;
  border: 1px solid var(--uia-hist-border-subtle);
  border-left: 3px solid transparent;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s, border-left-color 0.15s;
}

.uia-hist-card:hover {
  border-color: #bfdbfe;
  border-left-color: var(--uia-hist-accent);
  background: #fafcff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.07);
}

.uia-hist-card--clickable {
  cursor: pointer;
}

.uia-hist-card--clickable:focus-visible {
  outline: 2px solid var(--uia-hist-accent);
  outline-offset: 2px;
}

.uia-hist-card__slot {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.0625rem;
  flex-shrink: 0;
  min-width: 2.625rem;
  padding: 0.375rem 0.4375rem;
  border-radius: 8px;
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid var(--uia-hist-accent-border);
  line-height: 1;
  white-space: nowrap;
}

.uia-hist-card__slot-num {
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--uia-hist-accent-deep);
  letter-spacing: -0.02em;
}

.uia-hist-card__slot-sep {
  font-size: 0.5625rem;
  font-weight: 500;
  color: #94a3b8;
}

.uia-hist-card__slot-cap {
  font-size: 0.625rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #94a3b8;
}

.uia-hist-card__body {
  min-width: 0;
}

.uia-hist-card__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4375rem;
  margin-bottom: 0.15rem;
}

.uia-hist-card__runid {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uia-hist-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.4375rem;
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.uia-hist-badge--pass {
  background: #ecfdf5;
  color: #047857;
}

.uia-hist-badge--fail {
  background: #fef2f2;
  color: #b91c1c;
}

.uia-hist-badge--unk {
  background: #f1f5f9;
  color: #64748b;
}

.uia-hist-card__time {
  font-size: 0.6875rem;
  color: var(--uia-hist-muted);
  font-variant-numeric: tabular-nums;
}

.uia-hist-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
}

.uia-hist-link {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--uia-hist-accent-deep);
  text-decoration: none;
  padding: 0.2rem 0.35rem;
  border-radius: 5px;
  transition: background 0.12s, color 0.12s;
}

.uia-hist-link:hover {
  background: var(--uia-hist-accent-soft);
  color: #1e40af;
}

.uia-hist-link-btn {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  text-decoration: underline;
}

.uia-hist-link-btn:hover {
  color: var(--uia-hist-accent-deep);
}

.uia-hist-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.875rem;
  height: 1.875rem;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.uia-hist-icon-btn:hover {
  background: #fef2f2;
  color: #dc2626;
}

.uia-hist-icon-btn--view:hover {
  background: #eff6ff;
  color: var(--uia-hist-accent-deep);
}

/* —— Detail —— */
.uia-hist-detail-body {
  padding-top: 0.625rem;
}

#uia-history-detail-summary.uia-hist-detail-meta,
.uia-hist-detail-meta {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  margin-bottom: 0.75rem;
}

.uia-hist-meta-item {
  padding: 0.5625rem 0.6875rem;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e8f0fe;
}

.uia-hist-meta-label {
  display: block;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--uia-hist-muted);
  margin-bottom: 0.15rem;
}

.uia-hist-meta-value {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--uia-hist-text);
  word-break: break-all;
  line-height: 1.4;
}

.uia-hist-detail-links,
#uia-history-detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4375rem;
  margin-bottom: 0.75rem;
}

.uia-hist-detail-links a,
#uia-history-detail-links a {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border-radius: 7px;
  border: 1px solid var(--uia-hist-accent-border);
  background: var(--uia-hist-accent-soft);
  color: var(--uia-hist-accent-deep);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.uia-hist-detail-links a:hover,
#uia-history-detail-links a:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.uia-hist-video-wrap video,
#uia-history-detail-video video {
  width: 100%;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--uia-hist-border);
  background: #0f172a;
}

#uia-history-detail-video {
  margin-top: 0.625rem;
}

.uia-hist-shots,
#uia-history-detail-shots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.5625rem;
  margin-top: 0.625rem;
}

.uia-hist-shot {
  margin: 0;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--uia-hist-border-subtle);
  background: #f8fafc;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.uia-hist-shot:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.uia-hist-shot__frame {
  position: relative;
  cursor: zoom-in;
  background: #fff;
}

.uia-hist-shot__frame img {
  display: block;
  width: 100%;
  height: 6rem;
  object-fit: contain;
  background: #fff;
}

.uia-hist-shot__view {
  position: absolute;
  right: 0.3125rem;
  bottom: 0.3125rem;
  z-index: 1;
  padding: 0.1rem 0.4375rem;
  font-size: 0.625rem;
  line-height: 1.4;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(30, 58, 95, 0.78);
  color: #f8fafc;
  cursor: pointer;
}

.uia-hist-shot figcaption {
  padding: 0.3125rem 0.4375rem;
  font-size: 0.625rem;
  color: var(--uia-hist-muted);
  line-height: 1.35;
}

/* —— Delete modal —— */
.uia-del-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.uia-del-modal.is-hidden {
  display: none;
}

.uia-del-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 40, 80, 0.28);
  backdrop-filter: blur(10px);
}

.uia-del-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 22rem;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--uia-hist-border);
  box-shadow: 0 20px 48px rgba(30, 64, 175, 0.14);
  padding: 1.375rem 1.375rem 1.125rem;
}

.uia-del-modal__title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 650;
  color: #1e293b;
}

.uia-del-modal__lead {
  margin: 0 0 1.25rem;
  font-size: 0.8125rem;
  line-height: 1.65;
  color: var(--uia-hist-muted);
}

.uia-del-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.uia-del-modal__btn {
  border-radius: 8px;
  padding: 0.4375rem 0.9375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.uia-del-modal__btn--cancel {
  border: 1px solid var(--uia-hist-border-subtle);
  background: #fff;
  color: #475569;
}

.uia-del-modal__btn--cancel:hover {
  background: #f8fafc;
}

.uia-del-modal__btn--danger {
  border: 1px solid #fecaca;
  background: #fff;
  color: #dc2626;
}

.uia-del-modal__btn--danger:hover {
  background: #fef2f2;
}

.uia-del-modal__btn--danger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.uia-hist-table-fallback {
  display: none !important;
}

/* —— Lightbox —— */
.uia-shot-lightbox {
  position: fixed;
  inset: 0;
  z-index: 12050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.uia-shot-lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.uia-shot-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 40, 80, 0.55);
  backdrop-filter: blur(6px);
}

.uia-shot-lightbox__panel {
  position: relative;
  z-index: 1;
  width: min(960px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 0.875rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, #1e3a5f 0%, #0f2744 100%);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
  transform: translateY(8px) scale(0.985);
  transition: transform 0.2s ease;
}

.uia-shot-lightbox.is-open .uia-shot-lightbox__panel {
  transform: translateY(0) scale(1);
}

.uia-shot-lightbox__close {
  position: absolute;
  top: 0.625rem;
  right: 0.625rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  cursor: pointer;
}

.uia-shot-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.uia-shot-lightbox__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 12rem;
  max-height: calc(92vh - 5rem);
  overflow: auto;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
}

.uia-shot-lightbox__img {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 5rem);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
}

.uia-shot-lightbox__img.is-loading {
  opacity: 0.35;
}

.uia-shot-lightbox__caption {
  margin: 0;
  padding: 0 0.25rem;
  text-align: center;
  font-size: 0.8125rem;
  color: #cbd5e1;
}

body.uia-shot-lightbox-open {
  overflow: hidden;
}

@media (min-width: 1280px) {
  .uia-hist-page {
    --uia-hist-sidebar-width: 22rem;
    max-width: 82rem;
  }
}
