/* «Диванов»: оранжевый + тёмно-зелёный */
:root {
  --orange: #F26A1B;
  --orange-press: #D65A0F;
  --orange-soft: #FDE9DC;
  --green: #1C4A37;
  --green-2: #2B6A4F;
  --green-soft: #E3EFE8;
  --bg: #F2F3EF;
  --card: #FFFFFF;
  --text: #15201B;
  --muted: #6C7A72;
  --line: #E2E6E0;
  --danger: #D23F3F;
  --ok: #23875A;
  --warn: #C98A00;
  --radius: 16px;
  --nav-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
[data-theme="dark"] {
  --bg: #0C1813;
  --card: #14261E;
  --text: #EDF2EE;
  --muted: #92A69B;
  --line: #22392E;
  --orange-soft: #3A2515;
  --green-soft: #1B3328;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--orange); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---------- заставка / ошибки ---------- */
.splash { min-height: 80vh; display: grid; place-content: center; text-align: center; gap: 10px; padding: 24px; }
.logo-big { font-size: 34px; font-weight: 800; color: var(--green); letter-spacing: -0.5px; }
[data-theme="dark"] .logo-big { color: var(--orange); }

/* ---------- шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--green); color: #fff;
  padding: 12px 16px 12px;
  border-radius: 0 0 20px 20px;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.logo { font-size: 22px; font-weight: 800; letter-spacing: -0.3px; display: flex; align-items: center; gap: 8px; }
.logo i { width: 10px; height: 10px; border-radius: 50%; background: var(--orange); display: inline-block; }
.top h1 { margin: 0; font-size: 20px; }
.search {
  margin-top: 10px; width: 100%; border: 0; outline: 0;
  background: rgba(255,255,255,.14); color: #fff;
  border-radius: 12px; padding: 10px 12px 10px 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 11px center;
}
.search::placeholder { color: rgba(255,255,255,.7); }

main { padding: 12px 12px 0; }

/* ---------- чипсы ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 7px 14px; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 600; }
.chips.sub .chip { padding: 5px 12px; font-size: 13px; }
.chips.sub .chip.on { background: var(--green-2); border-color: var(--green-2); }

/* ---------- сетка товаров ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.card .img { position: relative; aspect-ratio: 1 / 1; background: var(--green-soft); cursor: pointer; }
.card .img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph {
  width: 100%; height: 100%; display: grid; place-items: center;
  font-size: 30px; font-weight: 800; color: var(--green-2);
  background: linear-gradient(135deg, var(--green-soft), var(--orange-soft));
}
.badges { position: absolute; left: 8px; top: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.badge {
  font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 8px;
  background: rgba(0,0,0,.6); color: #fff;
}
.badge.o { background: var(--orange); }
.badge.g { background: var(--green-2); }
.card .body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.price { font-size: 18px; font-weight: 800; color: var(--orange); }
.brand { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.name { font-size: 14px; font-weight: 600; line-height: 1.25; cursor: pointer;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .foot { margin-top: auto; padding-top: 6px; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 12px; padding: 11px 16px; cursor: pointer;
  background: var(--orange); color: #fff; font-weight: 700; width: 100%;
  transition: transform .06s, background .15s;
}
.btn:active { transform: scale(.98); background: var(--orange-press); }
.btn:disabled { opacity: .5; }
.btn.sm { padding: 8px 10px; font-size: 14px; border-radius: 10px; }
.btn.ghost { background: var(--orange-soft); color: var(--orange); }
.btn.green { background: var(--green-2); }
.btn.line { background: transparent; border: 1px solid var(--line); color: var(--text); font-weight: 600; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); font-weight: 600; }
.btn.auto { width: auto; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.row.wrap { flex-wrap: wrap; }
.row.wrap > * { flex: 1 1 auto; }

.stepper { display: flex; align-items: center; justify-content: space-between; background: var(--orange-soft); border-radius: 10px; }
.stepper button {
  width: 38px; height: 36px; border: 0; background: transparent; color: var(--orange);
  font-size: 22px; font-weight: 700; cursor: pointer;
}
.stepper button:disabled { opacity: .35; }
.stepper span { font-weight: 700; }

/* ---------- блоки ---------- */
.box { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.box h3 { margin: 0 0 10px; font-size: 16px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 44px; margin-bottom: 8px; }
.hint { background: var(--green-soft); border-radius: var(--radius); padding: 14px; margin: 12px 0 10px; display: flex; align-items: center; gap: 12px; }
.hint > div { flex: 1; }
.contact { text-align: center; color: var(--muted); font-size: 13px; padding: 14px 0 6px; }

/* ---------- корзина ---------- */
.cl { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cl:last-child { border-bottom: 0; }
.thumb { width: 56px; height: 56px; border-radius: 10px; overflow: hidden; flex: none; background: var(--green-soft); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .ph { font-size: 16px; }
.cl .info { flex: 1; min-width: 0; }
.cl .t { font-weight: 600; font-size: 14px; }
.cl .stepper { width: 110px; flex: none; }
.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 10px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
textarea, input.inp, select.inp {
  width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 12px;
  padding: 10px 12px; outline: 0; resize: vertical;
}
textarea:focus, input.inp:focus, select.inp:focus { border-color: var(--orange); }
.total { display: flex; justify-content: space-between; align-items: baseline; font-size: 18px; font-weight: 800; margin: 4px 0 12px; }
.warn { color: var(--danger); font-size: 13px; }

/* ---------- заказы ---------- */
.order .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.order .head b { font-size: 16px; }
.st { font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.st-new { background: var(--orange-soft); color: var(--orange); }
.st-accepted, .st-planned { background: var(--green-soft); color: var(--green-2); }
.st-ready { background: var(--orange); color: #fff; }
.st-done { background: var(--line); color: var(--muted); }
.st-cancelled { background: var(--line); color: var(--danger); }
.order ul { margin: 6px 0; padding-left: 18px; }
.order li { margin: 2px 0; font-size: 14px; }
.order .sum { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin: 8px 0; gap: 8px; flex-wrap: wrap; }
.paid { font-size: 12px; font-weight: 700; color: var(--ok); }
.unpaid { font-size: 12px; font-weight: 700; color: var(--warn); }
.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.acts .full { grid-column: 1 / -1; }
.plan-row { display: flex; gap: 6px; }
.plan-row input { flex: 1; min-width: 0; }

/* ---------- админка ---------- */
.prow { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.prow:last-child { border-bottom: 0; }
.prow .info { flex: 1; min-width: 0; }
.prow .t { font-weight: 600; font-size: 14px; }
.prow .btns { display: flex; gap: 6px; flex: none; }
.icon-btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; width: 38px; height: 38px; cursor: pointer; font-size: 16px; }
.hidden-p { opacity: .5; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.tile { background: var(--card); border-radius: var(--radius); padding: 12px; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-size: 22px; font-weight: 800; margin: 2px 0; }
.tile .s { font-size: 12px; color: var(--muted); }
.tile.accent { background: var(--green); color: #fff; }
.tile.accent .k, .tile.accent .s { color: rgba(255,255,255,.75); }
.form label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--orange); }
.photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.photos .ph-item { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; }
.photos .ph-item img { width: 100%; height: 100%; object-fit: cover; }
.photos .ph-item button {
  position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.65); color: #fff; font-size: 13px; cursor: pointer; line-height: 1;
}
.photos .ph-item .first { left: 3px; right: auto; }
.photos .add {
  width: 76px; height: 76px; border-radius: 10px; border: 2px dashed var(--line);
  display: grid; place-items: center; color: var(--muted); font-size: 28px; cursor: pointer;
}
.quick { display: flex; gap: 6px; margin: 8px 0; }
.quick button { flex: 1; }

/* ---------- нижняя навигация ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--card); border-top: 1px solid var(--line);
  display: flex; padding-bottom: var(--safe-b); height: calc(var(--nav-h) + var(--safe-b));
}
.nav button {
  flex: 1; border: 0; background: transparent; cursor: pointer; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; position: relative;
}
.nav button svg { width: 24px; height: 24px; }
.nav button.on { color: var(--orange); }
.nav .cnt {
  position: absolute; top: 6px; left: 50%; margin-left: 6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--orange); color: #fff; font-size: 11px; line-height: 18px;
}

/* ---------- модальное окно (шторка снизу) ---------- */
#modal .back { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; animation: fade .15s; }
#modal .sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-height: 92vh; overflow-y: auto;
  background: var(--card); border-radius: 20px 20px 0 0; padding: 8px 16px calc(16px + var(--safe-b));
  animation: up .2s ease-out;
}
#modal .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 10px; }
#modal h2 { margin: 0 0 10px; font-size: 19px; }
.gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px 12px; padding: 0 16px; }
.gallery img, .gallery .ph { flex: none; width: 82%; aspect-ratio: 1/1; object-fit: cover; border-radius: 14px; scroll-snap-align: center; }
.gallery.one img, .gallery.one .ph { width: 100%; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- уведомление ---------- */
#toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-h) + var(--safe-b) + 12px); z-index: 60;
  display: flex; justify-content: center; pointer-events: none;
}
#toast div {
  background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 12px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); animation: up .2s; max-width: 480px; text-align: center;
}
#toast div.err { background: var(--danger); color: #fff; }
