:root {
  --ink: #163c31;
  --paper: #f8f7f2;
  --panel: #fffefa;
  --sand: #dfddcf;
  --muted: #58685e;
  --leaf: #bcd9b8;
  --warn: #903a20;
  font-family: "DM Sans", "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
}
* {
  box-sizing: border-box;
}
body {
  padding-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  padding-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  padding-left: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
  padding-right: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
select,
input[type="checkbox"],
input[type="range"],
label.upload {
  cursor: pointer;
}
button,
.upload {
  border: 1px solid var(--sand);
  background: var(--panel);
  color: var(--ink);
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  font-weight: 550;
}
button:hover,
.upload:hover {
  border-color: var(--ink);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button.primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
button.danger {
  color: var(--warn);
  border-color: #d9b2a5;
}
button.active {
  background: #dde7da;
  border-color: #819685;
}
button.muted-btn {
  background: #ecece6;
  color: #7c847e;
  border-color: #d4d6ce;
}
a {
  color: inherit;
}
.photo-button {
  padding: 0;
  overflow: hidden;
  border: 0;
}
.photo-button .swatch {
  display: block;
  object-fit: cover;
}
.ref-photo {
  display: block;
  max-width: 100%;
  max-height: 55vh;
  object-fit: contain;
}
header {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.4vw, 22px);
  padding: 0.85rem 3.5vw;
  border-bottom: 1px solid var(--sand);
  background: #fffefa;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  font:
    600 clamp(16px, 1.55vw, 21px) Georgia,
    serif;
  letter-spacing: -0.6px;
}
.brand em {
  font-weight: 400;
}
.mark {
  background: var(--ink);
  color: #f7f4df;
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  border-radius: 50% 50% 4px 4px;
  font: italic bold 24px Georgia;
  flex-shrink: 0;
}
.tools,
nav,
.bar,
.actions,
.chips,
.subnav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tools {
  margin-left: auto;
  flex-wrap: nowrap;
  flex-shrink: 0;
}
.tools select {
  width: auto;
}
nav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.45rem 0.55rem;
  white-space: nowrap;
}
nav button.active {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 -2px;
}
.subnav {
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--sand);
  padding-bottom: 0.65rem;
}
.tools button {
  border: 1px solid #bac2b8;
}
.tools button,
.tools select {
  font-size: 0.86rem;
}
main {
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 4vw 3.5rem;
  flex: 1;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: clamp(1.8rem, 3vw, 2.9rem);
  font-weight: 580;
  letter-spacing: -0.05em;
}
h2 {
  font-size: 1.18rem;
  letter-spacing: -0.03em;
}
h3 {
  font-size: 1rem;
}
small,
.muted {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}
.title,
.section-head,
.total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.title {
  margin-bottom: 1.4rem;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(310px, 1fr);
  align-items: start;
  gap: 1.5rem;
}
.col,
.stack {
  display: grid;
  gap: 0.95rem;
  min-width: 0;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--sand);
  border-radius: 10px;
  padding: 1.15rem;
}
.section-head {
  margin-bottom: 0.85rem;
}
.stage {
  position: relative;
  background: #d8d8cb;
  overflow: hidden;
  border-radius: 6px;
  margin: 0;
}
.stage img {
  display: block;
  width: 100%;
  max-height: 64vh;
  object-fit: contain;
}
.stage figcaption {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: #f9f8eeed;
  border-radius: 4px;
  padding: 4px 9px;
  font-size: 0.76rem;
  font-weight: 580;
}
.overlay {
  position: absolute;
  border: 2px dashed #fbf3d3;
  background: #e7c57627;
  pointer-events: none;
}
.frame {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: auto;
}
.frame img {
  max-width: 100%;
}
.controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 0.8rem;
}
.upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.upload:focus-within,
:focus-visible {
  outline: 2px solid #587e55;
  outline-offset: 2px;
}
.grid2,
.grid3 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.grid3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
label.field {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.83rem;
}
.field input,
.field textarea,
.field select,
select {
  width: 100%;
  border: 1px solid #c7c9bd;
  background: #fffefa;
  border-radius: 5px;
  padding: 0.54rem 0.65rem;
  color: var(--ink);
  min-width: 0;
}
textarea {
  resize: vertical;
}
.field input:focus,
.field textarea:focus {
  outline: 2px solid #bccfba;
}
.variants {
  display: flex;
  gap: 7px;
  overflow: auto;
  margin: 0.6rem 0;
}
.variants button {
  padding: 0.28rem;
  font-size: 0.76rem;
  flex: 1;
  min-width: 62px;
}
.variants img {
  width: 100%;
  border-radius: 3px;
}
.buy-modes {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.7rem;
  background: #f3f2ea;
  border-radius: 6px;
  margin-bottom: 0.6rem;
}
.sku,
.item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--sand);
}
.sku {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.7rem;
  align-items: center;
}
.sku button {
  padding: 0.36rem 0.67rem;
}
.swatch {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 4px;
  background: #d6be92;
  display: grid;
  place-items: center;
  color: #584d32;
  font-family: Georgia;
  font-size: 25px;
}
.swatch.board {
  background: linear-gradient(135deg, #e5e2d9, #babbb2);
}
.item,
.quote {
  display: grid;
  gap: 0.6rem;
}
.quote-note {
  background: #f4f3eb;
  border-left: 3px solid var(--ink);
  padding: 0.55rem 0.75rem;
  border-radius: 4px;
  font-size: 0.84rem;
  color: var(--muted);
}
.total {
  border-top: 1px solid var(--sand);
  padding-top: 0.85rem;
}
.price {
  font:
    600 1.45rem Georgia,
    serif;
}
.check {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  font-size: 0.88rem;
}
.preview-card {
  display: grid;
  gap: 0.6rem;
  align-content: start;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 1rem;
}
.cards img,
.order-picture {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: #ecebe4;
  border-radius: 5px;
}
.line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.wide {
  width: 100%;
}
.chip {
  background: #e4eadc;
  border-radius: 10px;
  font-size: 0.75rem;
  padding: 3px 9px;
  white-space: nowrap;
}
.chip.warn {
  background: #f4dfd8;
  color: var(--warn);
}
.chip.ok {
  background: #d8ead7;
  color: #164e2e;
}
.upload {
  font-size: 0.88rem;
}
.prefs {
  padding-top: 0.65rem;
}
.prefs summary,
fieldset legend {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 550;
}
fieldset {
  border: 1px solid var(--sand);
  border-radius: 8px;
  padding: 0.75rem;
  display: grid;
  gap: 0.55rem;
}
.prefs .grid2 {
  margin-top: 0.65rem;
}
.tier-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  align-items: end;
}
.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.5rem;
}
.acct-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--sand);
  flex-wrap: wrap;
}
.msg-list {
  display: grid;
  gap: 0.5rem;
  max-height: 260px;
  overflow: auto;
  padding: 0.5rem;
  background: #f6f5ee;
  border-radius: 6px;
}
.msg {
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  background: #fffefa;
  border: 1px solid var(--sand);
}
.msg.staff {
  background: #e9f1e8;
  border-color: #c2d4c0;
}
.bank-box {
  background: #f5f4ec;
  border: 1px dashed #b9bba9;
  border-radius: 6px;
  padding: 0.65rem 0.8rem;
  white-space: pre-wrap;
  font-size: 0.85rem;
}
.site-footer {
  border-top: 1px solid var(--sand);
  background: #fffefa;
  padding: 1.25rem 4vw;
  font-size: 0.85rem;
  color: var(--muted);
}
.footer-inner {
  max-width: 1480px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  gap: 1.2rem;
  flex-wrap: wrap;
}
.auth-tabs {
  display: flex;
  gap: 0.5rem;
}
.auth-tabs button {
  flex: 1;
}
#notice {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  background: var(--ink);
  color: white;
  padding: 0.85rem 1.25rem;
  border-radius: 7px;
  max-width: 90vw;
  box-shadow: 0 4px 18px #0003;
}
dialog {
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--sand);
  border-radius: 12px;
  width: min(540px, 94vw);
  max-height: 90vh;
  overflow: auto;
  padding: 1.35rem;
}
dialog::backdrop {
  background: #18292180;
}
dialog form {
  display: grid;
  gap: 0.9rem;
}
.empty {
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}
.error {
  color: var(--warn);
}
.hidden,
[hidden] {
  display: none !important;
}
button.small {
  padding: 0.3rem 0.55rem;
  font-size: 0.82rem;
}
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}
.settings-group {
  border: 1px solid var(--sand);
  border-radius: 8px;
  padding: 0.75rem;
}
.settings-group summary {
  font-weight: 600;
  cursor: pointer;
}
.settings-group > .stack {
  margin-top: 0.75rem;
}
@media (pointer: coarse) {
  .field input,
  .field textarea,
  .field select,
  .tools select {
    font-size: max(16px, 1rem);
  }
}
@media (max-width: 850px) {
  header {
    gap: 0.7rem;
    flex-wrap: wrap;
    padding: 0.8rem 4vw;
  }
  nav {
    order: 3;
    width: 100%;
    gap: 2px;
  }
  nav button {
    font-size: 0.88rem;
    padding: 0.42rem 0.65rem;
  }
  .workspace,
  .admin-grid {
    grid-template-columns: 1fr;
  }
  .tools {
    flex-wrap: nowrap;
  }
  main {
    padding-top: 1.2rem;
  }
  .title {
    margin-bottom: 1rem;
  }
  .workspace {
    gap: 1rem;
  }
  .stage img {
    max-height: 55vh;
  }
}
@media (max-width: 420px) {
  .brand {
    font-size: 15px;
  }
  .mark {
    width: 26px;
    height: 26px;
    line-height: 26px;
    font-size: 20px;
  }
  .panel {
    padding: 0.85rem;
  }
  .tools select,
  .tools button {
    padding: 0.45rem;
  }
  .grid3 {
    gap: 0.35rem;
  }
  .grid2 {
    gap: 0.55rem;
  }
}
