/* ==========================================================================
   DM STOCK — КОМПОНЕНТЫ ИНТЕРФЕЙСА (ACTION TILES, STEPPERS, TABLES, MODALS)
   ========================================================================== */

/* --- 4 ГЛАВНЫЕ КНОПКИ-ПЛИТКИ ДАШБОРДА --- */
.action-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

@media (min-width: 768px) {
  .action-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }
}

.action-tile {
  background: var(--bg-card);
  border: 1.5px solid var(--border-steel);
  border-radius: var(--radius-lg);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
  min-height: 140px;
  justify-content: center;
}

.action-tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  opacity: 0.5;
  transition: opacity var(--transition-fast);
}

.action-tile:hover, .action-tile:active {
  transform: translateY(-3px);
  border-color: var(--border-steel-bright);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(203, 213, 225, 0.12);
  background: var(--bg-card-hover);
}

.action-tile:hover::before {
  opacity: 1;
}

/* Иконка плитки */
.tile-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--grad-steel-plate);
  border: 1px solid var(--border-steel-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--steel-200);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: transform var(--transition-fast), color var(--transition-fast);
}

.action-tile:hover .tile-icon-wrap {
  transform: scale(1.08);
  color: #ffffff;
}

.tile-icon-wrap svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.tile-title {
  font-size: 17px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--steel-100);
}

.tile-subtitle {
  font-size: 11px;
  color: var(--steel-500);
  line-height: 1.2;
}

/* Цветовые модификаторы главных действий */
.action-tile.tile-inflow .tile-icon-wrap {
  border-color: var(--color-success-border);
  color: var(--color-success);
}

.action-tile.tile-outflow .tile-icon-wrap {
  border-color: rgba(226, 232, 240, 0.4);
  color: var(--steel-100);
}

.action-tile.tile-reserve .tile-icon-wrap {
  border-color: var(--color-reserved-border);
  color: var(--color-reserved);
}

.action-tile.tile-order .tile-icon-wrap {
  border-color: var(--color-warning-border);
  color: var(--color-warning);
}

.action-tile .tile-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--color-danger);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  font-family: var(--font-mono);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  box-shadow: 0 0 10px rgba(255, 71, 87, 0.7);
}

/* --- ПАНЕЛЬ СВОДНОЙ СТАТИСТИКИ (DASHBOARD SUMMARY) --- */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 640px) {
  .stats-strip {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-item {
  background: var(--bg-card);
  border: 1px solid var(--border-steel);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 11px;
  color: var(--steel-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.stat-sub {
  font-size: 11px;
  color: var(--steel-500);
  margin-top: 4px;
  font-family: var(--font-mono);
}

/* --- ПОШАГОВЫЙ СЕЛЕКТОР ТРУБ (STEPPER SELECTOR) --- */
.stepper-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.step-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--steel-400);
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-number {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--grad-steel-plate);
  border: 1px solid var(--border-steel);
  font-size: 11px;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--steel-200);
}

/* Сетка кнопок выбора */
.step-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.step-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 480px) {
  .step-grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.step-grid-dimensions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px 2px;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
}

.selector-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-steel);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 56px; /* Touch target >= 56px */
  position: relative;
}

.selector-tile:hover {
  border-color: var(--border-steel-bright);
  background: var(--bg-card-hover);
}

.selector-tile.active {
  border-color: #ffffff;
  background: linear-gradient(135deg, rgba(203, 213, 225, 0.15) 0%, rgba(30, 41, 59, 0.6) 100%);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.15), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.selector-tile.active .tile-text {
  color: #ffffff;
  font-weight: 800;
}

.selector-tile .shape-svg {
  width: 24px;
  height: 24px;
  stroke: var(--steel-400);
  stroke-width: 2;
  fill: none;
}

.selector-tile.active .shape-svg {
  stroke: #ffffff;
  filter: drop-shadow(0 0 4px #ffffff);
}

.selector-tile .tile-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--steel-300);
}

.selector-tile .tile-subtext {
  font-size: 10px;
  color: var(--steel-500);
  font-family: var(--font-mono);
}

