.history-page {
  display: grid;
  gap: 16px;
}

.history-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.history-header h2 {
  margin: 0 0 4px;
  font-size: 24px;
}

.history-header p {
  margin: 0;
  color: var(--text-muted, #64748b);
  font-size: 14px;
}

.history-header form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.history-header input,
.history-header button,
.history-status button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 10px;
  color: inherit;
  background: var(--surface, #fff);
  font: inherit;
}

.history-header button,
.history-status button {
  border-color: #059669;
  color: #fff;
  background: #059669;
  cursor: pointer;
}

.history-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 10px 14px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  color: var(--text-muted, #64748b);
  background: var(--surface, #fff);
  font-size: 14px;
}

.history-status.error {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}

.history-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 14px;
  background: var(--surface, #fff);
}

.history-table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
  font-size: 14px;
}

.history-table th,
.history-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  text-align: left;
  white-space: nowrap;
}

.history-table th {
  color: var(--text-muted, #64748b);
  font-size: 12px;
  font-weight: 700;
  background: rgba(148, 163, 184, 0.08);
}

.history-table a {
  color: #047857;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
}

.history-table .number,
.history-table time {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.history-table .positive { color: #059669; }
.history-table .negative { color: #dc2626; }

.history-type,
.history-grade {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 700;
}

.history-type { color: #047857; background: #d1fae5; }
.history-type.type-retest_reclaim { color: #1d4ed8; background: #dbeafe; }
.history-type.type-higher_box_breakout { color: #7e22ce; background: #f3e8ff; }
.history-grade { color: #334155; background: #f1f5f9; }

.history-skeleton span {
  display: block;
  height: 24px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(148,163,184,.12), rgba(148,163,184,.28), rgba(148,163,184,.12));
  background-size: 200% 100%;
  animation: history-loading 1.2s linear infinite;
}

@keyframes history-loading { to { background-position: -200% 0; } }

@media (max-width: 760px) {
  .history-header,
  .history-header form {
    align-items: stretch;
    flex-direction: column;
  }

  .history-header input,
  .history-header button {
    width: 100%;
  }

  .history-table-wrap {
    border-radius: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .history-skeleton span { animation: none; }
}
