:root {
  --bg: #f4f5f3;
  --surface: #ffffff;
  --surface-2: #f8f9f7;
  --text: #231f20;
  --muted: #6b706c;
  --border: #e3e5e1;
  --border-strong: #cdd1cb;
  --accent: #8cc63f;
  --accent-2: #a9d86a;
  --accent-ink: #4e7d17;
  --accent-soft: #f0f8e4;
  --accent-border: #cfe6ae;
  --on-accent: #1c2a0c;
  --accent-rgb: 140, 198, 63;
  --ink-rgb: 35, 31, 32;
  --success: #7ab532;
  --danger: #e5484d;
  --danger-soft: #ffeced;
  --warning: #f59f00;
  --radius: 18px;
  --radius-sm: 11px;
  --shadow-sm: 0 1px 2px rgba(var(--ink-rgb), .06);
  --shadow: 0 10px 30px -12px rgba(var(--ink-rgb), .18), 0 2px 6px rgba(var(--ink-rgb), .05);
  --shadow-lg: 0 30px 60px -20px rgba(var(--ink-rgb), .35);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  padding-bottom: 110px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: 30px; font-weight: 800; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .86em; }

/* ---------- Background ---------- */
.bg-blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-blobs span {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: .45;
  animation: blob 22s ease-in-out infinite alternate;
}
.bg-blobs span:nth-child(1) { width: 520px; height: 520px; background: #d6edb6; top: -160px; left: -120px; }
.bg-blobs span:nth-child(2) { width: 460px; height: 460px; background: #e4e7e2; top: 10%; right: -160px; animation-delay: -7s; }
.bg-blobs span:nth-child(3) { width: 380px; height: 380px; background: #e3f2cf; bottom: -140px; left: 30%; animation-delay: -13s; }
@keyframes blob {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.08); }
  100% { transform: translate(-30px, 50px) scale(.95); }
}

/* ---------- Icons ---------- */
.ic { width: 18px; height: 18px; flex: none; }
.ic-lg { width: 30px; height: 30px; }
[data-icon] { display: inline-flex; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px max(16px, calc((100vw - 1180px) / 2));
  background: rgba(244, 245, 243, .78);
  backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid rgba(227, 229, 225, .7);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-sep { width: 1px; height: 32px; background: var(--border-strong); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 15.5px; }
.brand-text small { color: var(--muted); font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.stats { display: flex; gap: 8px; }
.stat-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); font-size: 13px; color: var(--muted);
}
.stat-pill b { color: var(--text); }

/* ---------- Layout ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 32px 16px; }
.view { display: none; }
.view.is-active { display: block; animation: viewIn .5s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.list-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.list-head p { margin: 6px 0 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: 14.5px; white-space: nowrap; text-decoration: none;
  transition: transform .18s var(--ease), box-shadow .25s var(--ease), background .2s, color .2s, border-color .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-lg { padding: 13px 22px; font-size: 15.5px; border-radius: 14px; }
.btn-primary { background: var(--grad); color: var(--on-accent); box-shadow: 0 8px 22px -8px rgba(var(--accent-rgb), .7); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 28px -10px rgba(var(--accent-rgb), .8); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not(:disabled) { border-color: var(--border-strong); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: rgba(var(--accent-rgb), .07); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: #ffd0da; }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-dashed {
  width: 100%; padding: 16px; border: 2px dashed var(--border-strong); background: transparent;
  color: var(--accent-ink); border-radius: var(--radius-sm);
}
.btn-dashed:hover { border-color: var(--accent-ink); background: var(--accent-soft); }
.btn-glow { position: relative; overflow: hidden; letter-spacing: .03em; }
.btn-glow::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%);
  transform: translateX(-100%); animation: shine 3.2s ease-in-out infinite;
}
@keyframes shine { 0%, 60% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; flex: none;
  border-radius: 11px; border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  transition: all .2s var(--ease);
}
.icon-btn:hover { color: var(--accent-ink); border-color: var(--accent-border); background: var(--accent-soft); }
.icon-btn.danger:hover { color: var(--danger); border-color: #ffc6d2; background: var(--danger-soft); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; }
.icon-btn.sm .ic { width: 16px; height: 16px; }

/* ---------- Product list ---------- */
.product-list { display: grid; gap: 14px; }
.pcard {
  display: grid; grid-template-columns: 88px 1fr auto; gap: 18px; align-items: center;
  padding: 14px 16px 14px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  animation: cardIn .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms);
  transition: box-shadow .25s var(--ease), transform .25s var(--ease), border-color .25s;
}
.pcard:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: #d8dbd5; }
.pcard.flash { animation: cardIn .55s var(--ease) both, flash 1.6s ease .2s; }
.pcard.removing { animation: cardOut .35s var(--ease) forwards; }
@keyframes cardIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes cardOut { to { opacity: 0; transform: translateX(30px) scale(.96); } }
@keyframes flash { 0% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), .5); } 100% { box-shadow: 0 0 0 16px rgba(var(--accent-rgb), 0); } }
.pcard-img {
  width: 88px; height: 88px; border-radius: 14px; overflow: hidden; background: var(--surface-2);
  display: grid; place-items: center; color: #b9bdb7; border: 1px solid var(--border);
}
.pcard-img img { width: 100%; height: 100%; object-fit: cover; }
.pcard-body { min-width: 0; }
.pcard-top { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.pcard h3 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.pcard-meta b { color: var(--text); font-weight: 600; }
.pcard-attrs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pcard-actions { display: flex; gap: 8px; }
.price s { color: var(--muted); margin-right: 6px; font-weight: 500; }
.price .sale { color: var(--danger); font-weight: 700; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: #eef0ec; color: #4a4f4b;
}
.badge .ic { width: 13px; height: 13px; }
.badge-violet { background: var(--accent-soft); color: var(--accent-ink); }
.pill {
  display: inline-flex; padding: 3px 10px; border-radius: 8px; font-size: 12.5px;
  background: var(--surface-2); border: 1px solid var(--border); color: #3a3f3b;
}
.pill b { margin-right: 4px; color: var(--muted); font-weight: 500; }

.empty {
  text-align: center; padding: 70px 20px; border: 2px dashed var(--border-strong); border-radius: 24px;
  background: rgba(255, 255, 255, .55); animation: cardIn .6s var(--ease);
}
.empty-ic {
  width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 24px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink); animation: float 4s ease-in-out infinite;
}
.empty-ic .ic { width: 38px; height: 38px; }
.empty h2 { font-size: 21px; margin-bottom: 6px; }
.empty p { margin: 0 0 22px; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ---------- Editor ---------- */
.editor-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.editor-head h1 { font-size: 26px; flex: 1; min-width: 200px; }

.stepper {
  display: flex; gap: 6px; padding: 6px; margin-bottom: 24px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-sm); position: relative;
}
.step {
  flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 11px;
  border: 0; background: transparent; color: var(--muted); font-weight: 600; text-align: left;
  position: relative; z-index: 1; transition: color .3s var(--ease);
}
.step-num {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: #eef0ec; color: var(--muted); font-size: 13px; transition: all .35s var(--ease);
}
.step small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.step.is-done .step-num { background: var(--success); color: var(--on-accent); }
.step.is-active { color: var(--text); }
.step.is-active .step-num { background: var(--grad); color: var(--on-accent); box-shadow: 0 6px 14px -4px rgba(var(--accent-rgb), .6); transform: scale(1.08); }
.step-indicator {
  position: absolute; top: 6px; bottom: 6px; left: 6px; border-radius: 11px;
  background: var(--accent-soft); transition: transform .5s var(--ease), width .5s var(--ease);
}

