:root {
  color-scheme: light;
  --ink: #16171c;
  --cream: #f4f1ec;
  --surface: #f3ecdf;
  --line: #c9beaa;
  --muted: #55565d;
  --green: #56c41d;
  --display: 'Archivo Black', sans-serif;
  font-family: Inter, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--edy-surface-grain), var(--edy-surface-green), var(--edy-surface-warm), var(--edy-surface-base);
  color: var(--ink);
}
a { color: inherit; }
button { font: inherit; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
main:focus { outline: none; }

.shell { width: calc(100% - clamp(32px, 5.4vw, 92px)); max-width: 1520px; margin-inline: auto; }
.sr-only, .skip:not(:focus) {
  position: absolute;
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  overflow: hidden;
  white-space: nowrap;
}
.skip:focus {
  position: fixed;
  z-index: 2;
  top: 12px;
  left: 12px;
  padding: 12px;
  background: var(--surface);
}

.site-header { border-bottom: 1px solid var(--line); background: #f0e8d8bb; }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; min-height: 44px; }
.brand img { width: clamp(104px, 14vw, 170px); height: 44px; object-fit: contain; object-position: left center; }

.back-link, .button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 8px 16px;
  background: transparent;
  color: var(--ink);
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
}
.back-link:hover, .button:hover:not(:disabled) { background: #eae5dc; }
.button:disabled { opacity: .55; cursor: wait; }
.button-primary { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.button-primary:hover:not(:disabled) { background: #373840; }
.button-primary:focus-visible { outline-color: var(--ink); }
.button-cancel { color: #a33335; }

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 42%);
  align-items: center;
  margin-top: clamp(16px, 3vw, 40px);
  border-radius: clamp(16px, 2vw, 26px);
  background: var(--green);
}
.hero-content { z-index: 1; padding: clamp(22px, 4vw, 58px); }
.hero-motion { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.hero-mark {
  position: absolute;
  width: min(52vw, 630px);
  height: auto;
  top: 50%;
  right: 4%;
  opacity: .19;
  filter: grayscale(1) brightness(0) invert(1);
  transform: translateY(-51%) rotate(-14deg);
  animation: energy-mark 12s ease-in-out infinite alternate;
}
.hero-shard {
  position: absolute;
  width: clamp(38px, 9vw, 124px);
  height: auto;
  opacity: .65;
  filter: drop-shadow(0 14px 18px #254a2455);
  animation: energy-shard 7s ease-in-out infinite alternate;
}
.hero-shard-one { top: 15%; right: 12%; --shard-turn: 22deg; }
.hero-shard-two { bottom: 10%; right: 40%; width: clamp(26px, 6vw, 86px); --shard-turn: -28deg; animation-delay: -4s; }
@keyframes energy-mark {
  to { transform: translate(-4%, -48%) rotate(-7deg) scale(1.13); }
}
@keyframes energy-shard {
  from { transform: translateY(-5%) rotate(var(--shard-turn)); }
  to { transform: translateY(18%) rotate(calc(var(--shard-turn) + 17deg)); }
}
.hero-tag {
  margin: 0 0 16px;
  font-size: .74rem;
  font-weight: 750;
  line-height: 1.35;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hero h1, .panel h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: -.025em;
}
.hero h1 { font-size: clamp(2.8rem, 6.6vw, 6rem); line-height: .88; }
.hero-content > p:last-child { max-width: 41ch; margin: 20px 0 0; font-size: .95rem; font-weight: 550; line-height: 1.48; }
.hero-product { position: relative; align-self: stretch; display: grid; place-items: center; min-height: 160px; }
.hero-product::before {
  content: '';
  position: absolute;
  width: min(122%, 530px);
  aspect-ratio: 1;
  background: repeating-radial-gradient(closest-side, transparent 0 21px, #f4f1ec67 22px 23px, transparent 24px 38px);
  mask-image: radial-gradient(closest-side, #000 28%, transparent 91%);
  animation: energy-ring 6.5s ease-in-out infinite alternate;
}
@keyframes energy-ring { to { transform: scale(1.1); opacity: .6; } }
.hero-product img {
  position: relative;
  display: block;
  width: auto;
  height: clamp(180px, 23vw, 304px);
  max-width: 80%;
  object-fit: contain;
  transform: rotate(14deg);
  filter: drop-shadow(10px 16px 12px #19301450);
}

.overview { margin-block: clamp(14px, 2vw, 26px); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; }
.metrics > div {
  min-width: 0;
  padding: 15px clamp(12px, 2vw, 23px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.metrics dt, .panel-label { color: var(--muted); font-size: .76rem; font-weight: 650; line-height: 1.3; }
.metrics dd {
  margin: 6px 0 0;
  font-size: clamp(1.3rem, 2.55vw, 2rem);
  font-weight: 820;
  line-height: 1.1;
  letter-spacing: -.055em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.workspace { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 68px;
  padding: 10px clamp(13px, 1.5vw, 22px);
  border-bottom: 1px solid var(--line);
  background: #e4d9c587;
}
.panel h2 { font-size: clamp(1.2rem, 2.4vw, 1.8rem); line-height: 1.05; }
.panel-message { padding: 9px 18px; color: var(--muted); font-size: .9rem; }
.panel-label { margin: 5px 0 0; }
.refresh { padding-inline: 12px; }

.empty { display: grid; justify-items: center; align-content: center; min-height: 250px; padding: 24px 18px; text-align: center; }
.empty h3 { margin: 0; font-size: 1.13rem; letter-spacing: -.035em; }
.empty p { max-width: 36ch; margin: 8px 0 18px; color: var(--muted); font-size: .87rem; line-height: 1.5; }

.order + .order { border-top: 1px solid var(--line); }
.order-highlight { box-shadow: inset 4px 0 var(--green); }
.order-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: clamp(6px, 1.1vw, 13px);
  min-height: 69px;
  padding: 10px clamp(12px, 1.5vw, 22px);
  list-style: none;
  cursor: pointer;
}
.order-summary::-webkit-details-marker { display: none; }
.order-summary:hover, .order[open] > .order-summary { background: #16171c08; }
.order-summary:focus-visible { outline-offset: -3px; }
.order-identity { min-width: 0; }
.order-identity strong, .order-identity time { display: block; }
.order-identity strong { font-size: .92rem; overflow-wrap: anywhere; }
.order-identity time { margin-top: 3px; color: var(--muted); font-size: .71rem; font-variant-numeric: tabular-nums; line-height: 1.3; }
.order-total { font-size: .82rem; white-space: nowrap; }
.order-view { color: var(--muted); font-size: .71rem; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.order-view > span + span, .order[open] .order-view > span:first-child { display: none; }
.order[open] .order-view > span + span { display: inline; }
.status {
  padding: 4px 8px;
  border-radius: 999px;
  background: #deefcd;
  color: #254917;
  font-size: .7rem;
  font-weight: 750;
  line-height: 1.3;
  text-align: center;
}
.status[data-status='preparing'] { background: #f5e7bf; color: #66481b; }
.status[data-status='shipped'] { background: #d7ebef; color: #14505a; }
.status[data-status='cancelled'] { background: #f4deda; color: #792b2f; }
.order-body { border-top: 1px solid var(--line); padding: 0 clamp(12px, 1.5vw, 22px); }
.line-items { margin: 0; padding: 0; list-style: none; }
.line-items li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; font-size: .84rem; line-height: 1.35; }
.line-items li + li { border-top: 1px solid var(--line); }
.line-items li > span { white-space: nowrap; }
.line-items small { display: block; margin-top: 4px; color: var(--muted); font-size: .75rem; }
.order-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 5px 0 13px; }

.inventory {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 12px;
  list-style: none;
}
.stock {
  display: grid;
  grid-template-rows: minmax(2em, auto) 1fr auto auto;
  justify-items: center;
  align-items: center;
  min-width: 0;
  gap: 7px;
  padding: 11px 5px 10px;
  border-radius: 13px;
  background: var(--flavor);
  color: var(--stock-ink, #fff);
  text-align: center;
}
.stock-name {
  font-family: var(--display);
  font-size: clamp(.72rem, 1.25vw, 1.02rem);
  font-weight: 400;
  line-height: 1.05;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.stock-art { display: grid; place-items: center; min-width: 0; }
.stock-art img { display: block; width: auto; height: 54px; object-fit: contain; filter: drop-shadow(0 3px 4px #16171c3b); }
.stock-art [data-new-product] {
  display: block;
  height: 54px;
  aspect-ratio: .46;
  border: 1px solid #16171c65;
  border-block-width: 4px;
  border-radius: 6px;
  background:
    url('./logo-mark.webp') center / 70% auto no-repeat,
    linear-gradient(90deg, #16171c6b, #ffffff80 23%, transparent 64%, #16171c70),
    var(--flavor);
}
.stock-controls { display: grid; justify-items: center; gap: 6px; align-self: end; }
.stock-status { min-width: 0; font-size: .69rem; font-weight: 750; }
.stock-edit {
  min-width: 72px;
  min-height: 34px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--surface);
  color: var(--ink);
  font-size: .7rem;
  font-weight: 750;
  cursor: pointer;
}
.stock-edit:hover:not(:disabled) { background: var(--cream); }
.stock-edit:disabled { opacity: .6; cursor: wait; }
.stock-quantity {
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--ink);
  color: var(--cream);
  font-size: .7rem;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
}
.stock-quantity strong { font-size: .8rem; }

.product-dialog {
  width: min(420px, calc(100% - 32px));
  max-height: calc(100dvh - 24px);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(18px, 4vw, 30px);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 65px #16171c3d;
}
.product-dialog::backdrop { background: #16171c8a; }
.product-dialog h2 { margin: 0 0 20px; font: 400 1.6rem/1.05 var(--display); text-transform: uppercase; overflow-wrap: anywhere; }
.field { display: grid; gap: 5px; margin-block: 12px; font-size: .84rem; font-weight: 650; }
.field input, .field select {
  min-width: 0;
  min-height: 42px;
  border: 1px solid #87868b;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  font: 500 1rem Inter, sans-serif;
}
.field input[type='color'] { width: 72px; padding: 3px 5px; cursor: pointer; }
.product-error { color: #8a2329; font-size: .85rem; line-height: 1.4; }
.product-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  border: 1px solid #c98674;
  border-radius: 12px;
  padding: 10px 13px;
  background: #f9e8df;
  color: #6d2d22;
  font-size: .86rem;
  line-height: 1.4;
}
.feedback button { flex-shrink: 0; }
.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-block: 14px 22px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 550;
  line-height: 1.4;
}

@media (max-width: 900px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 570px) {
  .topbar { min-height: 64px; }
  .back-link { padding-inline: 11px; }
  .hero { grid-template-columns: minmax(0, 1fr) minmax(68px, 29%); }
  .hero-content { padding: 20px 0 23px 16px; }
  .hero-tag { margin-bottom: 12px; font-size: .65rem; letter-spacing: .08em; }
  .hero h1 { font-size: clamp(1.84rem, 8.6vw, 2.85rem); }
  .hero-content > p:last-child { margin-top: 13px; font-size: .78rem; }
  .hero-product img { height: clamp(92px, 34vw, 143px); }
  .hero-product::before { width: 195%; }
  .hero-mark { width: 64vw; right: -18%; opacity: .14; }
  .hero-shard-one { right: 5%; }
  .hero-shard-two { display: none; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metrics > div { padding: 11px; }
  .workspace { gap: 12px; }
  .panel-header { min-height: 58px; }
  .order-view { display: none; }
  .order-summary { grid-template-columns: minmax(0, 1fr) auto auto; }
  .inventory { gap: 7px; padding: 9px; }
  .stock { border-radius: 10px; }
  .feedback { align-items: start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-mark, .hero-shard, .hero-product::before { animation: none; }
}
