:root {
  --ink: #202421;
  --muted: #5f6964;
  --paper: #f5f7f2;
  --surface: #ffffff;
  --line: #dbe3dc;
  --teal: #087f7f;
  --teal-dark: #055f5f;
  --red: #bf3345;
  --green: #2f8f58;
  --yellow: #f2c14e;
  --shadow: 0 18px 45px rgba(32, 36, 33, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  margin: 0;
  min-height: 100vh;
}

a {
  color: var(--teal);
}

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

button {
  cursor: pointer;
}

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

.site-header {
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 18px 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.admin-header {
  background: var(--ink);
  color: #fff;
}

.admin-header a,
.admin-header .brand {
  color: #fff;
}

.brand {
  align-items: center;
  color: var(--ink);
  display: inline-flex;
  font-weight: 850;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: var(--teal);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.main-nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: flex-end;
}

.main-nav a {
  font-weight: 750;
  text-decoration: none;
}

main {
  min-height: calc(100vh - 148px);
}

.hero-band,
.content-band {
  margin: 0 auto;
  max-width: 1240px;
  padding: 32px 28px;
}

.hero-band {
  align-items: end;
  display: flex;
  gap: 24px;
  justify-content: space-between;
}

.narrow {
  max-width: 760px;
}

.two-column {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) 380px;
}

.wide-left {
  grid-template-columns: minmax(0, 1fr) 420px;
}

.products-admin-layout {
  max-width: 1500px;
  grid-template-columns: minmax(320px, 0.85fr) minmax(680px, 1.15fr);
}

.eyebrow {
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 850;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 2.4rem;
  line-height: 1.08;
  margin-bottom: 10px;
}

h2 {
  font-size: 1.25rem;
}

.lede {
  color: var(--muted);
  font-size: 1.06rem;
  margin-bottom: 0;
}

.toolbar {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px) auto;
  margin-bottom: 22px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.9rem;
  font-weight: 750;
  gap: 7px;
}

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

textarea {
  resize: vertical;
}

.option-index-table textarea {
  min-width: 480px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 127, 127, 0.14);
}

.button {
  align-items: center;
  background: var(--teal);
  border: 0;
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-weight: 850;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  text-decoration: none;
}

.button:hover {
  background: var(--teal-dark);
}

.button.dark {
  background: var(--ink);
}

.button.light {
  background: #edf4f1;
  color: var(--ink);
}

.button.danger {
  background: #fff0f2;
  color: var(--red);
}

.button.small {
  min-height: 34px;
  padding: 7px 10px;
}

.button.full {
  width: 100%;
}

.storefront-products {
  max-width: 1500px;
}

.storefront-layout {
  align-items: start;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
}

.storefront-sidebar {
  display: grid;
  gap: 12px;
  min-width: 0;
  position: sticky;
  top: 24px;
}

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

