:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --panel-soft: #f0f4f1;
  --line: #d9ded7;
  --line-strong: #b8c1b7;
  --text: #1f2a24;
  --muted: #66736b;
  --accent: #176c5d;
  --accent-strong: #0d4f43;
  --warn: #8a5a00;
  --danger: #a13a2a;
  --shadow: 0 14px 35px rgba(31, 42, 36, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1440px;
  margin: 0 auto 14px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 16px;
  line-height: 1.2;
}

.status-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.status-pill,
.inline-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--panel);
  font-size: 12px;
  white-space: nowrap;
}

.status-pill.ok,
.inline-status.ok {
  color: var(--accent-strong);
  border-color: rgba(23, 108, 93, 0.25);
  background: #e7f3ef;
}

.status-pill.warn,
.inline-status.warn {
  color: var(--warn);
  border-color: rgba(138, 90, 0, 0.25);
  background: #fff6df;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.78fr) minmax(520px, 1.22fr);
  gap: 14px;
  max-width: 1440px;
  margin: 0 auto;
  align-items: start;
}

.catalog-panel,
.quote-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.catalog-panel {
  padding: 14px;
  min-height: calc(100vh - 98px);
}

.quote-panel {
  padding: 14px;
}

.panel-header,
.toolbar,
.section-head,
.filters,
.summary-grid,
.form-grid,
.shipping-stats {
  display: flex;
  gap: 10px;
}

.panel-header,
.section-head,
.toolbar {
  align-items: center;
  justify-content: space-between;
}

.panel-header p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--text);
  background: #fff;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 2px solid rgba(23, 108, 93, 0.22);
  outline-offset: 1px;
}

.search-box {
  min-width: 230px;
}

.filters {
  margin: 14px 0;
}

.filters label {
  flex: 1;
}

.product-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 238px);
  overflow: auto;
  padding-right: 4px;
}

.product-row,
.cart-row,
.shipping-option {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.product-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 10px;
  padding: 10px;
  align-items: center;
}

.product-main {
  min-width: 0;
}

.product-thumb,
.cart-thumb {
  width: 72px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  object-fit: cover;
}

.cart-thumb {
  width: 56px;
}

.product-thumb.placeholder,
.cart-thumb.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.product-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.product-meta,
.cart-meta,
.shipping-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.product-price {
  display: grid;
  align-content: center;
  gap: 6px;
  text-align: right;
  min-width: 112px;
}

.product-price strong,
.metric strong {
  font-size: 16px;
}

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

.product-alert {
  color: #8a4b00;
  font-weight: 700;
}

.secondary {
  background: #e8efec;
  color: var(--accent-strong);
  border-color: rgba(23, 108, 93, 0.18);
}

.primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
}

.ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.toolbar {
  display: grid;
  grid-template-columns: 190px minmax(145px, 1fr) auto;
  margin-bottom: 14px;
}

.quote-rule {
  min-height: 38px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

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

.quote-rule strong {
  color: var(--accent-strong);
  font-size: 13px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 14px;
}

.metric {
  display: grid;
  gap: 5px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

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

.metric.emphasis {
  color: var(--accent-strong);
  background: #e7f3ef;
  border-color: rgba(23, 108, 93, 0.22);
}

.quote-body {
  display: grid;
  gap: 16px;
}

.cart-list,
.shipping-options {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.cart-list.empty,
.shipping-options:empty {
  min-height: 68px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.cart-row {
  display: grid;
  grid-template-columns: 56px 1fr 112px 120px auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
}

.qty-control {
  display: grid;
  gap: 4px;
}

.qty-stepper {
  display: grid;
  grid-template-columns: 34px minmax(54px, 1fr) 34px;
  gap: 4px;
  align-items: center;
}

.qty-button {
  min-height: 38px;
  padding: 0;
}

.qty-control input {
  text-align: right;
}

.line-total {
  text-align: right;
}

.line-total strong {
  display: block;
}

.line-total span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.shipping-option {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  cursor: pointer;
}

.shipping-option.selected {
  border-color: rgba(23, 108, 93, 0.5);
  background: #f2faf7;
}

.shipping-option input {
  min-height: auto;
}

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

.address-grid {
  grid-template-columns: 1.4fr 0.6fr 1fr 1fr;
}

.wide-field {
  grid-column: span 2;
}

.compact-head {
  margin-top: 4px;
}

.shipping-stats {
  flex-wrap: wrap;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.shipping-stats span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid rgba(23, 108, 93, 0.16);
  border-radius: 999px;
  padding: 0 9px;
  color: var(--accent-strong);
  background: #fff;
  font-size: 12px;
}

.warning-text {
  color: var(--warn);
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .catalog-panel {
    min-height: auto;
  }

  .product-list {
    max-height: 460px;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 12px;
  }

  .topbar,
  .panel-header,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-box {
    min-width: 100%;
  }

  .toolbar,
  .summary-grid,
  .cart-row,
  .form-grid,
  .address-grid {
    grid-template-columns: 1fr;
  }

  .wide-field {
    grid-column: auto;
  }

  .product-row {
    grid-template-columns: 64px 1fr;
  }

  .product-price {
    text-align: left;
    grid-column: 1 / -1;
  }

  .line-total {
    text-align: left;
  }
}
