:root {
  --page-bg: #f5f7fa;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --success: #15803d;
  --success-soft: #f0fdf4;
  --error: #dc2626;
  --error-soft: #fef2f2;
  --shadow: 0 1px 2px rgb(15 23 42 / 5%);
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", monospace;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background: var(--page-bg);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

h1,
h2,
p {
  margin: 0;
}

.catalog-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 32px 0 40px;
}

.page-header {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.breadcrumb {
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 12px;
}

h1 {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.intro {
  margin-top: 6px;
  color: var(--text-secondary);
}

.status-badge {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  color: var(--success);
  background: var(--success-soft);
  font-size: 13px;
  font-weight: 550;
}

.status-mark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

body[data-state="error"] .status-badge {
  border-color: #fecaca;
  color: var(--error);
  background: var(--error-soft);
}

body[data-state="error"] .status-mark {
  background: var(--error);
}

.summary-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 0.7fr)) minmax(220px, 1.4fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.summary-item {
  display: flex;
  min-width: 0;
  min-height: 94px;
  padding: 18px 20px;
  border-right: 1px solid var(--border);
  flex-direction: column;
  justify-content: space-between;
}

.summary-item:last-child {
  border-right: 0;
}

.summary-label {
  color: var(--text-secondary);
  font-size: 12px;
}

.summary-value {
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1;
}

.summary-item--primary .summary-value {
  color: var(--accent);
}

.summary-time {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.catalog-card {
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}

h2 {
  font-size: 17px;
  font-weight: 650;
}

.card-header p {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 13px;
}

.revision-wrap {
  min-width: 0;
  max-width: 420px;
  text-align: right;
}

.revision-wrap span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-secondary);
  font-size: 12px;
}

.revision-wrap code {
  display: block;
  overflow: hidden;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 240px)) 1fr;
  gap: 14px;
  align-items: end;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-subtle);
}

.filter-toolbar label span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 550;
}

select {
  width: 100%;
  min-height: 38px;
  padding: 0 34px 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
}

select:focus-visible {
  border-color: var(--accent);
  outline: 3px solid var(--accent-soft);
}

select:disabled {
  color: var(--text-secondary);
  background: #f3f4f6;
  cursor: not-allowed;
}

.visible-count {
  justify-self: end;
  padding-bottom: 9px;
  color: var(--text-secondary);
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 13px 22px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th {
  color: var(--text-secondary);
  background: var(--surface-subtle);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #f8fbff;
}

.mono {
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}

.empty-state {
  padding: 56px 22px;
  color: var(--text-secondary);
  text-align: center;
}

.error-state {
  color: var(--error);
}

footer {
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 18px 2px 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
}

.usage-note {
  margin-top: 2px;
}

#source-line {
  max-width: 46%;
  overflow-wrap: anywhere;
  text-align: right;
}

@media (max-width: 800px) {
  .catalog-shell {
    width: min(100% - 28px, 1120px);
    padding-top: 24px;
  }

  .summary-panel {
    grid-template-columns: repeat(2, 1fr);
  }

  .summary-item:nth-child(2) {
    border-right: 0;
  }

  .summary-item:nth-child(-n + 2) {
    border-bottom: 1px solid var(--border);
  }

  .filter-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .visible-count {
    grid-column: 1 / -1;
    justify-self: start;
    padding-bottom: 0;
  }
}

@media (max-width: 560px) {
  .page-header,
  .card-header,
  footer {
    flex-direction: column;
  }

  .status-badge {
    align-self: flex-start;
  }

  .summary-panel,
  .filter-toolbar {
    grid-template-columns: 1fr;
  }

  .summary-item,
  .summary-item:nth-child(2) {
    min-height: 82px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .summary-item:last-child {
    border-bottom: 0;
  }

  .revision-wrap,
  #source-line {
    width: 100%;
    max-width: none;
    text-align: left;
  }

  .visible-count {
    grid-column: auto;
  }

  th,
  td {
    padding-inline: 16px;
  }
}