/* --- СЧЁТЧИК КОЛИЧЕСТВА (STEPPER & QUICK CHIPS) --- */
.quantity-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-steel);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stepper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.btn-step {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  background: var(--grad-steel-plate);
  border: 1px solid var(--border-steel-bright);
  color: var(--steel-100);
  font-size: 26px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.btn-step:hover {
  background: var(--grad-steel-plate-hover);
  transform: scale(1.05);
}

.btn-step:active {
  transform: scale(0.95);
  background: #111418;
}

.stepper-display {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.stepper-num-input {
  width: 100%;
  max-width: 140px;
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  font-size: 40px;
  font-weight: 800;
  color: var(--text-main);
  text-align: center;
  outline: none;
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

/* Отключение стандартных стрелок/плашек браузера в поле количества */
.stepper-num-input::-webkit-outer-spin-button,
.stepper-num-input::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  appearance: none !important;
  margin: 0 !important;
  display: none !important;
}

input[type="number"] {
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

.stepper-unit {
  font-size: 12px;
  color: var(--steel-500);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.stepper-meters {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--steel-400);
  margin-top: 2px;
}

/* Быстрый выбор (+1, +2, +3, +5, +10) */
.quick-chips-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.chip-btn {
  min-height: 44px;
  min-width: 48px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--grad-steel-plate);
  border: 1px solid var(--border-steel);
  color: var(--steel-300);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chip-btn:hover {
  border-color: var(--border-steel-bright);
  color: #ffffff;
  transform: translateY(-2px);
}

.chip-btn:active {
  transform: translateY(1px);
}

/* --- ИНФОРМАЦИОННЫЕ И ПРЕДУПРЕЖДАЮЩИЕ БАННЕРЫ --- */
.alert-banner {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  line-height: 1.4;
}

.alert-banner.deficit-warning {
  background: linear-gradient(135deg, rgba(255, 71, 87, 0.2) 0%, rgba(255, 165, 2, 0.15) 100%);
  border: 1px solid var(--color-danger);
  box-shadow: 0 0 16px rgba(255, 71, 87, 0.25);
  color: #ffeaa7;
}

.alert-banner.deficit-warning .alert-icon {
  color: var(--color-danger);
  font-size: 20px;
  line-height: 1;
}

.alert-banner.deficit-warning strong {
  color: #ffffff;
}

.alert-banner.stock-info {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-steel);
  color: var(--steel-300);
}

/* --- ПОЛЯ ВВОДА И ВЫПАДАЮЩИЕ СПИСКИ --- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--steel-400);
}

.form-input, .form-select, .form-textarea {
  min-height: var(--touch-min);
  background: var(--bg-secondary);
  border: 1px solid var(--border-steel);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 15px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: #ffffff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* --- ПИН-ПАД ДЛЯ БЫСТРОЙ СМЕНЫ ПОЛЬЗОВАТЕЛЯ --- */
.pin-display {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 16px 0;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-steel-bright);
  background: transparent;
  transition: all var(--transition-fast);
}

.pin-dot.filled {
  background: #ffffff;
  box-shadow: 0 0 10px #ffffff;
}

.pin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 300px;
  margin: 0 auto;
}

.pin-key {
  height: 64px;
  border-radius: var(--radius-md);
  background: var(--grad-steel-plate);
  border: 1px solid var(--border-steel);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.pin-key:hover {
  border-color: var(--border-steel-bright);
  background: var(--grad-steel-plate-hover);
}

.pin-key:active {
  transform: scale(0.94);
}

/* --- ТАБЛИЦЫ И СПИСКИ НОМЕНКЛАТУРЫ --- */
.stock-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-steel);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.steel-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.steel-table th {
  background: var(--grad-steel-plate);
  color: var(--steel-400);
  padding: 12px 14px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-steel-bright);
  white-space: nowrap;
}

.steel-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-steel);
  color: var(--steel-200);
  vertical-align: middle;
}

.steel-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.steel-table tr.row-deficit td {
  background: rgba(255, 71, 87, 0.08);
}

/* Карточки позиций для мобильного вида */
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-steel);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--transition-fast);
}

.product-card.has-deficit {
  border-color: var(--color-danger-border);
  background: linear-gradient(180deg, rgba(255, 71, 87, 0.1) 0%, var(--bg-card) 100%);
}

.product-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-name {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.product-badges {
  display: flex;
  gap: 6px;
}

.product-quantities {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}

.qty-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.qty-val {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.qty-val.success { color: var(--color-success); }
.qty-val.warning { color: var(--color-warning); }
.qty-val.danger { color: var(--color-danger); }
.qty-val.reserved { color: var(--color-reserved); }

.qty-lbl {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--steel-500);
}

/* Telegram Карточка предпросмотра */
.telegram-preview {
  background: #17212b;
  border: 1px solid #2b3947;
  border-radius: var(--radius-md);
  padding: 16px;
  color: #f5f5f5;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  box-shadow: var(--shadow-sm);
}

.telegram-preview b {
  color: #ffffff;
}
