:root {
  --yellow: #FFC400;
  --yellow-dark: #E6B000;
  --dark: #23262B;
  --dark-2: #34383F;
  --gray: #6B7280;
  --gray-light: #9CA3AF;
  --bg: #F7F7F8;
  --white: #FFFFFF;
  --red: #E5484D;
  --green: #16A34A;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 10px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--dark);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

button, input {
  font-family: inherit;
}

.hidden { display: none !important; }

/* ---------- Бренд ---------- */
.brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 800;
  font-size: 20px;
}
.brand-mark { color: var(--dark); }
.brand-mark .accent { color: var(--yellow-dark); }
.brand-sub {
  font-weight: 600;
  font-size: 13px;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-140%);
  background: var(--dark);
  color: var(--white);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  max-width: 90vw;
  z-index: 999;
  box-shadow: var(--shadow-lg);
  transition: transform 0.25s ease;
  text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

/* ---------- Загрузка ---------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 998;
}
.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(35,38,43,0.15);
  border-top-color: var(--yellow-dark);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Экран телефона ---------- */
.phone-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--yellow) 0%, var(--yellow) 38%, var(--bg) 38%);
  padding: 24px;
}
.phone-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 28px 24px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.phone-card .brand { justify-content: center; margin-bottom: 18px; font-size: 26px; }
.phone-card h1 { font-size: 20px; margin: 4px 0; }
.muted { color: var(--gray); font-size: 14px; margin: 0 0 20px; }
.phone-input-row {
  display: flex;
  align-items: center;
  border: 2px solid #E5E7EB;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 16px;
  transition: border-color 0.15s;
}
.phone-input-row:focus-within { border-color: var(--yellow-dark); }
.phone-prefix {
  padding: 14px 10px 14px 16px;
  font-weight: 700;
  color: var(--dark);
  background: #F3F4F6;
  border-right: 2px solid #E5E7EB;
  flex-shrink: 0;
  white-space: nowrap;
}
#phone-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 14px 16px;
  font-size: 16px;
  letter-spacing: 0.02em;
}
.field-error { color: var(--red); font-size: 13px; margin-top: -6px; margin-bottom: 10px; }

/* ---------- Кнопки ---------- */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-primary { background: var(--yellow); color: var(--dark); }
.btn-primary:not(:disabled):hover { background: var(--yellow-dark); }
.btn-dark { background: var(--dark); color: var(--white); }
.btn-outline { background: var(--white); color: var(--dark); border: 2px solid #E5E7EB; }
.btn-sm { padding: 8px 12px; font-size: 13px; }

/* ---------- Каркас приложения ---------- */
.app { min-height: 100vh; padding-bottom: 74px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--white);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}
.topbar-title { font-weight: 700; font-size: 15px; color: var(--gray); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.logout-btn {
  background: #F3F4F6;
  border: none;
  border-radius: 50%;
  color: var(--dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}
.logout-btn svg { width: 18px; height: 18px; fill: currentColor; }
.logout-btn:active { color: var(--red); }

.main { padding: 16px; max-width: 720px; margin: 0 auto; }

/* ---------- Нижняя навигация ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: var(--white);
  border-top: 1px solid #EEE;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  z-index: 60;
}
.nav-btn {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  color: var(--gray-light);
  cursor: pointer;
  position: relative;
}
.nav-btn.active { color: var(--dark); }
.nav-icon { width: 22px; height: 22px; fill: currentColor; }
.nav-btn span:last-child { font-size: 11px; font-weight: 600; }
.badge {
  position: absolute;
  top: 0; right: 22%;
  background: var(--red);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* ---------- Категории / меню ---------- */
.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 6px;
  scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }
.category-tab {
  flex: 0 0 auto;
  background: var(--white);
  border: 2px solid transparent;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--gray);
  cursor: pointer;
  box-shadow: var(--shadow);
}
.category-tab.active { background: var(--yellow); border-color: var(--yellow-dark); color: var(--dark); }

.section-title {
  font-size: 15px;
  font-weight: 700;
  margin: 18px 0 10px;
  color: var(--dark);
}
.section-title:first-child { margin-top: 0; }