.step-panel { animation: panelIn .5s var(--ease); }
.step-panel.from-left { animation-name: panelInLeft; }
@keyframes panelIn { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes panelInLeft { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }

.grid-2 { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }
.col-main { display: grid; gap: 18px; }
.col-media { position: sticky; top: 90px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm); animation: cardIn .5s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}
.card-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; margin-bottom: 16px; }
.card-title .ic { color: var(--accent); }
.card-sub { margin: -10px 0 16px; color: var(--muted); font-size: 13.5px; }

.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > .field { flex: 1 1 140px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; position: relative; }
.row .field { margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 600; color: #3a3f3b; }
.field > span i { color: var(--danger); font-style: normal; margin-left: 2px; }
.field .err { color: var(--danger); font-size: 12.5px; font-weight: 500; animation: errIn .3s var(--ease); }
@keyframes errIn { from { opacity: 0; transform: translateY(-4px); } }
.w-id { flex: 0 0 170px !important; }

.input, textarea.input {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
textarea.input { resize: vertical; min-height: 64px; }
.input:hover { border-color: var(--border-strong); }
.input:focus { border-color: var(--accent-ink); background: #fff; box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .13); }
.input::placeholder { color: #a5aaa3; }
.input.sm { padding: 8px 10px; font-size: 14px; }
.field.invalid .input, .field.invalid .wysiwyg, .input.invalid { border-color: var(--danger); background: #fffafb; }
.field.invalid .input:focus, .input.invalid:focus { box-shadow: 0 0 0 4px rgba(239, 69, 101, .14); }
.shake { animation: shake .45s ease; }
@keyframes shake {
  20% { transform: translateX(-6px); } 40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(3px); }
}

.input-group { display: flex; gap: 6px; }
.input-suffix { position: relative; }
.input-suffix .input { padding-right: 40px; }
.input-suffix em {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-style: normal; color: var(--muted); font-size: 13px; pointer-events: none;
}
.meta-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 9px;
  background: var(--surface-2); border: 1px dashed var(--border-strong); color: var(--muted); font-size: 13px;
}
.meta-chip b { color: var(--text); font-family: 'JetBrains Mono', monospace; font-weight: 500; }

/* ---------- WYSIWYG ---------- */
.wysiwyg {
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  overflow: hidden; transition: border-color .2s, box-shadow .2s, background .2s;
}
.wysiwyg:focus-within { border-color: var(--accent-ink); background: #fff; box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .13); }
.wys-toolbar { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, .7); }
.wys-toolbar button {
  min-width: 34px; height: 32px; border: 0; border-radius: 8px; background: transparent;
  color: #4a4f4b; display: grid; place-items: center; font-size: 15px; transition: all .15s;
}
.wys-toolbar button:hover { background: #eef0ec; color: var(--text); }
.wys-toolbar button.on { background: var(--accent-soft); color: var(--accent-ink); }
.wys-toolbar .sep { width: 1px; margin: 4px 6px; background: var(--border); }
.wys-area { min-height: 150px; max-height: 420px; overflow: auto; padding: 12px 14px; outline: none; }
.wys-area:empty::before { content: attr(data-placeholder); color: #a5aaa3; pointer-events: none; }
.wys-area ul, .wys-area ol { margin: 4px 0; padding-left: 24px; }

/* ---------- Dropzone & gallery ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 26px 16px; border: 2px dashed var(--border-strong); border-radius: 16px;
  color: var(--muted); background: var(--surface-2); cursor: pointer;
  transition: all .25s var(--ease);
}
.dropzone .ic-lg { color: var(--accent-ink); margin-bottom: 4px; transition: transform .3s var(--ease); }
.dropzone strong { color: var(--text); font-size: 14.5px; }
.dropzone span { font-size: 12.5px; }
.dropzone:hover, .dropzone.over { border-color: var(--accent-ink); background: var(--accent-soft); }
.dropzone.over .ic-lg, .dropzone:hover .ic-lg { transform: translateY(-4px); }

.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.gallery:empty { display: none; }
.thumb {
  position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2);
  border: 1px solid var(--border); animation: pop .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.is-main { grid-column: span 3; aspect-ratio: 16 / 11; border: 2px solid var(--accent); }
.thumb .badge-main {
  display: none; position: absolute; left: 8px; top: 8px; padding: 3px 9px; border-radius: 999px;
  background: var(--grad); color: var(--on-accent); font-size: 11.5px; font-weight: 700;
}
.thumb.is-main .badge-main { display: block; }
.thumb-actions { position: absolute; right: 6px; top: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .2s; }
.thumb:hover .thumb-actions, .thumb:focus-within .thumb-actions { opacity: 1; }
.thumb-actions button {
  width: 28px; height: 28px; border-radius: 8px; border: 0; display: grid; place-items: center;
  background: rgba(var(--ink-rgb), .7); color: #fff; backdrop-filter: blur(4px);
}
.thumb-actions button:hover { background: var(--accent); }
.thumb-actions button.del:hover { background: var(--danger); }
.thumb-actions .ic { width: 14px; height: 14px; }
.thumb.pending img { filter: blur(1px) saturate(.6); opacity: .7; }
.progress { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .7); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .2s; }
@keyframes pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }

/* ---------- Attributes ---------- */
.attr-list { display: grid; gap: 14px; margin-bottom: 14px; }
.attr-card {
  border: 1px solid var(--border); border-radius: 16px; padding: 16px; background: var(--surface-2);
  animation: attrIn .45s var(--ease) both; transition: border-color .2s, box-shadow .2s;
}
.attr-card:focus-within { border-color: var(--accent-border); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .07); background: #fff; }
.attr-card.removing { animation: attrOut .3s var(--ease) forwards; }
.attr-card.invalid { border-color: var(--danger); }
@keyframes attrIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes attrOut { to { opacity: 0; transform: scale(.96); height: 0; padding: 0; margin: -7px 0; } }
.attr-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.attr-num {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: var(--grad); color: var(--on-accent); font-weight: 700; font-size: 13px;
}
.attr-head .input { font-weight: 600; }
.tags {
  display: flex; flex-wrap: wrap; gap: 7px; padding: 8px; min-height: 50px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: #fff; cursor: text; transition: border-color .2s, box-shadow .2s;
}
.tags:focus-within { border-color: var(--accent-ink); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .13); }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 6px 5px 11px; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; font-size: 13.5px;
  animation: pop .3s var(--ease) both;
}
.chip button {
  width: 20px; height: 20px; border-radius: 6px; border: 0; background: transparent; color: inherit;
  display: grid; place-items: center; opacity: .6;
}
.chip button:hover { opacity: 1; background: rgba(var(--accent-rgb), .15); }
.chip .ic { width: 13px; height: 13px; }
.chip.dup { animation: shake .4s ease; background: var(--danger-soft); color: var(--danger); }
.tag-input { flex: 1; min-width: 160px; border: 0; outline: none; padding: 5px 6px; background: transparent; }
.hint { margin: 8px 2px 0; font-size: 12.5px; color: var(--muted); }
.kbd { display: inline-block; padding: 0 6px; border-radius: 5px; border: 1px solid var(--border-strong); background: #fff; font-size: 11.5px; font-family: 'JetBrains Mono', monospace; }

.combo-preview {
  margin-top: 18px; padding: 16px 18px; border-radius: 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), .08), rgba(var(--accent-rgb), .03)); border: 1px solid var(--accent-border);
}
.combo-formula { flex: 1; color: #3a3f3b; font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.combo-formula .x { color: var(--muted); }
.combo-count { font-size: 30px; font-weight: 800; background: linear-gradient(135deg, var(--accent-ink), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.combo-count.bump { animation: bump .35s var(--ease); }
@keyframes bump { 40% { transform: scale(1.18); } }

/* ---------- Variants ---------- */
.variants-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 16px; }
.variants-head .card-title { margin-bottom: 4px; }
.bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.bulk .input { width: 108px; }
.bulk-label { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 0 4px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; }
.vtable { width: 100%; border-collapse: collapse; min-width: 760px; }
.vtable th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  padding: 11px 10px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; font-weight: 600;
}
.vtable td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.vtable tr:last-child td { border-bottom: 0; }
.vrow { animation: rowIn .45s var(--ease) both; animation-delay: calc(min(var(--i, 0), 30) * 28ms); transition: background .2s, opacity .25s; }
.vrow:hover { background: #fafcf7; }
.vrow.is-off { opacity: .45; }
.vrow.is-off .input { pointer-events: none; }
@keyframes rowIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.vtable .input.sm { min-width: 90px; }
.vtable td.sku-cell .input { min-width: 240px; font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.vtable .num-cell .input { width: 100px; }
.attr-val { display: inline-flex; padding: 4px 10px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; font-size: 13px; white-space: nowrap; }

.vimg-wrap { position: relative; width: 46px; height: 46px; }
.vimg {
  width: 46px; height: 46px; border-radius: 11px; border: 1.5px dashed var(--border-strong); background: var(--surface-2);
  color: #a5aaa3; display: grid; place-items: center; overflow: hidden; padding: 0; transition: all .2s;
}
.vimg:hover { border-color: var(--accent-ink); color: var(--accent-ink); background: var(--accent-soft); }
.vimg.has { border-style: solid; border-color: var(--border); }
.vimg img { width: 100%; height: 100%; object-fit: cover; animation: pop .35s var(--ease); }
.vimg-del {
  position: absolute; right: -6px; top: -6px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff;
  background: var(--text); color: #fff; display: none; place-items: center; padding: 0;
}
.vimg-wrap:hover .vimg-del { display: grid; }
.vimg-del .ic { width: 11px; height: 11px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--accent-border); border-top-color: var(--accent-ink); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 22px; background: #d5d8d3; transition: background .25s; cursor: pointer; }
.switch span::after {
  content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .3s var(--ease);
}
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .3); }

/* ---------- Editor footer ---------- */
.editor-footer {
  position: sticky; bottom: 16px; z-index: 30; margin-top: 22px;
  display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 18px;
  background: rgba(255, 255, 255, .85); backdrop-filter: blur(14px) saturate(1.5);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.editor-footer .spacer { flex: 1; }

/* ---------- Export bar ---------- */
.export-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; padding: 14px 16px;
  transition: transform .5s var(--ease), opacity .4s;
}
.export-bar.hidden { transform: translateY(120%); opacity: 0; pointer-events: none; }
.export-inner {
  max-width: 1148px; margin: 0 auto; display: flex; align-items: center; gap: 16px; justify-content: space-between;
  padding: 12px 12px 12px 20px; border-radius: 18px; background: rgba(var(--ink-rgb), .92); color: #fff;
  backdrop-filter: blur(14px); box-shadow: var(--shadow-lg); flex-wrap: wrap;
}
.export-info { font-size: 14px; color: #c9ccc7; }
.export-info b { color: #fff; }
.export-actions { display: flex; gap: 10px; }
.export-bar .btn-secondary { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .15); color: #fff; box-shadow: none; }
.export-bar .btn-secondary:hover:not(:disabled) { background: rgba(255, 255, 255, .18); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; visibility: hidden; }
.modal.open { visibility: visible; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(var(--ink-rgb), .45); backdrop-filter: blur(4px); opacity: 0; transition: opacity .3s; }
.modal.open .modal-backdrop { opacity: 1; }
.modal-card {
  position: relative; width: min(480px, 100%); background: var(--surface); border-radius: 22px; padding: 26px;
  box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(20px) scale(.96); transition: all .35s var(--ease);
  max-height: calc(100vh - 32px); overflow: auto;
}
.modal.open .modal-card { opacity: 1; transform: none; }
.modal-card h2 { font-size: 20px; margin-bottom: 8px; }
.modal-card p { margin: 0 0 18px; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.opt { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; margin-bottom: 10px; cursor: pointer; transition: all .2s; align-items: flex-start; }
.opt:hover { border-color: var(--border-strong); }
.opt:has(input:checked) { border-color: var(--accent-ink); background: var(--accent-soft); }
.opt input[type=radio] { margin-top: 3px; accent-color: var(--accent-ink); }
.opt strong { display: block; font-size: 14.5px; }
.opt small { color: var(--muted); font-size: 12.5px; line-height: 1.4; display: block; }
.opt-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 110px; right: 16px; z-index: 80; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 13px 14px; border-radius: 14px; background: var(--text); color: #fff;
  box-shadow: var(--shadow-lg); font-size: 14px; animation: toastIn .45s var(--ease);
}
.toast.out { animation: toastOut .3s var(--ease) forwards; }
.toast .t-ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--success); }
.toast.error .t-ic { background: var(--danger); }
.toast.info .t-ic { background: var(--accent); }
.toast .t-ic .ic { width: 15px; height: 15px; }
.toast .t-msg { flex: 1; }
.toast button { border: 0; background: rgba(255, 255, 255, .14); color: #fff; padding: 5px 10px; border-radius: 8px; font-weight: 600; font-size: 13px; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }


/* ---------- Client chip & sync ---------- */
.client-chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 220px; height: 38px; padding: 0 14px 0 12px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 13.5px; transition: all .2s var(--ease);
}
.client-chip:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.client-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--accent); transition: background .3s; }
.sync-dot[data-state="pending"], .sync-dot[data-state="saving"] { background: var(--warning); animation: pulse 1s ease-in-out infinite; }
.sync-dot[data-state="error"] { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }

