/* =====================================================================
   dusktype — history view: summary cards, panels, tables
   ===================================================================== */
#historyView { width: 100%; padding-bottom: 0.625rem; }
.hv-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.875rem; }
.hv-title { color: var(--text); font-size: 1.4rem; }

/* segmented control (also used in settings) */
.seg { display: inline-flex; background: var(--panel); border-radius: 0.5rem; padding: 0.1875rem; flex-wrap: wrap; }
.seg button { padding: 0.25rem 0.625rem; border-radius: 0.375rem; color: var(--sub); font-size: .78rem; transition: color var(--t), background-color var(--t); }
.seg button:hover { color: var(--text); }
.seg button.active { color: var(--main); background: var(--bg); }
.btn {
  padding: 0.4375rem 0.875rem; border-radius: 0.5rem;
  background: var(--panel); color: var(--sub); font-size: .8rem;
  transition: color var(--t), background-color var(--t);
}
.btn:hover { color: var(--text); background: var(--sub-alt); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.625rem; }
.card { background: var(--panel); border-radius: 0.5rem; padding: 0.75rem 1rem; }
.card .k { font-size: .72rem; color: var(--sub); }
.card .v { font-size: 1.7rem; line-height: 1.25; color: var(--text); }
.panel { background: var(--panel); border-radius: 0.5rem; padding: 0.875rem 1rem; margin-top: 0.75rem; }
.panel h3 { margin: 0 0 0.625rem; font-weight: 400; font-size: .78rem; color: var(--sub); display: flex; gap: 0.875rem; flex-wrap: wrap; align-items: center; }
.legend { display: inline-flex; align-items: center; gap: 0.375rem; }
.legend i { display: inline-block; width: 0.75rem; height: 0.1875rem; border-radius: 2px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 0.75rem; }
.grid2 .panel { margin-top: 0.75rem; }
.scroll { max-height: 27.5rem; overflow: auto; }

table { width: 100%; border-collapse: collapse; font-size: .78rem; }
th {
  position: sticky; top: 0; background: var(--panel);
  color: var(--sub); font-weight: 400; text-align: right;
  padding: 0.375rem 0.5rem; white-space: nowrap; user-select: none;
}
#histTable th { cursor: pointer; transition: color var(--t); }
#histTable th:hover { color: var(--text); }
th.sorted { color: var(--main); }
th:first-child, td:first-child { text-align: left; }
td { color: var(--text); text-align: right; padding: 0.375rem 0.5rem; border-top: 1px solid var(--sub-alt); white-space: nowrap; }
td.empty { text-align: center; color: var(--sub); padding: 1.125rem; }
tbody tr { transition: background-color var(--t); }
tbody tr[data-ts] { cursor: pointer; }
#histTable td:last-child { width: 1px; padding: 2px 0.25rem; }
.race-btn {
  display: inline-grid; place-items: center;
  width: 1.625rem; height: 1.375rem; border-radius: 0.3125rem;
  color: var(--sub);
  transition: color var(--t), background-color var(--t);
}
.race-btn:hover { color: var(--main); background: var(--sub-alt); }
.race-btn svg { width: 0.8125rem; height: 0.8125rem; }
tbody tr:hover td { background: rgba(67, 62, 85, .35); }

@media (max-width: 760px) {
  .grid2 { grid-template-columns: 1fr; }
}
