/* ============================================================
   Sinerfarma · Administrador de Proyectos
   Sistema de diseño tomado de sinerfarma-v15 (sitio corporativo):
   navy #0B2545 · teal #0A7E73 · acento #5EEAD4
   Roboto (cuerpo) + Roboto Slab (títulos y cifras)
   ============================================================ */

:root {
  --navy: #0B2545;
  --navy-deep: #081C36;
  --navy-mid: #13315C;
  --teal: #0A7E73;
  --teal-hover: #099085;
  --teal-light: #E8F5F3;
  --hl: #5EEAD4;
  --blue: #2563EB;
  --purple: #7C3AED;
  --coral: #E63946;
  --amber: #F59E0B;
  --emerald: #059669;

  --white: #FFFFFF;
  --off-white: #F8F9FA;
  --gray-50: #F1F3F5;
  --gray-100: #E9ECEF;
  --gray-200: #DEE2E6;
  --gray-300: #CED4DA;
  --gray-400: #ADB5BD;
  --gray-500: #8E9499;
  --gray-600: #6C757D;
  --gray-700: #495057;
  --gray-800: #343A40;
  --gray-900: #212529;

  /* alias usados por la app */
  --paper: var(--off-white);
  --card: var(--white);
  --ink: var(--gray-900);
  --ink-2: var(--gray-700);
  --muted: var(--gray-500);
  --line: var(--gray-200);
  --line-soft: var(--gray-100);
  --brand: var(--teal);
  --chart-a: #0A8F80;   /* presupuesto — validado CVD sobre blanco */
  --chart-b: #B45309;   /* ejecutado — validado CVD sobre blanco */
  --danger: var(--coral);

  --r: 16px;
  --r-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.05);

  --font-display: "Roboto Slab", Georgia, serif;
  --font-body: "Roboto", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Roboto Mono", Consolas, monospace;

  /* Grano sutil para dar textura a superficies oscuras (sidebar, login) */
  --noise-overlay: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: var(--teal-light); color: var(--navy); }

/* Foco visible consistente con la marca — nunca se elimina, solo se estiliza */
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 4px; }
a, button, input, select, textarea, .nav-item, .btn { -webkit-tap-highlight-color: transparent; }
a, button, .nav-item, .btn, .btn-icon, .mod-card, .bell { touch-action: manipulation; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; margin: 0; letter-spacing: -.02em; color: var(--navy); }
h1 { font-size: clamp(23px, 3.2vw, 30px); }
h2 { font-size: clamp(18px, 2.4vw, 22px); }
h3 { font-size: 17px; }
p { margin: 0; }
a { color: var(--teal); }

