* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

h1 { 
  padding-bottom: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f8f9fa;
  color: #1e293b;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  background: white;
  min-height: 100vh;
  position: relative;
  padding-bottom: 80px;
}

/* ========== НИЖНЯЯ НАВИГАЦИЯ ========== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: white;
  display: flex;
  justify-content: space-around;
  padding: 12px 0;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  z-index: 10;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #94a3b8;
  font-size: 12px;
  gap: 4px;
}

.nav-item i {
  font-size: 20px;
}

.nav-item.active {
  color: #10b981;
}

/* ========== ШАПКА С ПОИСКОМ ========== */
.search-header {
  padding: 16px;
  background: white;
}

.search-box {
  background: #f1f5f9;
  border-radius: 12px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box i {
  color: #94a3b8;
}

.search-box input {
  border: none;
  background: none;
  outline: none;
  width: 100%;
  font-size: 16px;
}

/* ========== ФИЛЬТРЫ ПО ТИПУ ========== */
.category-filters {
  padding: 0 16px 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

.category-filters::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  padding: 8px 16px;
  background: #f1f5f9;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
}

.filter-chip.active {
  background: #10b981;
  color: white;
}

/* ========== КОНТЕНТ ========== */
.content {
  padding: 16px;
}

/* ========== ПУСТОЕ СОСТОЯНИЕ ========== */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: #94a3b8;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  color: #cbd5e1;
}

.empty-state p {
  font-size: 16px;
}

.empty-sub {
  font-size: 14px;
  margin-top: 8px;
}

/* ========== КНОПКА ДОБАВЛЕНИЯ (FAB) ========== */
.fab {
  position: fixed;
  bottom: 90px;
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: #10b981;
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.2s, box-shadow 0.2s;
}

.fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.fab:active {
  transform: scale(0.98);
}

/* ========== ИНДИКАТОР ЗАГРУЗКИ ========== */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  color: #10b981;
  gap: 12px;
}

.loading-spinner i {
  font-size: 32px;
}

.loading-spinner span {
  font-size: 14px;
  color: #64748b;
}

/* ========== СООБЩЕНИЕ ОБ ОШИБКЕ ========== */
.error-message {
  text-align: center;
  padding: 48px 16px;
  color: #dc2626;
}

.error-message i {
  font-size: 48px;
  margin-bottom: 16px;
}

.error-message p {
  font-size: 16px;
  margin-bottom: 16px;
}

.retry-btn {
  background: #10b981;
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 8px;
}

.retry-btn:hover {
  background: #059669;
}

/* ========== КАРТОЧКА ИНСТРУМЕНТА ========== */
.tool-card {
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  background: white;
}

.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-color: #10b981;
}

.tool-card:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tool-card::after {
  content: '›';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
  color: #94a3b8;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.tool-card:hover::after {
  opacity: 1;
}

.tool-card.in-repair {
  border-left: 4px solid #f59e0b;
}

.tool-card.scrapped {
  border-left: 4px solid #94a3b8;
  opacity: 0.7;
}

.tool-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.tool-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.tool-type {
  font-size: 12px;
  color: #64748b;
  background: #f1f5f9;
  padding: 4px 8px;
  border-radius: 12px;
}

.tool-condition {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  margin-top: 4px;
}

.condition-good {
  background: #dcfce7;
  color: #166534;
}

.condition-repair {
  background: #fef3c7;
  color: #92400e;
}

.condition-scrapped {
  background: #f1f5f9;
  color: #475569;
}

.tool-details {
  margin-top: 8px;
  font-size: 13px;
  color: #64748b;
}

.tool-details i {
  width: 20px;
  color: #10b981;
}

.tool-serial {
  font-family: monospace;
  font-size: 12px;
  background: #f8fafc;
  padding: 4px 8px;
  border-radius: 6px;
  margin-top: 8px;
}

