:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --ink: #22201d;
  --muted: #706a62;
  --line: #d9d4cc;
  --brand: #253529;
  --brand-soft: #e9eee9;
  --accent: #a4774e;
  --danger: #8f3d2f;
  --shadow: 0 12px 34px rgba(34, 32, 29, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 36px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1,
.panel h2,
.cart-panel h2 {
  margin: 0;
}

.topbar h1 {
  font-size: 28px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

.contact-link {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.layout {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) 360px;
  margin: 0 auto;
  max-width: 1360px;
  padding: 26px 36px 48px;
}

.main-flow {
  display: grid;
  gap: 18px;
}

form {
  display: grid;
  gap: 18px;
}

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

.panel {
  padding: 24px;
}

.intro-panel {
  align-items: start;
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.intro-panel p,
.section-heading p {
  color: var(--muted);
  margin: 6px 0 0;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 360px;
}

.status-strip span {
  background: var(--brand-soft);
  border: 1px solid #d6ded6;
  border-radius: 999px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
}

.section-heading {
  align-items: flex-start;
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
}

.step {
  align-items: center;
  background: var(--brand);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  flex: 0 0 34px;
  font-weight: 700;
  height: 34px;
  justify-content: center;
}

.segmented {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.segmented label {
  cursor: pointer;
}

.segmented input {
  inline-size: 1px;
  opacity: 0;
  position: absolute;
}

.segmented span {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  font-weight: 700;
  justify-content: center;
  min-height: 48px;
  padding: 12px;
}

.segmented input:checked + span {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

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

.company-fields {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 16px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 7px;
}

.wide {
  grid-column: span 2;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 44px;
  padding: 11px 12px;
  width: 100%;
}

textarea {
  resize: vertical;
}

.door-grid,
.product-grid {
  display: grid;
  gap: 14px;
}

.door-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.door-card,
.product-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.door-card {
  cursor: pointer;
  overflow: hidden;
}

.door-card input {
  inline-size: 1px;
  opacity: 0;
  position: absolute;
}

.door-card-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.door-swatch {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: block;
  height: 84px;
  object-fit: contain;
  padding: 6px;
  width: 100%;
}

.door-card strong,
.product-card strong {
  color: var(--ink);
}

.door-card small,
.product-card small,
.cart-item small {
  color: var(--muted);
}

.door-note {
  color: var(--brand) !important;
  font-weight: 700;
}

.door-card input:checked + .door-card-body {
  outline: 3px solid var(--brand);
  outline-offset: -3px;
}

.catalog-tools {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(260px, 420px) 1fr;
  margin-bottom: 16px;
}

.search-label {
  color: var(--ink);
}

.catalog-status {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 12px;
}

.category-tabs {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 12px;
}

.subcategory-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.category-tabs button,
.subcategory-filters button,
.text-button,
.cart-button,
.submit-button,
.email-draft-button {
  border: 0;
  cursor: pointer;
  font-weight: 700;
}

.category-tabs button,
.subcategory-filters button {
  background: #efede8;
  color: var(--ink);
}

.category-tabs button {
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 0;
  min-height: 62px;
  padding: 12px;
  text-align: left;
}

.category-tabs button small {
  color: var(--muted);
  font-weight: 700;
}

.subcategory-filters button {
  border-radius: 999px;
  padding: 9px 12px;
}

.category-tabs button.active,
.subcategory-filters button.active {
  background: var(--brand);
  color: #fff;
}

.category-tabs button.active small {
  color: #dfe9df;
}

.product-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.product-card {
  display: grid;
  gap: 12px;
  min-height: 278px;
  padding: 14px;
}

.cabinet-visual {
  align-items: center;
  aspect-ratio: 4 / 3;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.cabinet-visual img {
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.product-card p {
  color: var(--muted);
  margin: 0;
}

.product-info {
  display: grid;
  gap: 5px;
}

.product-title-row {
  align-items: start;
  display: grid;
  gap: 8px;
}

.availability-badge {
  background: #efe6da;
  border: 1px solid #d9c2a8;
  border-radius: 999px;
  color: #6f3f1c !important;
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  padding: 6px 8px;
  width: fit-content;
}

.availability-warning {
  color: #8a3b20 !important;
  font-weight: 800;
}

.product-card.unavailable {
  background: #fbfaf8;
}

.search-meta {
  background: var(--brand-soft);
  border: 1px solid #d6ded6;
  border-radius: 6px;
  color: var(--brand);
  display: inline-block;
  font-weight: 700;
  padding: 6px 8px;
}

.cart-button {
  background: var(--brand);
  border-radius: 8px;
  color: #fff;
  min-height: 42px;
}

.cart-button:disabled,
.product-action input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.product-action {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: 86px 1fr;
}

.product-action label {
  gap: 5px;
}

.product-action input {
  min-height: 42px;
  text-align: center;
}

.empty-products {
  border: 1px dashed #b7aea4;
  border-radius: 8px;
  color: var(--muted);
  grid-column: 1 / -1;
  padding: 22px;
}

.empty-products strong {
  color: var(--ink);
}

.empty-products p {
  margin: 6px 0 0;
}

.file-drop {
  align-items: center;
  border: 1px dashed #b7aea4;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  justify-items: center;
  margin-bottom: 16px;
  min-height: 116px;
  padding: 16px;
  text-align: center;
}

.file-drop input {
  display: none;
}

.file-drop span {
  color: var(--brand);
  font-size: 17px;
}

.notes-label {
  margin-top: 6px;
}

.submit-button {
  background: var(--accent);
  border-radius: 8px;
  color: #fff;
  font-size: 17px;
  min-height: 54px;
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.preview-actions {
  align-items: start;
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.email-draft-button {
  align-items: center;
  background: var(--brand);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  min-height: 46px;
  padding: 0 18px;
  text-decoration: none;
  width: fit-content;
}

.preview-actions p {
  color: var(--muted);
  margin: 0;
}

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

.submission-message.success {
  background: #eef7ef;
  border-color: #bdd8c1;
  color: #1f4b2a;
}

.submission-message.error {
  background: #fff1ec;
  border-color: #e4b8a8;
  color: #8a3b20;
}

.cart-panel {
  align-self: start;
  padding: 18px;
  position: sticky;
  top: 100px;
}

.cart-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
}

.text-button {
  background: transparent;
  color: var(--danger);
  padding: 6px 0;
}

.cart-items {
  display: grid;
  gap: 8px;
}

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

.cart-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.cart-item-header {
  align-items: start;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.cart-item-name {
  display: grid;
  gap: 2px;
}

.cart-item-name strong {
  font-size: 0.92rem;
  line-height: 1.25;
}

.cart-item-name small {
  font-size: 0.78rem;
}

.remove-button {
  background: transparent;
  border: 0;
  color: var(--danger);
  cursor: pointer;
  font-weight: 700;
}

.qty-row {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: 28px 54px 28px;
  justify-content: start;
  width: fit-content;
}

.qty-row button {
  background: #efede8;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  height: 28px;
}

.qty-row input {
  min-height: 28px;
  padding: 4px 6px;
  text-align: center;
}

.submission-preview {
  border-color: #bfd2c2;
  background: #f7fbf7;
}

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

.summary-block {
  background: #fff;
  border: 1px solid #dce8dc;
  border-radius: 8px;
  padding: 14px;
}

.summary-block h3 {
  margin: 0 0 8px;
}

.summary-block p,
.summary-block li {
  color: var(--muted);
}

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

  .cart-panel {
    position: static;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .layout {
    padding: 18px;
  }

  .panel {
    padding: 18px;
  }

  .intro-panel,
  .section-heading {
    flex-direction: column;
  }

  .status-strip {
    justify-content: flex-start;
  }

  .segmented,
  .form-grid,
  .catalog-tools,
  .category-tabs,
  .door-grid,
  .product-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }
}
