:root {
  color-scheme: light;
  --canvas: #f5f4f0;
  --panel: #fffefa;
  --ink: #191a1a;
  --muted: #625f5a;
  --line: #e6e3db;
  --subtle: #f7f5ef;
  --sidebar: #171819;
  --accent: #a92526;
  --accent-hover: #881c1d;
  --green-ink: #2f5840;
  --green-bg: #e9f2e9;
  --amber-ink: #6e4e24;
  --amber-bg: #f4eddf;
  --radius: .85rem;
  --app-edge: clamp(1.2rem, 3.15vw, 3.45rem);
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font: .9375rem/1.5 var(--font); }
p, h1, h2, figure, dl, dd { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }

.workspace { display: grid; grid-template-columns: 14rem minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 1.6rem .95rem 1.5rem;
  background: var(--sidebar);
  color: #f9f7f0;
}
.brand { display: inline-flex; gap: .7rem; align-items: center; line-height: 1.18; }
.brand img { width: 2.55rem; aspect-ratio: 1; border-radius: .48rem; }
.brand strong { display: block; font-size: .925rem; font-weight: 760; letter-spacing: -.02em; }
.brand small { display: block; margin-top: .25rem; color: #afaca5; font-size: .75rem; }
.sidebar-brand { padding: 0 .45rem; }
.sidebar :focus-visible { outline-color: #f18376; }

.admin-links { display: grid; gap: .3rem; margin-top: 2.55rem; }
.admin-links button {
  display: flex;
  align-items: center;
  position: relative;
  gap: .78rem;
  min-height: 2.8rem;
  width: 100%;
  border: 1px solid transparent;
  border-radius: .55rem;
  background: transparent;
  color: #c8c5bf;
  padding: .55rem .75rem;
  text-align: left;
  font-weight: 620;
  font-size: .875rem;
}
.admin-links button:hover { color: #fff; background: #262626; }
.admin-links button[aria-current="page"] { background: #312423; border-color: #4b302d; color: #f8efeb; }
.admin-links button[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -.04rem;
  height: 1.3rem;
  width: .16rem;
  border-radius: 0 .2rem .2rem 0;
  background: #ed7870;
}
.admin-links button[aria-current="page"] i { color: #ef8c83; }

.icon { display: inline-block; position: relative; flex: 0 0 auto; width: 1rem; height: 1rem; border: 1.4px solid; border-radius: .19rem; }
.icon-products::before, .icon-products::after { content: ""; position: absolute; background: currentColor; }
.icon-products::before { top: 0; bottom: 0; left: 50%; width: 1px; }
.icon-products::after { left: 0; right: 0; top: 50%; height: 1px; }
.icon-content::before { content: ""; position: absolute; top: .23rem; left: 0; right: 0; border-top: 1px solid; }
.icon-content::after { content: ""; position: absolute; left: .19rem; bottom: .2rem; width: .35rem; border-top: 1px solid; }
.icon-orders { transform: scale(.84, 1); }
.icon-orders::before { content: ""; position: absolute; left: .19rem; right: .19rem; top: .31rem; height: .25rem; border-block: 1px solid; }
.icon-shipping { height: .68rem; margin-block: .11rem .2rem; }
.icon-shipping::before, .icon-shipping::after { content: ""; position: absolute; bottom: -.24rem; width: .26rem; height: .26rem; border: 1px solid; border-radius: 50%; background: var(--sidebar); }
.icon-shipping::before { left: .09rem; }
.icon-shipping::after { right: .09rem; }
.icon-launch { border-radius: 50%; }
.icon-launch::before { content: ""; position: absolute; inset: .24rem; border: 1px solid; transform: rotate(45deg); }
.icon-search { width: .8rem; height: .8rem; border-radius: 50%; }
.icon-search::after { content: ""; position: absolute; width: .36rem; height: 1.3px; background: currentColor; transform: rotate(45deg); transform-origin: left; top: .59rem; left: .57rem; }

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
  min-height: 4.25rem;
  padding: .65rem var(--app-edge);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.breadcrumb, .top-actions { display: flex; align-items: center; gap: .8rem; }
.breadcrumb { font-size: .85rem; color: var(--muted); }
.breadcrumb strong { color: var(--ink); font-weight: 680; }
.top-actions { gap: .65rem; }
.mobile-brand { display: none; }
.mode {
  display: inline-flex;
  align-items: center;
  gap: .38rem;
  padding: .28rem .58rem;
  border-radius: 2rem;
  background: var(--amber-bg);
  color: var(--amber-ink);
  white-space: nowrap;
  font-size: .73rem;
  font-weight: 710;
}
.mode::before { content: ""; display: block; width: .36rem; height: .36rem; border-radius: 50%; background: currentColor; }
.mode:empty { display: none; }

.primary, .secondary, .quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  border: 1px solid transparent;
  border-radius: .5rem;
  min-height: 2.55rem;
  padding: .5rem .85rem;
  line-height: 1.25;
  font-weight: 690;
  font-size: .84rem;
  white-space: nowrap;
}
.primary { color: white; background: var(--accent); }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.primary span { font-size: 1.12em; }
.secondary { background: var(--panel); border-color: #dfdad0; }
.secondary:hover { background: var(--subtle); border-color: #c9c2b4; }
.quiet { background: transparent; color: var(--muted); }
.quiet:hover { background: var(--subtle); color: var(--ink); }

.app-content { padding: 2.2rem var(--app-edge) 4rem; max-width: 100rem; margin: 0 auto; }
.page-head, .panel-heading, .editor-heading, .section-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .7rem;
}
.page-head { margin-bottom: 1.55rem; }
h1 { font-size: clamp(2rem, 4.4vw, 3rem); font-weight: 740; letter-spacing: -.06em; line-height: 1.06; }
.page-head p { color: var(--muted); margin-top: .45rem; font-size: .9rem; }
.page-head .primary { min-height: 2.8rem; padding-inline: 1rem; }
h2, legend { font-size: 1.12rem; line-height: 1.25; font-weight: 730; letter-spacing: -.025em; }
.metrics { display: grid; grid-template-columns: repeat(4,minmax(0, 1fr)); gap: .85rem; margin-bottom: 1.45rem; }
.metrics > div, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
  box-shadow: 0 2px 4px #29201606;
}
.metrics > div { padding: .9rem 1rem .85rem; }
.metrics dt { font-size: .78rem; font-weight: 620; color: var(--muted); }
.metrics dd { font-size: 1.92rem; line-height: 1.1; letter-spacing: -.065em; font-weight: 710; margin-top: .3rem; font-variant-numeric: tabular-nums; }

.catalogue-layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(13rem, 22vw, 19rem); gap: 1rem; align-items: start; }
.catalogue-panel { overflow: hidden; }
.catalogue-header { display: grid; gap: .85rem; padding: 1.05rem 1rem .95rem; }
.panel-heading > .muted { font-size: .76rem; white-space: nowrap; }
.catalogue-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .55rem; }
.search { display: flex; position: relative; align-items: center; min-width: 0; }
.search .icon { position: absolute; inset-inline-start: .77rem; color: var(--muted); pointer-events: none; }
.search #product-search { padding-inline-start: 2.1rem; }
.status-filter select { width: 100%; }

.catalogue-columns, .product-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5.65rem 3.15rem 5.45rem 1rem;
  align-items: center;
  column-gap: .55rem;
}
.catalogue-columns {
  background: var(--subtle);
  color: var(--muted);
  border-block: 1px solid var(--line);
  padding: .5rem 1rem;
  font-size: .67rem;
  letter-spacing: .055em;
  text-transform: uppercase;
  font-weight: 730;
}
#product-results { max-height: 34rem; overflow: auto; scrollbar-color: #ccc5ba transparent; }
.product-row {
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  width: 100%;
  text-align: start;
  padding: .65rem 1rem;
  min-height: 4.35rem;
}
.product-row:hover { background: var(--subtle); }
.product-row:focus-visible { outline-offset: -3px; }
#product-results > :last-child .product-row { border-bottom: 0; }
.product-identity { display: grid; grid-template-columns: 2.65rem minmax(0,1fr); align-items: center; gap: .63rem; }
.product-row img { width: 2.65rem; height: 3.2rem; object-fit: cover; background: #e9e6df; border-radius: .35rem; }
.product-row strong, .product-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-row strong { font-size: .85rem; font-weight: 720; }
.product-row small { color: var(--muted); font-size: .73rem; margin-top: .13rem; }
.chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 2rem;
  padding: .25rem .48rem;
  font-size: .7rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
}
.chip[data-status="active"], .chip[data-status="paid"], .chip[data-status="shipped"] { color: var(--green-ink); background: var(--green-bg); }
.chip[data-status="draft"], .chip[data-status="pending"] { color: var(--amber-ink); background: var(--amber-bg); }
.chip[data-status="archive"], .chip[data-status="expired"], .chip[data-status="refunded"] { color: var(--muted); background: #efede7; }
.product-stock { font-size: .81rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.product-stock[data-empty="true"] { color: var(--muted); font-weight: 520; }
.product-price { font-size: .81rem; font-weight: 690; white-space: nowrap; font-variant-numeric: tabular-nums; }
.price-from { display: block; color: var(--muted); font-size: .67rem; font-weight: 530; }
.row-arrow { font-size: 1.1rem; color: var(--muted); justify-self: end; }
.empty { padding: 1.25rem 1rem; color: var(--muted); font-size: .87rem; }
.catalogue-panel .empty { text-align: center; padding: 2rem 1rem; }

.campaign-panel { padding: .85rem; }
.campaign-panel .panel-heading { margin: 0 .15rem .6rem; }
.campaign-edit { min-height: 2.15rem; padding: .3rem .45rem; }
.campaign-visual {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: center;
  isolation: isolate;
  width: 100%;
  min-height: 19rem;
  aspect-ratio: 5 / 6.5;
  overflow: hidden;
  border-radius: .53rem;
  color: #fff9ef;
  background: #313b42;
}
.campaign-visual img { position: absolute; z-index: -2; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 32%; }
.campaign-visual::after { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(0deg,#101317ef 2%,#10131700 59%); }
.campaign-caption { width: 100%; padding: 1rem; }
.campaign-caption p { font-size: .67rem; font-weight: 720; text-transform: uppercase; letter-spacing: .11em; margin-bottom: .24rem; }
.campaign-caption strong { display: block; max-width: 15ch; overflow-wrap: anywhere; font-size: clamp(1.35rem, 2.2vw, 2rem); line-height: 1.02; letter-spacing: -.05em; font-weight: 720; }

form, .fields, .form-panel { display: grid; gap: .85rem; }
label { display: grid; gap: .24rem; min-width: 0; font-size: .8rem; font-weight: 650; }
:where(input:not([type="checkbox"]), select, textarea) {
  min-width: 0;
  width: 100%;
  min-height: 2.5rem;
  background: #fff;
  border: 1px solid #dedad1;
  border-radius: .42rem;
  padding: .48rem .65rem;
  font-size: .875rem;
}
:where(input[type="file"]) { font-size: .77rem; padding: .35rem; }
::file-selector-button { font: inherit; border: 0; border-radius: .3rem; background: #f0ece4; padding: .35rem .55rem; margin-inline-end: .5rem; cursor: pointer; }
textarea { min-height: 5rem; resize: vertical; }
input[readonly] { background: var(--subtle); color: var(--muted); }
input[type="checkbox"] { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; margin: 0; }
.toggle { display: flex; align-items: center; gap: .48rem; min-height: 2.5rem; }
.fields.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.form-panel, .orders-panel { padding: clamp(.95rem, 2vw, 1.5rem); }
.form-panel :is(.secondary, .save), .editor > .save { justify-self: start; }
fieldset.panel { margin: 0; }
fieldset.panel legend { padding: 0 .3rem; }
.editor { gap: 1.1rem; max-width: 64rem; }
.product-responsible { margin-top: .65rem; }
.editor-heading { position: sticky; top: 0; background: var(--canvas); padding-block: .2rem; z-index: 2; }
.media-main { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .9rem; align-items: center; max-width: 45rem; }
.image-preview { height: 7.5rem; overflow: hidden; border: 1px solid var(--line); border-radius: .55rem; background: var(--subtle); }
.admin-preview { width: 100%; height: 100%; object-fit: cover; }
.montra-layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(16.5rem, 26vw, 22rem); gap: 1.15rem; align-items: start; }
.montra-preview { min-width: 0; position: sticky; top: 1rem; overflow: hidden; }
.montra-toolbar, .montra-save { display: flex; gap: .55rem .8rem; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.montra-toolbar { padding: .65rem .8rem; border-bottom: 1px solid var(--line); }
.montra-toolbar h2 { font-size: .85rem; }
.preview-devices { display: flex; gap: .2rem; padding: .2rem; background: var(--subtle); border: 1px solid var(--line); border-radius: .45rem; }
.preview-devices button { min-height: 2rem; padding: .3rem .55rem; border: 0; border-radius: .3rem; background: transparent; color: var(--muted); font-size: .73rem; font-weight: 650; }
.preview-devices button[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
.preview-stage { display: grid; justify-items: center; background: #eae7df; min-height: 4rem; }
.preview-screen { width: var(--preview-width); height: var(--preview-height); position: relative; overflow: hidden; background: #101113; }
#site-preview { position: absolute; inset: 0 auto auto 0; width: var(--device-width); height: var(--device-height); border: 0; transform: scale(var(--preview-scale)); transform-origin: top left; }
.montra-save { position: sticky; top: 0; z-index: 2; background: var(--canvas); padding-block: .15rem .4rem; }
.montra-save p { font-size: .75rem; }
.variant-row, .photo-row, .shipping-row {
  display: grid;
  align-items: end;
  gap: .65rem;
  border-bottom: 1px solid var(--line);
  padding-block: .7rem;
}
.variant-row { grid-template-columns: minmax(5rem,1.1fr) minmax(6rem,1.35fr) repeat(2,minmax(3.75rem,.65fr)) auto auto; }
.reserve-note { grid-column: 1 / -1; font-size: .78rem; }
.photo-row { grid-template-columns: 2.8rem minmax(7rem,.7fr) minmax(8rem,1fr) minmax(8rem,1fr) auto; }
.gallery-preview { width: 2.8rem; height: 2.5rem; object-fit: cover; border-radius: .3rem; }
.photo-row label:first-of-type { grid-column: 2; }
.shipping-row { grid-template-columns: 1fr 1fr minmax(5rem,.42fr) auto; }
#view-shipping .form-panel { max-width: 65rem; }
#view-launch .form-panel { max-width: 65rem; }
.drop-heading { flex-wrap: wrap; gap: .65rem; }
.drop-table-wrap { overflow-x: auto; }
.drop-table-wrap table { width: 100%; min-width: 32rem; border-collapse: collapse; text-align: left; font-size: .86rem; }
.drop-table-wrap th, .drop-table-wrap td { padding: .7rem .65rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.drop-table-wrap th { color: var(--muted); font-size: .78rem; }
.drop-table-wrap td { overflow-wrap: anywhere; }
.drop-table-wrap td:last-child { white-space: nowrap; }
.drop-pagination { display: flex; flex-wrap: wrap; justify-content: end; align-items: center; gap: .55rem; }
.drop-downloads { display: flex; flex-wrap: wrap; gap: .55rem; }
#shipping-rows:empty { display: none; }
#shipping-empty { background: var(--subtle); border-radius: .4rem; }

.orders-panel .panel-heading { margin-bottom: .6rem; flex-wrap: wrap; }
.section-tools { justify-content: end; flex-wrap: wrap; }
.order-card { border-top: 1px solid var(--line); }
.order-card summary {
  list-style: none;
  display: grid;
  grid-template-columns: minmax(6rem,1fr) minmax(7rem,1fr) minmax(5rem,.55fr) auto;
  align-items: center;
  gap: .6rem;
  padding: .75rem 0;
  font-size: .86rem;
}
.order-card summary::-webkit-details-marker { display: none; }
.order-ref { font-weight: 735; }
.order-ref small { display: block; color: var(--muted); font-size: .72rem; font-weight: 500; }
.order-card[open] summary .row-arrow { transform: rotate(90deg); }
.order-details { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; border-top: 1px solid var(--line); padding: .8rem 0 1.2rem; }
.order-details ul { margin: 0; padding-inline-start: 1.1rem; }
.order-details p { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); }
.order-details form { max-width: 24rem; }
.order-details form .primary { justify-self: start; }

.access { width: min(100% - 2.4rem, 27rem); margin: 12vh auto 3rem; }
.access-brand { margin-bottom: 1.2rem; }
.access-brand small { color: var(--muted); }
.access-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.access-card h1 { font-size: clamp(1.65rem, 5vw, 2.25rem); margin-bottom: 1.25rem; }
.access-card .primary { margin-top: .2rem; }
.access-card #mfa-secret { padding: .6rem; background: var(--subtle); overflow-wrap: anywhere; }
#feedback {
  position: fixed;
  z-index: 10;
  right: var(--app-edge);
  bottom: 1rem;
  width: fit-content;
  max-width: calc(100% - 2 * var(--app-edge));
  padding: .65rem .85rem;
  border-radius: .55rem;
  background: #222624;
  color: #fff;
  box-shadow: 0 .3rem 1rem #14131022;
  font-size: .86rem;
}
#feedback:empty { padding: 0; box-shadow: none; }
#feedback[data-error="true"] { background: #7e2322; }

@media (max-width: 1170px) {
  .workspace { grid-template-columns: 12.2rem minmax(0,1fr); }
  .catalogue-layout { grid-template-columns: minmax(0,1fr) 13rem; }
  .catalogue-columns, .product-row { grid-template-columns: minmax(0,1fr) 5.15rem 2.5rem 4.85rem .6rem; column-gap: .45rem; }
  .campaign-visual { min-height: 17rem; }
}
@media (max-width: 1000px) {
  .catalogue-layout { grid-template-columns: 1fr; }
  .campaign-panel { max-width: 25rem; }
  .campaign-visual { min-height: 14rem; aspect-ratio: 2 / 1; }
  .montra-layout { grid-template-columns: minmax(0, 1fr); }
  .montra-preview { position: static; }
}
@media (max-width: 770px) {
  .workspace { display: block; }
  .sidebar { display: contents; }
  .sidebar-brand { display: none; }
  .admin-links {
    display: grid;
    grid-template-columns: repeat(5,minmax(0,1fr));
    gap: .25rem;
    position: fixed;
    z-index: 5;
    inset-inline: 0;
    bottom: 0;
    margin: 0;
    padding: .32rem .5rem max(.35rem, env(safe-area-inset-bottom));
    background: var(--sidebar);
    border-top: 1px solid #32302f;
  }
  .admin-links button { justify-content: center; flex-direction: column; gap: .3rem; padding: .46rem .1rem; font-size: .65rem; }
  .admin-links button[aria-current="page"]::before { display: none; }
  .mobile-brand { display: block; flex: 0 0 auto; }
  .mobile-brand img { width: 1.9rem; border-radius: .35rem; }
  .topbar { min-height: 3.6rem; gap: .55rem; }
  .breadcrumb { margin-inline-end: auto; }
  .breadcrumb span { display: none; }
  .app-content { padding-top: 1.55rem; padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }
  #feedback { bottom: calc(4.4rem + env(safe-area-inset-bottom)); }
  .variant-row, .photo-row, .shipping-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .photo-row label:first-of-type { grid-column: auto; }
  .photo-row .gallery-preview { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  :root { --app-edge: .85rem; }
  .breadcrumb { display: none; }
  .top-actions { gap: .35rem; margin-inline-start: auto; }
  .top-actions :is(.quiet, .secondary) { min-height: 2.1rem; padding-inline: .48rem; font-size: .73rem; }
  .page-head { align-items: start; gap: .45rem; }
  .page-head .primary { min-height: 2.4rem; padding-inline: .65rem; font-size: .76rem; }
  .page-head p { font-size: .81rem; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); gap: .55rem; margin-bottom: .95rem; }
  .metrics > div { padding: .65rem .7rem; }
  .metrics dd { font-size: 1.56rem; }
  .catalogue-header { padding: .8rem .7rem; }
  .catalogue-tools { grid-template-columns: 1fr; }
  .catalogue-columns { display: none; }
  .product-row {
    grid-template-columns: minmax(0,1fr) minmax(3.45rem,auto) .6rem;
    grid-template-rows: auto auto;
    padding: .55rem .6rem;
    row-gap: .2rem;
  }
  .product-identity { grid-column: 1; grid-row: 1 / 3; }
  .product-row .chip { grid-column: 2; grid-row: 2; }
  .product-stock { grid-column: 1; grid-row: 2; margin-inline-start: 3.28rem; align-self: end; justify-self: start; white-space: nowrap; font-size: .68rem; }
  .product-row small { margin-bottom: .85rem; }
  .product-price { grid-column: 2; grid-row: 1; }
  .product-row .row-arrow { grid-column: 3; grid-row: 1 / 3; }
  #product-results { max-height: none; }
  .order-details { grid-template-columns: 1fr; }
  .media-main { grid-template-columns: 4.5rem minmax(0,1fr); }
  .image-preview { height: 5.2rem; }
  .order-card summary { grid-template-columns: minmax(0,1fr) auto auto; }
  .order-card summary .row-arrow { display: none; }
}
