@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;500;600;700;800&family=Barlow:wght@300;400;500;600&display=swap');

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

:root {
  --bg:           #f2f2f0;
  --bg-2:         #ffffff;
  --bg-3:         #ebebea;
  --bg-4:         #e0e0de;
  --border:       #d8d8d6;
  --border-2:     #c8c8c6;
  --text:         #1a1a1a;
  --text-2:       #666664;
  --text-3:       #999997;
  --red:          #cc2222;
  --red-dark:     #991a1a;
  --red-glow:     rgba(204,34,34,0.08);
  --yellow:       #c9a200;
  --yellow-light: #f5c800;
  --yellow-glow:  rgba(201,162,0,0.1);
  --green:        #1a7a4a;
  --green-bg:     rgba(26,122,74,0.08);
  --amber:        #b45309;
  --amber-bg:     rgba(180,83,9,0.08);
  --blue:         #1d4ed8;
  --blue-bg:      rgba(29,78,216,0.08);
  --purple:       #7c3aed;
  --purple-bg:    rgba(124,58,237,0.08);
  --radius:       6px;
  --radius-lg:    10px;
  --sans:         'Barlow', sans-serif;
  --cond:         'Barlow Condensed', sans-serif;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-3); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--red); }

/* ── HEADER ── */
.header {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}
.header::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--red) 0%, var(--yellow-light) 100%);
}
.header-inner {
  max-width: 1400px; margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.logo {
  font-family: var(--cond);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.logo-badge {
  display: inline-block;
  background: var(--red);
  color: #fff;
  padding: 2px 10px 2px 8px;
  clip-path: polygon(6px 0%, 100% 0%, calc(100% - 4px) 100%, 0% 100%);
  font-size: 17px;
  letter-spacing: 0.1em;
}
.logo em { font-style: normal; color: var(--red); }
.header-user {
  font-size: 12px; color: var(--text-2);
  font-family: var(--cond); letter-spacing: 0.05em; text-transform: uppercase;
}
.header-nav { display: flex; gap: 2px; }
.nav-btn {
  font-size: 12px; font-family: var(--cond); font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  background: none; border: none; padding: 7px 14px;
  border-radius: var(--radius); cursor: pointer; color: var(--text-2);
  transition: all 0.15s;
}
.nav-btn:hover { background: var(--bg-3); color: var(--text); }
.nav-btn.active { background: var(--red); color: #fff; }
.btn-logout {
  font-size: 11px; font-family: var(--cond); font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  background: none; border: 1px solid var(--border-2);
  border-radius: var(--radius); padding: 5px 12px;
  cursor: pointer; color: var(--text-2); transition: all 0.15s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

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

/* ── LOGIN ── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 39px, var(--border) 39px, var(--border) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, var(--border) 39px, var(--border) 40px);
  background-size: 40px 40px;
}
.login-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 380px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.1);
}
.login-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red), var(--yellow-light));
}
.login-logo {
  font-family: var(--cond); font-size: 26px; font-weight: 800;
  letter-spacing: 0.05em; text-transform: uppercase;
  margin-bottom: 4px; display: flex; align-items: center; gap: 10px;
}
.login-sub { font-size: 13px; color: var(--text-2); margin-bottom: 2rem; }
.login-field { margin-bottom: 1rem; }
.login-field label {
  display: block; font-size: 11px; font-weight: 600;
  font-family: var(--cond); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-2); margin-bottom: 6px;
}
.login-err { font-size: 12px; color: var(--red); margin-top: 10px; text-align: center; }
.login-actions { display: flex; gap: 8px; margin-top: 1.25rem; justify-content: flex-end; }

/* ── INPUTS ── */
input, select, textarea {
  font-family: var(--sans); font-size: 13px;
  background: var(--bg); border: 1px solid var(--border-2);
  border-radius: var(--radius); padding: 9px 12px;
  color: var(--text); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s; width: 100%;
}
input:focus, select:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-glow); background: #fff; }
input.err { border-color: var(--red); }

/* ── BUTTONS ── */
.btn {
  font-family: var(--cond); font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  border: none; border-radius: var(--radius);
  padding: 10px 20px; font-size: 13px; cursor: pointer;
  transition: all 0.15s; display: inline-flex; align-items: center; gap: 6px;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 2px 8px rgba(204,34,34,0.25); }
.btn-primary:hover:not(:disabled) { background: var(--red-dark); box-shadow: 0 4px 16px rgba(204,34,34,0.35); transform: translateY(-1px); }
.btn-secondary { background: var(--bg-3); color: var(--text-2); border: 1px solid var(--border-2); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-4); color: var(--text); }
.btn-danger { background: rgba(204,34,34,0.08); color: var(--red); border: 1px solid rgba(204,34,34,0.2); }
.btn-danger:hover { background: rgba(204,34,34,0.15); }
.btn-export { background: rgba(201,162,0,0.1); color: var(--yellow); border: 1px solid rgba(201,162,0,0.25); }
.btn-export:hover { background: rgba(201,162,0,0.18); }
.btn-sm { padding: 5px 12px; font-size: 11px; }
.btn-full { width: 100%; justify-content: center; }

/* ── SECTION TITLES ── */
.section-title {
  font-family: var(--cond); font-size: 22px; font-weight: 800;
  letter-spacing: 0.04em; text-transform: uppercase;
  margin-bottom: 1.25rem; color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.section-title::before {
  content: '';
  display: block; width: 4px; height: 24px;
  background: var(--red); border-radius: 2px; flex-shrink: 0;
}
.sub-title {
  font-family: var(--cond); font-size: 14px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text); margin-bottom: 0.75rem;
}

/* ── CARDS ── */
.card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1rem;
}
.card-title {
  font-family: var(--cond); font-size: 11px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-2); margin-bottom: 1rem;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}

