:root {
  color-scheme: light;
  --bg: #f7f4ef;
  --ink: #18212b;
  --navy: #172334;
  --steel: #465460;
  --muted: #6f7780;
  --line: #e1dbd3;
  --card: #ffffff;
  --paper: #fbfaf7;
  --accent: #c21f32;
  --accent-dark: #911625;
  --accent-soft: #f8e7e9;
  --gold: #b98222;
  --danger: #b42318;
  --shadow: 0 16px 40px rgba(16, 24, 32, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

.site-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  justify-content: center;
  gap: 24px;
  min-height: 64px;
  padding: 0 clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-self: center;
  color: var(--navy);
  text-decoration: none;
  text-align: center;
}

.brand strong,
.brand em {
  display: block;
  font-style: normal;
  line-height: 1.1;
}

.brand strong {
  font-size: 1.35rem;
  letter-spacing: 0.08em;
}

.brand em {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-self: end;
  justify-content: flex-end;
}

.site-nav a {
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--steel);
  font-size: 0.92rem;
  font-weight: 650;
  text-decoration: none;
  transition: background 140ms ease, color 140ms ease;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

.card,
.result {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}

.status-card {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-self: start;
  max-width: 320px;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
}

.status-card strong {
  display: block;
  color: var(--navy);
  font-size: 0.78rem;
  line-height: 1.1;
}

.status-card p {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 10;
  width: max-content;
  max-width: 320px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.15;
  opacity: 0;
  overflow-wrap: anywhere;
  pointer-events: none;
  visibility: hidden;
  white-space: pre-line;
}

.status-card:hover p {
  opacity: 1;
  visibility: visible;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(185, 130, 34, 0.14);
}

.status-dot.ready {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(194, 31, 50, 0.12);
}

.status-dot.error {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}

.grid {
  display: grid;
  gap: 20px;
}

.card {
  padding: clamp(22px, 4vw, 34px);
  box-shadow: var(--shadow);
}

.card-header {
  margin-bottom: 24px;
}

.card h2 {
  margin-bottom: 8px;
  color: var(--navy);
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.card p {
  max-width: 640px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

form {
  display: grid;
  gap: 16px;
}

.split {
  display: grid;
  grid-template-columns: minmax(160px, 0.45fr) 1fr;
  gap: 14px;
}

label {
  display: block;
  margin-bottom: 7px;
  color: var(--steel);
  font-size: 0.9rem;
  font-weight: 650;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(194, 31, 50, 0.1);
}

.autocomplete {
  position: relative;
}

.suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  display: none;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.suggestions.show {
  display: block;
}

.suggestions button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  border-radius: 0;
  padding: 10px 12px;
  background: #ffffff;
  box-shadow: none;
  color: var(--ink);
  text-align: left;
}

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

.suggestions span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestions em {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 700;
}

button {
  justify-self: start;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease, box-shadow 140ms ease;
  box-shadow: 0 10px 20px rgba(194, 31, 50, 0.16);
}

button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.result {
  display: none;
  margin-top: 22px;
  padding: 18px;
  background: var(--paper);
}

.result.show {
  display: block;
}

.result.error {
  border-color: rgba(180, 35, 24, 0.28);
  background: #fff5f4;
  color: var(--danger);
}

.result h3 {
  margin: 0 0 12px;
  color: var(--navy);
  font-size: 1.05rem;
  line-height: 1.3;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.fact {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #ffffff;
}

.fact span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.fact strong {
  display: block;
  line-height: 1.35;
}

.rep-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.rep-list-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
}

.rep-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f4f1ec;
}

.rep-list-header span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.rep-list-header strong {
  color: var(--steel);
  font-size: 0.78rem;
}

.rep-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
  max-height: 260px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  list-style: none;
}

.rep-list li {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: var(--paper);
}

.rep-list li strong,
.rep-list li span {
  display: block;
}

.rep-list li strong {
  color: var(--navy);
  line-height: 1.25;
}

.rep-list li span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

.rep-details {
  display: grid;
  gap: 3px;
  margin-top: 6px;
}

.rep-details span {
  margin-top: 0;
}

.rep-section + .rep-section {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.result-stack {
  display: grid;
  gap: 14px;
}

.table-wrap {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

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

th {
  position: sticky;
  top: 0;
  background: #f4f1ec;
  color: var(--steel);
  font-size: 0.8rem;
  font-weight: 700;
}

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

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

@media (max-width: 820px) {
  .site-header {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 18px;
  }

  .status-card,
  .site-nav {
    justify-self: center;
  }

  .site-nav {
    justify-content: center;
  }

  .split {
    grid-template-columns: 1fr;
  }

  .shell {
    padding-top: 24px;
  }
}
