/* Оранжевое облако — мягкий оранжевый + белый + жёлтый, mobile-first */
:root {
  --bg: #fffaf4;
  --card: #ffffff;
  --line: #f1e4d6;
  --ink: #2f2417;
  --muted: #9a8a77;
  --orange: #f97b22;
  --orange-soft: #ffe4c8;
  --orange-deep: #e5650e;
  --yellow: #fbbf24;
  --yellow-soft: #fef3c7;
  --green: #22a06b;
  --red: #e5484d;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(60, 40, 10, .06), 0 8px 24px rgba(60, 40, 10, .08);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.45;
  min-height: 100vh;
}
body.offline::after { content: 'Нет связи — переподключение…'; position: fixed; left: 0; right: 0; bottom: 0; background: var(--red); color: #fff; text-align: center; font-size: 13px; padding: 4px; z-index: 99; }
a { color: var(--orange-deep); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.hdr {
  position: sticky; top: 0; z-index: 50; background: linear-gradient(135deg, var(--orange), var(--orange-deep));
  color: #fff; padding: 12px 14px; display: flex; align-items: center; gap: 10px;
  box-shadow: 0 2px 10px rgba(200, 100, 20, .25);
}
.hdr .logo { font-size: 20px; font-weight: 800; letter-spacing: -.2px; display: flex; align-items: center; gap: 8px; }
.hdr .logo .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 4px rgba(255,255,255,.25); }
.hdr .sub { font-size: 12px; opacity: .9; }
.hdr .sp { flex: 1; }
.hdr button { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.hdr button.on { background: var(--yellow); color: #4a3500; border-color: var(--yellow); }

.wrap { max-width: 560px; margin: 0 auto; padding: 12px 12px 90px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.big { font-size: 20px; font-weight: 700; }
.bold { font-weight: 700; }

.card { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); border: 1px solid var(--line); margin-bottom: 12px; }
.card h3 { margin: 0 0 10px; font-size: 16px; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 11px 16px; font-size: 15px; font-weight: 600; width: 100%; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.yellow { background: var(--yellow); border-color: var(--yellow); color: #4a3500; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ok { background: var(--green); border-color: var(--green); color: #fff; }
.btn.sm { padding: 7px 10px; font-size: 13px; width: auto; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.on { background: var(--orange-soft); border-color: var(--orange); color: var(--orange-deep); }

/* Поля */
input, textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; font-size: 16px;
  background: #fff; color: var(--ink); font-family: inherit; margin-bottom: 8px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--orange); border-color: var(--orange); }
label { font-size: 13px; color: var(--muted); display: block; margin: 4px 0 4px; }

/* Сегменты */
.seg { display: flex; gap: 6px; background: var(--bg); border-radius: 14px; padding: 4px; overflow-x: auto; }
.seg button { flex: 1; white-space: nowrap; border: 0; background: transparent; padding: 9px 12px; border-radius: 11px; font-size: 14px; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--card); color: var(--orange-deep); box-shadow: var(--shadow); }

/* Города */
.cities { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.city-chip { flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 14px; font-weight: 600; color: var(--ink); }
.city-chip.on { background: var(--orange); color: #fff; border-color: var(--orange); }

/* Каталог */
.cat-title { font-size: 15px; font-weight: 800; margin: 16px 0 8px; display: flex; align-items: center; gap: 8px; }
.cat-title::before { content: ''; width: 6px; height: 20px; border-radius: 4px; background: linear-gradient(var(--orange), var(--yellow)); }
.prod { display: flex; gap: 12px; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; }
.prod .ph { flex: 0 0 64px; height: 64px; border-radius: 12px; background: linear-gradient(135deg, var(--orange-soft), var(--yellow-soft)); display: flex; align-items: center; justify-content: center; font-size: 30px; }
.prod .ph img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }
.prod .inf { flex: 1; min-width: 0; }
.prod .nm { font-weight: 700; font-size: 15px; }
.prod .ds { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prod .pr { font-weight: 800; color: var(--orange-deep); font-size: 16px; margin-top: 4px; }
.prod .row2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.prod .demo { font-size: 11px; color: var(--yellow); background: #fff7e0; border: 1px dashed var(--yellow); border-radius: 6px; padding: 1px 6px; }
.chip { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 8px; background: var(--bg); color: var(--muted); margin: 2px 4px 0 0; }
.chip.bought { font-size: 11px; background: #ecfdf5; color: #047857; border: 1px solid #d1fae5; }
.hidden-badge { font-size: 12px; color: var(--red); }

/* Корзина-бар */
.cartbar { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); z-index: 40; display: flex; gap: 10px; align-items: center; box-shadow: 0 -4px 16px rgba(60,40,10,.08); }
.cartbar .btn { flex: 1; }

/* Плавающая корзина — поверх нижней навигации, компактная одна строка */
#cartbar { bottom: calc(60px + env(safe-area-inset-bottom)); left: 10px; right: 10px; border-radius: 14px; border: 1px solid var(--line); z-index: 45; padding: 6px 10px; gap: 8px; box-shadow: var(--shadow); }
#cartbar .btn { flex: 0 0 auto; padding: 8px 12px; }
/* Нижняя навигация (табы) */
#tabbar { background: var(--card); padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
#tabbar .btn { border: 0; background: transparent; font-size: 12px; line-height: 1.25; padding: 6px 4px; color: var(--muted); }
#tabbar .btn.on { color: var(--orange-deep); background: var(--orange-soft); border-radius: 12px; }

/* Поиск / сортировка каталога */
#cat-controls { margin-bottom: 4px; }

/* Чат */
.chat-lst { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; padding: 4px 0; }
.msg { max-width: 82%; padding: 9px 12px; border-radius: 14px; font-size: 14.5px; }
.msg.me { align-self: flex-end; background: var(--orange); color: #fff; border-bottom-right-radius: 4px; }
.msg.them { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg .who { font-size: 11px; opacity: .75; margin-bottom: 2px; }
.msg .tm { font-size: 10.5px; opacity: .6; margin-top: 3px; text-align: right; }
.chat-input { display: flex; gap: 8px; margin-top: 8px; }
.chat-input input { flex: 1; margin-bottom: 0; }
.chat-input button { flex: 0 0 56px; }

/* Таблицы (админка/отчёты) */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; }

/* Списки-строки */
.row { display: flex; gap: 8px; align-items: center; }
.row .sp { flex: 1; }
.lst { display: flex; flex-direction: column; gap: 8px; }
.list-item { display: flex; gap: 10px; align-items: center; padding: 10px; background: var(--bg); border-radius: 12px; }

/* Статусы заказа */
.st { display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 999px; font-weight: 700; }
.st-new { background: var(--yellow-soft); color: #8a6100; }
.st-confirmed { background: #e0f2fe; color: #075985; }
.st-delivering { background: #ede9fe; color: #5b21b6; }
.st-done { background: #dcfce7; color: #166534; }
.st-cancelled { background: #fee2e2; color: #991b1b; }

/* Акции */
.promo { border: 1px solid var(--yellow); background: linear-gradient(135deg, #fffbf0, var(--yellow-soft)); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; position: relative; }
.promo .tag { position: absolute; top: -10px; left: 14px; background: var(--yellow); color: #5a3d00; font-size: 12px; font-weight: 800; padding: 2px 10px; border-radius: 999px; }

/* Предупреждения / ТБ */
.warn { border: 1px solid var(--yellow); background: var(--yellow-soft); border-radius: 12px; padding: 10px 12px; font-size: 13px; color: #6b4e00; margin-bottom: 10px; }
.warn.red { border-color: #fca5a5; background: #fef2f2; color: #7f1d1d; }
.notice { border-left: 4px solid var(--orange); background: var(--orange-soft); padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 10px; }

/* Модал */
.modal { position: fixed; inset: 0; background: rgba(30, 20, 10, .45); display: flex; align-items: flex-end; justify-content: center; z-index: 200; }
.modal-card { width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; background: var(--card); border-radius: 20px 20px 0 0; padding: 18px; }
@media (min-width: 600px) { .modal { align-items: center; padding: 20px; } .modal-card { border-radius: 20px; } }

/* Тосты */
#toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; width: calc(100% - 32px); max-width: 420px; }
.toast { background: #2f2417; color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14.5px; box-shadow: var(--shadow); transition: opacity .35s; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
.toast.gone { opacity: 0; }

/* Бейдж корзины */
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--yellow); color: #4a3500; font-size: 12px; font-weight: 800; }
.badge.dot { min-width: 10px; height: 10px; padding: 0; background: var(--red); }

/* Установка PWA */
.install-bar { background: var(--yellow-soft); border: 1px solid var(--yellow); border-radius: 12px; padding: 10px 12px; display: none; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 14px; }
.install-bar.show { display: flex; }

/* Вкладки */
.tabs { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px; margin-bottom: 12px; overflow-x: auto; }
.tabs button { flex: 1; white-space: nowrap; border: 0; background: transparent; padding: 9px 8px; border-radius: 11px; font-size: 13.5px; color: var(--muted); font-weight: 700; }
.tabs button.on { background: var(--orange); color: #fff; }

details.cat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; overflow: hidden; }
details.cat summary { padding: 12px 14px; font-weight: 700; cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
details.cat summary::-webkit-details-marker { display: none; }
details.cat summary::after { content: '▾'; margin-left: auto; color: var(--muted); }
details.cat[open] summary::after { content: '▴'; }
details.cat .body { padding: 0 12px 12px; }

/* Чек (receipt) */
.receipt { background: #fffdf8; border: 1px dashed var(--line); border-radius: 12px; padding: 16px; }
.rc-brand { font-size: 20px; font-weight: 800; text-align: center; color: var(--orange-deep); }
.rc-sub { font-size: 12px; color: var(--muted); text-align: center; margin-bottom: 12px; }
.rc-meta { font-size: 12.5px; color: var(--muted); line-height: 1.7; border-bottom: 1px dashed var(--line); padding-bottom: 8px; margin-bottom: 8px; }
.rc-items { border-bottom: 1px dashed var(--line); padding: 6px 0; }
.rc-row { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; margin: 4px 0; }
.rc-row .sp { flex: 1; }
.rc-totals { padding-top: 6px; }
.rc-grand { font-weight: 800; font-size: 16px; border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 6px; color: var(--orange-deep); }
.rc-foot { font-size: 11.5px; color: var(--muted); text-align: center; margin-top: 14px; }

/* Отзывы */
.review { border-top: 1px solid var(--line); padding: 8px 0; }
.review:first-child { border-top: 0; }
#rev-stars .btn { font-size: 22px; padding: 6px 8px; }