/* ── DROP ZONE ── */
.drop-zone {
  border: 1.5px dashed var(--border-2); border-radius: var(--radius-lg);
  padding: 1.5rem; text-align: center; cursor: pointer;
  transition: all 0.2s; background: var(--bg-2); user-select: none; margin-bottom: 1rem;
}
.drop-zone:hover, .drop-zone.dragging { border-color: var(--red); background: var(--red-glow); }
.drop-zone.loaded { border-style: solid; border-color: var(--green); background: var(--green-bg); }
.dz-icon { font-size: 26px; display: block; margin-bottom: 6px; }
.dz-label { font-size: 13px; font-weight: 500; color: var(--text); }
.dz-sub { font-size: 11px; color: var(--text-2); margin-top: 3px; font-family: monospace; }

/* ── STATUS BOX ── */
.status-box {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1rem 1.25rem; display: flex; align-items: center; gap: 12px;
  background: var(--bg-2); margin-bottom: 8px; transition: all 0.2s;
}
.status-box.ok { border-color: var(--green); background: var(--green-bg); }
.status-box.warn { border-color: var(--amber); background: var(--amber-bg); }
.status-icon { font-size: 20px; flex-shrink: 0; }
.status-label { font-size: 13px; font-weight: 500; color: var(--text); }
.status-sub { font-size: 11px; color: var(--text-2); font-family: monospace; }

/* ── TAGS ── */
.tag {
  display: inline-block; font-size: 11px; padding: 3px 10px;
  border-radius: 999px; font-weight: 600; font-family: var(--cond);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.tag-ok { background: var(--green-bg); color: var(--green); border: 1px solid rgba(26,122,74,0.2); }
.tag-warn { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(180,83,9,0.2); }
.tag-err { background: var(--red-glow); color: var(--red); border: 1px solid rgba(204,34,34,0.2); }
.tag-info { background: var(--blue-bg); color: var(--blue); border: 1px solid rgba(29,78,216,0.2); }

/* ── LOG ── */
.log-msg { font-size: 12px; margin-top: 10px; min-height: 20px; }

/* ── METRICS ── */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 1.5rem; }
.metric {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1rem;
  position: relative; overflow: hidden;
}
.metric::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 2px; background: linear-gradient(90deg, var(--red), var(--yellow-light));
  opacity: 0.4;
}
.metric-label {
  font-size: 10px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.1em;
  font-family: var(--cond); font-weight: 600; margin-bottom: 4px;
}
.metric-val { font-size: 20px; font-weight: 700; font-family: var(--cond); color: var(--text); letter-spacing: -0.01em; }

