:root {
  --bg: #f7f5f2; --card: #ffffff; --ink: #121110; --muted: #7a726b; --line: #e6e1db; --tile: #f3f0ec; --beige: #e9e1d7;
  --wood: #5a3a27; --accent: #9a6a45; --ok: #4f7a4c; --danger: #a33a2f;
  --sans: 'Inter Tight', system-ui, sans-serif; --serif: 'Instrument Serif', serif; --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body.locked { overflow: hidden; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
code { font-family: ui-monospace, Menlo, monospace; font-size: .86em; background: var(--tile); padding: 1px 5px; border-radius: 4px; }
.serif { font-family: var(--serif); font-size: 1.1em; }
.muted { color: var(--muted); margin: 0; }
.hint { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }
.dot-a { color: var(--accent); }
.brand { font-size: 22px; letter-spacing: -0.04em; white-space: nowrap; }
.brand em { font-family: var(--serif); font-style: italic; letter-spacing: 0; font-size: 1.08em; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 22px; border-radius: 100px; border: 1px solid transparent; font-size: 13px; text-transform: uppercase; letter-spacing: .02em; transition: background .25s, transform .15s; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--wood); }
.btn-dark:disabled { opacity: .5; cursor: wait; }
.btn-sm { min-height: 38px; padding: 0 18px; }
.pill { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 100px; border: 1px solid var(--line); background: #fff; font-size: 13px; white-space: nowrap; }
.pill:hover { border-color: var(--ink); }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: none; display: grid; place-items: center; transition: background .2s; flex: none; }
.icon-btn:hover { background: var(--tile); }
.icon-btn svg { width: 18px; height: 18px; }
.link-muted { color: var(--muted); font-size: 13px; text-align: center; }
.danger-link { background: none; border: 0; color: var(--danger); font-size: 13px; text-transform: uppercase; padding: 12px 0; justify-self: start; }

/* login */
.login { min-height: 100svh; display: grid; place-items: center; padding: 20px; background: radial-gradient(120% 80% at 80% 0%, rgba(154,106,69,.18), transparent 60%), linear-gradient(155deg, #3d2a1f, #17100b); }
.login-card { width: min(400px, 100%); background: #fff; border-radius: 16px; padding: 32px 26px; display: grid; gap: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.login-card .brand { font-size: 32px; }
.error { color: var(--danger); font-size: 13px; margin: 0; }

/* shell */
.top { position: sticky; top: 0; z-index: 20; background: rgba(247,245,242,.9); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px 16px; padding: 12px 16px 0; }
.top-actions { display: flex; gap: 6px; }
.tabs { grid-column: 1 / -1; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; padding: 10px 12px 12px; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
@media (min-width: 900px) {
  .top { grid-template-columns: auto 1fr auto; padding: 0 28px; height: 64px; }
  .tabs { grid-column: auto; margin: 0; justify-content: center; align-self: stretch; }
  .tabs button { padding: 0 14px; }
}
.main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 120px; }
@media (min-width: 900px) { .main { padding: 36px 28px 80px; } }
.view { animation: fade .4s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.h1 { font-size: clamp(36px, 6vw, 52px); font-weight: 400; letter-spacing: -0.045em; margin: 0 0 4px; line-height: 1; }
@media (max-width: 699px) {
  .add-btn { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 30; box-shadow: 0 10px 30px rgba(0,0,0,.25); min-height: 52px; }
}

/* stats */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border-radius: 12px; padding: 14px 16px; border: 1px solid var(--line); }
.stat b { display: block; font-size: 30px; font-weight: 400; letter-spacing: -0.04em; line-height: 1.1; }
.stat span { font-size: 12px; text-transform: uppercase; color: var(--muted); }

.list-tools { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.search { flex: 1 1 240px; display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 100px; padding: 0 16px; }
.search svg { color: var(--muted); width: 18px; }
.search input { border: 0; outline: 0; background: none; font: inherit; font-size: 16px; padding: 10px 0; flex: 1; min-width: 0; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 100px; padding: 3px; gap: 2px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.seg button { border: 0; background: none; padding: 8px 14px; border-radius: 100px; font-size: 13px; color: var(--muted); white-space: nowrap; transition: background .2s, color .2s; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.seg.small button { padding: 6px 12px; font-size: 12px; }
.status-seg button[data-v="available"][aria-pressed="true"] { background: var(--ok); }

/* product list */
.plist { display: grid; gap: 8px; }
.prow { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; transition: border-color .2s, box-shadow .2s; }
.prow:hover { border-color: #cfc8c0; }
.prow.is-hidden { opacity: .6; }
.prow .thumb { width: 64px; aspect-ratio: 4/5; border-radius: 8px; object-fit: cover; background: var(--beige); cursor: pointer; }
.prow .info { min-width: 0; cursor: pointer; }
.prow .name { font-size: 15px; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .meta { font-size: 12px; color: var(--muted); text-transform: uppercase; margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; }
.prow .meta .tag { background: var(--tile); border-radius: 100px; padding: 1px 8px; }
.prow .price { font-weight: 600; font-size: 14px; margin-top: 4px; }
.prow .acts { display: flex; align-items: center; gap: 2px; }
.prow .acts .on { color: var(--accent); }
.prow .acts .on svg { fill: currentColor; }
.prow-status { grid-column: 2 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
@media (min-width: 760px) {
  .prow { grid-template-columns: 64px 1fr 180px auto; }
  .prow-status { grid-column: auto; }
}
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 12px; text-transform: uppercase; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .track { width: 42px; height: 24px; border-radius: 20px; background: var(--ink); position: relative; transition: background .3s; flex: none; }
.toggle .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .35s var(--ease); }
.toggle input:checked + .track { background: var(--ok); }
.toggle input:checked + .track::after { transform: translateX(18px); }
.toggle .lbl { min-width: 70px; }
.move { display: flex; flex-direction: column; }
.move button { width: 30px; height: 20px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; border-radius: 4px; }
.move button:hover { color: var(--ink); background: var(--tile); }
.move svg { width: 14px; height: 14px; }
.empty-list { text-align: center; padding: 48px 16px; color: var(--muted); background: #fff; border-radius: 12px; border: 1px dashed var(--line); }

/* forms */
.card-form { display: grid; gap: 14px; }
.card-form.narrow { max-width: 480px; }
fieldset { border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 18px; margin: 0; display: grid; gap: 14px; min-width: 0; }
legend { float: left; width: 100%; padding: 0; font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .02em; }
legend + * { clear: both; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; color: var(--muted); }
.field small { color: var(--muted); font-size: 11.5px; }
.field input, .field textarea, .tags {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 11px 13px; font: inherit; font-size: 16px; color: var(--ink); outline: none; transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .tags:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(18,17,16,.06); }
.field.invalid input { border-color: var(--danger); }
.grid2 { display: grid; gap: 14px; }
@media (min-width: 700px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.form-foot { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); display: flex; justify-content: flex-end; }

/* media fields */
.media-fields { display: grid; gap: 14px; }
@media (min-width: 700px) { .media-fields { grid-template-columns: 1fr 1fr; } }
.media-field { display: grid; gap: 6px; }
.media-field > span { font-size: 12.5px; color: var(--muted); }
.media-box { position: relative; aspect-ratio: 16/10; border-radius: 10px; border: 1px dashed #cfc8c0; background: var(--tile); overflow: hidden; display: grid; place-items: center; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; }
.media-box:hover, .media-box.drag { border-color: var(--ink); background: #ece7e1; }
.media-box img, .media-box video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.media-box .ph { color: var(--muted); font-size: 13px; display: grid; gap: 6px; justify-items: center; padding: 12px; }
.media-box .rm { position: absolute; top: 8px; right: 8px; z-index: 2; background: rgba(255,255,255,.95); border: 0; border-radius: 100px; padding: 5px 12px; font-size: 12px; }
.progress { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); transition: width .2s; z-index: 3; }

/* WA */
.wa-layout { display: grid; gap: 20px; }
@media (min-width: 980px) { .wa-layout { grid-template-columns: 1fr 380px; align-items: start; } .wa-preview { position: sticky; top: 90px; } }
.wa-preview { display: grid; gap: 12px; justify-items: center; }
.tokens { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.tokens button { border: 1px solid var(--line); background: var(--tile); border-radius: 100px; padding: 4px 10px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.tokens button:hover { border-color: var(--ink); }
.phone { width: 100%; max-width: 360px; border-radius: 28px; overflow: hidden; border: 8px solid var(--ink); background: #efe7dc; box-shadow: 0 20px 60px rgba(0,0,0,.15); }
.phone-head { background: #1f2c33; color: #fff; display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.phone-head small { display: block; opacity: .7; font-size: 11px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #fff; color: var(--ink); display: grid; place-items: center; font-family: var(--serif); font-style: italic; font-size: 20px; }
.phone-body { min-height: 360px; padding: 18px 12px; display: flex; flex-direction: column; justify-content: flex-end; background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px); background-size: 14px 14px; }
.bubble { align-self: flex-end; background: #d9fdd3; border-radius: 10px 0 10px 10px; padding: 8px 10px 6px; font-size: 14px; white-space: pre-wrap; max-width: 88%; box-shadow: 0 1px 1px rgba(0,0,0,.08); animation: fade .3s var(--ease); }
.bubble::after { content: attr(data-time) ' ✓✓'; display: block; text-align: right; font-size: 10.5px; color: #53bdeb; margin-top: 2px; }

/* editor */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(18,17,16,0); transition: background .4s var(--ease); display: flex; justify-content: flex-end; }
.overlay.open { background: rgba(18,17,16,.45); }
.editor { width: min(720px, 100%); height: 100%; background: var(--bg); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .5s var(--ease); }
.overlay.open .editor { transform: none; }
.editor-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fff; }
.editor-head h2 { flex: 1; margin: 0; font-size: 20px; font-weight: 400; letter-spacing: -0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor-body { flex: 1; overflow-y: auto; padding: 18px 16px calc(40px + env(safe-area-inset-bottom)); display: grid; gap: 18px; align-content: start; }
@media (min-width: 700px) { .editor-body { padding: 24px 28px 48px; } }
.ed-label { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.img-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 560px) { .img-grid { grid-template-columns: repeat(4, 1fr); } }
.img-item { position: relative; aspect-ratio: 4/5; border-radius: 10px; overflow: hidden; background: var(--beige); }
.img-item img, .img-item video { width: 100%; height: 100%; object-fit: cover; }
.img-item .cover { position: absolute; top: 6px; left: 6px; background: var(--ink); color: #fff; font-size: 10px; text-transform: uppercase; border-radius: 100px; padding: 3px 8px; }
.img-item .tools { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; padding: 6px; background: linear-gradient(transparent, rgba(0,0,0,.5)); }
.img-item .tools button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(255,255,255,.94); display: grid; place-items: center; font-size: 13px; }
.img-item .tools button svg { width: 14px; height: 14px; }
.img-item.uploading::after { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,.55); }
.img-add { aspect-ratio: 4/5; border-radius: 10px; border: 1px dashed #cfc8c0; background: #fff; display: grid; place-items: center; align-content: center; gap: 6px; color: var(--muted); font-size: 12px; text-transform: uppercase; cursor: pointer; transition: border-color .2s, background .2s; }
.img-add:hover, .img-grid.drag .img-add { border-color: var(--ink); color: var(--ink); background: var(--tile); }
.img-add svg { width: 24px; height: 24px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 7px 8px; cursor: text; }
.tags input { flex: 1; min-width: 120px; border: 0; outline: 0; padding: 4px; font: inherit; font-size: 16px; background: none; }
.tag-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--tile); border-radius: 100px; padding: 4px 6px 4px 10px; font-size: 14px; }
.tag-chip .sw { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.tag-chip button { width: 20px; height: 20px; border-radius: 50%; border: 0; background: #fff; font-size: 13px; line-height: 1; display: grid; place-items: center; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.presets button { border: 1px dashed #cfc8c0; background: none; border-radius: 100px; padding: 4px 10px; font-size: 12px; color: var(--muted); }
.presets button:hover { border-color: var(--ink); color: var(--ink); }
.checks { display: grid; gap: 10px; }
.check { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); margin: 2px 0 0; }
.check small { display: block; color: var(--muted); font-size: 12px; }

.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 300; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 12px 20px; font-size: 14px; border-radius: 100px; opacity: 0; pointer-events: none; transition: opacity .3s, transform .4s var(--ease); max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); }
@media (max-width: 759px) {
  .prow .thumb { grid-row: span 2; align-self: start; }
  .prow .acts { grid-row: 1; grid-column: 3; }
  .prow-status { grid-column: 2 / -1; }
}

/* sale */
.sale-box { display: grid; gap: 8px; background: #fff; border: 1px dashed #d9cfc4; border-radius: 12px; padding: 12px; }
.sale-box .field input { background: var(--bg); }
.sale-quick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.sale-quick button { border: 1px solid var(--line); background: #fff; border-radius: 100px; padding: 5px 11px; font-size: 12px; }
.sale-quick button:hover { border-color: var(--ink); }
.sale-quick button[data-pct="0"] { color: var(--muted); border-style: dashed; }
.sale-preview { margin: 0; font-size: 13px; color: var(--wood); }
.sale-preview:empty { display: none; }
.sale-preview.bad { color: var(--danger); }
.sale-preview s, .prow .price s { color: var(--muted); font-weight: 400; font-size: .9em; }
.prow .sale-now { color: var(--accent); }
.sale-tag { background: var(--wood); color: #fff; font-size: 10.5px; font-weight: 500; border-radius: 100px; padding: 2px 7px; vertical-align: 1px; }

/* hero slides */
.hero-grid { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .hero-grid { grid-template-columns: repeat(4, 1fr); } }
.hero-grid .img-item, .hero-grid .img-add { aspect-ratio: 16 / 10; }
.interval { display: flex; align-items: center; gap: 14px; }
.interval input[type=range] { flex: 1; accent-color: var(--ink); padding: 0; border: 0; box-shadow: none; background: none; }
.interval output { min-width: 70px; font-size: 14px; }

/* stores */
.store-list { display: grid; gap: 14px; }
.store-item-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.store-item-head legend { float: none; width: auto; }
.store-item-acts { display: flex; gap: 4px; align-items: center; }
.pill.danger { color: var(--danger); }
.pill.danger:hover { border-color: var(--danger); }
.store-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .store-grid { grid-template-columns: 1.4fr 1fr; } }
.store-fields, .store-side, .grid1 { display: grid; gap: 14px; align-content: start; }
.map-preview { display: grid; gap: 6px; }
.map-preview > span { font-size: 12.5px; color: var(--muted); }
.map-box { aspect-ratio: 16/10; border-radius: 10px; overflow: hidden; background: var(--tile); display: grid; place-items: center; border: 1px solid var(--line); }
.map-box iframe { width: 100%; height: 100%; border: 0; filter: grayscale(1) sepia(.25); }
.map-box .ph { color: var(--muted); font-size: 13px; }
.store-fields .grid2 { align-items: start; }

/* tiktok */
.sync-status { margin: -8px 0 16px; padding: 12px 16px; border-radius: 12px; background: #fff; border: 1px solid var(--line); font-size: 14px; }
.sync-status.ok { border-color: #bcd3b9; background: #f1f7f0; color: var(--ok); }
.sync-status.bad { border-color: #e3bdb8; background: #fbf1ef; color: var(--danger); }
.tt-add { display: flex; gap: 8px; }
.tt-add input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 100px; padding: 10px 16px; font: inherit; font-size: 15px; outline: none; }
.tt-add input:focus { border-color: var(--ink); }
.tt-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .tt-list { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1000px) { .tt-list { grid-template-columns: repeat(6, 1fr); } }
.tt-item { display: grid; gap: 6px; align-content: start; }
.tt-item.is-hidden .tt-thumb { opacity: .35; }
.tt-thumb { position: relative; aspect-ratio: 9/16; border-radius: 10px; overflow: hidden; background: var(--tile); transition: opacity .3s; }
.tt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tt-thumb span { position: absolute; left: 8px; top: 8px; color: #fff; font-size: 11px; font-weight: 500; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.tt-item p { margin: 0; font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.tt-tools { display: flex; justify-content: space-between; }
.tt-tools .icon-btn { width: 30px; height: 30px; }
.tt-tools .icon-btn svg { width: 15px; height: 15px; }
.tt-tools .icon-btn:disabled { opacity: .25; cursor: default; }
