/* ============================================================
   Colectivo Moda · Inventario TI — Tema SaaS
   Neutros + acento azul; color solo para estados.
   ============================================================ */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --text-2: #64748b;
  --border: #e5e7eb;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;

  --sidebar-bg: #1e293b;
  --sidebar-text: #cbd5e1;
  --sidebar-hover: #334155;
  --sidebar-w: 256px;

  --radius: 14px;
  --shadow: 0 4px 12px rgba(15, 23, 42, .05);
  --shadow-hover: 0 8px 24px rgba(15, 23, 42, .08);

  --st-solicitud: #2563eb;
  --st-disponible: #10b981;
  --st-asignado: #8b5cf6;
  --st-transito: #f59e0b;
  --st-pendiente: #ef4444;
  --st-tienda: #06b6d4;

  /* Re-tema Bootstrap */
  --bs-primary: #2563eb;  --bs-primary-rgb: 37, 99, 235;
  --bs-success: #10b981;  --bs-success-rgb: 16, 185, 129;
  --bs-warning: #f59e0b;  --bs-warning-rgb: 245, 158, 11;
  --bs-danger: #ef4444;   --bs-danger-rgb: 239, 68, 68;
  --bs-info: #06b6d4;     --bs-info-rgb: 6, 182, 212;
  --bs-link-color: #2563eb; --bs-link-color-rgb: 37, 99, 235;
  --bs-link-hover-color: #1d4ed8; --bs-link-hover-color-rgb: 29, 78, 216;
  --bs-body-color: #0f172a;
  --bs-border-color: #e5e7eb;
  --bs-primary-bg-subtle: #dbeafe;  --bs-primary-text-emphasis: #1d4ed8;
  --bs-success-bg-subtle: #d1fae5;  --bs-success-text-emphasis: #047857;
  --bs-warning-bg-subtle: #fef3c7;  --bs-warning-text-emphasis: #b45309;
  --bs-danger-bg-subtle: #fee2e2;   --bs-danger-text-emphasis: #b91c1c;
  --bs-info-bg-subtle: #cffafe;     --bs-info-text-emphasis: #0e7490;
  --bs-secondary-bg-subtle: #f1f5f9; --bs-secondary-text-emphasis: #475569;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  font-family: 'Segoe UI', system-ui, -apple-system, 'Inter', Roboto, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.2rem 1.35rem .4rem;
  display: flex;
  align-items: center;
}
.brand-logo {
  display: block;
  height: 50px;
  width: auto;
  max-width: 100%;
}
.sidebar-app {
  padding: .15rem 1.45rem 1rem;
  font-size: .82rem;
  color: #94a3b8;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.sidebar-nav { padding: .7rem .55rem; flex: 1 1 auto; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .5rem .6rem;
  margin: .12rem 0;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .92rem;
  border-radius: 10px;
  transition: background .12s ease, color .12s ease;
}
.sidebar-nav a .ico {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.sidebar-nav a:hover:not(.disabled) { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav a.active { background: var(--sidebar-hover); color: #fff; font-weight: 500; }
.sidebar-nav a.active .ico { background: rgba(37, 99, 235, .35); color: #fff; }
.sidebar-nav a.disabled { opacity: .4; cursor: default; }
.sidebar-section {
  padding: 1rem .85rem .4rem;
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #94a3b8;
}
.badge-soon {
  margin-left: auto;
  font-size: .58rem;
  background: rgba(255, 255, 255, .12);
  color: #cbd5e1;
  padding: .1rem .45rem;
  border-radius: 8px;
}

.sidebar-user {
  margin: .4rem .6rem .8rem;
  padding: .55rem .65rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  background: rgba(255, 255, 255, .05);
  border-radius: 12px;
}
.sidebar-user .su-info { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sidebar-user .su-info strong { color: #f1f5f9; font-size: .85rem; }
.sidebar-user .su-info span { color: #94a3b8; font-size: .72rem; }
.sidebar-user .su-chev { margin-left: auto; color: #94a3b8; font-size: .8rem; }
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #475569;
  color: #e2e8f0;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ---------- Contenido ---------- */
.content-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .7rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-weight: 600; font-size: 1.05rem; color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: 1rem; }
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); cursor: pointer; font-size: 1.1rem;
}
.icon-btn:hover { background: #f1f5f9; color: var(--text); }
.topbar-user { display: flex; align-items: center; gap: .5rem; }
.topbar-user .avatar.sm { width: 30px; height: 30px; background: #e2e8f0; color: #475569; font-size: .9rem; }
.topbar-user .tu-name { font-weight: 500; color: var(--text); font-size: .92rem; }

.main-content { padding: 2rem; flex: 1; }

.app-footer {
  padding: 1.25rem 2rem 1.75rem;
  text-align: center;
  color: var(--text-2);
  font-size: .8rem;
  border-top: 1px solid var(--border);
}
.app-footer span { color: #94a3b8; }

/* ---------- Tarjetas KPI ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  --c: #64748b; --c-soft: #f1f5f9;
  position: relative;
  display: flex;
  align-items: center;
  gap: .9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .15s ease, transform .15s ease;
}
.stat-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.stat-card::before {
  content: ""; position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--c);
}
.kpi-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem;
  background: var(--c-soft);
  color: var(--c);
  flex-shrink: 0;
}
.kpi-body { min-width: 0; }
.stat-card .stat-label {
  font-size: .74rem; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .04em; font-weight: 500;
}
.stat-card .stat-value { font-size: 1.95rem; font-weight: 700; color: var(--text); line-height: 1.1; }

.stat-card.accent, .stat-card.blue { --c: #2563eb; --c-soft: #dbeafe; }
.stat-card.green  { --c: #10b981; --c-soft: #d1fae5; }
.stat-card.purple { --c: #8b5cf6; --c-soft: #ede9fe; }
.stat-card.amber  { --c: #f59e0b; --c-soft: #fef3c7; }
.stat-card.cyan   { --c: #06b6d4; --c-soft: #cffafe; }
.stat-card.red    { --c: #ef4444; --c-soft: #fee2e2; }

/* ---------- Paneles ---------- */
.card { border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: var(--radius); background: var(--surface); }
.card-header { background: var(--surface); border-bottom: 1px solid var(--border); font-weight: 600; color: var(--text); padding: .95rem 1.3rem; }
.card-body { padding: 1.3rem 1.4rem; }
.card-body.p-0 { padding: 0; }

/* Equipos por estado */
.estado-list { list-style: none; margin: 0; padding: 0; }
.estado-list li { display: flex; align-items: center; gap: .65rem; padding: .6rem 0; border-bottom: 1px solid #f1f5f9; }
.estado-list li:last-child { border-bottom: none; }
.estado-list .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.estado-nombre { flex: 1; color: var(--text); }
.estado-n { font-weight: 700; color: var(--text); min-width: 36px; text-align: right; }
.estado-pct { color: var(--text-2); min-width: 56px; text-align: right; font-variant-numeric: tabular-nums; }
.estado-link { display: inline-block; margin-top: .9rem; color: var(--accent); font-weight: 500; text-decoration: none; font-size: .9rem; }
.estado-link:hover { color: var(--accent-hover); }

/* Bienvenida */
.welcome-head { display: flex; align-items: center; gap: .9rem; }
.welcome-ico { width: 48px; height: 48px; border-radius: 12px; background: #dbeafe; color: #2563eb; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }

/* Flujo */
.flow { display: flex; align-items: flex-start; flex-wrap: wrap; gap: .15rem; }
.flow-step { display: flex; flex-direction: column; align-items: center; gap: .4rem; width: 80px; text-align: center; font-size: .72rem; color: var(--text-2); }
.fs-ico { width: 40px; height: 40px; border-radius: 11px; background: #f1f5f9; color: #475569; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; }
.flow-sep { color: #cbd5e1; align-self: flex-start; margin-top: 11px; }

/* ---------- Botones ---------- */
.btn { border-radius: 9px; font-weight: 500; }
.btn-brand, .btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-brand:hover, .btn-brand:focus, .btn-primary:hover, .btn-primary:focus { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-outline-secondary { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline-secondary:hover, .btn-outline-secondary:focus { background: #f1f5f9; border-color: #cbd5e1; color: var(--text); }

/* ---------- Tablas ---------- */
.table { --bs-table-hover-bg: #f8fafc; --bs-table-border-color: #eef2f6; color: var(--text); }
.table thead th {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-2); font-weight: 600; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.table > :not(caption) > * > * { border-bottom-color: #eef2f6; }
.badge { font-weight: 500; letter-spacing: .01em; }

/* ---------- Formularios ---------- */
.form-control, .form-select { border-color: var(--border); color: var(--text); }
.form-control:focus, .form-select:focus { border-color: #93c5fd; box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .15); }
.form-text { color: var(--text-2); }
hr { border-color: var(--border); opacity: 1; }
a { text-decoration-thickness: 1px; text-underline-offset: 2px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 1rem; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 2.4rem; width: 100%; max-width: 380px; box-shadow: 0 12px 32px rgba(15, 23, 42, .08); }
.login-card .brand { text-align: center; margin-bottom: 1.5rem; color: var(--text); }
.login-card .brand i { font-size: 2.4rem; color: var(--accent); }
.login-logo { height: 56px; width: auto; max-width: 220px; margin-bottom: .25rem; }
.login-card .brand h1 { font-size: 1.2rem; margin: .55rem 0 0; font-weight: 600; }
.login-card .brand p { font-size: .85rem; color: var(--text-2); margin: 0; }

/* ---------- Catálogos ---------- */
.catalogo-card { display: flex; align-items: center; gap: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.15rem 1.3rem; box-shadow: var(--shadow); text-decoration: none; color: inherit; transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
.catalogo-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: #cbd5e1; color: var(--text); }
.catalogo-card .ico { width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; background: #f1f5f9; border-radius: 12px; font-size: 1.35rem; color: var(--accent); flex-shrink: 0; }

@media (max-width: 768px) {
  .sidebar { position: static; width: 100%; height: auto; }
  .content-wrap { margin-left: 0; }
  .app-shell { flex-direction: column; }
  .main-content { padding: 1.25rem; }
  .topbar-user .tu-name { display: none; }
}

/* ---------- Impresión (Manual / Guardar PDF) ---------- */
@media print {
  .sidebar, .topbar, .app-footer, .no-print { display: none !important; }
  .content-wrap { margin-left: 0 !important; }
  .main-content { padding: 0 !important; }
  .card { box-shadow: none !important; border: none !important; }
  a { color: #000 !important; text-decoration: none; }
  .manual h3, .manual h4 { page-break-after: avoid; }
}
