:root {
  --ink: #17201c;
  --muted: #65706b;
  --line: #d8ded9;
  --surface: #ffffff;
  --page: #f4f7f3;
  --accent: #0c6b58;
  --accent-strong: #084b3e;
  --accent-soft: #dcefe8;
  --warn: #a3362d;
  --warn-soft: #f8e5e0;
  --shadow: 0 12px 32px rgba(22, 32, 28, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  background: var(--page);
}

button,
input {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  color: #fff;
  background: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

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

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

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

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

button.danger {
  color: var(--warn);
  border: 1px solid #ecc9c4;
  background: #fff;
}

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

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

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

textarea {
  width: 100%;
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fbfcfb;
  font: inherit;
  line-height: 1.45;
  resize: vertical;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.1;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 16px;
  color: var(--accent-strong);
  background: #fff;
  font-weight: 800;
  white-space: nowrap;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 34px;
}

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

.add-panel,
.selected-panel,
.catalog-panel {
  padding: 18px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.section-heading.compact {
  align-items: center;
}

.add-form label,
.search-box span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.message {
  min-height: 22px;
  margin-top: 10px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.message.error {
  color: var(--warn);
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.empty-state {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 62px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--muted);
  background: #fbfcfb;
}

.empty-state strong {
  color: var(--ink);
}

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

.selection-output {
  display: block;
  margin-top: 12px;
}

.selection-output span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.table-wrap.tall {
  max-height: 560px;
}

.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

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

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #f9fbf8;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.item-cell {
  width: 82px;
  color: var(--accent-strong);
  font-weight: 900;
}

.brand-cell {
  min-width: 250px;
  color: var(--ink);
}

.brand-name {
  display: block;
  font-weight: 800;
}

.note-text {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.qty-control {
  display: grid;
  grid-template-columns: 38px 54px 38px;
  width: 130px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.qty-control button {
  min-height: 36px;
  border-radius: 0;
  padding: 0;
  color: var(--accent-strong);
  background: #f8fbf9;
}

.qty-control button:hover {
  background: var(--accent-soft);
}

.qty-input {
  min-height: 36px;
  border: 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 0 4px;
  text-align: center;
  box-shadow: none;
}

.remove-button,
.add-button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.remove-button {
  color: var(--warn);
  border: 1px solid #ecc9c4;
  background: #fff;
}

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

.search-box {
  width: min(360px, 100%);
}

.flash {
  animation: flash-row 1.3s ease-out;
}

@keyframes flash-row {
  0% {
    background: var(--accent-soft);
  }
  100% {
    background: transparent;
  }
}

@media (min-width: 900px) {
  .app-shell {
    grid-template-columns: 0.88fr 1.12fr;
  }

  .add-panel {
    grid-column: 1;
  }

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

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

@media (max-width: 720px) {
  .app-header {
    align-items: flex-start;
    padding: 22px 14px 14px;
  }

  h1 {
    font-size: 26px;
  }

  .app-shell {
    padding: 0 14px 24px;
  }

  .add-panel,
  .selected-panel,
  .catalog-panel {
    padding: 14px;
  }

  .section-heading,
  .section-heading.compact {
    display: block;
  }

  .action-group {
    justify-content: flex-start;
    margin-top: 12px;
  }

  .input-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .empty-state {
    display: block;
  }

  .empty-state span {
    display: block;
    margin-top: 5px;
  }
}
