/* ── Google Font: DM Sans (closest to Avenir) ────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800;1,9..40,400&display=swap');

/* ── Brand variables (Steelagro Manual) ─────────────────── */
:root {
  --blue-700:  #0f6ba8;
  --blue-600:  #1279bb;
  --blue-500:  #168ece;   /* PRIMARY — azul corporativo */
  --blue-400:  #3aa2d8;
  --blue-100:  #dff0fb;
  --blue-50:   #f0f9ff;

  --gray-900:  #1a1a1a;
  --gray-800:  #2a2a2a;
  --gray-700:  #3d3d3d;
  --gray-600:  #666666;   /* SECONDARY — gris corporativo */
  --gray-500:  #888888;
  --gray-400:  #aaaaaa;
  --gray-200:  #dadada;   /* LIGHT — gris claro corporativo */
  --gray-100:  #f0f2f4;
  --gray-50:   #f8f9fa;

  --sidebar-bg: #131c29;
  --sidebar-w:  230px;
  --topbar-h:   56px;
}

/* ── Base ────────────────────────────────────────────────── */
body {
  background: var(--gray-100);
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--gray-900);
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #fff;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand-logomark {
  flex-shrink: 0;
}

.brand-wordmark {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.brand-name {
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1.1;
}

.brand-steel { color: var(--blue-500); }
.brand-agro  { color: #e0e0e0; }

.brand-tagline {
  font-size: .6rem;
  color: rgba(255,255,255,.4);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-top: 2px;
}

.brand-crm-badge {
  font-size: .6rem;
  background: var(--blue-500);
  color: #fff;
  border-radius: 3px;
  padding: 1px 5px;
  font-weight: 700;
  letter-spacing: .06em;
}

/* Nav */
.sidebar-nav { list-style: none; margin: 0; padding: 10px 0; }
.sidebar-nav li { margin: 1px 10px; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  border-radius: 6px;
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.sidebar-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-link.active {
  background: rgba(22, 142, 206, .2);
  color: #fff;
  font-weight: 600;
}
.sidebar-link.active i { color: var(--blue-500); }
.sidebar-link i { font-size: .95rem; width: 18px; text-align: center; opacity: .85; }

/* Footer */
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: auto;
}
.user-avatar {
  width: 34px; height: 34px; min-width: 34px;
  background: var(--blue-500); color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
}
.user-avatar-sm {
  width: 28px; height: 28px; min-width: 28px;
  background: var(--blue-500); color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .72rem;
}
.user-details  { flex: 1; overflow: hidden; }
.user-name     { font-size: .8rem; font-weight: 600; color: #fff; }
.user-role     { font-size: .7rem; color: rgba(255,255,255,.45); }
.logout-btn    { color: rgba(255,255,255,.4); text-decoration: none; font-size: 1.05rem; }
.logout-btn:hover { color: #fff; }

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e8eaed;
  padding: 0 24px;
}
.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
  letter-spacing: -.01em;
}

/* ── KPI Cards ───────────────────────────────────────────── */
.kpi-card {
  background: #fff;
  border-radius: 10px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  border: 1px solid #e8eaed;
}
.kpi-icon {
  width: 46px; height: 46px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; flex-shrink: 0;
}
.kpi-value { font-size: 1.75rem; font-weight: 800; line-height: 1; color: var(--gray-900); }
.kpi-label { font-size: .75rem; color: var(--gray-500); margin-top: 3px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }

.bg-primary-soft { background: var(--blue-100); }
.bg-blue-soft    { background: #dbeafe; }
.bg-success-soft { background: #dcfce7; }
.bg-warning-soft { background: #fef9c3; }
.bg-info-soft    { background: #cffafe; }

/* ── Cards ───────────────────────────────────────────────── */
.card { border: 1px solid #e8eaed; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.card-header {
  background: #fff;
  border-bottom: 1px solid #f0f2f4;
  padding: 13px 20px;
  border-radius: 10px 10px 0 0 !important;
  font-size: .875rem;
  color: var(--gray-700);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary  { background: var(--blue-500); border-color: var(--blue-500); font-weight: 600; }
.btn-primary:hover,
.btn-primary:active { background: var(--blue-700); border-color: var(--blue-700); }

.btn-outline-primary { color: var(--blue-500); border-color: var(--blue-500); font-weight: 500; }
.btn-outline-primary:hover { background: var(--blue-500); border-color: var(--blue-500); color: #fff; }

/* ── Activity icons ──────────────────────────────────────── */
.activity-icon {
  width: 30px; height: 30px; min-width: 30px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: .78rem;
}
.activity-whatsapp { background: #d1fae5; color: #059669; }
.activity-llamada  { background: var(--blue-100); color: var(--blue-700); }
.activity-email    { background: #ede9fe; color: #7c3aed; }
.activity-reunion  { background: #fef3c7; color: #d97706; }
.activity-nota     { background: #f1f5f9; color: var(--gray-600); }

/* ── Stage badges ────────────────────────────────────────── */
.stage-badge-consulta_nueva {
  background: var(--blue-100); color: var(--blue-700);
  border-radius: 99px; padding: 2px 8px; font-size: .75rem; font-weight: 600;
}
.stage-badge-en_seguimiento {
  background: #cffafe; color: #0e7490;
  border-radius: 99px; padding: 2px 8px; font-size: .75rem; font-weight: 600;
}
.stage-badge-presupuesto {
  background: #fef9c3; color: #854d0e;
  border-radius: 99px; padding: 2px 8px; font-size: .75rem; font-weight: 600;
}
.stage-badge-negociacion {
  background: #ffedd5; color: #9a3412;
  border-radius: 99px; padding: 2px 8px; font-size: .75rem; font-weight: 600;
}
.stage-badge-ganado {
  background: #dcfce7; color: #15803d;
  border-radius: 99px; padding: 2px 8px; font-size: .75rem; font-weight: 600;
}
.stage-badge-perdido {
  background: #fee2e2; color: #dc2626;
  border-radius: 99px; padding: 2px 8px; font-size: .75rem; font-weight: 600;
}

/* ── Pipeline board ──────────────────────────────────────── */
.pipeline-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: flex-start;
  min-height: calc(100vh - 120px);
}
.pipeline-column {
  min-width: 220px;
  max-width: 220px;
  background: #eef1f5;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
}
.pipeline-column-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  font-size: .72rem;
  font-weight: 700;
  border-radius: 10px 10px 0 0;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.stage-header-consulta_nueva { background: var(--blue-500); }
.stage-header-en_seguimiento { background: #0891b2; }
.stage-header-presupuesto    { background: #d97706; }
.stage-header-negociacion    { background: #ea580c; }
.stage-header-ganado         { background: #16a34a; }
.stage-header-perdido        { background: var(--gray-600); }

.pipeline-cards {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 80px;
  flex-grow: 1;
}
.pipeline-card {
  background: #fff;
  border-radius: 7px;
  padding: 11px 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  cursor: grab;
  border: 1px solid #e8eaed;
  transition: box-shadow .15s, transform .1s;
}
.pipeline-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.1); transform: translateY(-1px); }
.card-ghost { opacity: .4; background: var(--blue-100); }

.deal-client  { font-size: .82rem; font-weight: 700; color: var(--gray-900); }
.deal-title   { font-size: .74rem; margin-top: 2px; color: var(--gray-500); }
.deal-product { margin-top: 4px; }
.deal-footer  { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.deal-value   { font-size: .78rem; font-weight: 700; color: var(--blue-600); }
.deal-agent   {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--blue-500); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .62rem; font-weight: 700;
}
.deal-date { margin-top: 4px; font-size: .68rem; color: var(--gray-400); }

/* ── Login ───────────────────────────────────────────────── */
.login-body {
  background: var(--blue-500);
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
}
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
  background: #fff;
  border-radius: 14px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
}
.login-header    { text-align: center; margin-bottom: 28px; }
.login-logo      { display: flex; justify-content: center; margin-bottom: 14px; }
.login-wordmark  { font-size: 1.6rem; font-weight: 800; line-height: 1; letter-spacing: .02em; }
.login-subtag    { font-size: .65rem; color: var(--gray-500); letter-spacing: .12em; text-transform: uppercase; margin-top: 4px; }
.login-crm       { font-size: .7rem; font-weight: 700; color: var(--blue-500); margin-top: 6px; letter-spacing: .08em; }

/* ── Main layout ─────────────────────────────────────────── */
.main-wrapper  { min-width: 0; }
.main-content  { background: var(--gray-100); }

/* ── Table tweaks ────────────────────────────────────────── */
.table thead th {
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--gray-500);
}

/* ── Form controls ───────────────────────────────────────── */
.form-control:focus, .form-select:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 .2rem rgba(22,142,206,.2);
}

.input-group-text { background: #f8f9fa; border-color: #dee2e6; color: var(--gray-600); }