.admin-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 22px; padding: 10px 10px 10px 18px; border-radius: 16px; font-size: 14px;
  background: var(--text); color: #e9ebe7; box-shadow: var(--shadow); animation: cardIn .5s var(--ease);
}
.admin-banner b { color: #fff; }
.admin-banner a:not(.btn) { color: var(--accent); }
.admin-banner .btn-secondary { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .15); color: #fff; box-shadow: none; }

.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 120px 0; color: var(--muted); font-weight: 500; }

/* ---------- Onboarding ---------- */
.onb { display: grid; grid-template-columns: 1fr 460px; gap: 48px; align-items: center; min-height: calc(100vh - 220px); }
.onb-intro h1 { font-size: 40px; line-height: 1.1; margin: 10px 0 14px; }
.onb-intro > p { font-size: 16.5px; max-width: 480px; margin: 0 0 26px; }
.eyebrow {
  display: inline-block; padding: 5px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink);
  font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.onb-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.onb-points li { display: flex; align-items: center; gap: 12px; font-weight: 500; animation: cardIn .5s var(--ease) both; animation-delay: calc(200ms + var(--i) * 90ms); }
.onb-points .ic { width: 26px; height: 26px; padding: 5px; border-radius: 8px; background: var(--accent); color: var(--on-accent); }
.onb-form { padding: 28px; box-shadow: var(--shadow-lg); animation-delay: .1s; }
.onb-form .btn { margin-top: 6px; }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.copy-row { display: flex; gap: 8px; margin: 4px 0 8px; }
.copy-row .input { font-size: 12.5px; }
.modal-hero {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 14px;
  background: var(--accent); color: var(--on-accent); animation: pop .5s var(--ease);
}
.modal-hero .ic { width: 28px; height: 28px; }
.modal-card form .field { margin-bottom: 12px; }

