:root {
  --paper: #f3f5f2;
  --ink: #193d24;
  --muted: #4e5c54;
  --line: rgba(25, 61, 36, 0.12);
  --head: #f4f7f4;
  --calc: #f6fbf7;
  --card: #ffffff;
  --green: #0c7a34;
  --green-soft: #e7f6ec;
  --field: #f7faf7;
  --no: #9a4e38;
  --no-bg: #fff4ef;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: Inter, system-ui, sans-serif;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23193d24' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M3.5 6.2 8 10.2 12.5 6.2'/%3E%3C/svg%3E");
  color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

::selection {
  background: #c8ecd4;
  color: var(--ink);
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #e5f3e9 0, transparent 16rem),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

.nav {
  position: sticky;
  inset-block-start: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-block-size: 4rem;
  padding-block: 0.85rem;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
  background: rgba(243, 245, 242, 0.86);
  border-block-end: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.nav img { block-size: 28px; inline-size: auto; display: block; }

.nav-label {
  margin: 0;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

main {
  max-inline-size: 118rem;
  margin-inline: auto;
  padding-block: 2.75rem 5rem;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

h1 {
  margin: 0 0 0.7rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3.1rem, 6vw, 4.6rem);
  line-height: 0.92;
  letter-spacing: -0.03em;
}

h1 em { font-style: italic; }

.lede {
  margin: 0 0 1.75rem;
  max-inline-size: 34rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.sheet {
  container: sheet / inline-size;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow:
    0 1px 1px rgba(25, 61, 36, 0.04),
    0 18px 50px rgba(25, 61, 36, 0.07);
  overflow: hidden;
}

.sheet::before {
  content: "";
  display: block;
  block-size: 4px;
  background: linear-gradient(90deg, #193d24 0%, #0c7a34 62%, #b7e4c4 100%);
}

.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(70vh, 42rem);
}

.table-wrapper:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: -3px;
}

.account,
.orders {
  display: grid;
  gap: 1.15rem 1.25rem;
  align-items: start;
  padding: 1.35rem 1.4rem 1.4rem;
  border-block-end: 1px solid var(--line);
}

.account {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: #fff;
}

.orders {
  grid-template-columns: minmax(0, 1fr) auto;
  background: var(--field);
}

.field label,
.field-label {
  display: block;
  margin: 0 0 0.45rem;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.3;
  text-transform: none;
}

.orders > .field:first-child {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 0.75rem;
  align-items: end;
}

.orders > .field:first-child > label,
.orders > .field:first-child > .hint,
.orders > .field:first-child > .cell-error,
.orders > .field:first-child > .ado-set {
  grid-column: 1 / -1;
}

.field-discount {
  min-inline-size: 8.5rem;
  padding-inline-start: 1.25rem;
  border-inline-start: 1px solid var(--line);
}

.field-discount:has(.has-value) {
  background: transparent;
}

.sheet-table {
  --label-product: "Product *";
  --label-line: "Shipping line";
  inline-size: 100%;
  min-inline-size: 0;
  border-collapse: separate;
  border-spacing: 0;
  background: transparent;
}

.col-product { inline-size: 22rem; }
.col-line { inline-size: auto; }

.sheet-table > thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
}

.sheet-table > thead > tr > th,
.sheet-table > tbody > tr > th,
.sheet-table > tbody > tr > td {
  padding: 1rem 1.15rem;
  border-inline-end: 1px solid var(--line);
  border-block-end: 1px solid var(--line);
  text-align: start;
  vertical-align: top;
  font-weight: 400;
}

.sheet-table > thead > tr > :last-child,
.sheet-table > tbody > tr > :last-child { border-inline-end: 0; }

.sheet-table > thead th {
  background: var(--head);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.35;
  text-transform: uppercase;
}

.sheet-table > thead th:first-child {
  position: sticky;
  inset-inline-start: 0;
  z-index: 3;
  background: var(--head);
}

.sheet-table > tbody > tr > th {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  min-inline-size: 18rem;
  background: #fff;
}

.sheet-table > tbody > tr:hover > th { background: #fbfcfb; }
.sheet-table > tbody > tr:hover > td.calc { background: #f3faf5; }

td.line { min-inline-size: 12rem; }
td.calc { background: var(--calc); }

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.hint {
  margin: -0.15rem 0 0.55rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.sheet-input,
.sheet-select {
  display: block;
  inline-size: 100%;
  min-inline-size: 0;
  min-block-size: 3rem;
  margin: 0;
  padding: 0.7rem 0.9rem;
  border: 1px solid #c5cfc8;
  border-radius: 12px;
  background-color: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  line-height: 1.35;
  box-shadow: none;
}

.sheet-select {
  appearance: none;
  padding-inline-end: 2.4rem;
  font-weight: 500;
  cursor: pointer;
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 0.85rem;
}

.sheet-select:has(option[value=""]:checked) {
  color: #6d7b73;
  font-weight: 400;
}

.sheet-input {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.sheet-input:focus-visible,
.sheet-select:focus-visible,
.remove:focus-visible,
.add:focus-visible,
.see-discount:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}

.sheet-input:user-invalid,
.sheet-select:user-invalid,
.sheet-input.user-invalid-fallback,
.sheet-select.user-invalid-fallback {
  background-color: var(--no-bg);
  border-color: var(--no);
}

.cell-error {
  display: none;
  margin: 0.45rem 0 0;
  color: var(--no);
  font-size: 0.84rem;
  line-height: 1.35;
}

.sheet-input:user-invalid ~ .cell-error,
.sheet-select:user-invalid ~ .cell-error,
.sheet-input.user-invalid-fallback ~ .cell-error,
.sheet-select.user-invalid-fallback ~ .cell-error {
  display: block;
}

.line-out { display: block; min-block-size: 1.5rem; }

.line-out:empty::before,
.discount-out:empty::before {
  content: "—";
  color: #9aa79f;
  font-weight: 400;
}

.discount-out:empty::before {
  font-size: 2rem;
  color: #b7c2ba;
}

.line-name,
.note { display: block; overflow-wrap: anywhere; }

.line-name {
  font-weight: 600;
  letter-spacing: -0.01em;
}

tr:has(.sheet-select:valid) .line-name {
  display: inline-block;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.92rem;
}

.note {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.discount-out {
  display: block;
  min-block-size: 3rem;
  margin-block-start: 0.15rem;
  font-family: var(--serif);
  font-size: clamp(2.8rem, 4vw, 3.4rem);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 0.9;
}

.discount-out.has-value { color: var(--green); }

.remove {
  appearance: none;
  margin-block-start: 0.55rem;
  padding: 0.35rem 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.remove:hover { color: var(--ink); }

.sheet-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 0.85rem 1.15rem 1rem;
  border-block-start: 1px solid var(--line);
  background: #fbfcfb;
}

.footnote {
  margin: 0;
  flex: 1 1 18rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.add {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-block-size: 2.75rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.add:hover { background: var(--green-soft); border-color: transparent; }

.see-discount {
  appearance: none;
  margin: 0;
  min-block-size: 3rem;
  padding: 0.55rem 1.05rem;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.see-discount:hover { background: #102818; }

.ado-set {
  display: flex;
  align-items: center;
  min-block-size: 3rem;
  margin: 0;
  padding: 0.7rem 0.9rem;
  border: 1px solid #c5cfc8;
  border-radius: 12px;
  background: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.plus {
  color: var(--green);
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1;
}

@media (pointer: coarse) {
  .sheet-input,
  .sheet-select,
  .see-discount { min-block-size: 3.25rem; }
}

@container sheet (width < 760px) {
  .account,
  .orders { grid-template-columns: 1fr; }

  .orders > .field:first-child { grid-template-columns: 1fr; }

  .see-discount { justify-self: start; }

  .field-discount {
    min-inline-size: 0;
    padding-inline-start: 0;
    padding-block-start: 1rem;
    border-inline-start: 0;
    border-block-start: 1px solid var(--line);
  }
}

@container sheet (width < 640px) {
  .table-wrapper { max-block-size: none; }

  .sheet-table,
  .sheet-table > thead,
  .sheet-table > tbody,
  .sheet-table > thead > tr,
  .sheet-table > tbody > tr,
  .sheet-table > tbody > tr > th,
  .sheet-table > tbody > tr > td { display: block; }

  .sheet-table { min-inline-size: 0; }

  .sheet-table > thead { display: none; }

  .sheet-table > tbody > tr { border-block-end: 1px solid var(--line); }

  .sheet-table > tbody > tr > th,
  .sheet-table > tbody > tr > td {
    min-inline-size: 0;
    border: 0;
    border-block-end: 1px solid var(--line);
  }

  .sheet-table > tbody > tr > :last-child { border-block-end: 0; }

  .sheet-table > tbody > tr > th {
    position: sticky;
    inset-block-start: 0;
    inset-inline-start: auto;
    z-index: 2;
    background: var(--head);
  }

  .sheet-table > tbody > tr > th::before,
  .sheet-table > tbody > tr > td.line::before {
    display: block;
    margin-block-end: 0.45rem;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .sheet-table > tbody > tr > th::before { content: var(--label-product) / ""; }
  .sheet-table > tbody > tr > td.line::before { content: var(--label-line) / ""; }

  .sheet-foot { align-items: flex-start; }
}

.line-block + .line-block {
  margin-block-start: 1rem;
  padding-block-start: 1rem;
  border-block-start: 1px solid var(--line);
}

.line-cut {
  margin: 0 0 0.35rem;
  color: var(--green);
  font-family: var(--serif);
  font-size: 1.85rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 0.9;
}

.rate-note {
  margin: 0.55rem 0 0;
  max-inline-size: 36rem;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.rate-scroll {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(32rem, 70vh);
  margin-block-start: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.rate-scroll:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}

table.rates {
  inline-size: max-content;
  min-inline-size: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.78rem;
  line-height: 1.3;
}

table.rates th,
table.rates td {
  padding: 0.38rem 0.6rem;
  border-inline-end: 1px solid var(--line);
  border-block-end: 1px solid var(--line);
  text-align: end;
  white-space: nowrap;
  font-weight: 500;
  vertical-align: middle;
}

table.rates tr > :last-child { border-inline-end: 0; }
table.rates tbody tr:last-child > * { border-block-end: 0; }

table.rates thead th {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  background: var(--head);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: end;
}

table.rates thead th:first-child,
table.rates tbody th {
  position: sticky;
  inset-inline-start: 0;
  text-align: start;
  background: #fff;
}

table.rates thead th:first-child {
  z-index: 3;
  background: var(--head);
}

table.rates tbody th { z-index: 1; font-weight: 600; color: var(--ink); }

.card-price,
.now,
.was {
  display: block;
  font-variant-numeric: tabular-nums;
}

.card-price,
.now { color: var(--ink); font-weight: 600; }

.now { color: var(--green); }

.was {
  margin-block-start: 0.12rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}
