:root {
  color: #27212d;
  background: #f1edf4;
  font: 16px/1.45 Inter, "Segoe UI", Arial, sans-serif;
  --ink: #27212d;
  --muted: #62586a;
  --accent: #882a60;
  --line: #e5dce7;
  --panel: #fff;
  --soft: #f8f1f8;
  --shadow: 0 16px 44px #43254812;
  --silk: linear-gradient(112deg, #eebbd8, #fbe9f5 39%, #efb1d4 76%, #dfa7cc);
  --ease: cubic-bezier(.22, .7, .23, 1);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; min-height: 100vh; isolation: isolate; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; }
a { color: var(--accent); }
button { cursor: pointer; }
button:disabled { cursor: progress; opacity: .65; }
:focus-visible { outline: 3px solid #ae4a87; outline-offset: 3px; }

.admin-scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(ellipse at 9% 58%, #eddaed 0%, transparent 48%),
    radial-gradient(ellipse at 91% 13%, #f5cfe6 0%, transparent 48%),
    linear-gradient(127deg, #f6f2f8, #eeebf3 65%, #f9edf5);
}

.admin-scene::before {
  position: absolute;
  inset: -40px;
  content: "";
  background: linear-gradient(#94638525 1px, transparent 1px), linear-gradient(90deg, #94638525 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at 90% 32%, black, transparent 77%);
}

.admin-flow {
  position: absolute;
  inset: -16%;
  background: radial-gradient(ellipse at 18% 69%, #e3b7da9c, transparent 39%),
    radial-gradient(ellipse at 81% 24%, #efadd78c, transparent 35%),
    radial-gradient(ellipse at 69% 66%, #c9c3e98a, transparent 35%);
  opacity: .76;
}

.admin-orbits {
  position: absolute;
  top: 6%;
  right: -8%;
  width: clamp(260px, 50vw, 810px);
  aspect-ratio: 1.35;
  border-radius: 50%;
  border: 1px solid #bb75a461;
  box-shadow: 0 0 56px #cf80b531, inset 0 0 46px #fff9;
  background: repeating-radial-gradient(ellipse at center, transparent 0 12px, #9d68932b 13px 14px);
  rotate: -18deg;
}

.admin-orbits::before {
  position: absolute;
  inset: 8% 4%;
  border: 1px dashed #a976a75e;
  border-radius: 50%;
  content: "";
}

.admin-orbits::after {
  position: absolute;
  top: 63%;
  left: -2%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  content: "";
  background: #b65f99;
  box-shadow: 0 0 0 5px #d39fc04d, 0 0 28px 8px #d39fc0;
}

.admin-orbits-secondary {
  --orbit-angle: 23deg;
  --orbit-end: 35deg;
  top: auto;
  right: auto;
  bottom: -14%;
  left: -12%;
  width: clamp(275px, 43vw, 700px);
  opacity: .65;
  rotate: var(--orbit-angle);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
  padding: .75rem clamp(1rem, 4vw, 3.5rem);
  border-bottom: 1px solid #f2cee437;
  background: linear-gradient(110deg, #1a141f, #2d1e31 84%, #362438);
  color: #fff7fc;
}

.branding, .topbar-actions, .form-actions {
  display: flex;
  align-items: center;
  gap: .65rem;
}

.branding {
  color: #fff7fc;
  font-size: 1.025rem;
  font-weight: 750;
  letter-spacing: -.025em;
  text-decoration: none;
}

.branding > span > span { color: #f9b4d8; }
.branding img { border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px #eab2d87a; }
.button {
  display: inline-flex;
  min-height: 2.65rem;
  justify-content: center;
  align-items: center;
  padding: .55rem .9rem;
  border: 1px solid transparent;
  border-radius: 100px;
  font-weight: 650;
  font-size: .9rem;
  text-decoration: none;
  white-space: nowrap;
}

.primary {
  background: var(--silk);
  color: #3b1931;
  border-color: #d69abd;
  box-shadow: inset 0 1px #fffc, 0 5px 16px #8830672b;
}

.primary:hover { box-shadow: inset 0 1px white, 0 8px 21px #9f48805e; }
.secondary { background: white; border-color: var(--line); color: var(--ink); }
.secondary:hover { background: var(--soft); border-color: #bb9ab8; }
.topbar .secondary, .workspace-heading .secondary {
  color: #fff2fa;
  background: #fff1fd11;
  border-color: #e6bfd05e;
}
.topbar .secondary:hover, .workspace-heading .secondary:hover { background: #fff1fd27; }
.small { min-height: 2.25rem; padding: .35rem .7rem; }

.workspace {
  max-width: 1570px;
  margin-inline: auto;
  padding: clamp(1.15rem, 4vw, 3.5rem) clamp(.75rem, 4vw, 3.5rem) 4rem;
}

h1, h2, p, dl, dd { margin: 0; }
h1 { font-size: clamp(1.65rem, 4vw, 2.75rem); line-height: 1.08; letter-spacing: -.055em; }
h2 { font-size: 1rem; letter-spacing: -.02em; }
.workspace-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.6rem;
  padding: clamp(1rem, 4vw, 2.25rem);
  background: radial-gradient(ellipse at 93% 4%, #6e4168, transparent 64%), #23192a;
  border: 1px solid #704963;
  border-radius: 1.35rem;
  box-shadow: 0 14px 36px #44254732, inset 0 1px #ffe2f123;
  color: #fff4fd;
}

.workspace-heading, .login-card, .metrics > div { position: relative; isolation: isolate; }
.workspace-heading::before, .login-card::before, .metrics > div::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  content: "";
  pointer-events: none;
  background: linear-gradient(118deg, transparent 35%, #e5a6d34a 51%, transparent 66%) -130% 0 / 220% 100% no-repeat;
}
.workspace-heading::before { background-image: linear-gradient(118deg, transparent 35%, #f7b3dd32 51%, transparent 66%); }
.metrics > div:hover, .metrics > div:focus-within {
  border-color: #d59abd;
  box-shadow: 0 12px 30px #993e7426;
}

.notice {
  position: sticky;
  z-index: 1;
  top: .65rem;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 1rem auto;
  padding: .7rem 1rem;
  border: 1px solid #c6decf;
  border-radius: .75rem;
  color: #284c38;
  background: #f0f8f2;
  box-shadow: var(--shadow);
}

.notice.error { background: #fff1f5; color: #87213b; border-color: #ebc5d0; }
.login-card, .panel, .metrics > div {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 1.15rem;
  box-shadow: var(--shadow);
}

.login-card {
  max-width: 30rem;
  margin: clamp(1rem, 10vh, 6rem) auto 0;
  padding: clamp(1.25rem, 5vw, 2.75rem);
  background: linear-gradient(140deg, #fff 30%, #fbf2f9);
  border-top: 2px solid #d694bf;
  box-shadow: 0 22px 68px #6848662d;
}
.login-card h1 { margin-bottom: 1.4rem; }
.login-card form { display: grid; gap: 1rem; }

.sections {
  display: flex;
  gap: .35rem;
  width: fit-content;
  margin-bottom: 1.25rem;
  padding: .3rem;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: linear-gradient(145deg, #eee9f1, #f8ecf5);
}

.section-toggle {
  min-height: 2.4rem;
  padding: .45rem 1.05rem;
  border: 0;
  border-radius: 100px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.section-toggle[aria-pressed="true"] { color: #6b2150; background: linear-gradient(135deg, #fff, #f8dced); box-shadow: 0 2px 8px #41244721; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.metrics > div {
  padding: .9rem 1.05rem;
  border-top-color: #e4accf;
  background: linear-gradient(145deg, #fff 42%, #fbf0f9);
}
.metrics dt { font-size: .9rem; color: var(--muted); }
.metrics dd { margin-top: .12rem; font-size: 1.8rem; line-height: 1.25; letter-spacing: -.045em; font-weight: 750; color: #762454; }

label { display: grid; gap: .35rem; color: var(--muted); font-size: .9rem; font-weight: 650; min-width: 0; }
input, select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 2.6rem;
  padding: .5rem .65rem;
  border: 1px solid #ddd0df;
  border-radius: .6rem;
  background: #fff;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 400;
}

textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #b66b9c; }
select {
  appearance: none;
  padding-right: 2rem;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='8' viewBox='0 0 13 8'%3E%3Cpath d='m1 1 5.5 5.5L12 1' stroke='%23725e73' fill='none' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right .7rem center;
}

input[type="file"] { font-size: .9rem; }
input::file-selector-button {
  margin-right: .65rem;
  padding: .2rem .45rem;
  border: 1px solid var(--line);
  border-radius: .35rem;
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
}

.filters { display: grid; grid-template-columns: minmax(13rem, 24rem) minmax(10rem, 13rem); gap: .85rem; padding: 1rem; }
.table-scroll { overflow-x: auto; border-radius: 0 0 1rem 1rem; }
.table-scroll:focus-visible { outline-offset: -3px; }
table { border-collapse: collapse; width: 100%; min-width: 950px; font-size: .9rem; }
thead { text-align: left; color: #534058; background: #f3eaf4; }
th, td { padding: .8rem .7rem; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
th:first-child, td:first-child { padding-left: 1rem; }
th:last-child, td:last-child { padding-right: 1rem; }
tbody tr:not(.expanded-row):is(:hover, :focus-within) { background: #fbf2f9; }
tbody tr:not(.expanded-row):is(:hover, :focus-within) > :first-child { box-shadow: inset 3px 0 #c369a1; }
.order-id { white-space: nowrap; font-weight: 400; }
.subline { display: block; margin-top: .2rem; color: var(--muted); font-size: .85rem; font-weight: 400; }
.amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.order-action { position: sticky; right: 0; background: white; }
thead .order-action { background: #f3eaf4; }
tbody tr:is(:hover, :focus-within) .order-action { background: #fbf2f9; }
.status {
  display: inline-block;
  padding: .26rem .6rem;
  border-radius: 5rem;
  background: #f0ebf2;
  color: #58475e;
  font-weight: 650;
  white-space: nowrap;
}

.status[data-status="new"] { background: #fbeafa; color: #79215d; }
.status[data-status="printing"] { background: #eeeafe; color: #4f3e86; }
.status[data-status="ready"], .status[data-status="completed"] { background: #e8f5ea; color: #23613f; }
.status[data-status="cancelled"] { background: #fae9ec; color: #862f45; }
.empty { padding: 1.4rem; color: var(--muted); text-align: center; }

.expanded-row > td { padding: 0; background: #f8f4f9; }
.order-editor {
  position: sticky;
  left: 0;
  display: grid;
  grid-template-columns: minmax(12rem, .8fr) minmax(0, 2fr);
  gap: 1.3rem;
  padding: 1rem;
  width: min(100%, calc(100vw - 2 * clamp(.75rem, 4vw, 3.5rem) - 2px));
}

.order-context { min-width: 0; padding: .95rem; border: 1px solid var(--line); border-radius: .75rem; background: white; }
.order-facts { display: grid; gap: .6rem; margin-top: .8rem; }
.order-facts dt, .totals dt { color: var(--muted); font-size: .87rem; }
.order-facts dd { overflow-wrap: anywhere; white-space: pre-wrap; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; align-items: end; }
.fields .wide { grid-column: 1 / -1; }
.fields button.wide { justify-self: start; }
.totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 1rem 0;
  padding: .7rem;
  gap: .5rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: white;
}

.totals dd { color: var(--ink); font-weight: 700; overflow-wrap: anywhere; }
.add-product, .product-panel { padding: 1rem; }
.add-product { margin-bottom: 1rem; }
.add-product summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.add-product[open] summary { margin-bottom: 1rem; }
.add-product form { max-width: 46rem; }
.product-panel > label { max-width: 24rem; }
.product { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 1.15rem; padding: 1rem 0; margin-top: 1rem; border-top: 1px solid var(--line); }
.product-image { display: grid; place-items: center; width: 8rem; height: 8rem; overflow: hidden; border-radius: .65rem; color: var(--muted); background: var(--soft); font-size: .85rem; }
.product-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.form-actions { justify-content: space-between; flex-wrap: wrap; }
.checkbox { display: flex; align-items: center; gap: .45rem; }
.checkbox input { width: 1.1rem; min-height: 0; height: 1.1rem; margin: 0; accent-color: var(--accent); }

.review-panel { padding: 1rem; }
.review-panel > label { max-width: 16rem; }
.review-card { display: grid; gap: .65rem; padding: 1rem 0 .2rem; margin-top: 1rem; border-top: 1px solid var(--line); }
.review-heading, .review-actions { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.review-heading h2, .review-text { overflow-wrap: anywhere; }
.review-rating { color: var(--accent); font-size: .9rem; font-weight: 700; }
.review-text { white-space: pre-wrap; }
.review-media { display: block; width: fit-content; max-width: min(100%, 25rem); overflow: hidden; border-radius: .65rem; background: var(--soft); }
.review-media img { display: block; max-width: 100%; max-height: 18rem; object-fit: contain; }
video.review-media { width: min(100%, 25rem); aspect-ratio: 16 / 9; object-fit: contain; background: #1c161f; }
.review-actions { justify-content: flex-start; flex-wrap: wrap; }
.review-actions .danger { border-color: #e9c7d3; background: #fff; color: #892540; }
.review-actions .danger:hover { border-color: #bd718c; background: #fdf0f4; }
.review-status { font-size: .85rem; }
.review-status[data-status="pending"] { background: #fbeafa; color: #79215d; }
.review-status[data-status="published"] { background: #e8f5ea; color: #23613f; }

.sr-only {
  width: 1px;
  height: 1px;
  position: absolute;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@keyframes admin-orbit-drift {
  from { rotate: var(--orbit-angle, -18deg); translate: 0 0; scale: 1; }
  to { rotate: var(--orbit-end, -8deg); translate: -6% 8%; scale: 1.1; }
}

@keyframes admin-appear {
  from { opacity: .3; translate: 0 12px; }
  to { opacity: 1; translate: 0 0; }
}

@keyframes admin-flow-drift {
  from { translate: -3% 0; scale: 1; }
  to { translate: 5% -4%; scale: 1.14; }
}

@keyframes admin-grid-slide {
  to { translate: 40px 40px; }
}

@keyframes admin-silk-sweep {
  from { background-position: 145% 0; opacity: 0; }
  28% { opacity: 1; }
  to { background-position: -60% 0; opacity: 0; }
}

@keyframes admin-row-appear {
  from { opacity: .54; }
  to { opacity: 1; }
}

.motion-enabled .admin-scene::before { animation: admin-grid-slide 13s linear infinite; }
.motion-enabled .admin-flow { animation: admin-flow-drift 11s ease-in-out infinite alternate; }
.motion-enabled .admin-orbits { animation: admin-orbit-drift 13s ease-in-out infinite alternate; }
.motion-enabled .admin-orbits-secondary { animation-duration: 17s; animation-direction: alternate-reverse; }
.motion-enabled :is(.login-card, .workspace-heading, .sections, .notice, #workspace > section > .panel):not([hidden]) {
  animation: admin-appear .48s var(--ease) backwards;
}
.motion-enabled .workspace-heading::before,
.motion-enabled .login-card::before { animation: admin-silk-sweep 1.45s var(--ease) .2s both; }
.motion-enabled .metrics > div {
  animation: admin-appear .48s var(--ease) backwards;
  transition: border-color .25s, box-shadow .35s var(--ease), translate .35s var(--ease);
}
.motion-enabled .metrics > div:nth-child(2) { animation-delay: .07s; }
.motion-enabled .metrics > div:nth-child(3) { animation-delay: .14s; }
.motion-enabled .metrics > div:hover { translate: 0 -4px; }
.motion-enabled .metrics > div:hover::before { animation: admin-silk-sweep .8s var(--ease) both; }
.motion-enabled tbody tr:nth-child(-n+6) > :is(th, td) {
  animation: admin-row-appear .34s var(--ease) backwards;
}
.motion-enabled tbody tr:nth-child(n+3):nth-child(-n+6) > :is(th, td) { animation-delay: .055s; }
.motion-enabled :is(tbody tr, tbody .order-action) {
  transition: background-color .24s var(--ease), box-shadow .24s var(--ease);
}
.motion-enabled :is(.order-editor, .add-product[open] form, .review-card:nth-child(-n+4)) {
  animation: admin-appear .48s var(--ease) backwards;
}
.motion-enabled :is(.button, .section-toggle, .add-product summary, input, select, textarea) {
  transition: background-color .22s, box-shadow .25s, border-color .2s, translate .25s var(--ease), scale .2s var(--ease);
}
.motion-enabled :is(.button, .section-toggle, .add-product summary):hover:not(:disabled) { translate: 0 -1px; }
.motion-enabled :is(.button, .section-toggle, .add-product summary):active:not(:disabled) { translate: 0 1px; scale: .95; }

@media (max-width: 660px) {
  .topbar { padding-inline: .75rem; }
  .topbar-actions { gap: .35rem; }
  .topbar-actions .button { padding-inline: .55rem; }
  .branding { gap: .45rem; font-size: .9rem; }
  .branding img { width: 32px; height: 32px; }
  .metrics { gap: .4rem; }
  .metrics > div { padding: .65rem .5rem; }
  .metrics dt, .totals dt { font-size: .82rem; }
  .metrics dd { font-size: 1.4rem; }
  .filters { grid-template-columns: 1fr; padding: .75rem; }
  .order-editor { grid-template-columns: 1fr; gap: .8rem; padding: .75rem; }
  .product { grid-template-columns: 1fr; gap: .7rem; }
  .section-toggle { padding-inline: .72rem; }
  .button, .section-toggle, input, select { min-height: 2.75rem; }
  .checkbox input { min-height: 0; }
  .table-scroll { overscroll-behavior-inline: contain; }
  .table-scroll table { min-width: 900px; }
  .table-scroll th, .table-scroll td { padding-inline: .6rem; }
  .table-scroll .expanded-row > td { padding: 0; }
  .table-scroll tbody .empty { padding: 1rem .75rem; text-align: left; }
  .table-scroll .order-id .subline { max-width: 7.5rem; white-space: normal; }
  .table-scroll .order-action {
    z-index: 1;
    box-shadow: -6px 0 9px #57274914;
  }
  .table-scroll .order-action .button { padding-inline: .55rem; }
  .review-heading { flex-wrap: wrap; }
}

@media (max-width: 450px) {
  .topbar { flex-wrap: wrap; gap: .55rem; }
  .topbar-actions { flex-wrap: wrap; }
  .sections { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .section-toggle { padding-inline: .3rem; }
  .add-product, .product-panel, .review-panel { padding: .8rem; }
  .review-actions .button { white-space: normal; }
}

@media (max-width: 390px) {
  .workspace-heading { align-items: flex-start; }
  .workspace-heading .button { padding-inline: .55rem; }
  .fields { grid-template-columns: 1fr; }
  .order-settings > .button, .fields button.wide { width: 100%; }
  .form-actions { align-items: stretch; flex-direction: column; }
}