/* ---------- Estructura general (app con sesión) ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  background:
    radial-gradient(120% 50% at 100% 0%, rgba(94,234,212,.08), transparent 60%),
    var(--noise-overlay),
    linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: rgba(255,255,255,.88);
  padding: 22px 14px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 8px; padding: 2px 8px 18px; position: relative; }
.brand .logo-img { width: 100%; max-width: 188px; height: auto; display: block; filter: drop-shadow(0 2px 8px rgba(0,0,0,.35)); }
.brand small { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: rgba(255,255,255,.5); }

.nav-group { margin-top: 14px; }
.nav-group > span {
  display: block; padding: 0 10px 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: rgba(255,255,255,.38);
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: rgba(255,255,255,.82); text-decoration: none; font-size: 14px;
  border: 1px solid transparent; transition: background .2s, color .2s, transform .15s;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item:active { transform: scale(.98); }
.nav-item.active {
  background: rgba(94,234,212,.13);
  border-color: rgba(94,234,212,.32);
  color: var(--hl); font-weight: 500;
}
.nav-item .ico { width: 20px; text-align: center; }

.sidebar .foot { margin-top: auto; padding: 14px 10px 4px; font-size: 11.5px; color: rgba(255,255,255,.38); line-height: 1.5; }

.sidebar-close, .hamburger { display: none; }

.nav-overlay {
  position: fixed; inset: 0; background: rgba(8,28,54,.55); backdrop-filter: blur(1px);
  border: none; padding: 0; z-index: 39; cursor: pointer;
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.nav-overlay.open { opacity: 1; pointer-events: auto; }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px; border-bottom: 1px solid var(--gray-200);
  background: rgba(255,255,255,.96); backdrop-filter: blur(16px) saturate(180%);
  position: sticky; top: 0; z-index: 20;
}
.topbar .fecha { font-size: 12.5px; font-weight: 500; color: var(--gray-500); }
.topbar .left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar .right { display: flex; align-items: center; gap: 14px; }
.bell { position: relative; cursor: pointer; background: var(--white); border: 1px solid var(--gray-200); border-radius: 50%; width: 38px; height: 38px; font-size: 16px; transition: all .2s; }
.bell:hover { border-color: var(--teal); box-shadow: var(--shadow); }
.bell .badge {
  position: absolute; top: -5px; right: -5px; background: var(--coral); color: #fff;
  font-size: 10.5px; font-weight: 700;
  border-radius: 999px; padding: 1px 5.5px; border: 2px solid var(--white);
}
.userchip { display: flex; align-items: center; gap: 10px; }
.userchip .avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--navy);
  color: var(--hl); display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.userchip .nom { font-size: 13.5px; font-weight: 600; line-height: 1.15; color: var(--gray-900); }
.userchip .rol { font-size: 11px; color: var(--gray-500); text-transform: capitalize; }

.content { padding: 28px; max-width: 1180px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--gray-600); margin-top: 6px; max-width: 640px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Botones ---------- */
.btn {
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  border-radius: var(--r-sm); padding: 10px 18px; cursor: pointer;
  border: 1.5px solid transparent; transition: all .25s; letter-spacing: .01em;
  display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
}
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-hover); box-shadow: 0 4px 12px rgba(10,126,115,.3); transform: translateY(-1px); }
.btn-ghost { background: var(--white); color: var(--gray-700); border-color: var(--gray-300); }
.btn-ghost:hover { border-color: var(--teal); color: var(--teal); }
.btn-danger { background: transparent; color: var(--coral); border-color: rgba(230,57,70,.4); }
.btn-danger:hover { background: rgba(230,57,70,.06); border-color: var(--coral); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 15px; padding: 4px 6px; border-radius: 6px; }
.btn-icon:hover { background: var(--gray-100); }

/* ---------- Tarjetas y grids ---------- */
.card {
  background: var(--card); border: 1px solid var(--gray-200);
  border-radius: var(--r); box-shadow: var(--shadow); padding: 20px;
}
.card + .card { margin-top: 18px; }
.card h3 { margin-bottom: 4px; }
.card .desc { color: var(--gray-600); font-size: 13.5px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.kpi { padding: 16px 18px; }
.kpi .lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gray-400); }
.kpi .val { font-family: var(--font-display); font-size: 27px; font-weight: 700; margin-top: 5px; letter-spacing: -.02em; color: var(--navy); }
.kpi .hint { font-size: 12px; color: var(--gray-600); margin-top: 3px; }
.kpi .val small { font-size: 14px; color: var(--gray-500); font-weight: 500; }

.mod-card { display: block; text-decoration: none; color: inherit; position: relative; overflow: hidden; transition: box-shadow .3s, transform .3s, border-color .3s; }
.mod-card:hover { border-color: var(--teal); box-shadow: var(--shadow-md); transform: translateY(-3px); }
.mod-card .ico { font-size: 24px; }
.mod-card h3 { margin-top: 8px; }
.mod-card .cnt { position: absolute; top: 16px; right: 18px; font-family: var(--font-display); font-size: 12.5px; font-weight: 700; color: var(--teal); }

