* { box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0; padding: 20px; background: #f5f5f5; color: #222; }
#app { max-width: 480px; margin: 0 auto; }
h1 { font-size: 24px; }
h2 { font-size: 20px; margin: 0 0 10px; }
h3 { font-size: 16px; margin: 20px 0 8px; }
input, button { width: 100%; padding: 12px; margin: 6px 0; font-size: 16px;
  border-radius: 8px; border: 1px solid #ccc; background: #fff; color: #222; }
button { background: #4a2c1a; color: #fff; border: none; cursor: pointer; font-weight: 600; }
button:hover { background: #3a2014; }
button.primary { background: #2e7d32; }
button.primary:hover { background: #256428; }
button.success { background: #1565c0; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.card { background: #fff; padding: 20px; border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08); margin-bottom: 16px; }
.progress { font-size: 32px; font-weight: bold; margin: 10px 0; }
.cups-visual { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.cup { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #4a2c1a; }
.cup.filled { background: #4a2c1a; }
.referral { background: #fff; padding: 16px; border-radius: 12px; margin-bottom: 16px; }
#history > div { background: #fff; padding: 8px 12px; border-radius: 8px;
  margin-bottom: 6px; font-size: 14px; }
.error { color: #c62828; font-size: 14px; min-height: 20px; }
.muted { color: #666; font-size: 13px; }
#users-list > div { background: #fff; padding: 10px; border-radius: 8px;
  margin-bottom: 6px; font-size: 14px; }
#users-list button { width: auto; padding: 4px 10px; font-size: 12px; margin: 2px; }
#stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#stats > div { background: #fff; padding: 12px; border-radius: 8px; font-size: 13px; }
#stats b { font-size: 20px; display: block; margin-bottom: 4px; }

.tab-btn {
  width: auto !important;
  padding: 8px 12px !important;
  font-size: 13px !important;
  background: #eee !important;
  color: #333 !important;
  border-radius: 8px !important;
  font-weight: 500 !important;
}
.tab-btn.active {
  background: #4a2c1a !important;
  color: #fff !important;
}
.tab-content { margin-top: 8px; }

.cal-day:hover {
  filter: brightness(0.95);
}

select {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  background: #fff;
  color: #222;
  font-size: 15px;
  margin: 6px 0;
}

/* Кнопки действий в очереди бариста */
.queue-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.queue-actions button {
  width: auto !important;
  flex: 1;
  padding: 10px 12px !important;
  font-size: 14px !important;
  margin: 0 !important;
  white-space: nowrap;
}
.queue-actions .btn-serve {
  background: #2e7d32 !important;
  flex: 2;
}

.queue-actions .btn-full-width {
  flex: 1 1 100% !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}
.queue-actions .btn-skip {
  background: #757575 !important;
  flex: 1;
  max-width: 130px;
}
.queue-actions .btn-skip:hover {
  background: #616161 !important;
}

/* Индикатор новых заказов */
#new-orders-badge {
  display: none;
  background: #c62828;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 10px;
  margin-left: 8px;
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

#month-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
#month-stats > div {
  background: #fff;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
}
#month-stats b {
  font-size: 20px;
  display: block;
  margin-bottom: 4px;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #888 !important;
}


/* ============================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ (добавлено 2026-10-23)
   ============================================================ */

/* Код в панели бариста (было 120px inline) */
.pickup-code-big {
    font-family: monospace;
    font-size: 120px;
    font-weight: 900;
    letter-spacing: 20px;
    line-height: 1.1;
    margin: 10px 0;
    word-break: break-all;
}

/* Код на сайте клиента (было 52px inline) */
.pickup-code-client {
    font-size: 52px;
    font-weight: 900;
    letter-spacing: 8px;
    margin: 8px 0;
    font-family: monospace;
    word-break: break-all;
}

/* Карточки */
.card {
    padding: 16px !important;
}

/* Кнопки в ряд */
.queue-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.queue-actions button {
    width: auto !important;
    flex: 1;
    padding: 10px 12px !important;
    font-size: 14px !important;
    margin: 0 !important;
    box-sizing: border-box;
}
.queue-actions .btn-full-width {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

/* Инпуты и формы — не вылезают за контейнер */
input, select, textarea {
    box-sizing: border-box;
    max-width: 100%;
}

/* Контейнеры не скроллят вправо */
body {
    overflow-x: hidden;
}

/* Модалки */
[id="add-products-modal"], [id="staff-edit-modal"] {
    padding: 10px !important;
}

/* ============================================================
   МОБИЛЬНЫЙ ЭКРАН <= 768px
   ============================================================ */
@media (max-width: 768px) {
    /* Код бариста: 120px → 64px */
    .pickup-code-big {
        font-size: 64px !important;
        letter-spacing: 8px !important;
    }
    /* Код клиента: 52px → 44px */
    .pickup-code-client {
        font-size: 44px !important;
        letter-spacing: 4px !important;
    }
    /* Карточки */
    .card {
        padding: 12px !important;
        border-radius: 10px !important;
    }
    /* Заголовки */
    h1 { font-size: 22px !important; }
    h2 { font-size: 20px !important; }
    h3 { font-size: 17px !important; }
    /* Кнопки — не мелкие, но переносимые */
    .queue-actions button {
        padding: 10px 8px !important;
        font-size: 13px !important;
    }
    /* Нижняя навигация */
    #bottom-nav {
        padding: 8px 0 12px 0 !important;
    }
    /* Таблицы в админке — скролл по горизонтали */
    .tab-content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    /* Отступы в контейнере */
    .container, body > div {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
}

/* ============================================================
   УЗКИЙ ЭКРАН <= 480px (телефоны)
   ============================================================ */
@media (max-width: 480px) {
    /* Код бариста: 120px → 48px */
    .pickup-code-big {
        font-size: 48px !important;
        letter-spacing: 6px !important;
    }
    /* Код клиента: 52px → 36px */
    .pickup-code-client {
        font-size: 36px !important;
        letter-spacing: 3px !important;
    }
    /* Заголовки поменьше */
    h1 { font-size: 20px !important; }
    h2 { font-size: 18px !important; }
    h3 { font-size: 16px !important; }
    /* Кнопки — крупные и нажимаемые */
    .queue-actions button {
        padding: 12px 8px !important;
        font-size: 13px !important;
        min-height: 44px;
    }
    /* Кнопки в нижнем меню */
    #bottom-nav > div {
        font-size: 10px !important;
    }
    #bottom-nav > div > div:first-child {
        font-size: 20px !important;
    }
    /* Инпуты на всю ширину */
    input, select, textarea {
        width: 100% !important;
    }
    /* Убираем лишние боковые отступы */
    .container, body > div {
        padding-left: 6px !important;
        padding-right: 6px !important;
    }
    /* Карточка заказа — меньше паддинг */
    .card {
        padding: 10px !important;
    }
    /* Модалки — на весь экран */
    [id="add-products-modal"] > div,
    [id="staff-edit-modal"] > div {
        max-height: 96vh !important;
        border-radius: 12px !important;
    }
}

/* === CLIENT_CARD_MOBILE_CSS_V1 === */
@media (max-width: 600px) {
  /* Верх карточки: имя + чашки в 2 колонки (если хватает места) */
  #client-top {
    flex-wrap: wrap;
    gap: 8px;
  }
  #client-info {
    flex: 1 1 160px;
    min-width: 0;
  }
  #client-cups-block > div:first-child {
    font-size: 20px;
  }
  /* Кружки прогресса (если где-то рендерятся) — не сжимать */
  .cups-visual {
    gap: 4px;
  }
  .cups-visual > * {
    min-width: 24px;
    min-height: 24px;
    flex-shrink: 0;
  }
}

@media (max-width: 380px) {
  #client-info {
    flex: 1 1 100%;   /* на очень узких — в одну колонку */
  }
  #client-cups-block {
    text-align: left;
  }
  #client-name {
    font-size: 16px;
  }
  #client-contact {
    font-size: 13px;
  }
}
/* === /CLIENT_CARD_MOBILE_CSS_V1 === */

/* CIRCULAR_BUTTONS_MOBILE_FIX (устарело, заменено на CLIENT_CARD_V2_PROGRESS) */


/* === CLIENT_CARD_V2_CSS === */
#client-close-btn {
  position: static !important;
  top: auto !important;
  right: auto !important;
}

