/* The recent-records dialog: a sheet over the viewer with two tabs, records and aggregates. */

.records {
  width: 100%;
  max-width: min(32em, 100%);
  height: 100%;
  max-height: 100%;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: var(--surface);
  color: var(--ink);
}

.records::backdrop {
  background: rgba(17, 26, 33, 0.6);
}

.records-sheet {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-top: 4px solid var(--honey);
}

.records-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1em;
  padding: max(0.9em, env(safe-area-inset-top)) 1em 0.5em;
}

.records-heading {
  display: flex;
  flex-direction: column;
  gap: 0.15em;
}

.records-heading h2 {
  font-size: 1.3em;
  font-weight: 700;
  line-height: 1.15;
}

.records-robot {
  color: var(--ink-muted);
  font-size: 0.9em;
}

.records-close {
  padding: 0.4em 0.85em;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* two equal tabs; the open one is underlined in honey */
.records-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 0 1em;
  border-bottom: 1px solid var(--line);
}

.records-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  padding: 0.7em 0.5em 0.6em;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--ink-muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.records-tab[aria-selected="true"] {
  border-bottom-color: var(--honey);
  color: var(--ink);
}

.tab-count {
  padding: 0.05em 0.5em;
  border-radius: 1em;
  background: var(--surface-sunk);
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
}

.records-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.6em;
  padding: 0.9em 1em 1.2em;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y; /* vertical scrolling stays the browser's; a sideways swipe switches tabs */
}

.records-explain {
  color: var(--ink-muted);
  font-size: 0.9em;
}

.records-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.record {
  display: flex;
  flex-direction: column;
  gap: 0.15em;
  padding: 0.7em 0;
  border-bottom: 1px solid var(--line);
}

.record-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75em;
}

.record-name {
  font-weight: 700;
}

.record-age {
  color: var(--ink-muted);
  font-size: 0.85em;
  white-space: nowrap;
}

.record-detail {
  color: var(--ink-muted);
  font-size: 0.9em;
}

.record-link {
  color: var(--focus);
  font-size: 0.9em;
  font-weight: 600;
}

.records-empty {
  padding: 1.5em 0;
  color: var(--ink-muted);
  text-align: center;
}

.records-more {
  align-self: center;
}

.records-foot {
  padding: 0.6em 1em max(0.8em, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 0.75em;
}

/* the button on the full card that opens the dialog */
.tag-open {
  padding: 0.55em 0.8em;
  border: 1px solid var(--honey-deep);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9em;
  font-weight: 700;
  cursor: pointer;
}

@media (prefers-reduced-motion: no-preference) {
  .records[open] {
    animation: sheet-in 0.18s ease-out;
  }
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(1.5em);
  }
}