/* ---------- Tablas ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--gray-200);
  font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--gray-400); font-weight: 700; white-space: nowrap;
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.tbl tr:hover td { background: var(--off-white); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .empty { text-align: center; color: var(--gray-500); padding: 26px; }

/* ---------- Pills y estados (estilo ta-pill del sitio) ---------- */
.pill {
  display: inline-block; padding: 3px 12px; border-radius: 100px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
}
.pill-tipo-Cuantitativo   { background: var(--teal-light); color: var(--teal); border: 1px solid rgba(10,126,115,.2); }
.pill-tipo-Cualitativo    { background: rgba(37,99,235,.1); color: var(--blue); border: 1px solid rgba(37,99,235,.2); }
.pill-tipo-Epidemiológico { background: rgba(124,58,237,.1); color: var(--purple); border: 1px solid rgba(124,58,237,.2); }
.pill-tipo-PSM            { background: #FEF3C7; color: #92400E; border: 1px solid rgba(245,158,11,.25); }
.pill-tipo-Otro           { background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-200); }
.pill-ok   { background: rgba(5,150,105,.1); color: var(--emerald); border: 1px solid rgba(5,150,105,.2); }
.pill-warn { background: #FEF3C7; color: #92400E; border: 1px solid rgba(245,158,11,.25); }
.pill-crit { background: #FEE2E2; color: #991B1B; border: 1px solid rgba(230,57,70,.2); }
.pill-info { background: rgba(37,99,235,.1); color: var(--blue); border: 1px solid rgba(37,99,235,.2); }
.pill-off  { background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-200); }

.chip {
  display: inline-block; background: var(--off-white); border: 1px solid var(--gray-200);
  border-radius: 100px; padding: 2px 10px; font-size: 11.5px; margin: 2px 3px 2px 0; color: var(--gray-700);
}

/* ---------- Pills de etapa CRM ---------- */
.pill-etapa-Prospecto   { background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-200); }
.pill-etapa-Contactado  { background: rgba(37,99,235,.1); color: var(--blue); border: 1px solid rgba(37,99,235,.2); }
.pill-etapa-Reunión     { background: rgba(124,58,237,.1); color: var(--purple); border: 1px solid rgba(124,58,237,.2); }
.pill-etapa-Propuesta   { background: #FEF3C7; color: #92400E; border: 1px solid rgba(245,158,11,.25); }
.pill-etapa-Negociación { background: var(--teal-light); color: var(--teal); border: 1px solid rgba(10,126,115,.2); }
.pill-etapa-Ganado      { background: rgba(5,150,105,.12); color: var(--emerald); border: 1px solid rgba(5,150,105,.25); }
.pill-etapa-Perdido     { background: #FEE2E2; color: #991B1B; border: 1px solid rgba(230,57,70,.2); }

/* ---------- Pipeline por etapa ---------- */
.pipe { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 14px; }
.pipe-col {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 14px 8px 12px; border-radius: 12px; cursor: pointer;
  background: var(--off-white); border: 1.5px solid var(--gray-200);
  font-family: var(--font-body); transition: border-color .2s, background .2s, transform .15s;
  position: relative;
}
.pipe-col:hover { border-color: var(--teal); transform: translateY(-2px); }
.pipe-col.sel { border-color: var(--teal); background: var(--teal-light); }
.pipe-col.sel::after {
  content: ''; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%) rotate(45deg);
  width: 10px; height: 10px; background: var(--teal-light); border-right: 1.5px solid var(--teal); border-bottom: 1.5px solid var(--teal);
}
.pipe-n { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--navy); line-height: 1.1; }
.pipe-et { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gray-500); }
.pipe-v { font-size: 11.5px; color: var(--gray-600); font-variant-numeric: tabular-nums; }

