:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17231f;
  background: #f6f7f4;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --muted: #6c7772;
  --line: #e5e9e5;
  --green: #137451;
  --green-dark: #0e5e41;
  --green-light: #edf7f1;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% -30%, #e6f1e9 0, transparent 50rem),
    #f6f7f4;
}

button,
input {
  font: inherit;
}

.page {
  width: min(100% - 32px, 880px);
  margin: 0 auto;
  padding: 38px 0 24px;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 28px;
}

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 16px;
  background: var(--green);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: 26px;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  letter-spacing: -0.035em;
}

.header-copy {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.secure-label {
  margin-left: auto;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: #fff;
  color: #50645b;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.secure-label span {
  padding-right: 5px;
  color: var(--green);
  font-size: 9px;
}

.catalog-section,
.checkout-section,
.result-card {
  border: 1px solid #e6eae6;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 32px rgb(28 48 38 / 4%);
}

.catalog-section {
  padding: 24px 24px 12px;
}

.section-heading,
.summary-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading {
  margin-bottom: 18px;
}

.search-box {
  display: flex;
  width: min(100%, 230px);
  height: 42px;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.search-box:focus-within {
  border-color: #74ae90;
  box-shadow: 0 0 0 3px rgb(19 116 81 / 9%);
}

.search-box svg {
  width: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: #849089;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: #17231f;
  font-size: 12px;
}

.search-box input::placeholder {
  color: #939c97;
}

.catalog-wrap {
  overflow-x: auto;
}

.product-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.product-table thead {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: #78837d;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.product-table th,
.product-table td {
  padding: 14px 10px;
}

.product-table thead th {
  padding-top: 11px;
  padding-bottom: 11px;
  font-weight: 700;
}

.product-table tbody tr + tr {
  border-top: 1px solid #eef0ed;
}

.product-table tbody th {
  max-width: 300px;
  font-size: 13px;
  font-weight: 650;
}

.product-name small {
  display: block;
  margin-top: 4px;
  color: #758179;
  font-size: 10px;
  font-weight: 500;
}

.product-table tbody td {
  color: #59655f;
  font-size: 12px;
  white-space: nowrap;
}

.product-table .subtotal-cell {
  color: #17231f;
  font-weight: 700;
}

.quantity-control {
  display: flex;
  width: max-content;
  height: 34px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.quantity-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--green);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.quantity-button:hover:not(:disabled) {
  background: var(--green-light);
}

.quantity-button:disabled {
  color: #b5bdb8;
  cursor: not-allowed;
}

.quantity-value {
  min-width: 20px;
  color: #26352e;
  font-size: 12px;
  text-align: center;
}

.select-cell {
  width: 38px;
  text-align: right;
}

.select-cell input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
  cursor: pointer;
}

.notice {
  padding: 28px 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.notice-error,
.checkout-error {
  color: #a43832;
}

.checkout-section {
  position: sticky;
  z-index: 1;
  bottom: 12px;
  margin-top: 16px;
  padding: 22px 24px 17px;
  box-shadow: 0 14px 42px rgb(28 48 38 / 9%);
}

.summary-heading {
  margin-bottom: 12px;
}

.item-count {
  padding: 6px 9px;
  border-radius: 99px;
  background: #f3f5f2;
  color: #647169;
  font-size: 10px;
  font-weight: 700;
}

.summary-empty {
  padding: 14px 0;
  color: #839088;
  font-size: 12px;
}

.summary-list {
  max-height: 180px;
  overflow-y: auto;
}

.summary-line,
.total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.summary-line {
  padding: 10px 0;
  border-top: 1px solid #eef0ed;
}

.summary-description {
  display: grid;
  gap: 4px;
}

.summary-description strong {
  font-size: 12px;
  font-weight: 650;
}

.summary-description span {
  color: var(--muted);
  font-size: 10px;
}

.summary-subtotal {
  font-size: 12px;
}

.total-row {
  margin-top: 8px;
  padding: 15px 0 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 650;
}

.total-row strong {
  color: #163e2e;
  font-size: 21px;
  letter-spacing: -0.035em;
}

.pay-button {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border: 0;
  border-radius: 11px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: background 120ms ease, transform 120ms ease;
}

.pay-button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--green-dark);
}

.pay-button:disabled {
  background: #aab8af;
  cursor: not-allowed;
}

.pay-button span:last-child {
  font-size: 20px;
  font-weight: 400;
}

.payment-note {
  margin: 11px 0 0;
  color: #808b84;
  font-size: 10px;
  text-align: center;
}

.checkout-error {
  margin-bottom: 12px;
  font-size: 12px;
}

.result-card {
  margin-bottom: 16px;
  padding: 20px 22px;
}

.result-card h2 {
  margin-bottom: 8px;
  font-size: 18px;
}

.result-card > p:not(.eyebrow) {
  margin-bottom: 0;
  color: #59655f;
  font-size: 12px;
  line-height: 1.6;
}

.result-approved {
  border-color: #cde6d5;
  background: #f5fbf6;
}

.result-failed,
.result-error {
  border-color: #efd4d1;
  background: #fff9f8;
}

.result-pending {
  border-color: #eadfbe;
  background: #fffcf4;
}

.receipt-order,
.receipt-total,
.receipt-date {
  margin-top: 8px;
}

.receipt-lines {
  margin-top: 16px;
  border-top: 1px solid #dfe9e1;
}

.receipt-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 10px;
  color: #56645a;
  font-size: 12px;
}

