:root {
  --bg: #f4f1ec;
  --surface: #fffefb;
  --text: #1c1917;
  --muted: #57534e;
  --border: #d6d3d1;
  --accent: #1e3a5f;
  --accent-soft: #e8eef4;
  --accent-hover: #2d4a73;
  --ok: #166534;
  --warn: #9a3412;
  --shadow: 0 1px 3px rgb(28 25 23 / 8%), 0 8px 24px rgb(28 25 23 / 6%);
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(165deg, #ebe6de 0%, var(--bg) 40%, #e9ecef 100%);
  line-height: 1.5;
}

.site-header {
  background: var(--accent);
  color: #f8fafc;
  padding: 1.75rem 1.25rem 2rem;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 920px;
  margin: 0 auto;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.subtitle {
  margin: 0.5rem 0 0;
  opacity: 0.9;
  font-size: 0.95rem;
}

.meta-subtitle {
  margin-top: 0.25rem;
  opacity: 0.78;
  font-size: 0.875rem;
}

.disclaimer {
  margin: 1rem 0 0;
  font-size: 0.875rem;
  opacity: 0.85;
}

.disclaimer a {
  color: #bfdbfe;
}

.container {
  max-width: 920px;
  margin: -1.25rem auto 2rem;
  padding: 0 1rem;
  display: grid;
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem;
}

.intro p {
  margin: 0;
  color: var(--muted);
}

.popular h2 {
  margin: 0;
  font-size: 1.05rem;
}

.popular-intro {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.65rem;
  margin-top: 1rem;
}

.popular-card {
  display: block;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: inherit;
  text-decoration: none;
}

.popular-card:hover,
.popular-card:focus {
  background: var(--accent-soft);
  outline: none;
}

.popular-card strong,
.popular-card span,
.popular-card small {
  display: block;
}

.popular-card strong {
  line-height: 1.35;
}

.popular-card span {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.popular-card small {
  margin-top: 0.35rem;
  color: var(--accent);
  font-weight: 600;
}

.mode-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.tab {
  flex: 1;
  min-width: 10rem;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.field {
  display: block;
}

.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.input-date {
  width: auto;
  min-width: 11rem;
}

.input-date:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hint {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.suggestions {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 16rem;
  overflow-y: auto;
  background: #fff;
}

.suggestions li {
  border-bottom: 1px solid var(--border);
}

.suggestions li:last-child {
  border-bottom: none;
}

.suggestions button {
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.85rem;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.suggestions button:hover,
.suggestions button:focus {
  background: var(--accent-soft);
  outline: none;
}

.suggestions .sub {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.suggestions .code,
.suggestions .branch {
  font-weight: 600;
  color: var(--text);
}

.results-header h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.35;
}

.results-header .code,
.results-header .branch {
  font-weight: 600;
}

.results-meta {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.rcsi-card {
  margin: 1rem 0 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.rcsi-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  align-items: baseline;
}

.rcsi-note {
  color: var(--muted);
  font-size: 0.85rem;
}

.rcsi-status-link a {
  color: var(--accent);
}

.rcsi-levels {
  color: var(--ok);
  font-weight: 600;
}

.rcsi-dates {
  color: var(--muted);
}

.rcsi-card a {
  display: inline-block;
  margin-top: 0.4rem;
  color: var(--accent);
}

/* Indexing cards side by side */
.indexing-row {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.indexing-row > .rcsi-card {
  flex: 1;
  min-width: 0;
  margin-top: 0;
}


.spec-tools {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.spec-tools .primary-link {
  display: inline-block;
  color: var(--accent);
  font-weight: 600;
}

.spec-tools span {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.result-list {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.65rem;
}

.result-item {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.result-item.clickable {
  padding: 0;
}

.result-link {
  display: block;
  padding: 0.85rem 1rem;
  color: inherit;
  text-decoration: none;
  border-radius: 8px;
}

.result-link:hover,
.result-link:focus {
  background: var(--accent-soft);
  outline: none;
}

.result-item .code {
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.result-item .spec-heading {
  margin: 0;
}

.result-item .title {
  margin-top: 0.25rem;
}

.result-item .branch {
  font-weight: 600;
  color: var(--text);
}

.result-item .dates {
  margin-top: 0.45rem;
  font-size: 0.85rem;
}

.dates .from {
  color: var(--ok);
}

.dates .to {
  color: var(--warn);
}

.dates .unreliable {
  border-bottom: 1px dotted currentColor;
  cursor: help;
}

.dates .muted {
  color: var(--muted);
}

.group-label {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.group-label:first-child {
  margin-top: 0.5rem;
}

.empty p {
  margin: 0;
  color: var(--muted);
}

.empty code {
  font-size: 0.9em;
  background: var(--accent-soft);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.loading {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted);
}

.site-footer {
  text-align: center;
  padding: 1.5rem 1rem 2.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.site-footer a {
  color: var(--accent);
}

@media (max-width: 520px) {
  .mode-tabs {
    flex-direction: column;
  }

  .tab {
    min-width: 0;
  }
}
