:root {
  --ink: #092414;
  --muted: #61705b;
  --line: #d9ddbf;
  --panel: #ffffff;
  --page: #f4f5ea;
  --soft: #e8e8cf;
  --soft-green: #dddcaa;
  --accent: #7c9f14;
  --accent-strong: #315b00;
  --deep: #073f1c;
  --warning: #d94a22;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

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

header {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.wrap {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
}

h1,
h2,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 16px;
  margin-bottom: 14px;
}

p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

main {
  padding: 22px 0 42px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat,
.panel,
.order {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat {
  padding: 14px;
  min-height: 88px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

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

.notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: #fff;
}

.panel {
  padding: 16px;
  margin-bottom: 16px;
}

form {
  display: grid;
  gap: 12px;
}

.quick-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.quick-form .wide {
  grid-column: span 2;
}

.quick-form .full {
  grid-column: 1 / -1;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

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

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--deep);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

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

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--deep);
}

.secondary-button:hover {
  background: var(--soft);
}

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

.ghost:hover {
  background: var(--soft);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.toolbar input {
  max-width: 420px;
}

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

.order {
  padding: 14px;
}

.order-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.order-title {
  font-weight: 800;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.badge {
  align-self: start;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  background: var(--soft-green);
  color: var(--accent-strong);
  white-space: nowrap;
}

.badge.partial {
  background: #fff1e9;
  color: var(--warning);
}

.badge.warning {
  background: #fff1e9;
  color: var(--warning);
}

.badge.done {
  background: #eff5dd;
  color: var(--accent-strong);
}

.badge.danger {
  background: #fff0ed;
  color: var(--danger);
}

.progress-card {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #f8f9ef;
}

.progress-numbers {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.progress-numbers span {
  color: var(--muted);
}

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

.progress-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.delivery-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.order-details {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.order-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  color: var(--accent-strong);
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.order-details summary::-webkit-details-marker {
  display: none;
}

.order-details summary::after {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--deep);
}

.order-details[open] summary::after {
  content: "-";
}

.delivery-form .wide {
  grid-column: span 2;
}

.delivery-form .full {
  grid-column: 1 / -1;
}

.delivery-lines {
  display: grid;
  gap: 10px;
}

.delivery-line {
  display: grid;
  grid-template-columns: 140px 1.1fr 1.4fr 1.4fr;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf4;
}

.section-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.items,
.addresses,
.gallery,
.timeline {
  margin-top: 12px;
}

.item-grid {
  display: grid;
  gap: 8px;
}

.item-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.item-row span {
  overflow-wrap: anywhere;
}

.item-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.item-row i {
  display: block;
  height: 7px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft);
}

.item-row i b {
  display: block;
  height: 100%;
  background: var(--accent);
}

.item-row a,
.protocol-mini a {
  color: var(--accent-strong);
  font-weight: 800;
}

.address-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}

.address-row {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf4;
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.art-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.art {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f8faf2;
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.art img {
  width: 100%;
  height: 100%;
  max-height: 220px;
  object-fit: contain;
  background: #fff;
}

.timeline {
  display: grid;
  gap: 8px;
}

.timeline-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 10px;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: #fbfcf4;
}

.timeline-row span,
.timeline-row small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.protocol-mini {
  display: grid;
  align-content: start;
  justify-items: end;
  gap: 4px;
  font-size: 13px;
}

.empty,
.empty-gallery {
  padding: 24px 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  text-align: center;
}

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

.buyer-page {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.buyer-form {
  grid-template-columns: 1fr;
}

@media (max-width: 940px) {
  .stats,
  .quick-form,
  .quick-form .wide,
  .quick-form .full,
  .buyer-page,
  .delivery-form,
  .delivery-form .wide,
  .delivery-line,
  .item-row,
  .timeline-row {
    grid-template-columns: 1fr;
    grid-column: auto;
  }

  .topbar,
  .toolbar,
  .order-head,
  .progress-numbers {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar input {
    max-width: none;
  }

  .protocol-mini {
    justify-items: start;
  }
}
