:root {
  --ink: #17201d;
  --muted: #66716d;
  --paper: #f5f3ed;
  --surface: #fffefb;
  --line: #deddd6;
  --line-strong: #c7cac1;
  --green: #176b50;
  --green-dark: #0f4f3a;
  --green-soft: #e4f2eb;
  --gold: #c99036;
  --red: #a83b3b;
  --shadow: 0 16px 48px rgba(25, 45, 37, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% -10%, rgba(201, 144, 54, .14), transparent 32rem),
    radial-gradient(circle at 92% 0%, rgba(23, 107, 80, .10), transparent 38rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  padding: 34px 38px;
  color: white;
  background: linear-gradient(125deg, #0d3f31 0%, #176b50 66%, #2e8065 100%);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 50%;
  right: -74px;
  top: -130px;
  box-shadow: 0 0 0 34px rgba(255,255,255,.04), 0 0 0 68px rgba(255,255,255,.03);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.hero .eyebrow { color: #f3cb8d; }
h1, h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; line-height: 1.06; }
h1 { max-width: 860px; font-size: clamp(2rem, 4vw, 4rem); font-weight: 500; letter-spacing: -.035em; }
h2 { font-size: clamp(1.45rem, 2.5vw, 2rem); font-weight: 500; }
.hero-copy { margin: 14px 0 0; color: #f3cb8d; font-size: 1rem; }

.rate-card {
  position: relative;
  z-index: 1;
  width: 242px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 16px;
  background: rgba(255,255,255,.10);
  backdrop-filter: blur(10px);
}

.rate-card label { display: block; margin-bottom: 8px; font-size: .8rem; font-weight: 750; }
.rate-input-wrap { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 10px; background: white; color: var(--ink); }
.rate-input-wrap input { width: 100%; border: 0; outline: 0; padding: 10px 0; color: var(--ink); background: transparent; font-weight: 800; }
.rate-card small { display: block; margin-top: 8px; color: rgba(255,255,255,.7); line-height: 1.3; }
.rate-card.invalid .rate-input-wrap { outline: 3px solid rgba(255, 158, 158, .5); }
.rate-card.invalid small { color: #ffd1d1; }

.toolbar, .supplier-filter, .cart-section, .catalog-section {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid rgba(199, 202, 193, .8);
  border-radius: 18px;
  background: rgba(255, 254, 251, .94);
  box-shadow: 0 10px 28px rgba(25,45,37,.045);
}

.toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) auto auto; gap: 14px; align-items: end; }
.search-field label { display: block; margin-bottom: 6px; font-size: .78rem; font-weight: 800; color: var(--muted); }
input, select { min-height: 40px; border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 10px; color: var(--ink); background: white; }
input:focus, select:focus { outline: 3px solid rgba(23,107,80,.15); border-color: var(--green); }
.search-field input { width: 100%; min-height: 46px; }
.favorite-toggle { display: flex; min-height: 46px; align-items: center; gap: 9px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; white-space: nowrap; font-weight: 700; }
.favorite-toggle input { min-height: auto; accent-color: var(--green); }

.secondary-button, .text-button {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  font-weight: 750;
}
.secondary-button { min-height: 46px; padding: 0 16px; }
.text-button { padding: 8px 11px; color: var(--green-dark); }
.secondary-button:hover, .text-button:hover { border-color: var(--green); color: var(--green-dark); }
.danger { color: var(--red); }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.section-heading.compact { margin-bottom: 14px; }
.supplier-options { display: flex; flex-wrap: wrap; gap: 9px; }
.supplier-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: white; font-size: .86rem; font-weight: 720; }
.supplier-pill:has(input:checked) { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); }
.supplier-pill input { min-height: auto; margin: 0; accent-color: var(--green); }
.supplier-pill-content { display: grid; gap: 2px; line-height: 1.15; }
.supplier-pill-name { font-size: .84rem; }
.supplier-pill-updated { color: var(--muted); font-size: .66rem; font-weight: 620; white-space: nowrap; }
.supplier-pill:has(input:checked) .supplier-pill-updated { color: #497263; }

.cart-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 14px; }
.cart-group { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: white; }
.cart-group h3 { margin: 0; padding: 14px 16px; color: white; background: var(--green-dark); font-size: 1rem; }
.cart-items { padding: 4px 14px; }
.cart-item { display: grid; grid-template-columns: minmax(0, 1fr) 72px minmax(128px, auto) 34px; gap: 9px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-item:last-child { border-bottom: 0; }
.cart-item-name { min-width: 0; }
.cart-item-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; }
.cart-item-name small { color: var(--muted); }
.cart-qty { min-height: 34px; width: 100%; padding: 4px 7px; }
.cart-price { display: grid; gap: 4px; text-align: right; }
.cart-price span { display: grid; grid-template-columns: auto auto; gap: 7px; align-items: baseline; color: var(--muted); font-size: .7rem; }
.cart-price strong { color: var(--ink); font-size: .78rem; white-space: nowrap; }
.remove-button { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: #f7e8e8; color: var(--red); font-size: 1rem; }
.cart-totals { display: grid; grid-template-columns: 1fr auto; gap: 7px 14px; padding: 14px 16px; background: #f4f7f5; border-top: 1px solid var(--line); font-size: .86rem; }
.cart-totals strong { color: var(--green-dark); }

.catalog-section { padding: 0; overflow: hidden; }
.catalog-heading { padding: 22px 22px 0; }
.summary { margin: 0; color: var(--muted); text-align: right; font-size: .86rem; }
.table-wrap { overflow: auto; border-block: 1px solid var(--line); }
table { width: 100%; min-width: 1180px; border-collapse: separate; border-spacing: 0; background: white; }
th, td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: middle; }
th:last-child, td:last-child { border-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
thead { position: sticky; top: 0; z-index: 4; }
.header-row th { padding: 0; background: #eef3ef; color: var(--green-dark); text-align: left; }
.header-row button { display: flex; width: 100%; min-height: 48px; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border: 0; color: inherit; background: transparent; text-align: left; font-size: .76rem; font-weight: 850; text-transform: uppercase; letter-spacing: .035em; }
.header-row button:hover { background: #e2ece6; }
.header-row button span { color: var(--gold); }
.filter-row th { padding: 7px; background: #fafbf9; }
.filter-row input, .filter-row select { width: 100%; min-height: 35px; padding: 5px 7px; font-size: .76rem; }
td { padding: 10px; font-size: .84rem; line-height: 1.3; }
tbody tr:nth-child(even) td { background: #fcfcfa; }
tbody tr:hover td { background: #f2f7f4; }
.action-col { width: 100px; min-width: 100px; text-align: center; }
.favorite-col { width: 74px; text-align: center; }
.image-col { width: 92px; text-align: center; }
.price-col { width: 128px; text-align: right; }
.header-row .price-col button { text-align: right; }
.add-button, .favorite-button { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; font-weight: 900; }
.add-button { border: 0; background: var(--green); color: white; font-size: 1.15rem; }
.add-button:hover { background: var(--green-dark); }
.table-quantity { display: inline-flex; align-items: center; height: 36px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.table-quantity-button { display: grid; place-items: center; width: 30px; height: 34px; padding: 0; border: 0; background: var(--green-soft); color: var(--green-dark); font-size: 1.05rem; font-weight: 900; }
.table-quantity-button:hover { background: #cfe7da; }
.table-quantity-button.remove { background: #f8e6e6; color: var(--red); }
.table-quantity-button.remove:hover { background: #f1d2d2; }
.table-quantity-value { min-width: 30px; padding: 0 4px; color: var(--ink); font-weight: 900; text-align: center; }
.favorite-button { border: 1px solid var(--line-strong); background: white; color: #9ca39f; font-size: 1.1rem; }
.favorite-button.active { color: #be7f1d; border-color: #e0b66f; background: #fff6e6; }
.thumb { display: block; width: 66px; height: 66px; margin: auto; border: 1px solid var(--line); border-radius: 10px; object-fit: contain; background: white; }
.no-image { display: grid; width: 66px; height: 66px; margin: auto; place-items: center; border: 1px dashed var(--line-strong); border-radius: 10px; color: var(--muted); background: #f8f8f5; font-size: .68rem; text-align: center; }
.product-name { font-weight: 800; color: #1c3e33; }
.brand { font-weight: 700; }
.price { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 760; }
.supplier-tag { display: inline-flex; padding: 5px 8px; border-radius: 999px; background: var(--green-soft); color: var(--green-dark); white-space: nowrap; font-size: .72rem; font-weight: 800; }
.empty-row td { padding: 52px 20px; color: var(--muted); text-align: center; font-size: .95rem; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 22px; background: #fffefb; }
.page-actions { display: flex; align-items: center; gap: 8px; }
.page-actions button { min-height: 38px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 9px; background: white; color: var(--green-dark); font-weight: 800; }
.page-status { min-width: 118px; text-align: center; color: var(--muted); font-size: .84rem; }
.page-size { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .8rem; }
.page-size select { min-height: 38px; }

footer { display: flex; justify-content: space-between; gap: 18px; padding: 16px 6px 0; color: var(--muted); font-size: .76rem; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: 320px; padding: 12px 15px; border-radius: 11px; color: white; background: var(--green-dark); box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 760px) {
  .shell { width: calc(100% - 18px); padding-top: 9px; }
  .hero { grid-template-columns: 1fr; gap: 20px; padding: 25px 21px; border-radius: 18px; }
  .hero > *, .toolbar > *, .rate-card, .rate-input-wrap input, .supplier-filter, .cart-section, .catalog-section { min-width: 0; }
  h1 { font-size: 2.35rem; }
  .rate-card { width: 100%; }
  .toolbar { grid-template-columns: 1fr; padding: 16px; }
  .supplier-filter, .cart-section { padding: 16px; }
  .section-heading { flex-direction: column; align-items: stretch; }
  .section-heading > button { width: 100%; min-height: 42px; }
  .cart-groups { grid-template-columns: 1fr; }
  .cart-item { grid-template-columns: minmax(0, 1fr) 62px minmax(112px, auto) 32px; gap: 7px; }
  .cart-price span { display: block; }
  .cart-price strong { display: block; }
  .catalog-heading { display: block; padding: 18px 16px 0; }
  .summary { margin-top: 8px; text-align: left; }
  .pagination { flex-wrap: wrap; padding: 12px 14px; }
  .page-actions { order: 2; width: 100%; justify-content: space-between; }
  .page-actions button { flex: 1; }
  .page-status { flex: 1.1; min-width: 0; }
  .page-size { width: 100%; justify-content: space-between; }
  footer { display: grid; }
  .toast { left: 14px; right: 14px; bottom: 14px; max-width: none; }
}
