body { font-family: sans-serif; max-width: 500px; margin: 0 auto; padding: 16px; }

/* Вкладки */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  position: sticky;   /* прилипает к верху при прокрутке */
  top: 0;
  background: #fff;
  padding: 12px 0;
  z-index: 10;        /* поверх списка */
}
.tab {
  flex: 1;
  font-size: 17px;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: #eee;
  cursor: pointer;
}
.tab.active { background: #2d7; color: #fff; font-weight: bold; }

.hidden { display: none; }   /* скрыть */

/* Экраны входа и регистрации */
#gate, #register { margin-top: 60px; }
#gate h1, #register h1 { text-align: center; }

/* Бренд на екрані входу */
.brand-logo { display: block; width: 72px; height: 72px; margin: 0 auto 12px; }
.brand-name { text-align: center; font-size: 34px; margin: 0 0 2px; }
.brand-tagline { text-align: center; color: #999; margin: 0 0 24px; font-size: 16px; }
#gate input, #gate .auth-btn,
#register input, #register .auth-btn { display: block; width: 100%; box-sizing: border-box; margin-bottom: 12px; }
#gate input, #register input { font-size: 18px; padding: 14px; border: 1px solid #ccc; border-radius: 8px; }
.fl { display: block; font-size: 14px; color: #666; margin-bottom: 4px; }
.auth-btn { font-size: 18px; padding: 14px; border: none; border-radius: 8px; cursor: pointer; background: #2d7; color: #fff; }
.auth-btn.secondary { background: #eee; color: #333; }
.auth-btn.guest { background: none; color: #2d7; text-decoration: underline; padding: 8px; }
.auth-error { color: #c00; min-height: 20px; text-align: center; }

/* Верхняя панель в приложении */
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; padding: 8px 6px 0; color: #555; }
#logoutBtn { border: none; background: #eee; padding: 8px 14px; border-radius: 8px; cursor: pointer; }

/* Строка добавления */
.add-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
#newProduct { flex: 1 1 100%; font-size: 18px; padding: 10px; }
#newCategory { flex: 1; font-size: 18px; padding: 14px; }
#addBtn {
  font-size: 32px;
  font-weight: bold;
  width: 72px;
  min-height: 56px;
  border: none;
  background: #2d7;
  color: #fff;
  border-radius: 10px;
  cursor: pointer;
}
#addBtn:active { background: #1b5; }

/* Списки */
ul { list-style: none; padding: 0; margin: 0; }
li {
  font-size: 18px;
  padding: 12px 4px;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Заголовок категории */
.cat-header {
  font-weight: 800;
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fff;
  background: #2d7;
  border-bottom: none;
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 18px;
}

/* Чекбокс в каталоге */
.chk { width: 24px; height: 24px; cursor: pointer; }

/* Строка в режиме "Удалить?" */
.confirming { background: #fff4f4; }
.swipe-actions { display: flex; gap: 8px; }
.swipe-actions button {
  border: none;
  border-radius: 8px;
  font-size: 15px;
  padding: 8px 14px;
  cursor: pointer;
}
.btn-cancel { background: #eee; color: #333; }
.btn-delete { background: #e23; color: #fff; }

/* Крестик в списке покупок */
.del {
  border: none;
  background: #f3f3f3;
  color: #c00;
  font-size: 20px;
  line-height: 1;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
}
.del:active { background: #f8d0d0; }

/* Кнопка "Очистити все" внизу списка покупок */
.clear-btn {
  display: block;
  width: 100%;
  font-size: 17px;       /* как у вкладок */
  padding: 12px;         /* как у вкладок */
  margin-top: 20px;
  border: none;
  border-radius: 10px;
  background: #ccc;      /* серая, когда список пуст */
  color: #fff;
  cursor: default;
}
.clear-btn.active {
  background: #e23;      /* красная, когда есть что чистить */
  cursor: pointer;
}
.clear-btn.active:active { background: #c11; }

/* Подтверждение очистки */
.clear-confirm {
  margin-top: 20px;
  padding: 14px;
  background: #fff4f4;
  border-radius: 10px;
  text-align: center;
}
.clear-confirm span { display: block; margin-bottom: 10px; font-size: 16px; }
.clear-confirm-actions { display: flex; gap: 8px; }
.clear-confirm-actions button { flex: 1; padding: 12px; font-size: 16px; }
