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

body {
  font-family: 'Inter', sans-serif;
  background: #f5f5f0;
  color: #1a1a1a;
  min-height: 100vh;
}

/* HEADER */
.header {
  background: #1a1a1a;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.logo-icon {
  background: #e63946;
  color: white;
  font-weight: 700;
  font-size: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-name {
  display: block;
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
}
.logo-sub {
  display: block;
  color: #888;
  font-size: 0.72rem;
}
.nav { display: flex; gap: 8px; align-items: center; }

/* BOTONES */
.btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.btn-primary { background: #e63946; color: white; }
.btn-primary:hover { background: #c1121f; }
.btn-secondary { background: #333; color: white; }
.btn-secondary:hover { background: #555; }
.btn-ghost { background: transparent; color: #666; }
.btn-ghost:hover { background: #eee; color: #333; }
.btn-outline { background: transparent; color: white; border: 1px solid #444; }
.btn-outline:hover { background: #333; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s;
}
.btn-icon:hover { background: #eee; }

/* MAIN */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* ALERTS */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* STATS */
.stats-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat {
  background: white;
  border-radius: 10px;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.stat-num { font-size: 1.8rem; font-weight: 700; }
.stat-label { font-size: 0.75rem; color: #888; margin-top: 2px; }
.stat-ok { color: #059669; }
.stat-pending { color: #d97706; }

/* FILTROS */
.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.input-search {
  flex: 1;
  min-width: 200px;
  padding: 9px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.875rem;
  outline: none;
  background: white;
}
.input-search:focus { border-color: #e63946; }
.input-select {
  padding: 9px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.875rem;
  background: white;
  outline: none;
}

/* TABLA */
.table-wrap {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.table thead { background: #f9f9f9; }
.table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #555;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #eee;
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafafa; }

.thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
}
.thumb-empty {
  width: 48px;
  height: 48px;
  background: #f0f0f0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.sku {
  background: #f0f0f0;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: monospace;
}
.td-nombre strong { display: block; }
.td-nombre small { color: #888; font-size: 0.78rem; }
.td-num { font-variant-numeric: tabular-nums; }
.td-actions { display: flex; gap: 4px; align-items: center; }

.tag {
  background: #f0f0f0;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  color: #444;
}
.badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-green { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef3c7; color: #92400e; }

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: white;
  border-radius: 12px;
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h2 { margin-bottom: 0.5rem; color: #333; }
.empty-state p { color: #888; margin-bottom: 1.5rem; }

/* FORMULARIO */
.form-page { max-width: 800px; margin: 0 auto; }
.form-header { margin-bottom: 2rem; }
.form-header h1 { font-size: 1.6rem; margin-bottom: 4px; }
.form-header p { color: #888; }

.form-section {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.section-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #f0f0f0;
}
.section-num {
  background: #e63946;
  color: white;
  font-weight: 700;
  font-size: 0.8rem;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.section-header h2 { font-size: 1rem; margin-bottom: 2px; }
.section-header p { color: #888; font-size: 0.85rem; }

.fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-full { grid-column: 1 / -1; }
.field-half { grid-column: span 1; }
.field-third { grid-column: span 1; }

@media (min-width: 700px) {
  .fields-grid { grid-template-columns: 1fr 1fr 1fr; }
}

label { font-size: 0.85rem; font-weight: 500; color: #444; }
.req { color: #e63946; }
.input {
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
  width: 100%;
}
.input:focus { border-color: #e63946; }
.textarea { resize: vertical; min-height: 70px; }
small { color: #999; font-size: 0.78rem; }

/* UPLOAD */
.upload-area {
  border: 2px dashed #ddd;
  border-radius: 10px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
  position: relative;
}
.upload-area:hover { border-color: #e63946; }
.upload-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.upload-area p { color: #555; font-size: 0.9rem; }
.upload-area small { color: #aaa; }
.input-file {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.preview-img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
}
.hidden { display: none; }

/* FORM ACTIONS */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 1rem;
}

/* PRECIOS DINÁMICOS */
.precio-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}
.precio-row:last-child { border-bottom: none; }
.precio-check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  min-width: 200px;
}
.precio-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #e63946;
  cursor: pointer;
}
.precio-nombre { font-weight: 500; }
.precio-factor { color: #999; font-size: 0.8rem; }
.precio-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.precio-q { color: #666; font-weight: 500; }
.precio-input { width: 140px; }
.add-unidad-link { margin-top: 1rem; }
.add-unidad-link a { color: #e63946; font-size: 0.85rem; text-decoration: none; }
.add-unidad-link a:hover { text-decoration: underline; }
.empty-unidades {
  background: #fef3c7;
  padding: 12px 16px;
  border-radius: 8px;
  color: #92400e;
  font-size: 0.9rem;
}
.empty-unidades a { color: #e63946; }

/* LOGIN */
.body-login {
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-card {
  background: white;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo h1 {
  font-size: 1.5rem;
  margin: 0.75rem 0 0.25rem;
}
.login-logo p { color: #888; font-size: 0.9rem; }
.logo-icon-lg {
  width: 56px;
  height: 56px;
  font-size: 1.2rem;
  border-radius: 12px;
}
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.btn-full { width: 100%; justify-content: center; padding: 12px; }

/* LOGOUT en header */
.nav form { margin: 0; }


.upload-area { cursor: pointer; }
.input-file { display: none; }