:root {
  color-scheme: light;
  --ink: #171838;
  --muted: #605971;
  --paper: #fcf7f0;
  --card: #fffdf9;
  --line: #e8ded6;
  --accent: #3f3d81;
  --accent-light: #eeedf8;
  --danger: #962e45;
  --success: #24664f;
  font: 100% 'DM Sans', 'Trebuchet MS', system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
a { color: var(--accent); text-underline-offset: .2em; }
h1,h2,h3,p { margin: 0; }
h1 { margin-top: .15em; font-size: clamp(2.05rem,5vw,3.45rem); line-height: 1.05; letter-spacing: -.06em; }
h2 { font-size: 1.5rem; letter-spacing: -.035em; }
h3 { font-size: 1.03rem; }
p { line-height: 1.5; }
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .9rem max(1.2rem, calc((100vw - 1140px) / 2));
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.site-header > a:last-child { font-size: .9rem; }
.brand { text-decoration: none; color: var(--ink); letter-spacing: .13em; font-weight: 950; font-size: 1.4rem; }
.brand span { color: #9f5070; }
main { max-width: 1190px; padding: clamp(1.1rem,4vw,2.5rem); margin-inline: auto; }
.page-title,.section-heading,.dataset-tools,.order-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.page-title { align-items: flex-end; margin-bottom: 1.55rem; }
.section-label { color: var(--accent); font-size: .78rem; font-weight: 850; letter-spacing: .13em; }
#identity { display: flex; flex-wrap: wrap; gap: .35rem 1rem; justify-content: flex-end; font-size: .9rem; color: var(--muted); overflow-wrap: anywhere; }
#dashboard { display: grid; grid-template-columns: clamp(13rem,19vw,16rem) minmax(0,1fr); align-items: start; gap: clamp(1rem,2.5vw,2.5rem); }
.dashboard-content { min-width: 0; }
.sidebar { position: sticky; top: 1rem; max-height: calc(100dvh - 2rem); overflow: auto; padding: .5rem; background: var(--card); border: 1px solid var(--line); border-radius: .95rem; }
@media (width > 800px) {
  .sidebar { margin-block-start: var(--sidebar-panel-offset,0px); }
}
.tabs { display: grid; gap: .25rem; }
.nav-group summary { display: flex; align-items: center; justify-content: space-between; min-height: 2.65rem; padding: .5rem 1rem; font-size: .92rem; font-weight: 750; color: var(--ink); cursor: pointer; border-radius: .65rem; list-style: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: ''; width: .4rem; height: .4rem; border-bottom: 2px solid currentColor; border-right: 2px solid currentColor; transform: rotate(-45deg); }
.nav-group[open] summary::after { transform: rotate(45deg); }
.nav-group summary:hover { background: var(--accent-light); }
.nav-group:has([aria-pressed="true"]) summary { color: var(--accent); }
.subnav { display: grid; gap: .12rem; margin: .15rem 0 .45rem 1.15rem; padding-left: .35rem; border-left: 1px solid var(--line); }
.tabs .subnav button { padding: .45rem .65rem; min-height: 2.3rem; font-size: .84rem; font-weight: 600; }
#menu-toggle { display: none; }
button,.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.65rem;
  border: 1px solid transparent;
  border-radius: .65rem;
  padding: .5rem .8rem;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 750;
  font-size: .9rem;
  text-decoration: none;
  cursor: pointer;
}
button:disabled { opacity: .55; cursor: wait; }
button:hover:not(:disabled),.button:hover { filter: brightness(.92); }
.tabs button { justify-content: flex-start; text-align: left; background: transparent; color: var(--muted); }
.tabs button:hover { background: var(--accent-light); }
.tabs button[aria-pressed="true"] { box-shadow: inset 3px 0 var(--accent); }
.tabs button[aria-pressed="true"],.secondary { background: var(--accent-light); color: var(--accent); }
.danger { background: #fceef0; color: var(--danger); }
:focus-visible { outline: 3px solid #6f65b4; outline-offset: 3px; }
.panel,.notice {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: .95rem;
  box-shadow: 0 .4rem 1.6rem #24112e09;
}
.panel { padding: clamp(1rem,3vw,1.5rem); margin: 1rem 0; }
#access { max-width: 36rem; display: grid; justify-items: start; gap: .7rem; }
form.panel { display: grid; gap: .9rem; justify-items: start; }
form.panel > *:not(button) { width: 100%; }
.fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .8rem 1.1rem; }
.fields .full { grid-column: 1 / -1; }
label { display: grid; min-width: 0; gap: .35rem; font-weight: 750; font-size: .84rem; }
input,select {
  width: 100%;
  min-width: 0;
  padding: .58rem .62rem;
  background: #fff;
  border: 1px solid #d8cfc8;
  border-radius: .63rem;
  color: var(--ink);
  font: inherit;
  font-weight: 450;
}
.items { min-width: 0; margin: 0; border: 1px solid var(--line); border-radius: .7rem; padding: .8rem; }
.items legend { font-size: .84rem; padding-inline: .25rem; font-weight: 750; }
.item-row { display: grid; grid-template-columns: minmax(0,1fr) 6rem auto; align-items: end; gap: .6rem; margin-bottom: .7rem; }
.item-row button { min-height: 2.2rem; }
#order-total { font-weight: 800; font-size: 1.05rem; }
.muted,.empty { color: var(--muted); font-size: .86rem; }
.dataset { padding: 0; overflow: hidden; }
.dataset-tools { padding: 1rem 1.2rem; background: var(--card); }
.dataset-tools h3:not(:last-child) { margin-bottom: .55rem; }
.search-fields { display: flex; align-items: end; flex-wrap: wrap; gap: .6rem; }
.search-fields input { min-width: min(13rem, 100%); }
.table-scroll { overflow: auto; }
.table-scroll:focus-visible { outline-offset: -4px; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: .9rem; }
th,td { padding: .78rem 1.2rem; border-top: 1px solid var(--line); }
th { color: var(--muted); background: #f8f0e8; font-size: .79rem; white-space: nowrap; }
td { overflow-wrap: anywhere; }
td small { display: block; color: var(--muted); margin-top: .17rem; }
.status-editor { display: flex; gap: .45rem; align-items: center; min-width: 14rem; }
.status-editor button { min-height: 2.2rem; }
.empty { padding: 1rem 1.2rem; }
.notice { padding: .72rem .9rem; margin-bottom: 1rem; color: var(--success); }
.notice.error { color: var(--danger); border-color: #efc8cc; }
td .positive { color: var(--success); }
td .negative { color: var(--danger); }
@media (max-width: 600px) {
  .page-title { align-items: flex-start; flex-direction: column; gap: .65rem; }
  #identity { justify-content: flex-start; }
  .fields { grid-template-columns: 1fr; }
  .dataset-tools { align-items: end; }
  .item-row { grid-template-columns: minmax(0,1fr) auto; }
  .item-row label:first-child { grid-column: 1 / -1; }
  th,td { padding-inline: .8rem; }
}

.order-details { margin-top: .6rem; color: var(--muted); font-size: .82rem; }
.order-details summary { cursor: pointer; color: var(--accent); font-weight: 700; }
.order-details p,.order-details ul { margin: .35rem 0 0; }
.order-details ul { padding-left: 1.1rem; }

main { max-width: 1390px; }
.tabs button { padding-inline: 1rem; }
.dataset-tools { align-items: flex-end; flex-wrap: wrap; }
.dataset-tools > .search-fields { flex: 1; }
.section-heading { min-height: 2.65rem; }
.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; }
.order-id { display: grid; justify-items: start; gap: .6rem; }
input[readonly],textarea[readonly] { background: #f4f1eb; color: var(--muted); }
textarea { resize: vertical; min-height: 5.5rem; width: 100%; padding: .65rem; border: 1px solid #d8cfc8; border-radius: .63rem; font: inherit; color: var(--ink); }
.product-cell { display: flex; align-items: center; gap: .75rem; min-width: 14rem; }
.product-cell img { width: 56px; height: 56px; object-fit: contain; background: white; border: 1px solid var(--line); border-radius: .55rem; flex: 0 0 56px; }
.product-cell strong { font-size: .87rem; }
#product-list .product-family-cell { align-items: flex-start; min-width: 19rem; }
.product-family-details { min-width: 0; flex: 1; }
.product-family-details > strong { display: block; }
.product-family-picker { margin-top: .6rem; font-size: .76rem; }
.product-family-picker select { min-height: 44px; font-size: .82rem; }
#product-list .product-row-actions { display: grid; gap: .4rem; min-width: 6rem; }
#product-list .product-row-actions button { min-height: 44px; width: 100%; }
#product-list .product-delete { border: 1px solid #e6c3cc; }
#product-list .product-row-status { max-width: 12rem; margin: .1rem 0 0; color: var(--muted); font-size: .76rem; }
#product-list .product-row-status.error { color: var(--danger); }
#product-list td:nth-child(2),#product-list td:nth-child(3),#product-list td:nth-child(5) { white-space: nowrap; }
@media (max-width: 600px) {
  #product-list td:last-child { position: sticky; right: 0; background: var(--card); box-shadow: -4px 0 8px #24112e09; }
}
dialog { width: min(1050px,calc(100% - 2rem)); max-height: calc(100dvh - 2rem); margin: auto; border: 1px solid #d8cfc8; border-radius: 1.1rem; padding: 0; color: var(--ink); background: var(--card); box-shadow: 0 1.5rem 5rem #17183845; }
dialog::backdrop { background: #17183885; backdrop-filter: blur(2px); }
.product-delete-dialog { width: min(34rem,calc(100% - 2rem)); }
.product-delete-confirmation { padding: 1.3rem; }
.product-delete-confirmation strong { display: block; overflow-wrap: anywhere; }
.product-delete-confirmation p { margin: 0 0 .8rem; }
.product-delete-confirmation strong + p { margin-top: .4rem; }
.product-delete-confirmation .row-actions { justify-content: flex-end; margin-top: 1.2rem; }
.product-delete-confirmation button { min-height: 44px; }
.dialog-head { display: flex; position: sticky; top: 0; z-index: 2; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.3rem; background: var(--card); border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 1.3rem; overflow-wrap: anywhere; }
#editor-notice { position: sticky; top: 4.5rem; z-index: 1; margin: 1rem; }
#editor-body { padding: 1.3rem; }
#editor-body form { display: grid; gap: 1rem; margin-bottom: 1rem; }
#editor-body form > button { justify-self: start; }
#editor-body .fields { width: 100%; }
#editor-body .fields label:last-child:nth-child(odd) { grid-column: 1 / -1; }
#editor-body > button { margin-top: .4rem; }
.gallery-editor,.detail-section { margin-top: 1.5rem; padding-top: 1.4rem; border-top: 1px solid var(--line); display: grid; gap: .85rem; }
.gallery-editor > button { justify-self: start; }
.gallery-editor > label { justify-self: stretch; }
.media-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1rem; margin-block: 1rem; }
.media-card { display: grid; align-content: start; gap: .6rem; padding: .8rem; border: 1px solid var(--line); border-radius: .7rem; background: #fff; }
.media-card.is-selected { border-color: var(--accent); background: #f5f2fa; box-shadow: 0 0 0 1px var(--accent); }
.media-card-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.media-select-label { padding: .4rem .5rem; border-radius: .45rem; background: #f0ecf5; cursor: pointer; font-size: .875rem; }
.media-select-label input { min-width: 18px; min-height: 18px; cursor: pointer; }
.media-bulk-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .85rem; border: 1px solid var(--line); border-radius: .7rem; background: #f3eff8; }
.media-bulk-toolbar[hidden] { display: none; }
.media-selection-count { margin-left: auto; color: var(--muted); font-size: .875rem; }
#editor-body[aria-busy="true"] { opacity: .7; cursor: progress; }
.media-card > img { width: 100%; aspect-ratio: 4/3; object-fit: contain; background: #fff; }
.media-card button { font-size: .78rem; min-height: 2rem; padding: .4rem .55rem; }
.radio-label,.check-label { display: flex; gap: .5rem; align-items: center; }
.radio-label input,.check-label input { width: auto; margin: 0; accent-color: var(--accent); }
.removed-image { display: inline-flex; flex-direction: column; width: 100px; gap: .5rem; margin: .5rem; }
.removed-image img { width: 100px; height: 75px; object-fit: contain; }
.detail-row { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem; padding-bottom: .8rem; border-bottom: 1px solid var(--line); font-size: .88rem; }
.detail-row strong:first-child { margin-right: auto; }
.detail-section > .status-editor { justify-self: start; }
.order-totals { display: grid; gap: .4rem; justify-items: end; padding-top: 1rem; }
.timeline { display: grid; gap: .8rem; padding-left: 1.2rem; margin: 0; }
.timeline small { color: var(--muted); }
.return-record { border: 1px solid var(--line); padding: 1rem; border-radius: .75rem; display: grid; gap: .6rem; }
.return-record h4 { margin: 0; }
.return-lines { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem; }
.return-editor { margin-top: .5rem; }
@media (max-width: 800px) {
  #dashboard { display: block; }
  .sidebar { position: relative; top: auto; width: fit-content; max-height: none; overflow: visible; margin-bottom: 1rem; border: 0; padding: 0; background: transparent; }
  #menu-toggle { display: inline-flex; gap: .65rem; }
  #menu-toggle::before { content: ''; width: 1rem; height: 2px; background: currentColor; box-shadow: 0 -5px currentColor, 0 5px currentColor; }
  .tabs { position: absolute; z-index: 3; top: calc(100% + .35rem); left: 0; width: min(15rem,calc(100vw - 2rem)); max-height: 60dvh; overflow: auto; padding: .5rem; border: 1px solid var(--line); border-radius: .85rem; background: var(--card); box-shadow: 0 .65rem 1.4rem #231d3e25; }
  #menu-toggle[aria-expanded="false"] + .tabs { display: none; }
  .media-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dataset-tools > .search-fields { flex-basis: 100%; }
}
@media (max-width: 520px) {
  .media-bulk-toolbar { align-items: stretch; }
  .media-selection-count { flex-basis: 100%; margin-left: 0; }
  main { padding: 1rem .75rem; }
  .media-grid { grid-template-columns: 1fr; }
  .return-lines { grid-template-columns: 1fr; }
  dialog { width: calc(100% - 1rem); max-height: calc(100dvh - 1rem); }
  #editor-body,.dialog-head { padding: 1rem; }
  .product-cell { min-width: 12rem; }
  .tabs button { padding-inline: .75rem; }
}


#audit-list details{max-width:24rem}#audit-list pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:.76rem;max-height:18rem;overflow:auto;padding:.65rem;background:#f8f0e8;border-radius:.5rem}
