:root {
  --steel: #E6E9E7; --surface: #F8F9F7; --raised: #FFFFFF; --ink: #17211E; --muted: #5B6661;
  --dial: #1F4A3C; --dial-deep: #143328; --dial-soft: #DCE6E1;
  --brass: #9C7434; --brass-soft: #F1E7D6; --line: #CBD2CE; --danger: #9B2C2C; --danger-soft: #F6E3E1;
  /* Depth: base (page) → elevated (panels, cards) → floating (dialogs, sheets, toasts) */
  --sh-elevated: 0 1px 2px rgba(20,51,40,.06), 0 8px 20px -12px rgba(20,51,40,.22);
  --sh-hover: 0 2px 4px rgba(20,51,40,.06), 0 18px 36px -18px rgba(20,51,40,.34);
  --sh-floating: 0 2px 6px rgba(20,51,40,.08), 0 32px 80px -24px rgba(20,51,40,.48);
  --spring: cubic-bezier(.34, 1.45, .64, 1);
  --ease: cubic-bezier(.22, 1, .36, 1);
  /* Spacing tokens */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 72px;
}
* { box-sizing: border-box; }
html { background: var(--steel); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  font-family: Manrope, system-ui, sans-serif; font-size: 16px; line-height: 1.7;
  background:
    radial-gradient(1100px 520px at 88% -8%, rgba(31,74,60,.13), transparent 62%),
    radial-gradient(760px 480px at -12% 18%, rgba(156,116,52,.09), transparent 60%),
    radial-gradient(900px 700px at 50% 115%, rgba(255,255,255,.75), transparent 62%),
    var(--steel);
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 80; opacity: .07; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding-inline: var(--s-4); }
@media (min-width: 768px) { .wrap { padding-inline: var(--s-6); } }

.display { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; letter-spacing: -0.03em; line-height: 1.02; }
.tnum { font-variant-numeric: tabular-nums; }