/* Прогресс по товарам */
#client-progress-list > div {
  padding: 6px 8px;
  border-bottom: 1px solid #e0e0e0;
  font-size: 13px;
  line-height: 1.4;
}
#client-progress-list > div:last-child {
  border-bottom: none;
}
#client-progress-list .cp-name {
  font-weight: 600;
  color: #1a1a1a;
}
#client-progress-list .cp-bar {
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  margin-top: 4px;
  overflow: hidden;
}
#client-progress-list .cp-fill {
  height: 100%;
  background: linear-gradient(90deg, #2e7d32, #43a047);
  border-radius: 3px;
  transition: width 0.3s;
}
#client-progress-list .cp-meta {
  color: #666;
  font-size: 12px;
  margin-left: 8px;
}
#client-progress-list .cp-exp {
  color: #e65100;
  font-size: 12px;
  font-weight: 600;
}

/* На узких экранах: имя и телефон — в одну строку, чашки + крестик — во вторую */
@media (max-width: 500px) {
  #client-top {
    flex-wrap: wrap;
  }
  #client-info {
    flex: 1 1 100%;
  }
  #client-right {
    flex: 1 1 100%;
    justify-content: space-between;
  }
}

/* === CART_ADD_BTN_V3 === */
/* Кнопка + в списке товаров модалки «Добавить» */
button[onclick*="addToTempCart"] {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  max-width: 36px !important;
  flex: 0 0 36px !important;   /* flex-grow:0 flex-shrink:0 basis:36px */
  align-self: center;
  padding: 0 !important;
  box-sizing: border-box;
}

