/* BreadMeat brand system (§15) — black, white, warm amber-orange. Mobile-First (§21). */
:root {
  --bm-black: #0a0a0a;
  --bm-white: #ffffff;
  --bm-amber: #f5a524; /* теплый желтый с оттенком оранжевого */
  --bm-amber-dark: #d98a10;
  --bm-gray-900: #141414;
  --bm-gray-700: #2b2b2b;
  --bm-gray-400: #9a9a9a;
  --bm-gray-200: #e6e6e6;
  --bm-danger: #e5484d;
  --bm-radius: 14px;
  --bm-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  --bm-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--bm-font);
  color: var(--bm-black);
  background: var(--bm-white);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--bm-amber-dark); text-decoration: none; }

.bm-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  color: var(--bm-black);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--bm-gray-200);
}
.bm-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.bm-brand-logo {
  width: 44px; height: 44px; border-radius: 10px; object-fit: contain;
  background: transparent;
}
.bm-brand-tx { display: flex; flex-direction: column; line-height: 1.05; }
.bm-brand-name { font-weight: 800; font-size: 22px; letter-spacing: 0.3px; color: var(--bm-black); }
.bm-brand-sub { font-size: 12px; font-weight: 700; color: var(--bm-amber-dark); margin-top: 3px; letter-spacing: 0.2px; }

/* Совместимость со старой разметкой шапки (админка) */
.bm-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: 0.5px; }
.bm-logo .dot { color: var(--bm-amber); }

.bm-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 16px 64px;
}

.bm-hero {
  text-align: center;
  padding: 40px 16px 20px;
}
.bm-hero h1 { font-size: 30px; margin: 0 0 8px; line-height: 1.15; }
.bm-hero p { color: var(--bm-gray-700); font-size: 16px; margin: 0 auto; max-width: 46ch; }
.bm-accent { color: var(--bm-amber-dark); }

.bm-card {
  background: var(--bm-white);
  border: 1px solid var(--bm-gray-200);
  border-radius: var(--bm-radius);
  box-shadow: var(--bm-shadow);
  padding: 22px;
  margin: 18px 0;
}
.bm-card h2 { margin: 0 0 14px; font-size: 20px; }

label { display: block; font-size: 14px; font-weight: 600; margin: 12px 0 6px; }
input {
  width: 100%;
  padding: 13px 14px;
  font-size: 16px;
  border: 1px solid var(--bm-gray-200);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s;
}
input:focus { border-color: var(--bm-amber); }

.bm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 700;
  color: var(--bm-black);
  background: var(--bm-amber);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  margin-top: 16px;
  transition: transform 0.05s, background 0.15s;
}
.bm-btn:hover { background: var(--bm-amber-dark); }
.bm-btn:active { transform: translateY(1px); }
.bm-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.bm-btn.secondary { background: var(--bm-black); color: var(--bm-white); }
.bm-btn.ghost { background: transparent; color: var(--bm-black); border: 1px solid var(--bm-gray-200); }

/* Поле телефона с фиксированным префиксом +7 */
.bm-phone { display: flex; align-items: stretch; }
.bm-phone > .pfx {
  display: flex; align-items: center; padding: 0 14px; font-size: 16px; font-weight: 700;
  color: var(--bm-gray-700); background: #f2f2f2;
  border: 1px solid var(--bm-gray-200); border-right: none; border-radius: 10px 0 0 10px;
}
.bm-phone > input { border-radius: 0 10px 10px 0; }

.bm-note { font-size: 13px; color: var(--bm-gray-400); margin-top: 8px; }
.bm-alert { padding: 12px 14px; border-radius: 10px; font-size: 14px; margin: 12px 0; }
.bm-alert.error { background: #fdecec; color: var(--bm-danger); }
.bm-alert.success { background: #fff4e0; color: var(--bm-amber-dark); }

.bm-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--bm-gray-200); }
.bm-row:last-child { border-bottom: none; }
.bm-row .k { color: var(--bm-gray-700); }
.bm-row .v { font-weight: 700; }

.bm-balance { font-size: 40px; font-weight: 800; color: var(--bm-amber-dark); }

