:root {
  --paper: #f4f1eb;
  --surface: #fffdf9;
  --surface-soft: #ebe7df;
  --ink: #151a20;
  --muted: #606b77;
  --line: #d9d4ca;
  --accent: #cf442d;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html { color-scheme: light; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
}

a { color: inherit; }

.catalog-shell {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}

.catalog-header {
  padding: 30px 0 28px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(110deg, rgba(207, 68, 45, 0.08), transparent 42%),
    var(--surface);
}

.back-link {
  display: inline-flex;
  margin-bottom: 30px;
  color: var(--muted);
  font: 600 12px var(--mono);
  text-decoration: none;
}

.back-link:hover,
.back-link:focus-visible { color: var(--accent); }

h1 { font-family: var(--serif); }

h1 {
  max-width: 900px;
  margin: 0;
  font-size: clamp(2.35rem, 5vw, 4rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.lede {
  max-width: 840px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.catalog-main { padding: 26px 0 64px; }

.catalog-toolbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(244, 241, 235, 0.96);
  box-shadow: 0 10px 30px rgba(21, 26, 32, 0.07);
  backdrop-filter: blur(10px);
}

.catalog-count {
  min-width: 5.5rem;
  margin: 0;
  color: var(--muted);
  font: 600 11px var(--mono);
  white-space: nowrap;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(150px, 220px);
  gap: 10px;
}

.filter-row label { display: grid; gap: 5px; }

.filter-row label > span {
  color: var(--muted);
  font: 700 10px var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  padding: 8px 10px;
}

input:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.catalog-table-wrap {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.catalog-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.catalog-table th,
.catalog-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.catalog-table tr:last-child td { border-bottom: 0; }

.catalog-table th {
  background: var(--ink);
  color: #f7f5f0;
  font: 700 10px var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.catalog-table th:nth-child(1) { width: 13%; }
.catalog-table th:nth-child(2) { width: 23%; }
.catalog-table th:nth-child(3) { width: 27%; }
.catalog-table th:nth-child(4) { width: 37%; }

.catalog-table tbody tr:hover { background: rgba(207, 68, 45, 0.035); }

.agent-cell {
  font-size: 0.83rem;
  font-weight: 700;
}

.tag-cell { overflow-wrap: anywhere; }

.tag-token {
  display: block;
  color: var(--accent);
  font: 700 0.79rem/1.45 var(--mono);
  white-space: normal;
}

.context-cell,
.note-cell {
  color: #37414b;
  font-size: 0.82rem;
  line-height: 1.52;
}

.empty-state {
  margin: 0;
  padding: 48px 24px;
  color: var(--muted);
  text-align: center;
}

footer {
  padding: 30px 0;
  background: var(--ink);
  color: #c8ced4;
  font-size: 0.78rem;
}

footer .catalog-shell {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

footer p { margin: 0; }
footer a { color: white; text-decoration: none; }

@media (max-width: 820px) {
  .catalog-shell { width: min(100% - 32px, 1180px); }
  .catalog-toolbar { position: static; grid-template-columns: 1fr; }
  .catalog-table-wrap { overflow: visible; border: 0; background: transparent; }
  .catalog-table,
  .catalog-table tbody { display: block; }
  .catalog-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .catalog-table tr {
    display: grid;
    grid-template-columns: minmax(94px, 0.28fr) minmax(0, 0.72fr);
    margin-bottom: 10px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
  }
  .catalog-table td { border-bottom: 1px solid var(--line); }
  .catalog-table td:nth-child(3),
  .catalog-table td:nth-child(4) { grid-column: 1 / -1; }
  .catalog-table td:last-child { border-bottom: 0; }
}

@media (max-width: 560px) {
  body { font-size: 14px; }
  .catalog-header { padding-top: 24px; }
  .back-link { margin-bottom: 26px; }
  .catalog-main { padding-top: 24px; }
  .filter-row { grid-template-columns: 1fr; }
  footer .catalog-shell { flex-direction: column; }
}