/* ---------- Agenda de seguimientos ---------- */
.agenda-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 4px;
  border-bottom: 1px solid var(--gray-100); text-decoration: none; color: var(--ink);
  transition: background .15s; border-radius: 8px;
}
.agenda-item:hover { background: var(--off-white); }
.agenda-fecha {
  flex-shrink: 0; min-width: 92px; font-size: 12px; font-weight: 700;
  color: var(--teal); font-variant-numeric: tabular-nums;
}
.agenda-fecha.warn { color: #92400E; }
.agenda-fecha.crit { color: var(--coral); }
.agenda-txt { flex: 1; font-size: 13px; color: var(--gray-700); min-width: 0; }
.agenda-txt b { color: var(--gray-900); }
.agenda-tipo { flex-shrink: 0; font-size: 16px; }

/* ---------- Contactos por tipo (barras de conteo, un solo matiz) ---------- */
.tipo-chart { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.tipo-row { display: grid; grid-template-columns: 118px 1fr 30px; gap: 10px; align-items: center; }
.tipo-lbl { font-size: 12.5px; font-weight: 600; color: var(--gray-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tipo-barwrap { background: var(--gray-100); border-radius: 999px; height: 10px; overflow: hidden; }
.tipo-bar { height: 100%; background: var(--chart-a); border-radius: 999px; min-width: 4px; }
.tipo-n { font-family: var(--font-display); font-size: 13px; font-weight: 700; color: var(--navy); text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Timeline de seguimientos ---------- */
.timeline { position: relative; padding-left: 6px; }
.tl-item { display: flex; gap: 14px; position: relative; padding-bottom: 18px; }
.tl-item:not(:last-child)::before {
  content: ''; position: absolute; left: 17px; top: 38px; bottom: 0;
  width: 2px; background: var(--gray-200); border-radius: 2px;
}
.tl-ico {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
  background: var(--teal-light); border: 1.5px solid rgba(10,126,115,.25);
  display: grid; place-items: center; font-size: 15px; z-index: 1;
}
.tl-cuerpo { flex: 1; min-width: 0; padding-top: 2px; }
.tl-head { display: flex; align-items: center; gap: 10px; }
.tl-tipo { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--teal); }
.tl-fecha { font-size: 12px; color: var(--gray-500); font-variant-numeric: tabular-nums; }
.tl-head .btn-icon { margin-left: auto; opacity: 0; transition: opacity .15s; }
.tl-item:hover .btn-icon, .tl-head .btn-icon:focus-visible { opacity: 1; }
.tl-resumen { font-size: 13.5px; color: var(--gray-800); margin-top: 3px; line-height: 1.55; }
.tl-prox {
  margin-top: 7px; font-size: 12.5px; color: var(--navy);
  background: var(--off-white); border: 1px dashed var(--gray-300);
  border-radius: 8px; padding: 6px 11px; display: inline-block;
}

/* ---------- Formularios ---------- */
label.f { display: block; margin-bottom: 13px; }
label.f > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--gray-700); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=tel], input[type=number],
input[type=date], input[type=password], select, textarea {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--gray-200);
  border-radius: var(--r-sm); font-family: var(--font-body); font-size: 14px;
  background: var(--white); color: var(--gray-900); transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(10,126,115,.12); }
textarea { resize: vertical; min-height: 70px; }
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.f-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-bottom: 9px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--teal); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--gray-100); }
.switch-row .t { font-weight: 600; font-size: 14px; color: var(--gray-900); }
.switch-row .d { font-size: 12.5px; color: var(--gray-500); }