/* ── TABLA ── */
.tabla-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
table { border-collapse: collapse; font-size: 12px; width: 100%; min-width: max-content; }
th {
  font-weight: 700; text-align: left; padding: 8px 10px;
  border-bottom: 1px solid var(--border); color: var(--text-2);
  font-size: 10px; white-space: nowrap; background: var(--bg-3);
  position: sticky; top: 0; font-family: var(--cond);
  letter-spacing: 0.08em; text-transform: uppercase;
}
th.num { text-align: right; }
th.ventas-col { background: rgba(204,34,34,0.06); color: var(--red); border-bottom-color: rgba(204,34,34,0.2); }
th.exist-col  { background: rgba(26,122,74,0.06); color: var(--green); border-bottom-color: rgba(26,122,74,0.2); }
th.group-header { text-align: center; font-size: 10px; font-weight: 700; padding: 5px; }
th.group-ventas { background: rgba(204,34,34,0.08); color: var(--red); border-bottom: 1px solid rgba(204,34,34,0.2); }
th.group-exist  { background: rgba(26,122,74,0.08); color: var(--green); border-bottom: 1px solid rgba(26,122,74,0.2); }
td { padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td.num { text-align: right; font-family: monospace; }
td.cero { color: var(--text-3); }
td.total-cell { font-weight: 600; }
tr:hover td { background: rgba(204,34,34,0.03); }
tfoot .total-row td {
  font-weight: 700; background: var(--bg-3);
  border-top: 2px solid var(--border-2);
  font-family: var(--cond); font-size: 12px; letter-spacing: 0.03em;
}

/* ── TOOLBAR ── */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters input { width: 200px; }
.filters select { width: 170px; }

/* ── MAPPING ── */
.map-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.map-row label { font-size: 12px; color: var(--text-2); width: 160px; flex-shrink: 0; font-family: var(--cond); font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.map-row select { flex: 1; }

/* ── USERS ── */
.users-list { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.user-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: var(--bg-2); transition: background 0.15s;
}
.user-row:last-child { border-bottom: none; }
.user-row:hover { background: var(--bg-3); }
.user-name { font-size: 13px; font-weight: 500; flex: 1; }
.user-sub { font-size: 11px; color: var(--text-2); font-family: monospace; }
.user-actions { display: flex; gap: 6px; }

/* ── PROGRESS BAR ── */
.progress-wrap { margin-top: 1rem; display: none; }
.progress-wrap.visible { display: block; }
.progress-label { font-size: 11px; color: var(--text-2); margin-bottom: 6px; display: flex; justify-content: space-between; font-family: var(--cond); letter-spacing: 0.05em; }
.progress-track { width: 100%; height: 4px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; background: var(--red); border-radius: 999px; transition: width 0.3s ease; }
.progress-bar.done { background: var(--green); }
.progress-bar.animated { background: linear-gradient(90deg, var(--red) 0%, var(--yellow-light) 50%, var(--red) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ── MISC ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 700px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.count { font-size: 11px; color: var(--text-3); margin-top: 6px; font-family: monospace; }
.empty-msg { text-align: center; padding: 3rem; color: var(--text-3); font-size: 13px; }
.spacer { height: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.preview-title { font-size: 11px; color: var(--text-2); margin: 1rem 0 6px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; font-family: var(--cond); }
.info-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
.info-label { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 6px; font-family: var(--cond); font-weight: 700; }
.sku-chip { font-size: 11px; font-family: monospace; background: var(--bg-3); border: 1px solid var(--border); border-radius: 4px; padding: 2px 8px; display: inline-block; margin: 2px; }
.sku-chip.muted { color: var(--text-3); }
