/* ═══════════════════════════════════════════
   HQ Spawn History View (Task 7, 2026-07-12)
   Dense console table over spawn_observations.
   Table cells reuse .projects-table* (settings.css, globally linked).
   ═══════════════════════════════════════════ */

.history-view {
  flex: 1;
  overflow: auto;
  padding: var(--space-5) var(--space-7);
}

.history-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.history-header__title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 900;
  line-height: 1.1;
}

.history-header__sub {
  font-size: var(--text-sm);
  color: var(--color-dim);
  margin-top: 2px;
}

.history-table {
  min-width: 720px;
}

.history-th {
  cursor: pointer;
  user-select: none;
}

.history-th:hover {
  color: var(--color-text);
}

.history-th.is-sorted {
  color: var(--color-amber);
}

.history-row {
  cursor: pointer;
}

/* ── Surface switch (Spawns | Roundtables) ── */
.history-surface {
  display: flex;
  gap: 4px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 3px;
}

.history-surface__btn {
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-dim);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 6px 14px;
  min-height: 38px;
  cursor: pointer;
}

.history-surface__btn.is-active {
  background: var(--color-amber-dim);
  color: var(--color-amber);
}

/* ── Pager ── */
.history-pager {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.history-pager__btn {
  min-width: 44px;
  min-height: 40px;
  padding: 4px 12px;
}

.history-pager__label {
  font-size: var(--text-sm);
  color: var(--color-dim);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ── Detail drawer ── */
.history-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
}

/* The class's display:flex beats the UA's [hidden]{display:none} — without
   this override the drawer renders open-and-empty on load and the close
   button appears dead (Brian bug 2026-07-12; same pattern as
   .more-sheet-overlay[hidden] in layout.css). */
.history-drawer-overlay[hidden] {
  display: none;
}

.history-drawer {
  width: min(420px, 92vw);
  height: 100%;
  background: var(--color-panel);
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  box-shadow: -16px 0 40px rgba(0, 0, 0, 0.4);
}

.history-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  padding-top: max(var(--space-4), env(safe-area-inset-top));
  border-bottom: 1px solid var(--color-border);
}

.history-drawer__title {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-drawer__body {
  padding: var(--space-4);
  overflow-y: auto;
}

.history-drawer__field {
  margin-bottom: var(--space-3);
}

.history-drawer__actions {
  margin-bottom: var(--space-4);
  display: flex;
  gap: 8px;
}

.history-drawer__label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-dim);
  margin-bottom: 2px;
}

.history-drawer__value {
  font-size: var(--text-base);
  overflow-wrap: anywhere;
}

.history-drawer__dim {
  color: var(--color-dim);
  font-size: var(--text-sm);
}

.history-drawer__mono {
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .history-view {
    padding: var(--space-4) var(--space-3);
  }

  .history-header__title {
    font-size: var(--text-2xl);
  }

  .history-drawer {
    width: 100vw;
    border-left: none;
  }
}
