:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #696f75;
  --line: #dde2e0;
  --paper: #fbfbf8;
  --panel: #ffffff;
  --green: #1f8a5b;
  --mint: #dff4e9;
  --coral: #e95f3f;
  --amber: #f7b733;
  --shadow: 0 18px 50px rgba(21, 31, 28, 0.1);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100%;
  font-family: "Roboto", Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(31, 138, 91, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(233, 95, 63, 0.08), transparent 30%),
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 0.95;
}

h1 {
  font-size: clamp(3rem, 8vw, 6.5rem);
}

h2 {
  font-size: 2.4rem;
}

.status-pill,
.counter {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  white-space: nowrap;
}

.status-pill.ready {
  border-color: rgba(31, 138, 91, 0.28);
  color: var(--green);
}

.status-pill.error {
  border-color: rgba(233, 95, 63, 0.28);
  color: var(--coral);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(520px, 1.18fr);
  gap: 18px;
  align-items: start;
}

.catalog-panel,
.order-panel,
.setup-card {
  border: 1px solid rgba(23, 23, 23, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.catalog-panel,
.order-panel {
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 18px 12px;
  padding: 0 14px;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
}

.filters,
.quick-add,
.submit-area {
  display: grid;
  gap: 12px;
}

.filters {
  grid-template-columns: 1fr 1fr;
  padding: 0 18px 18px;
}

select,
input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  outline-color: rgba(31, 138, 91, 0.35);
}

.catalog-list {
  height: min(670px, calc(100vh - 260px));
  min-height: 420px;
  overflow: auto;
  padding: 0 10px 14px;
}

.catalog-group {
  padding: 8px;
}

.result-notice {
  margin: 8px 8px 4px;
  padding: 12px 14px;
  border: 1px solid rgba(31, 138, 91, 0.2);
  border-radius: 8px;
  background: var(--mint);
  color: var(--green);
}

.result-notice strong,
.result-notice span {
  display: block;
}

.result-notice span {
  margin-top: 4px;
  font-size: 0.86rem;
  color: #28684e;
}

.group-title {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 8px;
  background: rgba(251, 251, 248, 0.94);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.product-item {
  display: grid;
  grid-template-columns: 82px 1fr auto auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  margin: 5px 0;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  background: transparent;
  text-align: left;
  color: var(--ink);
}

.product-item:hover,
.product-item:focus-visible {
  border-color: rgba(31, 138, 91, 0.22);
  background: var(--mint);
}

.article {
  color: var(--green);
  font-weight: 700;
}

.product-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.tag.grill {
  background: rgba(233, 95, 63, 0.12);
  color: var(--coral);
}

.quick-add {
  grid-template-columns: minmax(220px, 1fr) 112px auto;
  align-items: end;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(31, 138, 91, 0.05);
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.primary-button,
.send-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 8px;
  font-weight: 700;
}

.primary-button,
.send-button {
  min-height: 44px;
  padding: 0 16px;
  color: #fff;
  background: var(--ink);
}

.primary-button:hover,
.send-button:hover {
  background: var(--green);
}

.send-button {
  min-width: 190px;
  background: var(--green);
}

.send-button:hover {
  background: #146a45;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.icon-button:hover {
  color: var(--ink);
  border-color: rgba(23, 23, 23, 0.18);
}

.icon-button.danger:hover {
  color: var(--coral);
  border-color: rgba(233, 95, 63, 0.28);
}

.order-table-wrap {
  overflow: auto;
}

.order-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.order-table th {
  padding: 14px 16px;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: left;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

.order-table th:nth-child(1) {
  width: 33%;
}

.order-table th:nth-child(2) {
  width: 22%;
}

.order-table th:nth-child(3) {
  width: 130px;
}

.order-table th:nth-child(5) {
  width: 58px;
}

.order-table td {
  padding: 12px 16px;
  vertical-align: middle;
  border-bottom: 1px solid rgba(221, 226, 224, 0.68);
}

.order-table td strong,
.order-table td span {
  display: block;
}

.order-table td span,
.order-table small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.small-input {
  max-width: 96px;
}

.note-input {
  min-width: 150px;
}

.empty-row td,
.empty-state {
  color: var(--muted);
  text-align: center;
}

.empty-row td {
  padding: 54px 16px;
}

.empty-row i,
.empty-state i {
  display: block;
  margin-bottom: 10px;
  font-size: 1.6rem;
}

.empty-state {
  padding: 46px 18px;
}

.empty-state strong,
.empty-state span {
  display: block;
}

.submit-area {
  grid-template-columns: minmax(150px, 0.8fr) minmax(180px, 1fr) auto;
  align-items: end;
  padding: 18px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100% - 44px));
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  background: var(--green);
}

.toast.error {
  background: var(--coral);
}

.setup-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
}

.setup-card {
  width: min(620px, 100%);
  padding: 28px;
}

.setup-card h1 {
  font-size: 4rem;
  margin-bottom: 10px;
}

.setup-card p {
  color: var(--muted);
  line-height: 1.6;
}

.setup-form {
  display: grid;
  gap: 16px;
  margin: 24px 0;
}

.setup-message {
  margin: 18px 0;
  padding: 13px 14px;
  border-radius: 8px;
  font-weight: 700;
}

.setup-message.success {
  background: var(--mint);
  color: var(--green);
}

.setup-message.error {
  background: rgba(233, 95, 63, 0.12);
  color: var(--coral);
}

.setup-link {
  color: var(--green);
  font-weight: 700;
}

@media (max-width: 1050px) {
  .workspace,
  .quick-add,
  .submit-area {
    grid-template-columns: 1fr;
  }

  .catalog-list {
    height: auto;
    max-height: 520px;
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 20px, 1500px);
    padding: 18px 0;
  }

  .topbar,
  .panel-head,
  .order-head,
  .filters {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 3.6rem;
  }

  .product-item {
    grid-template-columns: 72px 1fr auto;
  }

  .product-item .tag {
    grid-column: 2 / 3;
    width: fit-content;
  }

  .order-table {
    min-width: 760px;
  }
}
