:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #687383;
  --line: #dce2ea;
  --accent: #1f7a5c;
  --accent-dark: #176147;
  --danger: #b54708;
  --soft: #eef7f3;
}

* {
  box-sizing: border-box;
}

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

.page {
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  flex-direction: column;
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand {
  color: var(--text);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0;
  text-decoration: none;
}

.search-panel {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.search-form {
  display: grid;
  width: min(560px, 100%);
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 8px;
}

input,
button {
  min-height: 54px;
  border-radius: 8px;
  font: inherit;
  letter-spacing: 0;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  padding: 0 16px;
  background: var(--panel);
  color: var(--text);
  font-size: 18px;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 122, 92, 0.14);
}

button {
  border: 0;
  display: grid;
  place-items: center;
  padding: 0;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.status {
  min-height: 0;
  margin-top: 0;
  color: var(--muted);
  font-size: 15px;
}

.status:not(:empty) {
  min-height: 24px;
  margin-top: 16px;
}

.status.error {
  color: var(--danger);
}

.results {
  display: grid;
  gap: 12px;
}

.has-results {
  overflow: hidden;
}

.has-results .page {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100vh;
  height: 100svh;
  padding-bottom: 0;
}

.has-results .search-panel {
  display: block;
  padding: 18px 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.has-results .search-form {
  margin: 0 auto;
}

.has-results .status {
  display: none;
}

.has-results .results {
  min-height: 0;
  overflow-y: auto;
  padding: 16px 0 28px;
  -webkit-overflow-scrolling: touch;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.program {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

.badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.neutral {
  background: #f1f3f6;
  color: var(--muted);
}

.meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.item {
  min-width: 0;
}

.label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.value {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--panel);
  text-align: center;
  color: var(--muted);
}

@media (max-width: 700px) {
  .page {
    width: min(100% - 20px, 960px);
    padding-top: 18px;
  }

  .brand {
    font-size: 24px;
  }

  .search-panel {
    flex: none;
    min-height: 0;
    padding: 96px 0 40px;
  }

  .has-results .search-panel {
    padding: 14px 0 10px;
  }

  .has-results .results {
    padding: 12px 0 22px;
  }

  .search-form {
    grid-template-columns: minmax(0, 1fr) 50px;
    gap: 6px;
  }

  input,
  button {
    min-height: 50px;
  }

  input {
    padding: 0 12px;
    font-size: 16px;
  }

  .card-header {
    display: grid;
  }

  .badge {
    justify-self: start;
  }

  .meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .meta {
    grid-template-columns: 1fr;
  }
}
