/* Mobile-first. Designed at 390px; desktop just centres the column. */
:root {
  --bg: #f6f7f8;
  --surface: #ffffff;
  --text: #16191d;
  --muted: #69717c;
  --line: #e2e5e9;
  --brand: #0f766e;
  --brand-ink: #ffffff;
  --danger: #b42318;
  --warn-bg: #fff6e0;
  --warn-line: #f0b429;
  --ok-bg: #e7f6ef;
  --bad-bg: #fdecea;
  --radius: 14px;
  --tap: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101214; --surface: #1a1d21; --text: #eceef1; --muted: #9aa3ad; --line: #2c3036;
    --brand: #2dd4bf; --brand-ink: #062b27; --danger: #f97066;
    --warn-bg: #3a2e10; --warn-line: #d69e2e; --ok-bg: #12352a; --bad-bg: #3d1714;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}
a { color: var(--brand); }
img { max-width: 100%; display: block; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
code { font-size: 14px; }

.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) 12px 6px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); font-size: 20px; padding: 8px 4px; }
.topbar-title { flex: 1; text-align: center; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn {
  min-width: var(--tap); min-height: 44px; display: grid; place-items: center;
  font-size: 26px; text-decoration: none; color: var(--text);
}

.page { max-width: 640px; margin: 0 auto; padding: 12px 16px calc(110px + var(--safe-b)); }
.section { font-size: 17px; margin: 28px 0 8px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; touch-action: manipulation;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; }
.btn.block { display: flex; width: 100%; margin: 10px 0; }
.btn.big { min-height: 58px; font-size: 18px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn.subtle { background: transparent; }

.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 10px 16px calc(10px + var(--safe-b));
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: flex; gap: 10px; max-width: 640px; margin: 0 auto;
}
.bottombar .btn { margin: 0; }
.bottombar.two .btn { flex: 1; }
.bottombar .wide { flex: 1; }

/* Forms */
.field { display: block; margin: 14px 0; border-radius: var(--radius); }
.field > span { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; font-size: 15px; font-weight: 600; margin-bottom: 6px; }
input:not([type=radio]):not([type=file]), textarea, .picker-btn {
  width: 100%; min-height: var(--tap); padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-size: 17px; /* >=16px stops iOS zoom-on-focus */
}
textarea { resize: vertical; line-height: 1.4; }
.picker-btn { text-align: left; cursor: pointer; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset[disabled] input, fieldset[disabled] textarea, fieldset[disabled] .picker-btn { opacity: .75; }
.field.review { background: var(--warn-bg); outline: 2px solid var(--warn-line); outline-offset: 6px; }
.check { font-style: normal; font-weight: 600; font-size: 13px; color: #8a5a00; background: var(--warn-line); color: #2b1d00; padding: 1px 8px; border-radius: 99px; }
.counter { font-style: normal; font-weight: 400; margin-left: auto; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg.col { grid-template-columns: 1fr; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span {
  display: flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-weight: 500; text-align: center;
}
.seg input:checked + span { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, var(--surface)); font-weight: 700; }
.seg input:focus-visible + span { outline: 2px solid var(--brand); }

.alert { background: var(--bad-bg); border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.notice { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 12px 0; display: flex; gap: 10px; align-items: center; }
.notice.ok { background: var(--ok-bg); border-color: transparent; }
.spinner { width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Login */
.login { max-width: 380px; margin: 18vh auto 0; }
.login h1 { margin: 0; font-size: 34px; }

/* Home */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; text-align: center; text-decoration: none; color: var(--text); }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.bad b { color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { min-height: 44px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 500; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 10px 0; color: var(--text); text-decoration: none; }
.card.row { display: flex; gap: 12px; padding: 10px; align-items: center; }
.thumb { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; flex: none; background: var(--line); }
.card-body { min-width: 0; flex: 1; }
.card-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.badge { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--line); color: var(--text); }
.badge.warn { background: var(--warn-line); color: #2b1d00; }
.badge.bad, .badge.s-failed { background: var(--danger); color: #fff; }
.badge.busy { background: color-mix(in srgb, var(--brand) 20%, var(--surface)); }
.badge.s-posted { background: var(--ok-bg); }
.badge.s-draft { background: color-mix(in srgb, var(--brand) 18%, var(--surface)); }
.empty { text-align: center; padding: 40px 0; }
.ptr { height: 0; overflow: hidden; text-align: center; color: var(--muted); font-size: 14px; transition: height .15s; }
.ptr.show { height: 36px; line-height: 36px; }

/* Upload */
.pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick { width: 100%; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.grid.small { grid-template-columns: repeat(5, 1fr); }
.tile { position: relative; }
.tile img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.tile .x { position: absolute; top: 4px; right: 4px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 18px; }
.tile .cover { position: absolute; left: 4px; bottom: 4px; font-size: 11px; font-weight: 700; background: var(--brand); color: var(--brand-ink); padding: 1px 6px; border-radius: 6px; }
.tile .busy { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.35); border-radius: 10px; }
.qitem { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin: 10px 0; }
.qhead { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-weight: 600; }
.bars { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin-top: 8px; }
.bar { position: relative; height: 44px; border-radius: 8px; overflow: hidden; background: var(--line); }
.bar img { width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.bar i { position: absolute; left: 0; bottom: 0; height: 5px; background: var(--brand); width: 0; transition: width .2s; }
.bar.done img { opacity: 1; }
.bar.done i { width: 100% !important; }
.bar.err i { background: var(--danger); width: 100%; }

/* Review */
.gallery img { cursor: zoom-in; }
.price-tip { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -6px 0 14px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }
.regen { margin: 18px 0; }
.regen summary { min-height: 44px; display: flex; align-items: center; font-weight: 600; cursor: pointer; }
.picker { width: 100%; max-width: 640px; height: 100dvh; max-height: 100dvh; margin: 0 auto; padding: 0; border: 0; background: var(--bg); color: var(--text); }
.picker::backdrop { background: rgba(0,0,0,.4); }
.picker-head { position: sticky; top: 0; display: flex; gap: 8px; padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
#picker-list { list-style: none; margin: 0; padding: 0 0 calc(20px + var(--safe-b)); }
#picker-list button { width: 100%; text-align: left; min-height: var(--tap); padding: 10px 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; }
#picker-list button small { display: block; color: var(--muted); }

/* Manual post */
.steps { list-style: none; padding: 0; margin: 0; }
.steps > li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 12px 0; }
.copyrow { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; width: 100%; text-align: left; padding: 12px; margin: 8px 0; min-height: var(--tap); border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); font: inherit; cursor: pointer; }
.copy-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.copy-hint { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: 13px; font-weight: 700; color: var(--brand); }
.copy-value { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 9.5em; overflow: hidden; }
.copyrow.copied { border-color: var(--brand); }
.copyrow.copied .copy-hint::after { content: " ✓"; }
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-weight: 600; z-index: 30; }

@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
}

/* Remote Vinted login */
.vscreen { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--line); aspect-ratio: 430 / 860; width: min(100%, 35vh); margin: 0 auto; }
.vscreen img { display: block; width: 100%; height: 100%; object-fit: contain; touch-action: none; user-select: none; -webkit-user-select: none; }
.vtype { display: flex; gap: 8px; margin: 10px 0; }
.vtype input { flex: 1; min-width: 0; }
.vtype .btn { margin: 0; }
.vkeys { display: flex; flex-wrap: wrap; gap: 8px; }
.vkeys .btn { margin: 0; flex: 1; min-width: 64px; }
