:root {
  --brand: #7a2e4f;
  --brand-2: #a3476f;
  --bg: #faf6f2;
  --card: #ffffff;
  --ink: #2a1f24;
  --muted: #7c6f75;
  --line: #eadfe3;
  --ok: #2e7d4f;
  --warn: #b26a00;
  --bad: #b3261e;
  --radius: 14px;
  --tap: 48px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: hidden; }
body { min-height: 100dvh; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
button, input, select, textarea { font: inherit; color: inherit; }

.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  background: var(--brand); color: #fff;
}
.bar h1 { flex: 1; margin: 0; font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .back { width: 44px; height: 44px; border: 0; background: transparent; color: #fff; font-size: 32px; line-height: 1; }
.saving { font-size: 12px; opacity: .85; }

main { padding: 12px; max-width: 640px; margin: 0 auto; }

.steps { display: flex; gap: 4px; margin: 4px 0 14px; }
.steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps span.on { background: var(--brand-2); }
.step-title { font-size: 20px; margin: 0 0 4px; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 14px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
label.f { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 6px; }
label.f .req { color: var(--bad); }
input[type=text], input[type=number], input[type=password], input[type=search], textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 16px;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--brand-2); outline-offset: 0; border-color: transparent; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--brand); background: #fff; color: var(--brand); font-weight: 600; font-size: 16px;
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.block { width: 100%; }
.btn.small { min-height: 40px; padding: 0 12px; font-size: 14px; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn:disabled { opacity: .45; }
.link { background: none; border: 0; color: var(--brand); font-weight: 600; padding: 8px 0; min-height: 44px; }

.footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
  display: flex; gap: 10px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(250, 246, 242, .96); border-top: 1px solid var(--line);
}
.footer .btn { flex: 1; }

.picker-btn {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-align: left; font-size: 16px;
}
.picker-btn .ph { color: var(--muted); }
.picker-btn::after { content: "›"; color: var(--muted); font-size: 22px; margin-left: 8px; }
.chosen { font-size: 13px; color: var(--muted); margin-top: 6px; }

.results { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.results li { border-top: 1px solid var(--line); }
.results li:first-child { border-top: 0; }
.results button { display: block; width: 100%; min-height: var(--tap); padding: 10px 12px; border: 0; background: none; text-align: left; font-size: 16px; }
.results small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.results button.sel { background: #f6e9ef; font-weight: 600; }
.results button.sel::after { content: " ✓"; color: var(--brand); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; border-radius: 999px; background: #f3e6ec; font-size: 15px; }
.chip button { width: 32px; height: 32px; border: 0; border-radius: 50%; background: #fff; color: var(--bad); font-size: 18px; }

.sheet-bg { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; }
.sheet {
  width: 100%; max-height: 88dvh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 18px 18px 0 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
}
.sheet header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sheet header h2 { flex: 1; margin: 0; font-size: 18px; }
.sheet .list { overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }

.models { display: grid; gap: 10px; }
.model { display: flex; gap: 12px; align-items: center; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-align: left; width: 100%; }
.model img, .model .noimg { width: 64px; height: 80px; object-fit: cover; border-radius: 8px; background: #eee; flex: none; }
.model .t { font-weight: 600; }
.model .s { font-size: 13px; color: var(--muted); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eee; color: #444; margin-top: 4px; }
.badge.Yayında { background: #e3f3ea; color: var(--ok); }
.badge.Reddedildi, .badge.bad { background: #fbe9e7; color: var(--bad); }
.badge.Onay, .badge.Sırada { background: #fff3e0; color: var(--warn); }
.badge.Kısmen { background: #eef3fb; color: #2456a6; }

.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.photo { position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; background: #eee; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .del { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 16px; }
.photo .cover { position: absolute; left: 4px; bottom: 4px; padding: 2px 8px; border-radius: 999px; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; min-height: 28px; }
.photo.first .cover { background: var(--brand); }
.addphoto { display: flex; align-items: center; justify-content: center; aspect-ratio: 3 / 4; border: 2px dashed var(--line); border-radius: 10px; color: var(--brand); font-weight: 600; font-size: 14px; text-align: center; padding: 6px; }
.addphoto input { display: none; }

.grid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -14px; padding: 0 14px; }
table.stock { border-collapse: collapse; width: 100%; }
table.stock th, table.stock td { padding: 6px 4px; text-align: center; font-size: 14px; }
table.stock th { color: var(--muted); font-weight: 600; white-space: nowrap; }
table.stock td:first-child, table.stock th:first-child { text-align: left; font-weight: 600; color: var(--ink); white-space: nowrap; }
table.stock input { width: 72px; min-height: 44px; text-align: center; padding: 6px; }
.prices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.toggle { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.toggle input { width: 22px; height: 22px; }

.errors { list-style: none; padding: 0; margin: 0; }
.errors li { padding: 10px 12px; border-radius: 10px; background: #fbe9e7; color: var(--bad); margin-bottom: 6px; font-size: 15px; }
.ok-box { padding: 14px; border-radius: 12px; background: #e3f3ea; color: var(--ok); font-weight: 600; }
.vrow { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.vrow:first-child { border-top: 0; }
.reason { color: var(--bad); font-size: 13px; }

.login { max-width: 360px; margin: 12vh auto 0; text-align: center; }
.login input { text-align: center; letter-spacing: 8px; font-size: 24px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.loading { color: var(--muted); padding: 12px; text-align: center; }

#toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: 92vw; padding: 10px 16px; border-radius: 12px; background: #2a1f24; color: #fff; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30;
}
#toast.show { opacity: 1; }
#toast.bad { background: var(--bad); }