.storefront-search {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.category-filter-list {
  display: grid;
  gap: 8px;
}

.category-filter-link {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px 12px;
  text-decoration: none;
}

.category-filter-link strong {
  color: var(--muted);
  font-size: 0.82rem;
}

.category-filter-link.active {
  background: #e5f3ee;
  border-color: var(--teal);
}

.product-grid {
  align-items: stretch;
  display: grid;
  gap: 18px;
  grid-auto-rows: 1fr;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.product-card {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  min-width: 0;
  overflow: hidden;
}

.product-card-link {
  color: inherit;
  text-decoration: none;
}

.product-image-wrap {
  aspect-ratio: 4 / 3;
  background: #e6eee8;
  display: block;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.product-image-wrap img,
.table-product img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.stock-badge {
  background: var(--yellow);
  border-radius: 8px;
  bottom: 12px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 850;
  left: 12px;
  padding: 6px 9px;
  position: absolute;
}

.stock-badge.out {
  background: var(--red);
  color: #fff;
}

.product-body {
  display: grid;
  gap: 10px;
  grid-template-rows: auto 1fr;
  min-width: 0;
  padding: 16px;
}

.product-card-summary {
  align-content: start;
  display: grid;
  gap: 10px;
  grid-template-rows: auto 3rem 2.5rem 4.1rem auto auto;
}

.product-card-summary h2 {
  line-height: 1.2;
  margin-bottom: 0;
}

.product-card-summary .button {
  justify-self: start;
}

.category {
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 850;
  margin-bottom: 0;
  text-transform: uppercase;
}

.description,
.empty-state {
  color: var(--muted);
}

.product-title-link {
  color: inherit;
  text-decoration: none;
}

.product-title-link:hover,
.product-card-link:hover img {
  opacity: 0.96;
}

.description,
.part-code,
.price {
  min-width: 0;
  overflow-wrap: anywhere;
}

.product-card-summary h2,
.product-card-summary .part-code,
.product-card-summary .description {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.product-card-summary h2 {
  -webkit-line-clamp: 2;
}

.product-card-summary .part-code {
  -webkit-line-clamp: 2;
  line-height: 1.25;
}

.product-card-summary .description {
  -webkit-line-clamp: 3;
  line-height: 1.35;
}

.price {
  font-size: 1.2rem;
  font-weight: 850;
  margin-bottom: 0;
}

.product-configurator {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.selected-options-block {
  background: #f7fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.selected-options-block h2 {
  font-size: 1rem;
  margin-bottom: 0;
}

.selected-options-lines {
  color: var(--ink);
  display: grid;
  font-size: 1rem;
  gap: 6px;
  line-height: 1.35;
  min-width: 0;
  overflow-wrap: anywhere;
}

.selected-options-lines p {
  margin: 0;
}

.product-selected-options {
  grid-column: 1;
  width: 100%;
}

.product-configurator .button {
  margin-top: auto;
}

.product-buy-row {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: 92px minmax(0, 1fr);
  margin-top: auto;
}

.qty-field {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.qty-field input {
  text-align: center;
}

.product-detail-layout {
  align-items: start;
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  max-width: 1500px;
}

.product-page-search {
  padding-bottom: 0;
}

.product-page-layout {
  align-items: start;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  max-width: 1500px;
}

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

.back-link {
  color: var(--muted);
  display: inline-block;
  margin-bottom: 14px;
  text-decoration: none;
}

.product-detail-gallery {
  display: grid;
  gap: 14px;
}

.product-detail-main-image {
  aspect-ratio: 4 / 3;
  background: #e6eee8;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.product-detail-main-image img,
.product-detail-thumb img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.product-detail-thumbs {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.product-detail-thumb {
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: block;
  overflow: hidden;
}

.product-detail-panel {
  display: grid;
  gap: 12px;
}

.product-detail-copy {
  max-width: 1500px;
}

.detail-text {
  color: var(--ink);
  line-height: 1.6;
  white-space: normal;
}

.panel {
  align-self: start;
  padding: 20px;
}

.stacked-form,
.table-form {
  display: grid;
  gap: 14px;
}

.form-row,
.button-row {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

.responsive-table {
  overflow-x: auto;
}

.section-heading-row {
  align-items: end;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.option-index-editor {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.admin-link-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  margin-top: 24px;
  padding: 16px;
}

.admin-link-panel h2 {
  margin-bottom: 0;
}

.option-index-page {
  max-width: 1500px;
}

.category-page {
  max-width: 1200px;
}

.category-editor {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.category-table {
  table-layout: fixed;
}

.category-table th:nth-child(1),
.category-table td:nth-child(1) {
  width: 42%;
}

.category-table th:nth-child(2),
.category-table td:nth-child(2) {
  width: 26%;
}

.category-table th:nth-child(3),
.category-table td:nth-child(3) {
  width: 12%;
}

.category-table th:nth-child(4),
.category-table td:nth-child(4) {
  width: 20%;
}

.metadata-table {
  table-layout: fixed;
}

.metadata-heading-row {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.metadata-heading-row h3 {
  margin-bottom: 0;
}

.metadata-table th:nth-child(1),
.metadata-table td:nth-child(1) {
  width: 32%;
}

.metadata-table th:nth-child(2),
.metadata-table td:nth-child(2) {
  width: 48%;
}

.metadata-table th:nth-child(3),
.metadata-table td:nth-child(3) {
  width: 20%;
}

.metadata-option-list {
  display: grid;
  gap: 8px;
}

.metadata-option-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.metadata-option-list + .button {
  margin-top: 8px;
}

.option-index-table {
  table-layout: fixed;
}

.option-index-table th:nth-child(1),
.option-index-table td:nth-child(1) {
  font-weight: 850;
  width: 15%;
}

.option-index-table th:nth-child(2),
.option-index-table td:nth-child(2) {
  width: 9%;
}

.option-index-table th:nth-child(3),
.option-index-table td:nth-child(3) {
  width: 22%;
}

.option-index-table th:nth-child(4),
.option-index-table td:nth-child(4) {
  width: 22%;
}

.option-index-table th:nth-child(5),
.option-index-table td:nth-child(5) {
  width: 13%;
}

.option-index-table th:nth-child(6),
.option-index-table td:nth-child(6) {
  width: 8%;
}

.option-index-table th:nth-child(7),
.option-index-table td:nth-child(7) {
  width: 11%;
}

.option-index-description-row td {
  background: #f7fbfa;
  border-top: 0;
  font-weight: 750;
  padding-top: 0;
}

.option-index-description-row label {
  width: 100%;
}

.option-index-description-row textarea {
  min-width: 100%;
}

.option-index-table td:nth-child(1) input {
  font-weight: 850;
}

.option-index-editor input {
  min-width: 120px;
  width: 100%;
}

.option-index-row-actions {
  display: grid;
  gap: 8px;
}

.option-index-actions {
  justify-self: end;
  min-width: 360px;
}

.sort-form label {
  align-items: center;
  color: var(--muted);
  display: grid;
  font-size: 0.82rem;
  font-weight: 750;
  gap: 8px;
  grid-template-columns: auto minmax(140px, 180px);
  margin: 0;
  white-space: nowrap;
}

.sort-form {
  align-items: end;
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
}

table {
  background: var(--surface);
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

td span {
  color: var(--muted);
  display: block;
  font-size: 0.86rem;
}

.table-product {
  align-items: center;
  display: flex;
  gap: 10px;
}

.table-product img {
  border-radius: 8px;
  flex: 0 0 auto;
  height: 48px;
  width: 48px;
}

.qty-input {
  max-width: 88px;
}

.inline-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.total-line,
.order-line {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
}

.total-line strong {
  font-size: 1.25rem;
}

.stats-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.stat-card {
  color: var(--ink);
  display: grid;
  gap: 8px;
  padding: 18px;
  text-decoration: none;
}

.stat-card span {
  color: var(--muted);
  font-weight: 750;
}

.stat-card strong {
  font-size: 2rem;
}

.detail-block {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.flash {
  border-radius: 8px;
  font-weight: 750;
  margin: 18px auto 0;
  max-width: 1184px;
  padding: 12px 14px;
}

.flash.success {
  background: #e6f5ec;
  color: #17643a;
}

.flash.error {
  background: #fff0f2;
  color: var(--red);
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 22px 28px;
  text-align: center;
}

@media (max-width: 1120px) {
  .product-detail-layout,
  .products-admin-layout {
    grid-template-columns: 1fr;
  }

  .product-selected-options {
    grid-column: 1;
  }
}

@media (max-width: 980px) {
  .two-column,
  .wide-left,
  .products-admin-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .site-header,
  .hero-band {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 1.85rem;
  }

  .toolbar,
  .form-row,
  .button-row,
  .product-buy-row,
  .storefront-search {
    grid-template-columns: 1fr;
  }

  .storefront-layout {
    grid-template-columns: 1fr;
  }

  .product-page-layout {
    grid-template-columns: 1fr;
  }

  .storefront-sidebar {
    position: static;
  }

  .storefront-products .product-grid {
    grid-template-columns: 1fr;
  }

  .product-card-summary {
    grid-template-rows: auto;
  }

  .option-choice {
    align-items: start;
  }
}

@media (min-width: 721px) and (max-width: 1120px) {
  .storefront-layout,
  .product-page-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

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


.part-code {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 0;
}

.part-code strong {
  color: var(--ink);
}

.option-fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  margin: 0;
  min-width: 0;
  padding: 12px;
}

.option-fieldset legend {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
  padding: 0 6px;
}

.option-choice {
  align-items: center;
  color: var(--ink);
  display: grid;
  font-size: 0.88rem;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-width: 0;
}

.option-choice span {
  line-height: 1.25;
  min-width: 0;
  overflow-wrap: anywhere;
}

.option-choice input {
  min-height: auto;
  width: auto;
}

.option-choice strong {
  color: var(--muted);
  font-size: 0.82rem;
  justify-self: end;
  text-align: right;
  white-space: nowrap;
}

.option-editor {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  padding-top: 14px;
}

.option-editor h3 {
  margin-bottom: 0;
}

.form-help {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 0;
}

.option-row {
  display: grid;
  gap: 10px;
}

.option-group-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 12px;
}

.option-editor .option-group-card:nth-of-type(6n+1) {
  background: #edf7e8;
}

.option-editor .option-group-card:nth-of-type(6n+2) {
  background: #e8f6f6;
}

.option-editor .option-group-card:nth-of-type(6n+3) {
  background: #f6efd9;
}

.option-editor .option-group-card:nth-of-type(6n+4) {
  background: #f2eaf5;
}

.option-editor .option-group-card:nth-of-type(6n+5) {
  background: #eaf0f8;
}

.option-editor .option-group-card:nth-of-type(6n) {
  background: #f6eae4;
}

.option-group-header {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding-bottom: 12px;
}

.option-group-settings {
  grid-template-columns: minmax(0, 1fr) 150px 150px auto;
}

.option-group-rows {
  display: grid;
  gap: 12px;
}

.option-group-footer {
  display: flex;
  justify-content: flex-start;
}

.option-entry {
  align-items: end;
  column-gap: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  row-gap: 8px;
}

.conditional-addon-list {
  display: grid;
  gap: 12px;
}

.conditional-addon-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.option-entry > input[type="hidden"] {
  display: none;
}

.option-row-actions {
  align-self: end;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.option-row-actions .button {
  white-space: nowrap;
}

.option-row.four-column {
  grid-template-columns: 1fr 1fr 120px 110px;
}

.option-row.three-column {
  grid-template-columns: 1fr 120px 110px;
}

.option-row.five-column {
  grid-template-columns: minmax(120px, 1fr) 130px minmax(180px, 1.2fr) 120px 110px;
}

.option-row.six-column {
  grid-template-columns: minmax(130px, 1fr) minmax(130px, 1fr) minmax(130px, 1fr) minmax(180px, 1.2fr) 120px 110px;
}

.image-editor {
  display: grid;
  gap: 10px;
}

.image-row {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.option-editor-actions {
  display: flex;
  justify-content: flex-end;
}

.order-line small {
  color: var(--muted);
  display: block;
  font-size: 0.82rem;
  margin-top: 3px;
}

@media (max-width: 720px) {
  .option-row.four-column,
  .option-row.three-column,
  .option-row.five-column,
  .option-row.six-column,
  .image-row,
  .option-group-settings,
  .option-group-header,
  .option-entry {
    grid-template-columns: 1fr;
  }

  .option-editor-actions,
  .option-row-actions {
    justify-content: stretch;
  }

  .section-heading-row {
    align-items: stretch;
    flex-direction: column;
  }
}
