* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f4f5f7;
  color: #1a1a1a;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 10px;
}

.hidden {
  display: none !important;
}

header h1 {
  font-size: 18px;
  margin: 4px 0 14px;
}

/* ===== Меню ===== */
.menu-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-btn {
  width: 100%;
  font-size: 16px;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: #2563eb;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.menu-btn.secondary {
  background: #6b7280;
}

.menu-btn.disabled {
  background: #d1d5db;
  color: #9ca3af;
  cursor: not-allowed;
}

/* ===== Компактный топбар ===== */
.topbar-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.back-btn-mini {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  font-size: 16px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: #6b7280;
  color: white;
  cursor: pointer;
}

.topbar-mini-title {
  font-size: 13px;
  color: #6b7280;
  font-weight: 600;
}

/* ===== Строка сканирования ===== */
.scan-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.scan-row input {
  flex: 1;
  min-width: 0;
  font-size: 20px;
  padding: 10px 12px;
  border: 2px solid #ccc;
  border-radius: 10px;
}

.scan-row input:focus {
  border-color: #2563eb;
  outline: none;
}

.icon-btn {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  font-size: 18px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: #6b7280;
  color: white;
  cursor: pointer;
}

.icon-btn-primary {
  background: #2563eb;
}

.icon-btn.active {
  background: #16a34a;
}

button {
  font-size: 15px;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: #2563eb;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

button.secondary {
  background: #6b7280;
}

button:active {
  opacity: 0.8;
}

/* ===== Камера ===== */
.camera-block {
  margin-top: 8px;
  text-align: center;
}

.camera-block video {
  width: 100%;
  border-radius: 10px;
  background: black;
}

/* ===== Статусы ===== */
.status-block {
  margin-top: 8px;
  padding: 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.status-block.error {
  background: #fee2e2;
  color: #991b1b;
}

.status-block.loading {
  background: #e5e7eb;
  color: #374151;
}

.status-block.success {
  background: #dcfce7;
  color: #166534;
}

.status-block.warn {
  background: #fef3c7;
  color: #92400e;
}

/* ===== Результат заявки — компактная строка меты ===== */
.result-block {
  margin-top: 8px;
}

.order-meta-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  color: #444;
  background: white;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
}

.order-meta-line b {
  font-size: 14px;
  color: #111;
}

.order-meta-line span {
  flex: 1;
  color: #666;
}

.tiny-btn {
  flex: 0 0 auto;
  width: auto;
  font-size: 12px;
  padding: 6px 10px;
  background: #6b7280;
}

.scan-hint {
  font-size: 12px;
  color: #2563eb;
  text-align: center;
  margin-bottom: 6px;
  font-weight: 600;
}

/* ===== Карточки товаров ===== */
.products-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.product-card {
  background: white;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
}

.product-card.complete {
  background: #dcfce7;
}

.product-card .product-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.product-card .product-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #555;
  font-size: 12px;
  align-items: center;
}

.product-card .product-details b {
  color: #111;
}

.reserve-btn {
  width: auto;
  font-size: 11px;
  padding: 4px 8px;
  background: #6b7280;
}

.reserve-content {
  margin-top: 4px;
  font-size: 11px;
  color: #555;
  background: #f9fafb;
  padding: 6px;
  border-radius: 6px;
}

.complect-item {
  padding-left: 12px;
  color: #777;
  font-size: 12px;
  margin-top: 2px;
}

.complete-banner {
  margin-top: 8px;
  padding: 10px;
  border-radius: 10px;
  background: #dcfce7;
  color: #166534;
  font-weight: 600;
  text-align: center;
  font-size: 14px;
}

/* ===== Общие input-блоки (ячейки, паллеты) ===== */
.input-block {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.input-block input {
  flex: 1;
  min-width: 120px;
  font-size: 15px;
  padding: 10px;
  border: 2px solid #ccc;
  border-radius: 8px;
}

.input-block input:focus {
  border-color: #2563eb;
  outline: none;
}

.input-block button {
  flex: 0 0 auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid #eee;
  font-size: 13px;
}

th {
  color: #666;
  font-weight: 600;
}

.delete-cell-btn {
  width: 32px;
  padding: 4px;
  font-size: 14px;
  background: #ef4444;
}

.pallet-take-cell {
  display: flex;
  gap: 6px;
  align-items: center;
}

.take-qty-input {
  width: 50px;
  padding: 6px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.take-btn {
  width: auto;
  font-size: 12px;
  padding: 6px 10px;
}
