:root {
  color-scheme: light;
  --ink: #16201d;
  --muted: #5b6764;
  --line: #d8dedb;
  --panel: #ffffff;
  --soft: #f3f6f2;
  --green: #147d64;
  --green-soft: #dff3ec;
  --amber: #9a6200;
  --amber-soft: #fff1cf;
  --red: #a13b3b;
  --red-soft: #ffe5e2;
  --blue: #315f9f;
  --blue-soft: #e4eefc;
  --shadow: 0 12px 32px rgba(22, 32, 29, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef2ef;
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 0 14px;
  border-radius: 7px;
  cursor: pointer;
}

button:hover:not(:disabled),
.file-button:hover {
  border-color: var(--green);
  color: var(--green);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

a {
  color: var(--green);
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 18px 20px;
}

.workspace {
  display: grid;
  gap: 16px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 6px;
  font-size: 20px;
}

h3 {
  margin-bottom: 6px;
  font-size: 17px;
}

.server-state {
  max-width: min(100%, 620px);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  text-align: right;
  overflow-wrap: anywhere;
}

.server-state.limited {
  border-color: #e2c16d;
  background: var(--amber-soft);
  color: var(--amber);
}

.server-state.missing {
  border-color: #efbbb5;
  background: var(--red-soft);
  color: var(--red);
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.9fr);
  gap: 18px;
  align-items: start;
  padding: 4px 0 2px;
}

.intro h2 {
  margin-bottom: 6px;
}

.intro p {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.source-legend {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.source-legend div {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.source-legend div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.source-legend dt {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.source-legend dd {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.upload-band,
.controls,
.summary-grid,
.list-tools,
.results {
  width: 100%;
}

.upload-band {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  min-height: 132px;
  border: 2px dashed #b7c4bf;
  border-radius: 8px;
  background: var(--panel);
  padding: 24px;
  box-shadow: var(--shadow);
}

.upload-band.dragging {
  border-color: var(--green);
  background: var(--green-soft);
}

.upload-band p {
  color: var(--muted);
  margin-bottom: 0;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 138px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
}

.file-button input {
  display: none;
}

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

.control-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr);
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select,
input[type="search"] {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.combobox {
  position: relative;
}

.combo-menu {
  position: absolute;
  z-index: 10;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.combo-option {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.combo-menu .combo-option:hover,
.combo-menu .combo-option.active {
  background: var(--green-soft);
  color: var(--ink);
}

.combo-option strong,
.combo-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.combo-option span {
  color: var(--muted);
  font-size: 12px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.turnstile-row {
  margin-top: 0;
}

.turnstile-widget {
  min-height: 0;
}

.progress-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.progress-bar {
  height: 8px;
  overflow: hidden;
  background: var(--soft);
  border-radius: 999px;
}

.progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--green);
  transition: width 160ms ease;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.list-tools {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(200px, 280px);
  gap: 12px;
  align-items: end;
}

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

.metric strong {
  display: block;
  font-size: 24px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

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

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

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

.result-card.issue {
  border-left-color: var(--amber);
}

.result-card.ok {
  border-left-color: var(--green);
}

.result-card.error {
  border-left-color: var(--red);
}

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

.card-head p {
  margin-bottom: 0;
  color: var(--muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tag.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.tag.good {
  background: var(--green-soft);
  color: var(--green);
}

.tag.bad {
  background: var(--red-soft);
  color: var(--red);
}

.tag.info {
  background: var(--blue-soft);
  color: var(--blue);
}

.tag.detail {
  background: var(--soft);
  color: var(--muted);
}

.compare {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.provider {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 12px;
}

.provider h4 {
  position: relative;
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--muted);
}

.provider-title {
  position: relative;
  cursor: help;
  text-decoration: underline dotted #9aa8a3;
  text-underline-offset: 3px;
}

.provider-title::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  width: max-content;
  max-width: min(260px, 70vw);
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  text-transform: none;
  transform: translateY(-2px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.provider-title:hover::after,
.provider-title:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.provider-title:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.compare .provider:last-child .provider-title::after {
  right: 0;
  left: auto;
}

.provider dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 8px;
  margin: 0;
  font-size: 13px;
}

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

.provider dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.notes {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.notes li {
  margin: 4px 0;
}

.footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 18px 28px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 820px) {
  .topbar,
  .upload-band,
  .card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .control-row,
  .intro,
  .summary-grid,
  .list-tools,
  .compare {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 28px;
  }

  .tags {
    justify-content: flex-start;
  }

  .server-state {
    text-align: left;
  }
}