.receipt-total {
  font-weight: 750;
}

.secondary-button {
  min-height: 40px;
  margin-top: 15px;
  padding: 0 13px;
  border: 1px solid #d7dfd8;
  border-radius: 9px;
  background: #fff;
  color: #28583f;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.secondary-button:hover {
  background: #f4f8f4;
}

.page-footer {
  padding: 20px 0 0;
  color: #828d86;
  font-size: 11px;
  text-align: center;
}

.page-footer a {
  margin-left: 7px;
  color: #63746a;
}

.admin-page {
  max-width: 880px;
}

.brand-link {
  text-decoration: none;
}

.admin-back-link {
  margin-left: auto;
  color: #52645a;
  font-size: 12px;
  font-weight: 650;
}

.admin-panel {
  padding: 24px;
  border: 1px solid #e6eae6;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 32px rgb(28 48 38 / 4%);
}

.admin-description {
  margin: 10px 0 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.login-form {
  display: grid;
  max-width: 420px;
  gap: 14px;
  margin-top: 24px;
}

.login-form > label,
.admin-field {
  display: grid;
  gap: 7px;
  color: #4d5c53;
  font-size: 11px;
  font-weight: 650;
}

.login-form input,
.admin-field input,
.admin-field select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #dfe5df;
  border-radius: 9px;
  background: #fff;
  color: #17231f;
  outline: none;
  font-size: 12px;
}

.login-form input:focus,
.admin-field input:focus,
.admin-field select:focus {
  border-color: #74ae90;
  box-shadow: 0 0 0 3px rgb(19 116 81 / 9%);
}

.admin-error {
  color: #a43832 !important;
}

.admin-title-row,
.product-card-heading,
.save-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-title-row {
  margin-bottom: 5px;
}

.admin-logout {
  margin-top: 0;
}

.new-product-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 0.7fr) auto;
  align-items: end;
  gap: 12px;
  padding: 16px;
  border: 1px solid #e6eae6;
  border-radius: 12px;
  background: #fafbf9;
}

.add-product-button {
  min-height: 42px;
  margin-top: 0;
  white-space: nowrap;
}

.admin-message {
  margin: 14px 0;
  color: #236346;
  font-size: 12px;
}

.product-editor {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.product-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid #e5e9e5;
  border-radius: 13px;
  background: #fff;
}

.product-card-heading {
  align-items: flex-start;
  margin-bottom: 14px;
}

.product-card-heading > .admin-field {
  flex: 1;
}

.product-heading-details {
  display: grid;
  justify-items: end;
  gap: 8px;
  padding-top: 4px;
}

.product-id {
  color: #859088;
  font-size: 10px;
}

.active-control {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #4d5c53;
  font-size: 10px;
  white-space: nowrap;
}

.active-control input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--green);
}

.product-actions {
  align-self: flex-end;
}