/* ========== ФОРМА ДОБАВЛЕНИЯ ========== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: white;
  border-bottom: 1px solid #e2e8f0;
}

.header h1 {
  font-size: 18px;
  font-weight: 600;
}

.back-btn, .save-btn {
  background: none;
  border: none;
  font-size: 16px;
  color: #10b981;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-container, .edit-container {
  padding: 16px;
}

.form-group {
  margin-bottom: 24px;
}

.form-group.required .form-label::after {
  content: '*';
  color: #dc2626;
  margin-left: 4px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 8px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

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

.input-hint {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

.form-info {
  background: #f1f5f9;
  padding: 12px;
  border-radius: 8px;
  font-size: 12px;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.form-info i {
  color: #10b981;
}

/* ========== ВЫБОР ТИПА, СОСТОЯНИЯ ========== */
.type-select, .condition-select {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.type-option, .condition-option {
  padding: 8px 16px;
  background: #f1f5f9;
  border-radius: 20px;
  font-size: 14px;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
}

.type-option.selected, .condition-option.selected {
  background: #10b981;
  color: white;
}

/* ========== ДУБЛИРОВАННАЯ КНОПКА ========== */
.form-actions {
  margin-top: 16px;
  margin-bottom: 16px;
}

.save-btn-bottom {
  width: 100%;
  padding: 14px 20px;
  background: #10b981;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.save-btn-bottom:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.save-btn-bottom:active {
  transform: translateY(0);
}

.save-btn-bottom:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ========== КНОПКА УДАЛЕНИЯ ========== */
.delete-btn {
  width: 100%;
  padding: 16px;
  background: #fee2e2;
  color: #991b1b;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  cursor: pointer;
  transition: background 0.2s;
}

.delete-btn:hover {
  background: #fecaca;
}

/* ========== ДЕТАЛЬНЫЙ ПРОСМОТР ========== */
.tool-container {
  padding: 16px;
}

.tool-type-badge {
  display: inline-block;
  padding: 4px 12px;
  background: #f1f5f9;
  border-radius: 20px;
  font-size: 14px;
  margin-bottom: 16px;
}

.tool-info-section {
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.tool-info-section h3 {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
}

.tool-info-row:last-child {
  border-bottom: none;
}

.tool-info-label {
  color: #64748b;
  font-size: 14px;
}

.tool-info-value {
  font-weight: 500;
  color: #1e293b;
}

.condition-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
}

.condition-badge.good {
  background: #dcfce7;
  color: #166534;
}

.condition-badge.repair {
  background: #fef3c7;
  color: #92400e;
}

.condition-badge.scrapped {
  background: #f1f5f9;
  color: #475569;
}

.tool-actions {
  display: flex;
  gap: 12px;
  margin: 24px 0;
}

.tool-action-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.tool-action-btn.maintenance {
  background: #e0e7ff;
  color: #4338ca;
}

.tool-action-btn.repair {
  background: #fef3c7;
  color: #92400e;
}

.tool-action-btn.fix {
  background: #dcfce7;
  color: #166534;
}

/* ========== МОДАЛЬНОЕ ОКНО ========== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 400px;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-content h3 {
  font-size: 20px;
  margin-bottom: 16px;
}

.modal-input {
  width: 100%;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 16px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.modal-cancel {
  flex: 1;
  padding: 12px;
  background: #f1f5f9;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
}

.modal-confirm {
  flex: 1;
  padding: 12px;
  background: #10b981;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
}

/* ========== СТАТИСТИКА ========== */
.stats-header {
  padding: 20px 16px;
  background: white;
  border-bottom: 1px solid #e2e8f0;
}

.stats-header h1 {
  font-size: 24px;
}

.stats-content {
  padding: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.stat-card.warning {
  background: #fef3c7;
}

.stat-card.danger {
  background: #fee2e2;
}

.stat-label {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #1e293b;
}

.stat-card.warning .stat-value {
  color: #f59e0b;
}

.stat-card.danger .stat-value {
  color: #dc2626;
}

.stats-section {
  margin-top: 24px;
}

.stats-section h2 {
  font-size: 16px;
  margin-bottom: 12px;
  color: #1e293b;
}

.type-stats {
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px;
}

.type-stat-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
}

.type-stat-item:last-child {
  border-bottom: none;
}

.type-name {
  color: #1e293b;
}

.type-count {
  font-weight: 600;
  color: #10b981;
}

/* ========== TOAST-УВЕДОМЛЕНИЯ ========== */
.toast-container {
  position: fixed;
  bottom: 100px;
  left: 16px;
  right: 16px;
  max-width: 480px;
  margin: 0 auto;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #1e293b;
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: auto;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-success {
  background: #10b981;
}

.toast-error {
  background: #ef4444;
}

.toast-warning {
  background: #f59e0b;
}