/* Родитель — если flex, кнопка справа от текста */
button[onclick*="addToTempCart"] ~ * { min-width: 0; }

/* === CLIENT_CLOSE_BTN_V3 (definitive circle) === */
#client-card {
  overflow: visible !important;
  padding-right: 8px;
}

.client-close-btn,
#client-close-btn {
  /* размеры — жёстко */
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  aspect-ratio: 1 / 1 !important;   /* ← гарантия круга */
  flex: 0 0 36px !important;         /* grow 0, shrink 0, basis 36 */
  box-sizing: border-box !important;

  /* центрирование × идеально по центру */
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  margin: 0 !important;

  /* визуал */
  background: #c62828 !important;
  color: #fff !important;
  border: 2px solid #fff !important;
  border-radius: 50% !important;
  font-size: 22px !important;
  font-weight: bold !important;
  line-height: 1 !important;
  cursor: pointer !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4) !important;
  position: static !important;
}
.client-close-btn:hover,
#client-close-btn:hover {
  background: #b71c1c !important;
}

/* Родитель — не давим на кнопку */
#client-right {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-shrink: 0 !important;
  min-width: 0;
}

/* На узких экранах кнопка не прилипает к краю */
@media (max-width: 600px) {
  #client-card {
    padding-right: 12px;
  }
  .client-close-btn,
  #client-close-btn {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    flex-basis: 34px !important;
    font-size: 20px !important;
  }
}
@media (max-width: 380px) {
  .client-close-btn,
  #client-close-btn {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    max-width: 30px !important;
    flex-basis: 30px !important;
    font-size: 18px !important;
  }
}
/* === /CLIENT_CLOSE_BTN_V3 === */