/* ---------- Wizard ---------- */
.stepper { display: flex; gap: 0; margin-bottom: 26px; }
.step { flex: 1; text-align: center; position: relative; padding-top: 34px; font-size: 12px; font-weight: 500; color: var(--gray-500); }
.step::before {
  content: attr(data-n);
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--gray-100); border: 1.5px solid var(--gray-200);
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 12px; font-weight: 700; color: var(--gray-500);
}
.step::after {
  content: ""; position: absolute; top: 14px; left: calc(50% + 18px); right: calc(-50% + 18px);
  height: 1.5px; background: var(--gray-200);
}
.step:last-child::after { display: none; }
.step.done::before { background: var(--teal); border-color: var(--teal); color: #fff; content: "✓"; }
.step.done::after { background: var(--teal); }
.step.now { color: var(--navy); font-weight: 700; }
.step.now::before { background: var(--navy); border-color: var(--navy); color: var(--hl); }

.wiz-foot { display: flex; justify-content: space-between; margin-top: 22px; }
.estudio-bloque { border: 1px solid var(--gray-200); border-radius: 12px; padding: 16px; margin-bottom: 14px; background: var(--off-white); }
.estudio-bloque h4 { margin: 0 0 10px; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--teal); display: flex; align-items: center; gap: 8px; }
.estudio-bloque h4::before { content: ''; width: 22px; height: 2px; background: currentColor; border-radius: 2px; flex-shrink: 0; }
.equipo-grupo { margin-bottom: 12px; }
.equipo-grupo > b { display: block; font-size: 12.5px; margin-bottom: 5px; color: var(--gray-700); }
.equipo-opciones { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.equipo-opciones .check { margin-bottom: 3px; }

/* ---------- Medidores y barras ---------- */
.meter { height: 8px; background: var(--gray-100); border-radius: 999px; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 999px; background: var(--chart-a); }
.meter > i.warn { background: var(--chart-b); }
.meter > i.crit { background: var(--coral); }
.meter-row { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.meter-row .meter { flex: 1; }

/* ---------- Gráfica finanzas (barras HTML) ---------- */
.legend { display: flex; gap: 18px; font-size: 12.5px; color: var(--gray-600); align-items: center; }
.legend .sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.sw-a { background: var(--chart-a); }
.sw-b { background: var(--chart-b); }
.chart { margin-top: 18px; display: flex; flex-direction: column; gap: 18px; }
.chart-row { display: grid; grid-template-columns: 190px 1fr; gap: 14px; align-items: center; }
.chart-label { font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--gray-900); }
.chart-label small { display: block; font-weight: 400; color: var(--gray-500); font-size: 11.5px; }
.chart-bars { display: flex; flex-direction: column; gap: 2px; }
.barwrap { display: flex; align-items: center; gap: 8px; }
.bar { height: 14px; border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-a { background: var(--chart-a); }
.bar-b { background: var(--chart-b); }
.barval { font-size: 11.5px; font-weight: 500; color: var(--gray-600); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Alertas / notificaciones ---------- */
.alerta { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--gray-200); border-radius: 12px; background: var(--white); margin-bottom: 10px; }
.alerta .ico { font-size: 18px; margin-top: 1px; }
.alerta .cuerpo { flex: 1; }
.alerta .t { font-weight: 600; font-size: 14px; color: var(--gray-900); }
.alerta .d { font-size: 13px; color: var(--gray-600); margin-top: 2px; }
.alerta .acciones { display: flex; gap: 8px; flex-shrink: 0; }
.alerta.nivel-critica { border-left: 3px solid var(--coral); }
.alerta.nivel-advertencia { border-left: 3px solid var(--amber); }
.alerta.nivel-info { border-left: 3px solid var(--blue); }

.aviso {
  background: #FFFBEB; border: 1px solid #FDE68A; border-radius: 12px;
  padding: 12px 15px; font-size: 13px; color: #92400E; margin-bottom: 16px;
}
.aviso b { color: #78350F; }

/* ---------- Login ---------- */
.login-bg {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%);
}
.login-bg::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(90% 70% at 85% 10%, rgba(94,234,212,.14), transparent 55%),
    radial-gradient(70% 60% at 10% 90%, rgba(37,99,235,.16), transparent 55%),
    var(--noise-overlay);
}
.login-shell {
  position: relative; z-index: 1; width: 100%; max-width: 430px;
  display: grid; grid-template-columns: 1fr;
  animation: login-rise .6s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes login-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.login-brand-panel { display: none; }
.login-card {
  width: 100%; background: var(--white);
  border-radius: 24px; box-shadow: var(--shadow-lg); padding: 36px 36px 28px;
}
.login-card .logo-img { max-width: 240px; width: 100%; height: auto; display: block; }
.login-card .tag { font-size: 10.5px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--teal); margin: 12px 0 24px; display: flex; align-items: center; gap: 10px; }
.login-card .tag::before { content: ''; width: 28px; height: 2px; background: currentColor; border-radius: 2px; }
.login-card h2 { font-size: 20px; margin-bottom: 4px; }
.login-card .paso-desc { font-size: 13.5px; color: var(--gray-600); margin-bottom: 18px; }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; margin-top: 6px; min-height: 46px; }
.login-foot { margin-top: 18px; font-size: 12px; color: var(--gray-500); text-align: center; line-height: 1.6; }
.code-input { font-family: var(--font-mono) !important; font-size: 24px !important; letter-spacing: .45em; text-align: center; }
.demo-code {
  background: var(--teal-light); border: 1px dashed var(--teal); border-radius: var(--r-sm);
  padding: 12px 14px; font-size: 12.5px; color: var(--gray-700); margin-bottom: 16px;
}
.demo-code .cod { font-family: var(--font-mono); font-size: 21px; font-weight: 700; color: var(--navy); letter-spacing: .3em; display: block; margin-top: 4px; }
.login-error { background: #FEE2E2; color: #991B1B; border: 1px solid rgba(230,57,70,.2); border-radius: var(--r-sm); padding: 9px 13px; font-size: 13px; margin-bottom: 14px; }

/* Panel de marca — solo en pantallas con espacio de sobra */
@media (min-width: 900px) {
  .login-shell {
    max-width: 940px; grid-template-columns: 1fr 1fr; align-items: stretch;
    border-radius: 28px; overflow: hidden; box-shadow: var(--shadow-lg);
  }
  .login-card { border-radius: 0; box-shadow: none; padding: 52px 48px; display: flex; flex-direction: column; justify-content: center; }
  .login-brand-panel {
    display: flex; flex-direction: column; justify-content: center; gap: 22px;
    padding: 52px 48px; color: #fff; position: relative; overflow: hidden;
    background:
      radial-gradient(120% 90% at 0% 0%, rgba(94,234,212,.18), transparent 60%),
      var(--noise-overlay), var(--navy-deep);
  }
  .login-brand-panel .lbp-eyebrow {
    font-size: 10.5px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase;
    color: var(--hl); display: flex; align-items: center; gap: 10px;
  }
  .login-brand-panel .lbp-eyebrow::before { content: ''; width: 24px; height: 2px; background: currentColor; border-radius: 2px; }
  .login-brand-panel h1 {
    color: #fff; font-size: clamp(24px, 2.6vw, 30px); line-height: 1.25; letter-spacing: -.01em;
  }
  .login-brand-panel p { color: rgba(255,255,255,.72); font-size: 14.5px; line-height: 1.6; max-width: 34ch; }
  .login-brand-panel .lbp-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
  .login-brand-panel .lbp-stat {
    font-size: 11.5px; font-weight: 600; color: rgba(255,255,255,.85);
    background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
    padding: 6px 13px; border-radius: 100px; white-space: nowrap;
  }
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(11,37,69,.55); z-index: 100;
  display: grid; place-items: center; padding: 20px; backdrop-filter: blur(3px);
}
.modal {
  background: var(--white); border-radius: var(--r); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; padding: 24px 26px;
}
.modal.wide { max-width: 720px; }
.modal h3 { margin-bottom: 16px; }
.modal .modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--navy); color: #fff; padding: 11px 18px; border-radius: var(--r-sm);
  font-size: 13.5px; box-shadow: var(--shadow-lg);
  animation: toast-in .18s ease-out;
}
.toast.err { background: var(--coral); }
.toast.ok { background: var(--teal); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Detalle proyecto ---------- */
.proy-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.proy-head .meta { font-size: 13px; color: var(--gray-600); margin-top: 6px; }
.proy-head select { width: auto; font-weight: 600; }
.est-card { border: 1px solid var(--gray-200); border-radius: 12px; padding: 16px 18px; background: var(--off-white); margin-bottom: 12px; }
.est-card .est-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.est-card h4 { margin: 0; font-size: 15.5px; font-family: var(--font-body); font-weight: 700; color: var(--gray-900); }
.est-card .datos { display: flex; gap: 22px; flex-wrap: wrap; margin: 10px 0; font-size: 12.5px; color: var(--gray-600); }
.est-card .datos b { color: var(--navy); font-weight: 700; font-variant-numeric: tabular-nums; }
.est-card .equipos { font-size: 12.5px; margin-top: 8px; }
.est-card .equipos .rolet { color: var(--gray-400); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-right: 4px; }
.avance-ctl { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.avance-ctl input[type=range] { flex: 1; accent-color: var(--teal); }
.avance-ctl .pct { font-family: var(--font-display); font-weight: 700; font-size: 13px; width: 44px; text-align: right; color: var(--navy); }

/* ---------- Entrada animada del dashboard ---------- */
@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.dash-stagger > * { animation: rise-in .45s cubic-bezier(.2,.8,.2,1) both; }
.dash-stagger > *:nth-child(1) { animation-delay: 0ms; }
.dash-stagger > *:nth-child(2) { animation-delay: 45ms; }
.dash-stagger > *:nth-child(3) { animation-delay: 90ms; }
.dash-stagger > *:nth-child(4) { animation-delay: 135ms; }
.dash-stagger > *:nth-child(5) { animation-delay: 180ms; }
.dash-stagger > *:nth-child(6) { animation-delay: 225ms; }
.dash-stagger > *:nth-child(7) { animation-delay: 270ms; }
.dash-stagger > *:nth-child(8) { animation-delay: 315ms; }
.dash-stagger > *:nth-child(9) { animation-delay: 360ms; }

/* ============================================================
   Responsive — breakpoints: ≥1024 escritorio (sidebar fija),
   <1024 tablet y móvil comparten un cajón deslizable (patrón
   recomendado para ese rango: Material Adaptive Navigation).
   ============================================================ */

/* Escritorio grande: un poco más de aire */
@media (min-width: 1440px) {
  .content { max-width: 1280px; padding: 32px 40px; }
}

@media (max-width: 1023px) {
  .shell { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed; inset: 0 auto 0 0; height: 100vh; height: 100dvh;
    width: min(300px, 84vw); z-index: 40;
    transform: translateX(-100%);
    transition: transform .32s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-close {
    display: flex; align-items: center; justify-content: center;
    position: absolute; top: 14px; right: 14px; width: 40px; height: 40px;
    border-radius: 50%; background: rgba(255,255,255,.08); border: none;
    color: rgba(255,255,255,.85); font-size: 18px; cursor: pointer; transition: background .2s;
  }
  .sidebar-close:hover { background: rgba(255,255,255,.18); }

  .brand { padding: 2px 34px 18px 8px; }
  .nav-item { padding: 12px 14px; font-size: 15px; }

  .hamburger {
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 10px; border: 1.5px solid var(--gray-200);
    background: var(--white); cursor: pointer; font-size: 18px; color: var(--navy);
    flex-shrink: 0; transition: border-color .2s;
  }
  .hamburger:hover { border-color: var(--teal); }
  .hamburger .bar { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: relative; }
  .hamburger .bar::before, .hamburger .bar::after { content: ''; position: absolute; left: 0; width: 18px; height: 2px; background: currentColor; border-radius: 2px; }
  .hamburger .bar::before { top: -5px; }
  .hamburger .bar::after { top: 5px; }

  .topbar { padding: 12px 16px; gap: 10px; }
  .topbar .fecha { display: none; }
  .content { padding: 18px; }
  .chart-row { grid-template-columns: 1fr; gap: 6px; }
  .f-row, .f-row-3 { grid-template-columns: 1fr; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }

  /* CRM: sin hover en táctil, el botón de eliminar seguimiento siempre visible */
  .tl-head .btn-icon { opacity: 1; }
  .pipe { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .pipe-et { font-size: 9px; }
  .pipe-n { font-size: 19px; }
  .pipe-v { display: none; }

  /* Objetivos táctiles ≥44px (Material/HIG) */
  .btn:not(.btn-sm) { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  .bell { width: 44px; height: 44px; }
  .btn-icon { min-width: 40px; min-height: 40px; }
  input[type=text], input[type=email], input[type=tel], input[type=number],
  input[type=date], input[type=password], select, textarea { min-height: 44px; }
  textarea { min-height: 80px; }
}

/* Tablet: hay espacio de sobra para mostrar la fecha y una rejilla de 2 */
@media (min-width: 640px) and (max-width: 1023px) {
  .topbar .fecha { display: block; }
}

@media (max-width: 639px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .content { padding: 14px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; justify-content: center; }
  .stepper { gap: 0; }
  .step { font-size: 10.5px; padding-top: 30px; }
  .login-card { padding: 28px 22px 24px; border-radius: 20px; }
  .modal { padding: 20px 18px; border-radius: 18px; }
  .pipe { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .tipo-row { grid-template-columns: 96px 1fr 26px; }
  .agenda-fecha { min-width: 76px; }
}
