:root {
  color-scheme: light;
  --bg: #f3f5f7;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #627080;
  --line: #d9e0e7;
  --primary: #146b5a;
  --primary-dark: #0e4f43;
  --warn: #9a6815;
  --bad: #a63f3f;
  --ok: #146b5a;
  --soft-bad: #faeeee;
  --soft-warn: #fff5df;
  --soft-ok: #eaf6f1;
  --shadow: 0 16px 42px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app {
  width: min(1540px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar,
.workspace,
.resultSection {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 92px;
  padding: 20px 24px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
  font-weight: 780;
}

h2 {
  font-size: 17px;
  line-height: 1.25;
}

.topbar p,
.resultHeader p {
  margin-top: 5px;
  color: var(--muted);
}

.status {
  min-width: 120px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--primary-dark);
  text-align: center;
  font-size: 14px;
  font-weight: 760;
}

.status[data-mode="busy"] {
  color: var(--warn);
}

.status[data-mode="error"] {
  color: var(--bad);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  margin-top: 18px;
  overflow: hidden;
}

.inputPanel,
.criteriaPanel {
  padding: 20px;
}

.criteriaPanel {
  border-left: 1px solid var(--line);
  background: #fbfcfd;
}

.panelHeader,
.actions,
.resultHeader,
.resultTools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.controlsGrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 14px;
  margin-top: 16px;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input,
select {
  min-height: 40px;
  padding: 8px 10px;
}

textarea {
  min-height: 220px;
  margin-top: 16px;
  padding: 12px;
  resize: vertical;
  line-height: 1.45;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(20, 107, 90, 0.14);
}

.actions {
  justify-content: flex-end;
  margin-top: 16px;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 760;
}

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

.primaryButton,
.secondaryButton {
  padding: 0 16px;
}

.primaryButton {
  background: var(--primary);
  color: #fff;
}

.primaryButton:hover {
  background: var(--primary-dark);
}

.secondaryButton {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.compact {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.criteriaList {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.criteriaList div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.criteriaList span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.resultSection {
  margin-top: 18px;
  overflow: hidden;
}

.resultHeader {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.resultTools select {
  width: 190px;
}

.tableWrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1280px;
  border-collapse: collapse;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef3f2;
  color: #31404a;
  font-size: 12px;
  text-transform: uppercase;
}

a {
  color: var(--primary-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.siteCell {
  min-width: 230px;
  font-weight: 720;
}

.siteCell span {
  display: block;
  max-width: 310px;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 780;
  white-space: nowrap;
}

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

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

.badge.ok {
  background: var(--soft-ok);
  color: var(--ok);
}

.findings {
  min-width: 340px;
  max-width: 520px;
  line-height: 1.38;
}

.empty {
  height: 92px;
  color: var(--muted);
  text-align: center;
  vertical-align: middle;
}

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

  .criteriaPanel {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

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

@media (max-width: 680px) {
  .app {
    width: min(100% - 20px, 1540px);
    padding-top: 10px;
  }

  .topbar,
  .resultHeader,
  .resultTools {
    align-items: flex-start;
    flex-direction: column;
  }

  .inputPanel,
  .criteriaPanel {
    padding: 14px;
  }

  h1 {
    font-size: 23px;
  }

  .resultTools,
  .resultTools select,
  .resultTools button {
    width: 100%;
  }
}
