.gps-history-root {
  color: var(--text-primary, #172033);
}

.gps-history-form {
  display: grid;
  grid-template-columns: minmax(150px, 1.3fr) repeat(4, minmax(120px, 1fr)) auto;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--border, #dfe4ee);
  border-radius: 12px;
  background: var(--surface, #fff);
}

.gps-history-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--text-secondary, #667085);
  font-size: 12px;
  font-weight: 600;
}

.gps-history-form input,
.gps-history-form select,
.gps-history-submit {
  width: 100%;
  min-height: 36px;
  box-sizing: border-box;
  border: 1px solid var(--border, #d0d7e2);
  border-radius: 8px;
  background: #fff;
  color: #172033;
  padding: 8px 10px;
  font: inherit;
}

.gps-history-submit {
  width: auto;
  min-width: 112px;
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.gps-history-submit:disabled {
  cursor: not-allowed;
  opacity: .58;
}

.gps-history-message {
  min-height: 20px;
  padding: 8px 4px 6px;
  color: var(--text-secondary, #667085);
  font-size: 13px;
}

.gps-history-message[data-state="error"] { color: #b42318; }
.gps-history-message[data-state="warning"] { color: #9a6700; }

.gps-history-map {
  width: 100%;
  height: 280px;
  margin: 2px 0 10px;
  overflow: hidden;
  border: 1px solid var(--border, #dfe4ee);
  border-radius: 12px;
  background: #eef2f6;
}

.gps-history-results {
  border: 1px solid var(--border, #dfe4ee);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.gps-history-summary {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border, #e6eaf0);
  color: var(--text-secondary, #667085);
  font-size: 13px;
  font-weight: 600;
}

.gps-history-header,
.gps-history-row {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr) 76px 66px 66px;
  gap: 8px;
  align-items: center;
}

.gps-history-header {
  padding: 7px 10px;
  background: #f6f8fb;
  color: var(--text-secondary, #667085);
  font-size: 12px;
  font-weight: 700;
}

.gps-history-row {
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-top: 1px solid var(--border, #edf0f4);
  background: #fff;
  color: #172033;
  text-align: left;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.3;
}

.gps-history-row:hover,
.gps-history-row:focus-visible {
  background: #f4f7ff;
  outline: none;
}

.gps-history-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.gps-history-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  border-top: 1px solid var(--border, #e6eaf0);
}

.gps-history-pagination button {
  min-height: 36px;
  border: 1px solid var(--border, #d0d7e2);
  border-radius: 8px;
  background: #fff;
  color: #253047;
  padding: 7px 13px;
  cursor: pointer;
}

.gps-history-pagination button:disabled { cursor: not-allowed; opacity: .45; }
.gps-history-pagination span { color: var(--text-secondary, #667085); font-size: 12px; }

@media (max-width: 900px) {
  .gps-history-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gps-history-form label:first-child,
  .gps-history-submit { grid-column: 1 / -1; width: 100%; }
  .gps-history-map { height: 300px; }
  .gps-history-header { display: none; }
  .gps-history-row { grid-template-columns: 1fr; gap: 7px; padding: 13px 14px; }
  .gps-history-row span { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px; }
  .gps-history-row span::before { content: attr(data-label); color: var(--text-secondary, #667085); font-size: 12px; font-weight: 700; }
}

@media (max-width: 480px) {
  .gps-history-form { grid-template-columns: 1fr; padding: 12px; }
  .gps-history-form label:first-child,
  .gps-history-submit { grid-column: auto; }
  .gps-history-map { height: 270px; border-radius: 10px; }
  .gps-history-row span { grid-template-columns: 72px minmax(0, 1fr); }
  .gps-history-pagination { gap: 8px; }
  .gps-history-pagination button { padding-inline: 10px; }
}

/* The mobile workbench also renders inside a phone-width frame on desktop. */
#mobileGpsHistory .gps-history-form { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0; }
#mobileGpsHistory .gps-history-form label:first-child,
#mobileGpsHistory .gps-history-submit { grid-column: 1 / -1; width: 100%; }
#mobileGpsHistory .gps-history-form input,
#mobileGpsHistory .gps-history-form select { min-width: 0; }
#mobileGpsHistory .gps-history-map { box-sizing: border-box; }
#mobileGpsHistory .gps-history-header { display: none; }
#mobileGpsHistory .gps-history-row { grid-template-columns: minmax(0, 1fr); gap: 7px; box-sizing: border-box; }
#mobileGpsHistory .gps-history-row span { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px; }
#mobileGpsHistory .gps-history-row span::before { content: attr(data-label); color: var(--text-secondary, #667085); font-size: 12px; font-weight: 700; }