.text-button {
  padding: 7px 4px;
  border: 0;
  background: transparent;
  color: #56675d;
  cursor: pointer;
  font-size: 10px;
  font-weight: 650;
}

.text-button:disabled {
  color: #a3aca6;
  cursor: not-allowed;
}

.danger-button {
  color: #a43832;
}

.options-header,
.option-editor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 0.45fr) auto;
  align-items: center;
  gap: 12px;
}

.options-header {
  padding: 0 4px 8px;
  color: #7c8880;
  font-size: 10px;
  font-weight: 700;
}

.options-list {
  border-top: 1px solid #e9ede9;
}

.option-editor-row {
  padding: 10px 4px;
  border-bottom: 1px solid #eef0ed;
}

.admin-field-compact {
  gap: 0;
}

.admin-field-compact > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.admin-field-compact input {
  min-height: 38px;
}

.remove-option {
  min-width: 52px;
  text-align: right;
}

.add-option-button {
  min-height: 36px;
  margin-top: 11px;
}

.empty-catalog {
  padding: 24px 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.save-row {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #e9ede9;
}

.save-status {
  margin: 0;
  color: #7c8880;
  font-size: 10px;
}

.save-button {
  width: auto;
  min-width: 160px;
  min-height: 46px;
}

.save-button:disabled {
  opacity: 0.75;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

[hidden] {
  display: none !important;
}

@media (max-width: 620px) {
  .page {
    width: min(100% - 22px, 520px);
    padding-top: 22px;
  }

  .page-header {
    gap: 12px;
    margin-bottom: 18px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 13px;
  }

  h1 {
    font-size: 23px;
  }

  .header-copy {
    max-width: 235px;
    font-size: 11px;
  }

  .secure-label {
    align-self: flex-start;
    padding: 7px 8px;
    font-size: 9px;
  }

  .catalog-section {
    padding: 18px 14px 8px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 13px;
  }

  .search-box {
    width: 100%;
  }

  .product-table thead {
    display: none;
  }

  .product-table,
  .product-table tbody,
  .product-table tr {
    display: block;
    width: 100%;
  }

  .product-table tbody tr {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    padding: 14px 32px 14px 0;
  }

  .product-table tbody th,
  .product-table tbody td {
    max-width: none;
    padding: 0;
    border: 0;
    text-align: left;
  }

  .product-table tbody .product-name {
    grid-column: 1 / -1;
    font-size: 13px;
  }

  .product-table tbody .price-cell::before {
    content: "Unit · ";
    color: #89928d;
    font-size: 10px;
  }

  .product-table tbody .subtotal-cell::before {
    content: "Subtotal · ";
    color: #89928d;
    font-size: 10px;
    font-weight: 400;
  }

  .product-table tbody .price-cell,
  .product-table tbody .subtotal-cell {
    font-size: 11px;
  }

  .product-table tbody td[data-label="Quantity"] {
    grid-column: 2;
    grid-row: 2 / span 2;
    align-self: center;
  }

  .product-table tbody .select-cell {
    position: absolute;
    top: 13px;
    right: 0;
    width: auto;
    padding: 0;
  }

  .quantity-control {
    height: 36px;
  }

  .quantity-button {
    width: 36px;
    height: 36px;
  }

  .checkout-section {
    bottom: 7px;
    padding: 18px 15px 14px;
  }

  .total-row strong {
    font-size: 19px;
  }

  .result-card {
    padding: 17px;
  }

  .admin-panel {
    padding: 17px 14px;
  }

  .new-product-form {
    grid-template-columns: 1fr;
  }

  .add-product-button {
    width: 100%;
  }

  .product-card {
    padding: 13px 10px;
  }

  .product-card-heading {
    flex-wrap: wrap;
  }

  .product-heading-details {
    justify-items: start;
  }

  .options-header,
  .option-editor-row {
    grid-template-columns: minmax(0, 1fr) minmax(95px, 0.7fr) auto;
    gap: 7px;
  }

  .remove-option {
    min-width: 44px;
    padding-right: 0;
    font-size: 9px;
  }

  .save-row {
    align-items: stretch;
    flex-direction: column;
  }

  .save-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