/* Header */
.site-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding-block: var(--s-4); }
.wordmark { font-size: 1.75rem; color: var(--dial-deep); text-decoration: none; line-height: 1; }
.wordmark:hover { color: var(--dial); }
.wordmark:active { opacity: .7; }
.seller-tag { font-size: .8125rem; font-weight: 600; color: var(--brass); background: var(--brass-soft); border-radius: 999px; padding: 2px 10px; margin-left: var(--s-2); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: .9375rem; line-height: 1; white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: transform .4s var(--spring), opacity .2s var(--ease);
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--dial); color: #fff; box-shadow: 0 1px 2px rgba(20,51,40,.18), 0 6px 14px -8px rgba(20,51,40,.5); }
.btn-primary:hover:not(:disabled) { background: var(--dial-deep); }
.btn-ghost { background: rgba(255,255,255,.55); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--raised); border-color: #AEB8B3; }
.btn-quiet { background: transparent; color: var(--dial); padding-inline: 12px; }
.btn-quiet:hover:not(:disabled) { background: rgba(31,74,60,.07); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #7E2222; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .875rem; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 999px; border: 1px solid transparent; background: transparent; cursor: pointer; transition: transform .4s var(--spring); }
.icon-btn:hover { background: rgba(23,33,30,.07); }
.icon-btn:active { transform: scale(.9); }

/* Fields */
.label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: 6px; }
.hint { font-size: .8125rem; color: var(--muted); line-height: 1.55; }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--raised); line-height: 1.4; box-shadow: inset 0 1px 2px rgba(20,51,40,.05);
}
.input:hover, .select:hover, .textarea:hover { border-color: #AEB8B3; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 2px solid var(--brass); outline-offset: 0; border-color: var(--brass); }
.textarea { min-height: 112px; resize: vertical; line-height: 1.6; }
.select { appearance: none; padding-right: 36px; cursor: pointer;
  background: var(--raised) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235B6661' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 14px center; }
.money { position: relative; }
.money::before { content: "$"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.money .input { padding-left: 26px; }
[aria-invalid="true"] { border-color: var(--danger) !important; }

/* Surfaces */
.panel { background: var(--surface); border: 1px solid rgba(203,210,206,.8); border-radius: 18px; box-shadow: var(--sh-elevated); }

/* Intro */
.intro { padding-block: var(--s-5) var(--s-6); }
.intro h1 { font-size: clamp(2.4rem, 6vw, 4rem); max-width: 16ch; margin: 0; color: var(--dial-deep); }
.intro p { max-width: 58ch; margin: var(--s-3) 0 0; color: var(--muted); font-size: 1.0625rem; }

.price { color: var(--brass); font-weight: 700; font-variant-numeric: tabular-nums; }

.empty { padding: var(--s-7) var(--s-5); text-align: center; border: 1px dashed #B9C2BD; border-radius: 18px; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 1.75rem; margin: 0 0 var(--s-2); }

/* Dialogs (floating layer) */
dialog { border: 0; padding: 0; color: var(--ink); background: var(--surface); box-shadow: var(--sh-floating); }
dialog::backdrop { background: rgba(20,33,30,.5); }
dialog[open] { animation: rise .45s var(--spring); }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.dlg { width: min(1040px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border-radius: 22px; }
.dlg-sm { width: min(440px, calc(100vw - 32px)); border-radius: 18px; }
@media (max-width: 639px) {
  .dlg { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
}

/* Brand picker + sections */
.seller-grid { display: grid; gap: var(--s-5); align-items: start; }
@media (min-width: 960px) { .seller-grid { grid-template-columns: 320px 1fr; } .brand-picker { position: sticky; top: var(--s-4); } }
.brand-picker { padding: var(--s-5); display: grid; gap: var(--s-4); }
.brand-list { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
@media (max-width: 959px) { .brand-list { max-height: 260px; } }
.brand-item { display: flex; align-items: center; gap: var(--s-3); min-height: 44px; padding: 6px var(--s-2); border-radius: 8px; cursor: pointer; }
.brand-item:hover { background: rgba(31,74,60,.06); }
.brand-item input { width: 18px; height: 18px; accent-color: var(--dial); flex: none; cursor: pointer; }
.brand-item .n { margin-left: auto; font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.other-box { border-radius: 12px; border: 1px solid var(--line); background: var(--raised); padding: var(--s-2); }
.other-box .brand-item { align-items: flex-start; }
.other-box .brand-item input { margin-top: 4px; }

.brand-section { padding: var(--s-5); animation: open .5s var(--spring); }
@keyframes open { from { opacity: 0; transform: translateY(-8px) scale(.99); } }
.brand-section header { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.brand-section h3 { font-size: 2rem; margin: 0; color: var(--dial-deep); }
.rows { list-style: none; margin: var(--s-4) 0 0; padding: 0; display: grid; gap: var(--s-2); }
.row { display: grid; grid-template-columns: 56px 1fr auto; gap: var(--s-3); align-items: center; padding: var(--s-2); border-radius: 12px; background: var(--raised); border: 1px solid rgba(203,210,206,.6); }
.row-thumb { width: 56px; height: 70px; border-radius: 8px; object-fit: cover; background: var(--dial-soft); }
.row-title { font-weight: 600; line-height: 1.35; }
.row-sub { font-size: .8125rem; color: var(--muted); line-height: 1.5; }
.row-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 639px) { .row { grid-template-columns: 56px 1fr; } .row-actions { grid-column: 1 / -1; justify-content: flex-start; } }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 600; padding: 1px 9px; border-radius: 999px; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.status-sent { background: var(--dial-soft); color: var(--dial); }
.status-sending { background: var(--brass-soft); color: #7A5A26; }
.status-failed { background: var(--danger-soft); color: var(--danger); }

/* Editor */
.editor { display: flex; flex-direction: column; max-height: inherit; height: 100%; }
.editor-head, .editor-foot { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4) var(--s-5); }
.editor-head { border-bottom: 1px solid var(--line); }
.editor-foot { border-top: 1px solid var(--line); justify-content: flex-end; flex-wrap: wrap; background: var(--surface); }
.editor-body { overflow-y: auto; padding: var(--s-5); display: grid; gap: var(--s-5); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: var(--s-3); }
.ph { position: relative; aspect-ratio: 4 / 5; border-radius: 12px; overflow: hidden; background: var(--dial-soft); box-shadow: var(--sh-elevated); cursor: grab; }
.ph.dragging { opacity: .4; }
.ph.over { outline: 2px dashed var(--brass); outline-offset: 2px; }
.ph img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ph-num { position: absolute; top: 6px; left: 6px; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: rgba(248,249,247,.94); font-size: .75rem; font-weight: 700; display: grid; place-items: center; }
.ph-cover { background: var(--dial); color: #fff; }
.ph-tools { position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; padding: 6px; background: linear-gradient(to top, rgba(0,0,0,.55), transparent); }
.ph-tools button { width: 32px; height: 32px; border-radius: 999px; border: 0; background: rgba(248,249,247,.94); cursor: pointer; display: grid; place-items: center; transition: transform .35s var(--spring); }
.ph-tools button:hover:not(:disabled) { background: #fff; }
.ph-tools button:active:not(:disabled) { transform: scale(.88); }
.ph-tools button:disabled { opacity: .35; cursor: default; }
.ph-tools .rm { color: var(--danger); }
.drop { display: grid; place-items: center; gap: 4px; aspect-ratio: 4 / 5; border: 1.5px dashed #AEB8B3; border-radius: 12px; color: var(--dial); font-weight: 600; font-size: .875rem; text-align: center; padding: var(--s-2); cursor: pointer; background: rgba(255,255,255,.5); transition: transform .35s var(--spring); }
.drop:hover { background: var(--raised); border-color: var(--dial); }
.drop:active { transform: scale(.97); }
.drop:focus-within { outline: 2px solid var(--brass); outline-offset: 2px; }
.error { color: var(--danger); font-size: .875rem; font-weight: 600; margin: 0; }
.error:empty { display: none; }

/* Toast */
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 90; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--dial-deep); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: .9375rem; box-shadow: var(--sh-floating);
  transition: transform .45s var(--spring), opacity .25s var(--ease); }
#toast.show { transform: translate(-50%, 0); opacity: 1; }
#toast.err { background: var(--danger); }

.site-foot { padding-block: var(--s-8) var(--s-6); color: var(--muted); font-size: .8125rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