/* Общие подписи ячейки (центрированы) */
.bm-loyalty-label { font-size: 15px; font-weight: 700; color: var(--bm-gray-700); margin-bottom: 8px; text-align: center; }
.bm-loyalty-terms { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; justify-content: center; }
.bm-loyalty-term {
  background: #fff4e0; color: var(--bm-amber-dark);
  border-radius: 20px; padding: 7px 13px; font-size: 13px; font-weight: 700;
}
.bm-loyalty { padding: 24px; background: linear-gradient(160deg, #fff 60%, #fffaf0 100%); border: 1px solid #f2e3c4; }

/* Карта лояльности с 3D-переворотом: лицо = баланс, оборот = штрихкод */
.bm-flip { perspective: 1400px; cursor: pointer; margin: 18px 0; }
.bm-flip-inner {
  position: relative; width: 100%; min-height: 250px;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.bm-flip.flipped .bm-flip-inner { transform: rotateY(180deg); }
.bm-flip-front, .bm-flip-back {
  position: absolute; inset: 0; box-sizing: border-box; padding: 24px;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  border-radius: 18px; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.14);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.bm-flip-front {
  background: radial-gradient(120% 120% at 15% 0%, #262626 0%, #0a0a0a 60%);
  border: 1px solid #000; color: #fff;
}
.bm-flip-front .bm-loyalty-label { color: rgba(255, 255, 255, 0.7); }
.bm-flip-front .bm-balance { color: var(--bm-amber); font-size: 48px; line-height: 1; }
.bm-flip-back { background: #fff; border: 1px solid var(--bm-gray-200); transform: rotateY(180deg); }
.bm-flip-hint { margin-top: 16px; font-size: 12px; color: var(--bm-gray-400); }
.bm-flip-front .bm-flip-hint { color: rgba(255, 255, 255, 0.55); }
.bm-pending { margin-top: 8px; font-size: 13px; font-weight: 600; color: rgba(245, 165, 36, 0.9); }
.bm-purchase-bonus { display: inline-block; margin-left: 6px; font-size: 12px; font-weight: 700; color: var(--bm-amber-dark); background: #fff4e0; border-radius: 20px; padding: 1px 8px; }

.bm-balance { text-align: center; }
.bm-barcode { text-align: center; padding: 10px 6px; background: var(--bm-white); border-radius: 12px; width: 100%; }
.bm-barcode svg { width: 100%; max-width: 320px; height: 150px; }

.bm-hidden { display: none !important; }
.bm-center { text-align: center; }
.bm-spinner {
  width: 22px; height: 22px; border: 3px solid var(--bm-gray-200);
  border-top-color: var(--bm-amber); border-radius: 50%;
  animation: spin 0.8s linear infinite; display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.bm-footer { text-align: center; color: var(--bm-gray-400); font-size: 13px; padding: 24px; }

/* Landing / login */
.bm-features { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 4px 0 8px; }
.bm-feature { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border: 1px solid var(--bm-gray-200); border-radius: 12px; }
.bm-feature .ic { width: 38px; height: 38px; flex-shrink: 0; border-radius: 10px; background: #fff4e0; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.bm-feature .tx { font-size: 14px; color: var(--bm-gray-700); }
.bm-feature .tx b { color: var(--bm-black); display: block; font-size: 15px; }

.bm-divider { display: flex; align-items: center; gap: 12px; color: var(--bm-gray-400); font-size: 13px; margin: 18px 0 10px; }
.bm-divider::before, .bm-divider::after { content: ''; flex: 1; height: 1px; background: var(--bm-gray-200); }

/* Секция «Как это работает» */
.bm-section-title { font-size: 20px; font-weight: 800; margin: 28px 0 14px; text-align: center; }
.bm-steps { display: grid; grid-template-columns: 1fr; gap: 12px; }
.bm-step { display: flex; gap: 14px; align-items: flex-start; padding: 16px; background: #fff; border: 1px solid var(--bm-gray-200); border-radius: 14px; }
.bm-step .no { flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--bm-black); color: var(--bm-amber); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.bm-step .tx b { display: block; font-size: 15px; margin-bottom: 2px; }
.bm-step .tx span { font-size: 14px; color: var(--bm-gray-700); }

.bm-cta { background: var(--bm-black); color: #fff; border-radius: 18px; padding: 26px 22px; text-align: center; margin: 24px 0; }
.bm-cta h3 { margin: 0 0 6px; font-size: 20px; }
.bm-cta p { margin: 0 0 16px; color: var(--bm-gray-200); font-size: 14px; }
.bm-cta .bm-btn { max-width: 280px; margin: 0 auto; }

@media (min-width: 720px) {
  .bm-features { grid-template-columns: repeat(3, 1fr); }
  .bm-steps { grid-template-columns: repeat(3, 1fr); }
}

/* Modal */
.bm-overlay {
  position: fixed; inset: 0; background: rgba(10, 10, 10, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50;
  animation: fade 0.15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.bm-modal {
  position: relative; background: #fff; border-radius: 18px; width: 100%; max-width: 440px;
  padding: 26px 24px 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-height: 92vh; overflow-y: auto; animation: pop 0.18s ease;
}
@keyframes pop { from { transform: translateY(12px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.bm-modal h2 { margin: 0 0 14px; padding-right: 30px; }
.bm-modal-close {
  position: absolute; top: 14px; right: 16px; width: 30px; height: 30px; border: none;
  background: var(--bm-gray-200); border-radius: 50%; font-size: 18px; line-height: 1; cursor: pointer; color: var(--bm-gray-700);
}
.bm-modal-close:hover { background: var(--bm-amber); color: #000; }
body.bm-noscroll { overflow: hidden; }

@media (min-width: 720px) {
  .bm-hero h1 { font-size: 38px; }
}

/* ─────────────── Кнопка доставки (WhatsApp) ─────────────── */
.bm-delivery {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: #fff; border-radius: var(--bm-radius); padding: 16px 18px; margin: 16px 0;
  box-shadow: var(--bm-shadow); text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.bm-delivery:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(18, 140, 126, 0.35); }
.bm-delivery:active { transform: translateY(0); }
.bm-delivery .ic { font-size: 30px; line-height: 1; }
.bm-delivery .tx { display: flex; flex-direction: column; flex: 1; line-height: 1.3; }
.bm-delivery .tx b { font-size: 17px; }
.bm-delivery .tx span { font-size: 13px; opacity: 0.9; }
.bm-delivery .arr { font-size: 22px; font-weight: 700; opacity: 0.9; }

/* ─────────────── Информация о магазине ─────────────── */
.bm-store .bm-store-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 0; font-size: 15px; border-bottom: 1px solid var(--bm-gray-200);
}
.bm-store .bm-store-row:last-child { border-bottom: none; }
.bm-store .bm-store-row .ic { font-size: 18px; line-height: 1.4; }
.bm-store .bm-store-row a { color: var(--bm-amber-dark); font-weight: 600; }

/* ─────────────── Кабинет: приветствие ─────────────── */
.bm-welcome { display: flex; align-items: center; gap: 14px; margin: 4px 0 16px; }
.bm-avatar {
  width: 56px; height: 56px; flex-shrink: 0; border-radius: 50%;
  background: radial-gradient(120% 120% at 30% 20%, var(--bm-amber) 0%, var(--bm-amber-dark) 100%);
  color: #fff; font-size: 26px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(217, 138, 16, 0.35);
}
.bm-welcome-tx { display: flex; flex-direction: column; min-width: 0; }
.bm-welcome-tx b { font-size: 20px; line-height: 1.2; }
.bm-welcome-tx span { font-size: 13px; color: var(--bm-gray-400); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Быстрые показатели */
.bm-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 16px; }
.bm-stat {
  background: #fff; border: 1px solid var(--bm-gray-200); border-radius: 14px;
  padding: 14px 8px; text-align: center;
}
.bm-stat .ic { font-size: 20px; }
.bm-stat .num { font-size: 22px; font-weight: 800; color: var(--bm-black); margin-top: 4px; line-height: 1; font-variant-numeric: tabular-nums; }
.bm-stat .lbl { font-size: 11px; color: var(--bm-gray-400); margin-top: 5px; }

/* История покупок — карточки */
.bm-hist-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--bm-gray-200); }
.bm-hist-item:last-child { border-bottom: none; }
.bm-hist-item .ic {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px;
  background: #fff4e0; display: flex; align-items: center; justify-content: center; font-size: 19px;
}
.bm-hist-item .ic.ret { background: #fdecec; }
.bm-hist-item .meta { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.bm-hist-item .meta b { font-size: 15px; }
.bm-hist-item .meta span { font-size: 12px; color: var(--bm-gray-400); }
.bm-hist-item .amt { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.bm-hist-item .amt .sum { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Пустая история */
.bm-empty { text-align: center; padding: 24px 12px; color: var(--bm-gray-400); }
.bm-empty .ic { font-size: 34px; }
.bm-empty p { font-size: 14px; margin: 10px 0 0; }

/* Аккаунт — сворачиваемый блок */
.bm-account { padding: 0; }
.bm-account > summary {
  list-style: none; cursor: pointer; padding: 18px 20px;
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 16px;
}
.bm-account > summary::-webkit-details-marker { display: none; }
.bm-account > summary .chev { color: var(--bm-gray-400); transition: transform 0.2s; font-size: 18px; }
.bm-account[open] > summary .chev { transform: rotate(180deg); }
.bm-account-body { padding: 0 20px 20px; }

/* ─────────────── Компактный герой (лендинг) ─────────────── */
.bm-hero-mini { padding: 14px 4px 6px; }
.bm-badge {
  display: inline-block; padding: 6px 12px; border-radius: 999px;
  background: #fff4e0; color: var(--bm-amber-dark);
  font-size: 12px; font-weight: 800; letter-spacing: 0.3px; margin-bottom: 12px;
  border: 1px solid #f2e0bd;
}
.bm-hero-mini h1 { margin: 0 0 8px; font-size: 28px; line-height: 1.1; font-weight: 800; letter-spacing: -0.3px; }
.bm-hero-mini p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--bm-gray-700); max-width: 42ch; }

/* Карточка входа — акцент, чтобы сразу цепляла взгляд */
.bm-login { border: 1px solid #f2e0bd; box-shadow: 0 10px 34px rgba(217, 138, 16, 0.14); }

/* ─────────────── Витрина «Наше производство» — карусель ─────────────── */
.bm-mills {
  display: flex; gap: 14px; margin: 4px -16px 6px; padding: 6px 16px 12px;
  overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
}
.bm-mills::-webkit-scrollbar { display: none; }
.bm-mill {
  flex: 0 0 78%; max-width: 300px; scroll-snap-align: center;
  border-radius: 20px; padding: 22px 20px; min-height: 190px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 6px;
  color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18); position: relative; overflow: hidden;
}
.bm-mill .e { font-size: 42px; margin-bottom: auto; }
.bm-mill b { font-size: 21px; font-weight: 800; line-height: 1.15; }
.bm-mill span { font-size: 14px; line-height: 1.4; color: rgba(255, 255, 255, 0.88); }
.bm-mill.m1 { background: linear-gradient(155deg, #e8a13a 0%, #b26a12 100%); }
.bm-mill.m2 { background: linear-gradient(155deg, #5bb04a 0%, #2f7d3f 100%); }
.bm-mill.m3 { background: linear-gradient(155deg, #d98a10 0%, #8a4f0a 100%); }
.bm-mill.m4 { background: linear-gradient(155deg, #c0453f 0%, #7d1f1f 100%); }
.bm-mill.pay { background: radial-gradient(120% 120% at 20% 0%, #2a2a2a 0%, #0a0a0a 70%); border: 1px solid rgba(245,165,36,0.4); }
.bm-mill.pay b { color: var(--bm-amber); }
.bm-mill.pay .bm-btn { margin-top: 12px; }
.bm-swipe-hint { text-align: center; font-size: 13px; color: var(--bm-gray-400); margin: 2px 0 8px; }
