:root {
  --accent: #15539a;
  --navy-dark: #102f4c;
  --hair: #dbe3eb;
}
body:is(
  [data-page="home"],
  [data-page="catalogue"],
  [data-page="products"],
  [data-page="cart"],
  [data-page="orders"],
  [data-page="operations"]
) {
  background: #f1f4f7;
  color: #172c41;
}
.mast {
  background: #fff;
  width: 100%;
  padding: 12px max(4%, calc((100vw - 1200px) / 2));
  border-bottom: 1px solid var(--hair);
  gap: 1rem;
}
.mast .market-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.mast .market-nav a {
  color: var(--navy-dark);
  text-decoration: none;
  font-weight: 600;
}
.market,
.commerce {
  width: min(1200px, 94%);
  padding-block: 1.6rem 3rem;
}
[data-page="home"] .market,
.product-detail .market {
  background: #fff;
  padding-inline: clamp(0.65rem, 2vw, 1.5rem);
}
.market h1,
.commerce h1 {
  font:
    700 clamp(1.65rem, 3.8vw, 3rem)/1.16 "Segoe UI",
    Tahoma,
    sans-serif;
  letter-spacing: -0.025em;
}
.market h2,
.commerce h2 {
  font-size: 1.2rem;
}
.primary,
.market .primary {
  background: #15539a;
  color: white;
  border: 1px solid #144a87;
  display: inline-block;
  text-decoration: none;
  padding: 0.62rem 1rem;
  border-radius: 6px;
}
.shop-hero {
  position: relative;
  display: grid;
  min-height: 180px;
  isolation: isolate;
  border-radius: 10px;
  overflow: hidden;
  background: #e9dfcf;
}
.shop-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 55%;
  z-index: -1;
}
.shop-hero > div {
  justify-self: right;
  text-align: start;
  width: 45%;
  padding: clamp(1rem, 5vw, 4.6rem) 0.6rem;
  color: #153359;
  align-self: center;
}
.shop-hero h1 {
  margin: 0 0 0.85rem;
  font-size: clamp(1.6rem, 4vw, 3.5rem);
  max-width: 12ch;
}
.shop-hero > button {
  position: absolute;
  bottom: 0.6rem;
  left: 0.7rem;
  background: white;
  color: #19395c;
  border-radius: 50%;
}
.shop-strip {
  margin-block: 1.5rem;
}
.category-strip,
.store-strip {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.category-strip a,
.store-strip a {
  display: grid;
  justify-items: center;
  gap: 0.3rem;
  color: #173653;
  text-decoration: none;
  min-width: 6.5rem;
  padding: 0.65rem;
}
.category-strip a::before,
.store-strip a::before {
  font-size: 1.6rem;
}
.store-strip a {
  align-content: center;
  border: 1px solid var(--hair);
  border-radius: 8px;
  background: white;
  min-width: 9rem;
}
.category-strip a:hover,
.store-strip a:hover {
  background: #eef4fa;
}
.store-strip small {
  color: var(--muted);
}
.market-heading {
  padding: 0.5rem 0 1rem;
}
.product-list {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 0.9rem;
}
.product-list li {
  border: 1px solid var(--hair);
  border-radius: 9px;
  padding: 0.65rem;
  overflow: hidden;
}
.product-list h3 {
  font:
    650 1.03rem/1.35 "Segoe UI",
    Tahoma,
    sans-serif;
}
[data-page="home"] .product-list li > p:not(:last-of-type) {
  display: none;
}
.product-list li > .primary,
.product-list li > a.secondary {
  align-self: stretch;
  text-align: center;
  margin-top: 0.6rem;
}
.product-detail #items {
  display: block;
}
.product-detail #items > li {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(1rem, 4vw, 3rem);
  padding: clamp(0.8rem, 2.4vw, 2rem);
}
.product-detail #items > li > .product-photo {
  max-height: 470px;
  aspect-ratio: 1;
  object-fit: contain;
  grid-column: 1;
}
.detail-purchase {
  grid-column: 2;
  display: grid;
  gap: 0.7rem;
  align-self: center;
}
.detail-purchase h1 {
  font-size: clamp(1.65rem, 4vw, 2.65rem);
}
.detail-purchase p {
  margin: 0;
}
.detail-purchase .price {
  font-size: 1.5rem;
}
.vendor-byline {
  border-top: 1px solid var(--hair);
  padding-top: 0.6rem;
}
.product-detail #list > .list-tools,
.product-detail #intro {
  display: none;
}
.related-list {
  display: grid !important;
  grid-template-columns: repeat(
    auto-fit,
    minmax(min(100%, 155px), 1fr)
  ) !important;
}
.related-list a {
  text-decoration: none;
  color: inherit;
}
.variant-axes,
.pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}
.variant-axes {
  width: 100%;
  margin-block: 0.5rem;
}
.variant-axes label {
  display: grid;
  gap: 0.2rem;
}
.variant-axes select {
  width: 100%;
}
[data-page="products"] .market-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
[data-page="products"] .market-body > section {
  width: 100%;
}
#editor {
  max-width: 820px;
}
.table-scroll {
  overflow: auto;
  max-width: 100%;
}
.table-scroll table {
  border-collapse: collapse;
  width: 100%;
  background: white;
  font-size: 0.92rem;
}
.table-scroll td,
.table-scroll th {
  padding: 0.58rem 0.7rem;
  border-bottom: 1px solid var(--hair);
  text-align: start;
  vertical-align: middle;
}
.table-scroll th {
  background: #eff3f7;
  color: #2d4960;
  font-size: 0.85rem;
}
.table-scroll td small {
  display: block;
  color: var(--muted);
}
.mini-photo,
.checkout-thumb {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 6px;
  vertical-align: middle;
  margin-inline-end: 0.65rem;
}
.table-scroll .actions {
  gap: 0.35rem;
  flex-wrap: wrap;
}
.table-scroll button {
  padding: 0.35rem 0.65rem;
  font-size: 0.86rem;
}
.badge.approved {
  background: #ddf0e5;
  color: #205d3b;
}
.badge.pending {
  background: #fff0d3;
  color: #7a541a;
}
.badge.suspended,
.badge.rejected {
  background: #f9e1de;
  color: #8b3730;
}
.ops-layout {
  grid-template-columns: clamp(145px, 17vw, 205px) minmax(0, 1fr);
  gap: 1rem;
}
#sections {
  position: sticky;
  top: 0.75rem;
  min-height: 68vh;
  border-radius: 9px;
  background: linear-gradient(155deg, #163d60, #0e2b47);
  padding: 0.7rem;
}
#sections a {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
}
.section-tab[aria-current] {
  background: #295577;
  box-shadow: inset 3px 0 #83b9ee;
}
.metrics {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 0.55rem;
}
.metric {
  border: 1px solid var(--hair);
  border-radius: 6px;
  padding: 0.75rem 0.85rem;
}
.metric strong {
  font:
    700 1.45rem/1.4 "Segoe UI",
    sans-serif;
}
.metric span {
  font-size: 0.84rem;
}
.sheet {
  border: 1px solid var(--hair);
  border-radius: 8px;
}
.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 0.8rem;
  align-items: start;
}
.analytics-grid .sheet {
  margin: 0;
}
.chart-products {
  grid-column: 1/-1;
  margin-bottom: 0.8rem !important;
}
.analytics-grid canvas {
  width: 100%;
  height: 210px;
  display: block;
}
.analytics-grid details {
  font-size: 0.82rem;
}
.analytics-grid details[open] {
  max-height: 18rem;
  overflow: auto;
}
.legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
}
.legend span::before {
  content: "";
  display: inline-block;
  width: 0.65em;
  height: 0.65em;
  margin-inline-end: 0.35em;
  border-radius: 2px;
  background: #1855a0;
}
.legend .series-sand::before {
  background: #c5ab83;
}
.chart-bar {
  display: grid !important;
  grid-template-columns: 1fr auto;
  gap: 0.2rem 0.7rem;
  margin-block: 0.6rem;
}
.chart-bar meter {
  width: 100%;
  grid-column: 1/-1;
  accent-color: #2167ac;
}
.recent-order {
  display: block;
  padding: 0.45rem 0;
}
#build-matrix {
  background: white;
  border: 1px solid var(--hair);
  padding: 0.65rem;
  margin-block: 0.5rem;
  border-radius: 7px;
}
.checkout-thumb {
  float: inline-start;
  margin-bottom: 0.6rem;
}
.basket-line {
  display: flow-root;
}
#print-invoice {
  display: none;
}
@media (min-width: 950px) {
  .shop-hero {
    min-height: 310px;
  }
}
@media (max-width: 720px) {
  .mast {
    padding: 0.65rem 4%;
    gap: 0.45rem;
  }
  .mast .market-nav {
    gap: 0.55rem;
    flex-wrap: wrap;
  }
  .market,
  .commerce {
    width: 95%;
  }
  .shop-hero img {
    object-fit: fill;
  }
  .shop-hero > div {
    width: 48%;
    padding: 0.9rem 0.25rem;
  }
  .shop-hero h1 {
    font-size: 1.55rem;
  }
  .category-strip {
    gap: 0.15rem;
  }
  .category-strip a {
    min-width: 4rem;
    padding: 0.45rem;
    font-size: 0.8rem;
  }
  .product-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }
  .product-list li {
    padding: 0.45rem;
  }
  .product-list .card-meta {
    gap: 0.2rem;
    font-size: 0.9rem;
  }
  .variant-axes {
    grid-template-columns: 1fr;
  }
  .product-detail #items > li {
    display: block;
  }
  .detail-purchase {
    margin-top: 1rem;
  }
  .detail-purchase .variant-axes {
    grid-template-columns: 1fr 1fr;
  }
  .ops-layout,
  .analytics-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  #sections {
    position: static;
    min-height: 0;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .table-scroll th,
  .table-scroll td {
    padding: 0.38rem;
  }
  .market .filters {
    gap: 0.4rem;
  }
}
@media print {
  @page {
    size: auto;
    margin: 15mm;
  }
  body:has(#print-invoice) > :not(#print-invoice) {
    display: none !important;
  }
  #print-invoice {
    display: block !important;
    background: white;
    color: #172b3d;
    font:
      11pt/1.45 "Segoe UI",
      Tahoma,
      sans-serif;
  }
  #print-invoice header {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 2px solid #1855a0;
    padding-bottom: 8px;
  }
  #print-invoice h1 {
    font-size: 20pt;
  }
  #print-invoice h2 {
    break-after: avoid;
    font-size: 13pt;
  }
  #print-invoice table {
    width: 100%;
    border-collapse: collapse;
  }
  #print-invoice td,
  #print-invoice th {
    text-align: start;
    border-bottom: 1px solid #aaa;
    padding: 5px;
  }
  #print-invoice tr {
    break-inside: avoid;
  }
  #print-invoice dl {
    max-width: 24em;
    margin-inline-start: auto;
    break-inside: avoid;
  }
  #print-invoice dl div {
    display: flex;
    justify-content: space-between;
    padding: 3px;
  }
  #print-invoice dd {
    margin: 0;
  }
}

.header-search {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex: 1;
  max-width: 31rem;
}
.header-search input {
  min-width: 0;
  width: 100%;
  padding: 0.46rem 0.8rem;
  border: 1px solid var(--hair);
  border-radius: 6px;
  background: #f1f4f7;
}
.header-search button {
  padding: 0.45rem 0.7rem;
}
.sr-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.ops-layout > #content {
  min-width: 0;
}
.primary-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 720px) {
  .header-search {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }
  .primary-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.detail-purchase:only-child {
  grid-column: 1/-1;
}
