:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #697386;
  --line: #d8dee8;
  --paper: #f7f8fb;
  --panel: #ffffff;
  --accent: #146c5f;
  --accent-strong: #0f544a;
  --warn: #9b4d20;
  --focus: #2f80ed;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

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

button:hover {
  border-color: #aeb8c7;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.primary:hover {
  background: var(--accent-strong);
}

button.secondary {
  background: #f4f6f8;
}

button.compact {
  width: fit-content;
}

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

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
  margin-bottom: 16px;
}

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

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.status {
  min-height: 24px;
  margin-bottom: 12px;
  color: var(--accent-strong);
  font-size: 14px;
}

.status.error {
  color: #b42318;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

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

.span-2 {
  grid-column: 1 / -1;
}

.fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

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

.fields.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 6px;
}

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

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

textarea {
  resize: vertical;
  min-height: 44px;
}

input:focus,
textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.14);
}

.goods-table {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.goods-head,
.goods-row {
  display: grid;
  grid-template-columns: 1fr 0.7fr 1fr 2.1fr 0.8fr 0.8fr 42px;
  min-width: 920px;
}

.goods-head {
  background: #eef2f6;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.goods-head span,
.goods-row > label,
.goods-row > div {
  border-right: 1px solid var(--line);
  padding: 8px;
}

.goods-head span:last-child,
.goods-row > div:last-child {
  border-right: 0;
}

.goods-row {
  border-top: 1px solid var(--line);
}

.goods-row input {
  border: 0;
  border-radius: 0;
  padding: 7px 0;
  box-shadow: none;
}

.goods-row label span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.remove-row {
  width: 28px;
  min-height: 28px;
  padding: 0;
  color: var(--warn);
}

#addGoodsRow {
  margin-top: 12px;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 1240px);
    padding-top: 14px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions button {
    flex: 1 1 150px;
  }

  .form-grid,
  .fields.two,
  .fields.three {
    grid-template-columns: 1fr;
  }
}
