:root {
  --bg: #eef2f1;
  --surface: #fffffb;
  --surface-strong: #f2f6f5;
  --ink: #17201d;
  --muted: #66716c;
  --line: #d5ded9;
  --line-strong: #aebbb5;
  --accent: #176b5c;
  --accent-dark: #0c4f43;
  --accent-soft: #dceeea;
  --warning: #9d6816;
  --danger: #9b2c2c;
  --shadow: 0 16px 34px rgba(24, 35, 31, 0.09);
  --shadow-tight: 0 8px 18px rgba(24, 35, 31, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background:
    linear-gradient(rgba(238, 242, 241, 0.96), rgba(238, 242, 241, 0.96)),
    repeating-linear-gradient(90deg, rgba(23, 32, 29, 0.045) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(0deg, rgba(23, 32, 29, 0.035) 0 1px, transparent 1px 72px);
  background-attachment: fixed;
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 0 24px;
  background: rgba(255, 255, 251, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 720;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #fffefb;
  background: linear-gradient(135deg, var(--ink), var(--accent-dark));
  border-radius: 6px;
  font-size: 12px;
}

.topnav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.topnav a,
.link-button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.topnav a:hover,
.link-button:hover {
  color: var(--ink);
  background: var(--surface-strong);
}

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

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

.workspace-header h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.05;
  font-weight: 780;
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.breadcrumbs a {
  color: var(--accent-dark);
  text-decoration: none;
}

.breadcrumbs a:hover,
.breadcrumbs a:focus-visible {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.breadcrumbs span[aria-hidden="true"] {
  color: var(--line-strong);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.metrics {
  display: flex;
  gap: 8px;
}

.metrics div {
  min-width: 118px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-tight);
}

.metrics span {
  display: block;
  font-size: 22px;
  font-weight: 780;
}

.metrics small {
  color: var(--muted);
}

.order-header-actions {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.metrics .order-total-metric {
  min-width: 162px;
}

.order-vat-summary {
  display: grid;
  gap: 2px;
  margin-bottom: 6px;
}

.order-vat-summary small {
  font-size: 11px;
}

.order-title-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.order-title-line span {
  color: var(--muted);
  font-size: 15px;
  font-weight: 720;
}

.order-download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.order-download-menu {
  position: relative;
  align-self: flex-start;
  display: inline-flex;
}

.order-download-menu summary {
  list-style: none;
  cursor: pointer;
}

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

.order-download-options {
  position: absolute;
  z-index: 10;
  top: 100%;
  right: 0;
  display: grid;
  min-width: 240px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(12, 79, 67, 0.16);
}

.order-download-options a {
  padding: 9px 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 720;
  text-decoration: none;
  border-radius: 7px;
}

.order-download-options a:hover,
.order-download-options a:focus {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.order-detail-footer {
  display: flex;
  margin-top: 18px;
}

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

.message {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.message-success {
  border-color: #8bb7a9;
  background: var(--accent-soft);
}

.message-error {
  color: var(--danger);
  border-color: #d6a2a2;
  background: #fff3f3;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) minmax(210px, 0.85fr) minmax(210px, 0.85fr) minmax(190px, 0.75fr) auto auto auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.mobile-filter-panel,
.mobile-catalog,
.mobile-cart,
.mobile-orders,
.mobile-order-items {
  display: none;
}

.field {
  display: grid;
  gap: 6px;
}

.field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  line-height: 1;
}

.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.inline-add input,
.auth-form input {
  width: 100%;
  min-height: 38px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
}

.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.auth-form input {
  padding: 0 10px;
}

.field select {
  height: 38px;
  padding-right: 34px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%230c4f43' d='M1.4 1.2 6 5.8l4.6-4.6L12 2.6l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 10px 7px;
  line-height: normal;
}

.field input:not([type="checkbox"]):not([type="radio"]):focus,
.field select:focus,
.inline-add input:focus,
.auth-form input:focus,
.multi-select[open] summary {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.multi-select {
  position: relative;
  min-width: 0;
}

.multi-select summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 0 10px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
  list-style: none;
  outline: 0;
}

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

.multi-select summary strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.multi-select summary b {
  color: var(--accent-dark);
  font-size: 15px;
}

.multi-select[open] summary b {
  transform: rotate(180deg);
}

.multi-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  gap: 3px;
  max-height: 330px;
  overflow: auto;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.supplier-menu {
  max-height: 240px;
}

.category-menu {
  align-content: start;
}

.category-menu-search {
  position: sticky;
  top: -8px;
  z-index: 1;
  display: grid;
  gap: 5px;
  margin: -8px -8px 4px;
  padding: 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.category-menu-search span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}

.category-menu-search input {
  width: 100%;
  min-height: 34px;
  padding: 0 9px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: 0;
}

.category-menu-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.category-menu-empty {
  padding: 12px 8px;
  color: var(--muted);
  font-size: 13px;
}

.category-menu .is-hidden {
  display: none !important;
}

.checkline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  color: var(--ink);
}

.checkline input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.checkline.compact {
  min-height: 38px;
  padding: 0 8px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.option-line {
  min-height: 34px;
  padding: 6px 8px;
  border-radius: 7px;
  width: 100%;
}

.option-line:hover {
  background: var(--surface-strong);
}

.muted {
  color: var(--muted);
}

.primary-button {
  min-height: 38px;
  padding: 0 15px;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 720;
}

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

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 13px;
  color: var(--accent-dark);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-weight: 720;
}

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

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

.catalog-head,
.catalog-row {
  display: grid;
  grid-template-columns: minmax(320px, 1.9fr) minmax(160px, 0.9fr) minmax(130px, 0.7fr) minmax(90px, 0.45fr) minmax(100px, 0.5fr) minmax(130px, 0.55fr);
  align-items: center;
  gap: 12px;
}

.catalog-head {
  min-height: 42px;
  padding: 0 14px;
  color: var(--muted);
  background: #e2ebe7;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.catalog-row {
  min-height: 54px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
}

.catalog-row:last-child,
.catalog-group:last-child .catalog-row:last-child {
  border-bottom: 0;
}

.catalog-row:hover {
  background: #f6faf8;
}

.catalog-group {
  border-bottom: 1px solid var(--line);
}

.catalog-group:last-child {
  border-bottom: 0;
}

.catalog-group summary {
  cursor: pointer;
  list-style: none;
}

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

.group-row {
  background: #f2f7f5;
}

.offer-list {
  background: #fff;
}

.offer-row {
  padding-left: 34px;
}

.product-cell {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.product-cell strong {
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.product-cell small {
  color: var(--muted);
}

.badge {
  padding: 2px 7px;
  color: var(--warning);
  background: #fff5dd;
  border: 1px solid #dfc17a;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 720;
}

.row-action {
  color: var(--muted);
  text-align: center;
  font-size: 18px;
}

.inline-add {
  display: grid;
  grid-template-columns: minmax(64px, 1fr) 38px;
  gap: 6px;
  align-items: center;
}

.inline-add input {
  min-width: 0;
  padding: 0 6px;
}

.inline-add button {
  width: 38px;
  height: 38px;
  color: #fff;
  background: var(--ink);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.inline-add button:hover {
  background: var(--accent);
}

.empty-state {
  padding: 22px 14px;
  color: var(--muted);
}

.desktop-cart .cart-head,
.desktop-cart .cart-row {
  grid-template-columns: 42px minmax(300px, 1.7fr) minmax(140px, 0.7fr) minmax(190px, 0.8fr) minmax(110px, 0.5fr) minmax(110px, 0.5fr) minmax(90px, 0.4fr);
}

.desktop-orders .cart-head,
.desktop-orders .cart-row {
  grid-template-columns: minmax(320px, 1.7fr) minmax(140px, 0.7fr) minmax(90px, 0.4fr) minmax(110px, 0.5fr) minmax(110px, 0.5fr);
}

.cart-selection-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-tight);
}

.cart-select-all,
.mobile-cart-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 720;
}

.cart-selection-toolbar > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.cart-item-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.cart-item-checkbox:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.cart-row-unavailable {
  background: #fff8f7;
}

.cart-item-unavailable {
  display: block;
  margin-top: 5px;
  color: #a0332c;
  font-size: 12px;
  font-weight: 680;
  line-height: 1.3;
}

.cart-quantity-form {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.cart-quantity-form input {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 0 8px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.compact-button {
  min-height: 34px;
  padding: 0 10px;
  white-space: nowrap;
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 13px;
  color: #fff;
  background: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 7px;
  cursor: pointer;
  font-weight: 720;
}

.danger-button:hover {
  background: #7d2020;
}

.deactivate-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 13px;
  color: #fff;
  background: #66716c;
  border: 1px solid #66716c;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 720;
}

.deactivate-button:hover {
  background: #4d5853;
}

.order-head {
  grid-template-columns: minmax(80px, 0.35fr) minmax(145px, 0.7fr) minmax(170px, 0.85fr) minmax(120px, 0.55fr) minmax(80px, 0.35fr) minmax(120px, 0.5fr) 40px;
}

.order-row {
  position: relative;
  grid-template-columns: minmax(0, 1fr) 40px;
  padding: 0 8px 0 14px;
}

.order-row-main {
  display: grid;
  grid-template-columns: minmax(80px, 0.35fr) minmax(145px, 0.7fr) minmax(170px, 0.85fr) minmax(120px, 0.55fr) minmax(80px, 0.35fr) minmax(120px, 0.5fr);
  align-items: center;
  align-self: stretch;
  gap: 12px;
  padding: 8px 0;
}

.order-row-main > a {
  align-self: stretch;
  display: flex;
  align-items: center;
}

.order-total-breakdown {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.order-total-breakdown strong {
  color: var(--ink);
  font-size: 12px;
}

.order-status-dropdown {
  position: relative;
  width: max-content;
}

.order-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  color: #4c5752;
  background: #eef2f0;
  border: 1px solid #cbd5d0;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  font-weight: 760;
  line-height: 1.2;
}

.order-status-dropdown > summary {
  padding-right: 30px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234c5752' d='M1.4 1.2 6 5.8l4.6-4.6L12 2.6l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px 7px;
  list-style: none;
}

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

.order-status-dropdown > summary:hover,
.order-status-dropdown[open] > summary {
  border-color: #9daa9f;
  background-color: #e7ece9;
}

.order-status-dropdown > summary:focus {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(102, 113, 108, 0.18);
}

.order-status-badge.order-status-ready {
  color: #0f5f2c;
  background-color: #dff4e5;
  border-color: #88c79a;
}

.order-status-dropdown > summary.order-status-ready {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%230f5f2c' d='M1.4 1.2 6 5.8l4.6-4.6L12 2.6l-6 6-6-6z'/%3E%3C/svg%3E");
}

.order-status-dropdown > summary.order-status-ready:hover,
.order-status-dropdown[open] > summary.order-status-ready {
  border-color: #52a96e;
  background-color: #d3efdc;
}

.order-status-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 35;
  min-width: 130px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.order-status-menu form {
  margin: 0;
}

.order-status-option {
  width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  color: #4c5752;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-size: 13px;
  font-weight: 720;
}

.order-status-option:hover,
.order-status-option[aria-current="true"] {
  background: #eef2f0;
}

.order-status-option.order-status-ready {
  color: #0f5f2c;
}

.order-status-option.order-status-ready:hover,
.order-status-option.order-status-ready[aria-current="true"] {
  background: #dff4e5;
}

.desktop-orders {
  overflow: visible;
}

.order-actions-menu {
  position: relative;
  justify-self: center;
}

.order-actions-menu summary {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 20px;
  font-weight: 760;
  line-height: 1;
  list-style: none;
}

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

.order-actions-menu summary:hover,
.order-actions-menu[open] summary {
  color: var(--ink);
  background: var(--surface-strong);
}

.order-actions-menu > div {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 30;
  min-width: 150px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-tight);
}

.order-actions-menu form {
  margin: 0;
}

.order-actions-menu button {
  width: 100%;
  padding: 8px 10px;
  color: var(--danger);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-weight: 720;
}

.order-actions-menu button:hover {
  background: #fff3f3;
}

a.catalog-row:hover {
  color: var(--accent-dark);
}

.checkout-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 14px;
}

.checkout-total {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  line-height: 1;
}

.checkout-total span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  text-transform: uppercase;
  line-height: 1;
}

.checkout-total strong {
  font-size: 18px;
  line-height: 1;
}

.checkout-bar .primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}

.pagination a,
.pagination span {
  min-height: 36px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.pagination a:hover {
  border-color: var(--accent);
}

.auth-panel {
  width: min(420px, 100%);
  margin: 70px auto;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-panel h1 {
  margin: 0 0 18px;
}

.auth-form p {
  display: grid;
  gap: 6px;
}

.auth-form label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.control-header {
  align-items: center;
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 14px;
  margin-bottom: 14px;
}

.control-panel {
  min-width: 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-tight);
}

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

.control-panel-heading h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
  font-weight: 780;
}

.control-panel-heading .eyebrow {
  margin-bottom: 4px;
}

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

.control-field-wide {
  grid-column: 1 / -1;
}

.control-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.control-actions .primary-button {
  min-width: 210px;
}

.form-errors,
.errorlist {
  margin: 0 0 10px;
  padding: 8px 10px;
  color: var(--danger);
  background: #fff3f3;
  border: 1px solid #d6a2a2;
  border-radius: 7px;
  list-style-position: inside;
}

.field .errorlist {
  margin: 6px 0 0;
  font-size: 12px;
}

.credentials-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.credentials-panel-empty {
  min-height: 245px;
}

.credentials-user {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.credentials-user span {
  color: var(--muted);
  font-size: 12px;
}

.credentials-output {
  width: 100%;
  min-height: 142px;
  padding: 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  resize: vertical;
  outline: 0;
}

.credentials-output:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.copy-button {
  width: 100%;
}

.muted-text {
  color: var(--muted);
}

.credentials-placeholder {
  display: grid;
  place-items: center;
  min-height: 152px;
  color: var(--line-strong);
  background: var(--surface-strong);
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  font-size: 42px;
}

.user-management {
  padding: 0;
  overflow: hidden;
}

.supplier-stock-panel {
  padding: 0;
  overflow: hidden;
  margin-top: 22px;
  margin-bottom: 14px;
}

.category-override-panel {
  margin-top: 14px;
}

.category-override-panel .control-panel-heading > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.category-override-search {
  display: flex;
  align-items: end;
  gap: 10px;
}

.category-override-search .field {
  flex: 1;
}

.category-override-search .primary-button {
  min-width: 100px;
}

.category-override-results {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.category-override-result-count {
  margin: 0;
  padding: 9px 12px;
  color: var(--muted);
  background: var(--surface-strong);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 720;
}

.category-override-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(240px, 0.7fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.category-override-row:last-child {
  border-bottom: 0;
}

.category-override-product {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.category-override-product strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-override-product span,
.category-override-product small {
  color: var(--muted);
  font-size: 12px;
}

.category-override-product small {
  color: #0f5f2c;
  font-weight: 720;
}

.category-override-form,
.category-override-reset {
  display: flex;
  gap: 8px;
  margin: 0;
}

.category-override-form select {
  min-width: 0;
  flex: 1;
}

.category-override-form .compact-button {
  width: 96px;
}

.category-override-reset .compact-button {
  width: 132px;
}

.user-management-heading {
  margin: 0;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.user-management-heading > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.control-table {
  overflow-x: auto;
}

.supplier-stock-table {
  overflow-x: auto;
}

.supplier-stock-head,
.supplier-stock-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(92px, 0.42fr) minmax(142px, 0.58fr) minmax(180px, 0.85fr) minmax(58px, 0.25fr) minmax(64px, 0.28fr) minmax(400px, 1.35fr);
  align-items: center;
  gap: 12px;
}

.supplier-stock-head {
  min-height: 42px;
  padding: 0 16px;
  color: var(--muted);
  background: #e2ebe7;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.supplier-stock-row {
  min-height: 54px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.supplier-stock-row:last-child {
  border-bottom: 0;
}

.supplier-stock-row:hover {
  background: #f6faf8;
}

.supplier-stock-row strong,
.supplier-stock-row > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supplier-name-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.vat-badge,
.vat-breakdown {
  color: #0f5f2c;
  font-size: 11px;
  font-weight: 720;
  line-height: 1.3;
}

.vat-badge {
  width: fit-content;
  padding: 2px 6px;
  background: #dff4e5;
  border: 1px solid #afd9bd;
  border-radius: 999px;
}

.offer-price {
  min-width: 0;
}

.offer-price .vat-breakdown {
  display: block;
  margin-top: 3px;
}

.supplier-stock-row form {
  margin: 0;
}

.supplier-stock-actions {
  display: flex;
  gap: 8px;
}

.supplier-stock-row .compact-button {
  width: 126px;
  min-height: 34px;
  height: 34px;
  padding: 0 8px;
}

.control-table-head,
.control-table-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(70px, 0.32fr) minmax(92px, 0.38fr) minmax(58px, 0.24fr) minmax(126px, 0.5fr) minmax(304px, 0.9fr);
  align-items: center;
  gap: 10px;
}

.control-table-head {
  min-height: 42px;
  padding: 0 16px;
  color: var(--muted);
  background: #e2ebe7;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.control-table-row {
  min-height: 64px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.control-table-row:last-child {
  border-bottom: 0;
}

.control-table-row:hover {
  background: #f6faf8;
}

.control-user-cell {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.control-user-cell strong,
.control-user-cell span,
.control-user-cell small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-user-cell span,
.control-user-cell small {
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 1px solid #b8d9d0;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 760;
  line-height: 1;
}

.status-pill-muted {
  color: var(--muted);
  background: var(--surface-strong);
  border-color: var(--line);
}

.status-pill-strong {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.status-pill-green {
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-color: #b8d9d0;
}

.status-pill-red {
  color: var(--danger);
  background: #fff3f3;
  border-color: #d6a2a2;
}

.control-row-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
}

.control-row-actions form {
  margin: 0;
}

.control-row-actions .compact-button {
  width: 96px;
  min-height: 36px;
  height: 36px;
  padding: 0 8px;
}

@media (max-width: 1100px) {
  .filters {
    grid-template-columns: 1fr 1fr auto auto;
  }

  .control-grid {
    grid-template-columns: 1fr;
  }

  .credentials-panel-empty {
    min-height: 0;
  }
}

@media (max-width: 820px) {
  .topbar,
  .workspace-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    position: static;
    padding: 14px 16px;
  }

  .topnav {
    justify-content: flex-start;
  }

  .page,
  .messages {
    width: min(100% - 18px, 1500px);
  }

  .workspace-header h1 {
    font-size: 28px;
  }

  .metrics {
    width: 100%;
  }

  .order-header-actions {
    width: 100%;
  }

  .metrics div {
    flex: 1;
    min-width: 0;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .multi-menu {
    position: static;
    margin-top: 8px;
  }

  .catalog-table {
    overflow-x: auto;
  }

  .catalog-head,
  .catalog-row {
    min-width: 860px;
  }

  .cart-head,
  .cart-row,
  .order-head,
  .order-row,
  .supplier-stock-head,
  .supplier-stock-row,
  .control-table-head,
  .control-table-row {
    min-width: 920px;
  }

  .category-override-row {
    grid-template-columns: 1fr;
  }

  .category-override-form,
  .category-override-reset {
    width: 100%;
  }

  .category-override-reset .compact-button {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .page {
    margin-top: 18px;
    margin-bottom: 36px;
  }

  .workspace-header {
    gap: 14px;
    margin-bottom: 14px;
  }

  .workspace-header h1 {
    font-size: 27px;
  }

  .eyebrow {
    margin-bottom: 4px;
    font-size: 10px;
    letter-spacing: 0.08em;
  }

  .metrics {
    gap: 7px;
  }

  .order-header-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .order-download-button {
    min-height: 44px;
  }

  .order-detail-footer .secondary-button {
    width: 100%;
    text-align: center;
  }

  .metrics div {
    padding: 9px 11px;
    border-radius: 7px;
    box-shadow: none;
  }

  .metrics span {
    font-size: 20px;
  }

  .metrics small {
    font-size: 11px;
  }

  .desktop-filters,
  .catalog-table {
    display: none;
  }

  .mobile-filter-panel,
  .mobile-catalog {
    display: block;
  }

  .mobile-filter-panel {
    margin-bottom: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-tight);
  }

  .mobile-filter-panel > summary {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto 16px;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 12px;
    list-style: none;
    color: var(--accent-dark);
    cursor: pointer;
  }

  .mobile-filter-panel > summary::-webkit-details-marker,
  .mobile-product-card > summary::-webkit-details-marker {
    display: none;
  }

  .mobile-filter-icon {
    position: relative;
    width: 16px;
    height: 14px;
    background:
      linear-gradient(var(--accent), var(--accent)) 0 2px / 16px 1.5px no-repeat,
      linear-gradient(var(--accent), var(--accent)) 0 7px / 16px 1.5px no-repeat,
      linear-gradient(var(--accent), var(--accent)) 0 12px / 16px 1.5px no-repeat;
  }

  .mobile-filter-icon::before,
  .mobile-filter-icon::after {
    content: "";
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--surface);
    border: 1.5px solid var(--accent);
    border-radius: 50%;
  }

  .mobile-filter-icon::before {
    top: 0;
    left: 3px;
  }

  .mobile-filter-icon::after {
    right: 3px;
    bottom: 0;
  }

  .mobile-filter-active {
    padding: 2px 6px;
    color: var(--accent-dark);
    background: var(--accent-soft);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 720;
  }

  .mobile-chevron {
    width: 8px;
    height: 8px;
    border-right: 1.5px solid var(--muted);
    border-bottom: 1.5px solid var(--muted);
    transform: rotate(45deg);
    transition: transform 160ms ease;
  }

  .mobile-filter-panel[open] > summary .mobile-chevron,
  .mobile-product-card[open] > summary .mobile-chevron {
    transform: rotate(225deg);
  }

  .mobile-filters {
    display: grid;
    margin: 0;
    padding: 12px;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0 0 8px 8px;
    box-shadow: none;
  }

  .mobile-filters .multi-select summary {
    background: #fff;
  }

  .mobile-stock-toggle {
    min-height: 40px;
    padding: 0 2px;
  }

  .mobile-filter-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .mobile-filter-actions > * {
    min-height: 42px;
  }

  .mobile-catalog {
    display: grid;
    gap: 8px;
  }

  .mobile-product-card {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 3px 12px rgba(24, 35, 31, 0.055);
  }

  .mobile-product-card > summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 16px;
    gap: 8px 10px;
    align-items: center;
    min-height: 84px;
    padding: 11px 12px;
    list-style: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-product-card[open] > summary {
    background: var(--surface-strong);
    border-bottom: 1px solid var(--line);
  }

  .mobile-product-title {
    display: -webkit-box;
    overflow: hidden;
    min-width: 0;
    max-width: 100%;
    font-weight: 760;
    line-height: 1.3;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .mobile-product-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    grid-column: 1;
  }

  .mobile-product-summary strong {
    font-size: 16px;
    line-height: 1;
  }

  .mobile-product-card > summary .mobile-chevron {
    grid-column: 2;
    grid-row: 1 / span 2;
    justify-self: center;
  }

  .stock-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 8px;
    color: var(--accent-dark);
    background: var(--accent-soft);
    border: 1px solid #b8d9d0;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 760;
    line-height: 1;
  }

  .mobile-product-body {
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  .mobile-offers-caption {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 720;
  }

  .mobile-offer {
    min-width: 0;
  }

  .mobile-offer-grouped {
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }

  .mobile-offer-grouped:first-of-type {
    padding-top: 0;
    border-top: 0;
  }

  .mobile-offer h3 {
    margin: 0 0 8px;
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .mobile-offer-facts {
    display: grid;
    gap: 0;
    margin: 0 0 12px;
  }

  .mobile-offer-facts div {
    display: grid;
    grid-template-columns: minmax(84px, 0.45fr) minmax(0, 1fr);
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
  }

  .mobile-offer-facts div:last-child {
    border-bottom: 0;
  }

  .mobile-offer-facts dt {
    color: var(--muted);
    font-size: 11px;
  }

  .mobile-offer-facts dd {
    min-width: 0;
    margin: 0;
    text-align: right;
    font-size: 12px;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  .mobile-offer-facts dd strong {
    font-size: 14px;
  }

  .mobile-add {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(112px, 0.65fr);
    gap: 8px;
  }

  .mobile-add label {
    display: block;
  }

  .mobile-add label span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .mobile-add input,
  .mobile-add button {
    width: 100%;
    min-height: 42px;
    border-radius: 6px;
  }

  .mobile-add input {
    padding: 0 10px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line-strong);
    outline: 0;
    font-weight: 720;
    text-align: center;
  }

  .mobile-add input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
  }

  .mobile-add button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 10px;
    color: #fff;
    background: var(--accent-dark);
    border: 1px solid var(--accent-dark);
    cursor: pointer;
    font-size: 12px;
    font-weight: 760;
  }

  .mobile-add button:active {
    background: var(--accent);
    transform: translateY(1px);
  }

  .mobile-empty-state {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .desktop-cart {
    display: none;
  }

  .mobile-cart {
    display: grid;
    gap: 10px;
  }

  .mobile-cart-item {
    padding: 13px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 3px 12px rgba(24, 35, 31, 0.055);
  }

  .mobile-cart-select {
    margin-bottom: 10px;
    font-size: 13px;
  }

  .mobile-cart-item h2 {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .mobile-cart-item dl {
    display: grid;
    gap: 0;
    margin: 0 0 12px;
  }

  .mobile-cart-item dl div {
    display: grid;
    grid-template-columns: minmax(74px, 0.45fr) minmax(0, 1fr);
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
  }

  .mobile-cart-item dl div:last-child {
    border-bottom: 0;
  }

  .mobile-cart-item dt {
    color: var(--muted);
    font-size: 11px;
  }

  .mobile-cart-item dd {
    min-width: 0;
    margin: 0;
    text-align: right;
    font-size: 12px;
    overflow-wrap: anywhere;
  }

  .mobile-cart-item dd strong {
    font-size: 14px;
  }

  .mobile-cart-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: stretch;
  }

  .mobile-cart-actions .cart-quantity-form {
    grid-template-columns: minmax(58px, 0.55fr) minmax(86px, 1fr);
  }

  .mobile-cart-actions input,
  .mobile-cart-actions button {
    min-height: 40px;
  }

  .mobile-cart-actions .danger-button {
    width: 100%;
  }

  .mobile-cart-empty {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .desktop-orders {
    display: none;
  }

  .mobile-orders,
  .mobile-order-items {
    display: grid;
    gap: 10px;
  }

  .mobile-order-card,
  .mobile-order-item {
    min-width: 0;
    padding: 13px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 3px 12px rgba(24, 35, 31, 0.055);
  }

  .mobile-order-card {
    position: relative;
    transition: border-color 150ms ease, background 150ms ease;
  }

  .mobile-order-card > a:active {
    background: var(--surface-strong);
    border-color: var(--accent);
  }

  .mobile-order-card > a {
    display: block;
    padding-right: 32px;
  }

  .mobile-order-actions {
    position: absolute;
    top: 8px;
    right: 8px;
  }

  .mobile-order-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    padding-right: 32px;
  }

  .mobile-order-card-heading strong {
    font-size: 15px;
  }

  .mobile-order-card-heading > span {
    flex: 0 0 auto;
    font-size: 10px;
  }

  .mobile-order-card-heading .order-status-dropdown,
  .mobile-order-card-heading .order-status-badge {
    min-height: 25px;
    font-size: 10px;
  }

  .mobile-order-card-heading .order-status-dropdown > summary {
    padding: 3px 22px 3px 7px;
    background-position: right 7px center;
  }

  .mobile-order-card-heading > .order-status-badge {
    padding: 3px 7px;
  }

  .mobile-order-card-heading .order-status-menu {
    left: auto;
    right: 0;
  }

  .mobile-order-card-heading .order-status-option {
    font-size: 12px;
  }

  .mobile-order-card dl,
  .mobile-order-item dl {
    display: grid;
    gap: 0;
    margin: 0;
  }

  .mobile-order-card dl div,
  .mobile-order-item dl div {
    display: grid;
    grid-template-columns: minmax(84px, 0.45fr) minmax(0, 1fr);
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
  }

  .mobile-order-card dl div:last-child,
  .mobile-order-item dl div:last-child {
    border-bottom: 0;
  }

  .mobile-order-card dt,
  .mobile-order-item dt {
    color: var(--muted);
    font-size: 11px;
  }

  .mobile-order-card dd,
  .mobile-order-item dd {
    min-width: 0;
    margin: 0;
    text-align: right;
    font-size: 12px;
    overflow-wrap: anywhere;
  }

  .mobile-order-card dd strong,
  .mobile-order-item dd strong {
    font-size: 14px;
  }

  .mobile-order-item h2 {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .mobile-order-empty {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .checkout-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 12px;
  }

  .checkout-total {
    justify-content: space-between;
    width: 100%;
    min-height: 46px;
  }

  .checkout-bar .primary-button {
    width: 100%;
    min-height: 44px;
  }

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

  .control-actions .primary-button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }

  .user-management-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}
