.history-list { min-height: 0; }
.history-table-wrap { min-height: 100%; overflow-x: auto; }
.history-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.history-table th {
  height: 40px; padding: 0 var(--sp-5); border-bottom: 1px solid var(--line-subtle);
  background: var(--bg-panel); color: var(--fg-3); font-size: var(--text-xs);
  font-weight: var(--fw-medium); text-align: left; white-space: nowrap;
}
.history-table th:first-child, .history-table td:first-child { padding-left: var(--gutter); }
.history-table th:last-child, .history-table td:last-child { padding-right: var(--gutter); }
.history-table th:nth-child(2) { width: 180px; }
.history-table th:nth-child(3) { width: 180px; }
.history-table th:nth-child(4) { width: 132px; }
.history-table th:nth-child(5) { width: 104px; }
.history-table th:nth-child(6) { width: 56px; }
.history-table td {
  height: 68px; padding: var(--sp-3) var(--sp-5); border-bottom: 1px solid var(--line-subtle);
  color: var(--fg-2); font-size: var(--text-sm); vertical-align: middle;
}
.history-row { transition: background-color var(--dur-2) var(--ease-std); }
.history-row:hover { background: var(--row-hover); }
.history-device { display: flex; align-items: center; gap: var(--sp-4); min-width: 0; }
.history-device-icon {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 36px; height: 36px; border-radius: var(--r-md);
  background: var(--bg-raised); color: var(--fg-2);
}
.history-row[data-outcome="failed"] .history-device-icon { color: var(--fg-3); }
.history-device-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.history-device-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--fg); font-size: var(--text-md); font-weight: var(--fw-medium);
}
.history-device-code { color: var(--fg-3); font-size: var(--text-2xs); white-space: nowrap; }
.history-time { display: flex; flex-direction: column; gap: 2px; }
.history-time-date { color: var(--fg-2); font-size: var(--text-sm); }
.history-time-clock { color: var(--fg-3); font-size: var(--text-xs); }
.history-duration { color: var(--fg-2); font-size: var(--text-sm); white-space: nowrap; }
.history-muted { color: var(--fg-4); }
.history-col-action { text-align: right; }

.history-range { width: 132px; height: 32px; flex-shrink: 0; font-size: var(--text-sm); }
.history-pagination {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5);
  min-height: 52px; padding: 0 var(--gutter); border-top: 1px solid var(--line-subtle);
  background: var(--bg-panel); flex-shrink: 0;
}
.history-pagination:empty { display: none; }
.history-page-summary { color: var(--fg-3); font-size: var(--text-xs); }
.history-page-controls { display: flex; align-items: center; gap: var(--sp-3); }
.history-page-number { min-width: 56px; color: var(--fg-3); font-size: var(--text-xs); text-align: center; }

.history-skeleton td { height: 68px; }
.history-skel-device { display: flex; align-items: center; gap: var(--sp-4); }
.history-skel-avatar { width: 36px; height: 36px; flex-shrink: 0; }
.history-skel-time { width: 120px; height: 30px; }
.history-skel-short { width: 64px; height: 22px; }

.history-detail-device { display: flex; align-items: center; gap: var(--sp-4); min-width: 0; }
.history-detail-avatar {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 48px; height: 48px; border-radius: var(--r-md); background: var(--bg-overlay); color: var(--fg-2);
}
.history-detail-device-meta { display: flex; flex: 1; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.history-detail-device-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--fg); font-size: var(--text-lg); font-weight: var(--fw-semibold);
}
.history-detail-info {
  display: flex; flex-direction: column; padding-top: var(--sp-4); border-top: 1px solid var(--line-subtle);
}
.history-detail-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-6);
  min-height: 38px; padding: var(--sp-3) 0; border-bottom: 1px solid var(--line-subtle);
  font-size: var(--text-sm);
}
.history-detail-row:last-child { border-bottom: none; }
.history-detail-label { flex-shrink: 0; color: var(--fg-3); }
.history-detail-value { min-width: 0; color: var(--fg-2); text-align: right; overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .history-col-end { display: none; }
  .history-table th:nth-child(2) { width: 160px; }
  .history-table th:nth-child(4) { width: 120px; }
}

@media (max-width: 640px) {
  .history-col-duration { display: none; }
  .history-table th:nth-child(2) { width: 136px; }
  .history-table th:nth-child(5) { width: 88px; }
  .history-table th:nth-child(6) { width: 48px; }
  .history-table th, .history-table td { padding-left: var(--sp-3); padding-right: var(--sp-3); }
  .history-table th:first-child, .history-table td:first-child { padding-left: var(--sp-6); }
  .history-table th:last-child, .history-table td:last-child { padding-right: var(--sp-6); }
  .history-device-icon { display: none; }
  .history-filter { gap: var(--sp-3); }
  .history-filter .topbar-spacer { display: none; }
  .history-range { margin-left: auto; width: 120px; }
  .history-filter .seg button { padding: 0 var(--sp-3); }
  .history-pagination { padding: 0 var(--sp-6); }
}

@media (max-width: 440px) {
  .history-table th:nth-child(2) { width: 124px; }
  .history-table th:nth-child(5) { width: 80px; }
  .history-table th:nth-child(6) { width: 44px; }
  .history-time-date { font-size: var(--text-xs); }
  .history-page-summary { display: none; }
  .history-pagination { justify-content: flex-end; }
  .history-detail-row { gap: var(--sp-4); }
}