.item-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow);
}
.item-card.unavailable { opacity: 0.5; }
.item-thumb {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(150deg, var(--yellow) 0%, var(--yellow-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
}
.item-info { flex: 1; min-width: 0; }
.item-name { font-weight: 800; font-size: 15px; margin-bottom: 4px; line-height: 1.25; }
.item-place { font-size: 12px; color: var(--gray-light); margin-bottom: 6px; }
.item-price { font-weight: 800; color: var(--dark); font-size: 15px; }
.item-unavailable-tag { font-size: 12px; color: var(--red); font-weight: 600; }

.qty-control {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border-radius: 999px;
  padding: 4px;
  flex-shrink: 0;
}
.qty-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--white);
  box-shadow: var(--shadow);
  font-size: 19px;
  font-weight: 800;
  color: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
}
.qty-btn.primary { background: var(--yellow); }
.qty-value { min-width: 20px; text-align: center; font-weight: 800; font-size: 14.5px; }
.add-btn {
  background: var(--yellow);
  border: 2px solid var(--yellow-dark);
  border-radius: 999px;
  width: 38px; height: 38px;
  box-shadow: var(--shadow);
  font-size: 22px;
  font-weight: 700;
  color: var(--dark);
  cursor: pointer;
  flex-shrink: 0;
}

/* ---------- Корзина ---------- */
.cart-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.cart-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.cart-item-name { font-weight: 700; font-size: 14.5px; }
.cart-item-sum { font-weight: 700; color: var(--dark); font-size: 14px; white-space: nowrap; }
.cart-item-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cart-comment {
  width: 100%;
  border: 1.5px solid #E5E7EB;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  margin-top: 10px;
  outline: none;
  resize: none;
}
.cart-comment:focus { border-color: var(--yellow-dark); }
.remove-btn {
  background: none;
  border: none;
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
}

.order-type-row {
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px;
  margin: 16px 0 10px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pill { background: var(--dark); color: var(--white); font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 999px; }

.summary-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  margin: 14px 0;
  box-shadow: var(--shadow);
}
.summary-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--gray); margin-bottom: 6px; }
.summary-row.total { color: var(--dark); font-weight: 800; font-size: 18px; margin-top: 8px; padding-top: 10px; border-top: 1px dashed #E5E7EB; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-light);
}
.empty-state svg { width: 64px; height: 64px; fill: #E5E7EB; margin-bottom: 12px; }
.empty-state p { font-size: 14px; margin: 0; }

/* ---------- Заказ ---------- */
.order-header-card {
  background: var(--dark);
  color: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-lg);
}
.order-number { font-size: 13px; color: #B9BDC4; margin-bottom: 4px; }
.order-status-big { font-size: 22px; font-weight: 800; color: var(--yellow); margin-bottom: 10px; }
.order-total-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.order-total-row b { font-size: 18px; }
.refresh-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.refresh-hint { font-size: 12px; color: var(--gray-light); }
.icon-btn {
  background: var(--white);
  border: none;
  border-radius: 50%;
  width: 38px; height: 38px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; fill: var(--dark); }
.icon-btn.spinning svg { animation: spin 0.8s linear infinite; }

.order-item-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.order-item-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.order-item-name { font-weight: 700; font-size: 14px; }
.order-item-qty { font-size: 12.5px; color: var(--gray); margin-bottom: 6px; }
.status-chip {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: #F3F4F6;
  color: var(--gray);
}
.status-chip.done { background: #DCFCE7; color: var(--green); }
.status-chip.progress { background: #FEF3C7; color: #B45309; }
.order-item-comment { font-size: 12.5px; color: var(--gray-light); margin-top: 6px; font-style: italic; }

.sticky-bottom {
  position: fixed;
  left: 0; right: 0;
  bottom: 74px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 60%, rgba(247,247,248,0));
  z-index: 55;
}
.checkout-comment {
  width: 100%;
  border: 1.5px solid #E5E7EB;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
  resize: none;
  margin-bottom: 14px;
  background: var(--white);
}
.checkout-comment:focus { border-color: var(--yellow-dark); }

@media (min-width: 720px) {
  .main { padding: 24px; }
}