/* ---------- Admin ---------- */
.login-card { max-width: 420px; margin: 60px auto; padding: 30px; box-shadow: var(--shadow-lg); }
.login-card h1 { font-size: 26px; margin-bottom: 4px; }
.login-card p { margin: 0 0 20px; }
.alert { padding: 11px 14px; border-radius: 12px; margin-bottom: 16px; background: var(--danger-soft); color: #a8262b; font-weight: 500; font-size: 14px; }
.alert.ok { background: var(--accent-soft); color: var(--accent-ink); }
.admin-search { max-width: 320px; }
.client-card { grid-template-columns: 64px 1fr auto; }
.client-avatar {
  width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center;
  background: var(--grad); color: var(--on-accent); font-size: 26px; font-weight: 800;
}
.client-date { font-size: 12.5px; }
.pcard-meta a { color: var(--muted); text-decoration: none; }
.pcard-meta a:hover { color: var(--accent-ink); text-decoration: underline; }
.client-card .pcard-actions { align-items: center; }
.del-form { margin: 0; }
.admin-page { padding-bottom: 40px; }
.admin-page .toasts { bottom: 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .onb { grid-template-columns: 1fr; gap: 28px; min-height: 0; }
  .onb-intro h1 { font-size: 30px; }
  .client-card { grid-template-columns: 52px 1fr; }
  .client-avatar { width: 52px; height: 52px; font-size: 21px; }
  .client-card .pcard-actions { grid-column: 1 / -1; justify-content: flex-end; flex-wrap: wrap; }
  .grid-2 { grid-template-columns: 1fr; }
  .col-media { position: static; }
  .step small { display: none; }
}
@media (max-width: 640px) {
  body { padding-bottom: 190px; }
  .toasts { bottom: 180px; }
  h1 { font-size: 24px; }
  .stats { display: none; }
  .brand-text small { display: none; }
  .brand-logo { height: 26px; }
  .brand-sep, .brand-text { display: none; }
  .client-chip { max-width: 160px; }
  .admin-search { max-width: none; }
  .pcard { grid-template-columns: 64px 1fr; }
  .pcard-img { width: 64px; height: 64px; }
  .pcard-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .step { padding: 8px; justify-content: center; }
  .step-text { display: none; }
  .export-inner { padding: 12px; }
  .export-info { width: 100%; text-align: center; }
  .export-actions { width: 100%; }
  .export-actions .btn { flex: 1; }
  .editor-footer { flex-wrap: wrap; }
  .editor-footer .spacer { display: none; }
  .editor-footer .btn { flex: 1; }
  .w-id { flex: 1 1 140px !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}
