@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,700&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --paper: #f4efe3;
  --paper-strong: #e7ddc8;
  --paper-soft: rgba(255, 251, 243, 0.74);
  --ink: #1f2a27;
  --muted: #66716d;
  --accent: #9b4d24;
  --accent-soft: #c76a39;
  --rule: rgba(64, 53, 42, 0.18);
  --line: rgba(64, 53, 42, 0.12);
  --chip: #efe3c7;
  --chip-active: #203730;
  --chip-active-text: #f8f3e7;
  --shadow: 0 20px 60px rgba(49, 38, 29, 0.12);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'IBM Plex Sans', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(155, 77, 36, 0.10), transparent 28%),
    linear-gradient(180deg, #f8f3e8 0%, #f1eadc 100%);
}

a,
button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 20px auto;
  border: 1px solid var(--rule);
  border-radius: 24px;
  background: var(--paper-soft);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.site-header {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 20px;
  align-items: center;
  padding: 32px;
  border-bottom: 1px solid var(--rule);
  background:
    linear-gradient(135deg, rgba(32, 55, 48, 0.07), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
}

.masthead-mark {
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  border-radius: 22px;
  background:
    linear-gradient(145deg, #203730, #39574e);
  color: #f8f3e7;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.masthead-mark span {
  font-family: 'Fraunces', serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  font-weight: 600;
}

.site-title {
  margin: 0;
  font-family: 'Fraunces', serif;
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 0.95;
}

.site-subtitle {
  margin: 10px 0 0;
  max-width: 760px;
  font-size: 1.05rem;
  color: var(--muted);
}

.content {
  padding: 28px 32px 20px;
}

.intro p {
  margin: 0 0 24px;
  max-width: 900px;
  color: #36403d;
  line-height: 1.65;
}

.controls-panel,
.table-panel {
  border: 1px solid var(--rule);
  border-radius: 20px;
  background: rgba(255, 252, 246, 0.86);
}

.controls-panel {
  padding: 18px;
  margin-bottom: 18px;
}

.search-field {
  display: block;
}

.search-field span {
  display: block;
  margin-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.search-field input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: white;
  color: var(--ink);
}

.search-field input:focus {
  outline: 2px solid rgba(155, 77, 36, 0.18);
  border-color: rgba(155, 77, 36, 0.38);
}

.type-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 16px;
}

.type-filter {
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--chip);
  color: #4c4d42;
  padding: 8px 14px;
}

.type-filter.active {
  background: var(--chip-active);
  color: var(--chip-active-text);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.action-button {
  border: 1px solid rgba(32, 55, 48, 0.18);
  border-radius: 12px;
  padding: 10px 14px;
  background: #203730;
  color: #f8f3e7;
  font-weight: 600;
}

.action-button.ghost {
  background: transparent;
  color: var(--ink);
}

.status-line {
  margin: 0;
  min-height: 1.4em;
  color: var(--muted);
  font-size: 0.95rem;
}

.table-wrap {
  overflow: auto;
  border-radius: 20px;
}

.systems-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

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

.systems-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, #f7f1e3, #eee3cb);
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5d5a4f;
}

.systems-table thead th[data-key] {
  cursor: pointer;
  user-select: none;
}

.systems-table tbody tr:nth-child(even) {
  background: rgba(244, 239, 227, 0.72);
}

.systems-table tbody tr:hover {
  background: rgba(155, 77, 36, 0.06);
}

.systems-table tbody tr.is-selected {
  background: rgba(32, 55, 48, 0.10);
  box-shadow: inset 4px 0 0 #203730;
}

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

.id-link,
.name-link {
  color: inherit;
  text-decoration: none;
}

.id-link {
  font-weight: 700;
  color: var(--accent);
}

.name-link {
  font-weight: 600;
}

.type-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(32, 55, 48, 0.08);
  color: #274038;
  white-space: nowrap;
  font-size: 0.88rem;
}

.summary-copy {
  max-width: 48ch;
  line-height: 1.55;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(155, 77, 36, 0.10);
  color: #7a4a2d;
  font-size: 0.84rem;
}

.first-mention {
  color: #44504c;
  white-space: nowrap;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--rule);
  color: #6d6b63;
  font-size: 0.82rem;
}

.footer-sep {
  color: #b8aa91;
}

@media (max-width: 820px) {
  .page-shell {
    width: min(100vw - 18px, 1280px);
    margin: 9px auto;
    border-radius: 18px;
  }

  .site-header {
    grid-template-columns: 1fr;
    padding: 22px 18px;
  }

  .masthead-mark {
    width: 72px;
    height: 72px;
    border-radius: 18px;
  }

  .content {
    padding: 18px;
  }

  .controls-panel {
    padding: 14px;
  }
}
