:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #172026;
  --muted: #64737f;
  --line: #d9e0e5;
  --primary: #0c6b58;
  --primary-dark: #094e41;
  --danger: #a63f3f;
  --accent: #b98720;
  --shadow: 0 18px 40px rgba(23, 32, 38, 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 {
  font: inherit;
}

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

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

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

h1,
h2,
p {
  margin: 0;
}

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

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

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

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

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

.form,
.jsonPanel {
  padding: 20px;
}

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

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

.requestRows {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.requestRow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.rowTop {
  grid-column: 1 / -1;
}

legend {
  padding: 0;
  font-weight: 700;
}

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

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

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

.features {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sizeHint {
  grid-column: 1 / -1;
  min-height: 38px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.sizeHint[data-mode="ok"] {
  border-color: rgba(12, 107, 88, 0.35);
  background: rgba(12, 107, 88, 0.08);
  color: var(--primary-dark);
}

.sizeHint[data-mode="warning"] {
  border-color: rgba(185, 135, 32, 0.42);
  background: rgba(185, 135, 32, 0.1);
  color: #775414;
}

.sizeHint[data-mode="error"] {
  border-color: rgba(166, 63, 63, 0.42);
  background: rgba(166, 63, 63, 0.1);
  color: var(--danger);
}

.features label {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: #fff;
}

.features input {
  width: 15px;
  min-height: 15px;
  margin: 0 6px 0 0;
}

.mutedLine {
  min-height: 34px;
  padding: 8px 0;
  color: var(--muted);
  font-size: 13px;
}

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

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

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

.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;
}

.iconButton {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--primary);
  font-size: 24px;
  line-height: 1;
}

.iconButton.danger {
  color: var(--danger);
}

pre {
  min-height: 420px;
  max-height: 620px;
  margin: 16px 0 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #172026;
  color: #e9f1f2;
  font-size: 12px;
  line-height: 1.55;
}

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

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

.total {
  color: var(--accent);
  font-size: 24px;
  font-weight: 800;
  white-space: nowrap;
}

.tableWrap {
  overflow: auto;
}

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

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

th {
  position: sticky;
  top: 0;
  background: #eef3f2;
  color: #314049;
  font-size: 12px;
  text-transform: uppercase;
}

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

.thumb {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  background: #eef3f2;
}

.nameCell {
  min-width: 260px;
  font-weight: 700;
}

.subtle {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

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

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

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

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

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

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

  .form,
  .jsonPanel {
    padding: 14px;
  }

  .requestRow {
    grid-template-columns: 1fr;
    padding: 13px;
  }

  h1 {
    font-size: 23px;
  }
}
