:root {
  --bg: #F4F3EF;
  --surface: #FFFFFF;
  --ink: #1B2230;
  --ink-soft: #5A6273;
  --ink-faint: #8B92A1;
  --line: #E4E2DB;
  --line-strong: #D2CFC6;
  --accent: #0F6E56;
  --accent-soft: #E1F1EB;
  --won: #0F6E56;
  --lost: #A32D2D;
  --lost-soft: #F7E7E7;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(27,34,48,.06), 0 4px 12px rgba(27,34,48,.05);
  /* Colores por etapa */
  --et-contacto: #6E63B4;
  --et-calificacion: #1D7FB0;
  --et-propuesta: #B07A12;
  --et-negociacion: #C25A2E;
  --et-cierre: #0F6E56;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}
h1, h2, h3 { font-family: "Space Grotesk", "Inter", sans-serif; margin: 0; font-weight: 600; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

.hidden { display: none !important; }
/* Si hay sesión activa, el login no se pinta al cargar (evita el parpadeo al volver al Dashboard). */
.has-session #login { display: none !important; }

/* ---------- Login ---------- */
#login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 36px 34px; width: 100%; max-width: 380px;
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
  display: grid; place-items: center; color: #fff; font-family: "Space Grotesk"; font-weight: 700;
}
.brand-name { font-family: "Space Grotesk"; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.login-card p.sub { color: var(--ink-soft); margin: 4px 0 24px; font-size: 13px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 500; color: var(--ink-soft); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: #fff; color: var(--ink); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn {
  border: 1px solid transparent; border-radius: 8px; padding: 9px 15px; font-weight: 600; font-size: 14px;
  background: var(--accent); color: #fff;
}
.btn:hover { background: #0c5b47; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: #f0efe9; }
.btn.danger { background: var(--lost); }
.btn.danger:hover { background: #8a2424; }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.error-msg { color: var(--lost); font-size: 13px; margin-top: 6px; min-height: 18px; }
.hint { font-size: 12px; color: var(--ink-faint); margin-top: 14px; line-height: 1.6; }

/* ---------- App shell ---------- */
.topbar {
  height: 58px; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 20px; position: sticky; top: 0; z-index: 20;
}
.topbar .brand-name { font-size: 15px; }
.spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-soft); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: 12px;
}
.role-tag { font-size: 11px; color: var(--ink-faint); }

.toolbar { display: flex; align-items: center; gap: 12px; padding: 16px 20px 0; flex-wrap: wrap; }
.toolbar h1 { font-size: 18px; }
.toolbar .filters { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.toolbar select { padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; }

/* ---------- Board ---------- */
.board { display: flex; gap: 8px; padding: 14px 14px 24px; overflow-x: auto; align-items: flex-start; }
.column {
  background: #ECEAE3; border-radius: 10px; flex: 1 1 0; min-width: 0; width: auto;
  display: flex; flex-direction: column; max-height: calc(100vh - 150px);
}
.col-head { padding: 9px 9px 7px; border-top: 3px solid var(--c, #999); border-radius: 10px 10px 0 0; }
.col-title { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.col-title strong { font-size: 11.5px; font-weight: 600; line-height: 1.25; min-width: 0; overflow-wrap: anywhere; }
.col-count { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 0 6px; font-size: 10.5px; color: var(--ink-soft); flex: 0 0 auto; }
.col-sum { font-size: 10px; color: var(--ink-soft); margin-top: 2px; }
.col-body { padding: 6px; overflow-y: auto; flex: 1; min-height: 40px; }
.col-body.drop-active { background: rgba(15,110,86,.07); outline: 2px dashed var(--accent); outline-offset: -4px; border-radius: 8px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 9px; margin-bottom: 6px; box-shadow: var(--shadow); cursor: grab;
}
.card:active { cursor: grabbing; }
.card.dragging { opacity: .45; }
.card h3 { font-size: 11.5px; font-family: "Inter"; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.card .meta { color: var(--ink-soft); font-size: 10.5px; margin-top: 2px; }
.card .card-foot { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 7px; }
.card .val { font-weight: 600; font-size: 11.5px; }
.pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.pill.ganada { background: var(--accent-soft); color: var(--won); }
.pill.perdida { background: var(--lost-soft); color: var(--lost); }
.pill.abierta { background: #EEF1F5; color: var(--ink-soft); }
.ejec-dot { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-faint); font-size: 10.5px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 100%; }

/* ---------- Modal / drawer ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20,24,33,.42); z-index: 50; display: flex; justify-content: flex-end; }
.overlay.center { align-items: center; justify-content: center; padding: 20px; }
.drawer { background: var(--bg); width: 728px; max-width: 100%; max-height: 88vh; border-radius: 14px; overflow-y: auto; box-shadow: var(--shadow); }
.modal { background: var(--surface); border-radius: 14px; width: 460px; max-width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow); padding: 24px; }
.modal.wide { width: 600px; }
.drawer-head { padding: 18px 20px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; border-radius: 14px 14px 0 0; display: flex; align-items: flex-start; gap: 10px; }
.drawer-head h2 { font-size: 17px; font-family: "Space Grotesk"; line-height: 1.25; }
.icon-btn { background: none; border: none; font-size: 20px; color: var(--ink-soft); line-height: 1; padding: 2px 6px; }
.drawer-body { padding: 18px 20px 40px; }
.section { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); margin-bottom: 10px; font-family: "Inter"; font-weight: 600; }
.kv { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13px; }
.kv span:first-child { color: var(--ink-soft); }
table.items { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.items th { text-align: left; color: var(--ink-faint); font-weight: 500; padding: 4px 4px; border-bottom: 1px solid var(--line); }
table.items td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.items td.num, table.items th.num { text-align: right; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 12px 18px; font-size: 12.5px; }
.timeline li::before { content: ""; position: absolute; left: 2px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.timeline li::after { content: ""; position: absolute; left: 5px; top: 12px; bottom: 0; width: 1.5px; background: var(--line-strong); }
.timeline li:last-child::after { display: none; }
.timeline .when { color: var(--ink-faint); font-size: 11px; }
.interv { border-left: 3px solid var(--line-strong); padding: 4px 0 4px 10px; margin-bottom: 8px; font-size: 12.5px; }
.interv .who { font-weight: 600; }
.interv .area { font-size: 11px; color: var(--ink-faint); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.stage-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.empty { color: var(--ink-faint); font-size: 12.5px; font-style: italic; }
.modal h2 { font-size: 18px; margin-bottom: 4px; }
.modal .sub { color: var(--ink-soft); font-size: 13px; margin-bottom: 18px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

@media (max-width: 560px) {
  .drawer, .modal { width: 100%; }
}

/* ====================== Layout con sidebar ====================== */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: 200px; flex: 0 0 auto; background: #F7F6F2; border-right: 0.5px solid var(--line);
  display: flex; flex-direction: column; padding: 14px 10px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 4px 8px 16px; }
.sidebar .brand-name { font-size: 15px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border: none; background: none; border-radius: 8px;
  font-family: inherit; font-size: 13.5px; color: var(--ink-soft); cursor: pointer;
  text-decoration: none;
}
.nav-item:hover { background: #EFEDE6; }
.nav-item.active { background: var(--accent-soft); color: #085041; font-weight: 500; }
.nav-item i { font-size: 18px; }

.sidebar-foot { margin-top: auto; border-top: 0.5px solid var(--line); padding-top: 10px; }
.sidebar-foot .user-chip { padding: 4px 6px; }
.btn.block.sm { padding: 7px 10px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar #topbarTitle { font-size: 15px; font-weight: 600; }
.view-label { font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.view { padding: 18px 22px 28px; }
.view[hidden] { display: none; }
.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.view-head h1 { font-size: 18px; }
.view-sub { color: var(--ink-soft); font-size: 13px; margin: 4px 0 0; }
.view-head .filters { display: flex; gap: 8px; align-items: center; }
.view-head .filters select { padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; }

/* La board dentro de su vista */
.view .board { padding: 4px 0 8px; }

/* Placeholder de vistas en construcción */
.placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; gap: 10px; color: var(--ink-faint); text-align: center;
}
.placeholder i { font-size: 34px; }

/* ====================== Tabla de datos (Configuración) ====================== */
.card-wrap { background: var(--surface); border: 0.5px solid var(--line); border-radius: 12px; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th { text-align: left; color: var(--ink-faint); font-weight: 500; padding: 10px 14px; }
.data-table tbody tr { border-top: 0.5px solid #EFEDE6; }
.data-table td { padding: 10px 14px; }
.data-table td.actions { text-align: right; color: var(--ink-soft); white-space: nowrap; }
.data-table td.actions i { font-size: 16px; margin-left: 12px; cursor: pointer; }
.data-table td.actions i:hover { color: var(--ink); }

.role-badge { padding: 2px 8px; border-radius: 20px; font-size: 11px; background: #EFEDE6; color: #444441; }
.role-badge.ejec { background: var(--accent-soft); color: #085041; }

/* Árbol de jerarquía */
.tree { font-size: 13px; line-height: 1.9; }
.tree .node-line .muted { color: var(--ink-faint); }
.tree .lvl-1 { padding-left: 20px; }
.tree .lvl-2 { padding-left: 40px; }
.tree i.crown { color: #B07A12; font-size: 15px; vertical-align: -2px; margin-right: 2px; }

@media (max-width: 720px) {
  .sidebar { width: 60px; }
  .sidebar .brand-name, .nav-item span, .sidebar-foot .user-chip > div:last-child { display: none; }
  .nav-item { justify-content: center; }
}

/* Etiquetas de etapa en la tabla de oportunidades */
.etapa-tag { padding: 2px 8px; border-radius: 20px; font-size: 11px; background: #EFEDE6; color: #444441; }
.et-contacto_inicial { background: #ECEAF7; color: #4A3F8F; }
.et-calificacion { background: #E7EEF6; color: #155488; }
.et-propuesta { background: #F3E8D6; color: #7A4F0B; }
.et-negociacion { background: #F6E6DC; color: #8A3D1C; }
.et-cierre { background: #E1F1EB; color: #085041; }

/* ====================== Submenú desplegable (Configuración) ====================== */
.nav-group { display: flex; flex-direction: column; }
.nav-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border: none; background: none; border-radius: 8px;
  font-family: inherit; font-size: 13.5px; color: var(--ink-soft); cursor: pointer;
}
.nav-toggle:hover { background: #EFEDE6; }
.nav-toggle > i:first-child { font-size: 18px; }
.nav-toggle .chev { font-size: 15px; margin-left: auto; color: var(--ink-faint); transition: transform .15s ease; }
.nav-group.open .nav-toggle .chev { transform: rotate(180deg); }

.nav-sub { display: none; flex-direction: column; gap: 2px; margin-top: 2px; }
.nav-group.open .nav-sub { display: flex; }
.nav-subitem {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 30px;
  font-size: 13px; color: var(--ink-soft); border-radius: 8px; text-decoration: none; cursor: pointer;
}
.nav-subitem i { font-size: 16px; flex: 0 0 auto; }
.nav-subitem:hover { background: #EFEDE6; }
.nav-subitem.active { background: var(--accent-soft); color: #085041; font-weight: 500; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; padding-left: 27px; }

/* Botón compactar/expandir en la línea de la marca */
.brand-toggle {
  margin-left: auto; border: none; background: none; color: var(--ink-soft); cursor: pointer;
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; padding: 0;
}
.brand-toggle:hover { background: #EFEDE6; color: #085041; }
.brand-toggle i { font-size: 18px; }
.brand-toggle .ico-expand { display: none; }

/* Menú compacto (solo íconos), preferencia del usuario (aplicada antes de pintar) */
.sidebar { transition: width .15s ease; }
html.crm-collapsed .sidebar { width: 64px; }
html.crm-collapsed .sidebar .brand { flex-direction: column; gap: 6px; align-items: center; }
html.crm-collapsed .sidebar .brand-name { display: none; }
html.crm-collapsed .sidebar .brand-toggle { margin-left: 0; }
html.crm-collapsed .sidebar .brand-toggle .ico-collapse { display: none; }
html.crm-collapsed .sidebar .brand-toggle .ico-expand { display: inline-flex; }
html.crm-collapsed .nav-item,
html.crm-collapsed .nav-toggle { justify-content: center; gap: 0; padding-left: 0; padding-right: 0; font-size: 0; }
html.crm-collapsed .nav-item i,
html.crm-collapsed .nav-toggle > i:first-child { font-size: 18px; }
html.crm-collapsed .nav-toggle .chev { display: none; }
html.crm-collapsed .nav-subitem { justify-content: center; gap: 0; padding: 7px 0; font-size: 0; border-left: none; border-radius: 8px; }
html.crm-collapsed .nav-subitem i { font-size: 16px; }
html.crm-collapsed .nav-subitem.active { padding-left: 0; border-left: none; border-radius: 8px; }

/* Estado de verificación de identificación de empresa */
.ident-status { font-size: 11px; margin-top: 4px; }
.ident-status:empty { display: none; }
.ident-status.ok { color: var(--accent); }
.ident-status.error { color: var(--lost); }

/* ====================== Documentos en el detalle ====================== */
.doc-block { margin-top: 16px; border-top: 1px dashed var(--line-strong); padding-top: 14px; }
.doc-block h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); margin-bottom: 10px; }
.doc-upload { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.doc-upload select { padding: 8px; border: 1px solid var(--line-strong); border-radius: 8px; font-family: inherit; font-size: 13px; }
.doc-upload input[type="file"] { flex: 1; min-width: 140px; font-size: 12px; }
.doc-groups { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.doc-group-title { font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.doc-count { background: var(--accent-soft); color: #085041; border-radius: 20px; padding: 0 7px; font-size: 11px; font-weight: 500; }
.doc-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 0.5px solid var(--line); border-radius: 8px; margin-bottom: 5px; font-size: 12.5px; }
.doc-item .ti-file { color: var(--ink-soft); font-size: 16px; }
.doc-name { color: var(--accent); text-decoration: none; font-weight: 500; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-cat { background: #EFEDE6; color: #444441; border-radius: 20px; padding: 1px 9px; font-size: 11px; white-space: nowrap; }
.doc-meta { color: var(--ink-faint); font-size: 11px; margin-left: auto; white-space: nowrap; }
.doc-del { color: var(--lost); cursor: pointer; font-size: 15px; }
.doc-group .empty { color: var(--ink-faint); font-size: 12px; padding: 2px 4px; }

/* Nombre de documento clicable */
.doc-name { cursor: pointer; }
.doc-name:hover { text-decoration: underline; }
.icon-btn { cursor: pointer; text-decoration: none; }

/* ====================== Visor de documentos ====================== */
.visor-modal { width: 900px; max-width: 100%; height: 86vh; max-height: 86vh; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.visor-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); border-radius: 14px 14px 0 0; }
.visor-head h2 { flex: 1; min-width: 0; font-size: 15px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.visor-body { flex: 1; min-height: 0; display: flex; overflow: auto; background: #ECEAE3; }
.visor-frame { flex: 1; width: 100%; height: 100%; border: 0; background: #fff; }
.visor-img { margin: auto; max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.visor-msg { margin: auto; text-align: center; color: var(--ink-soft); padding: 40px 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.visor-msg .ti { font-size: 40px; color: var(--ink-faint); }

/* Indicador Producto (Sí/No) en variables */
.prod-badge { padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.prod-badge.si { background: var(--accent-soft); color: #085041; }
.prod-badge.no { background: #EEF1F5; color: var(--ink-soft); }

/* ====================== Tipos de intervención ====================== */
.interv-actions { display: flex; gap: 8px; justify-content: space-between; margin-bottom: 16px; }
.interv-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; background: none; border: none; cursor: pointer; font-family: inherit; font-size: 11.5px; color: var(--ink-soft); padding: 0; }
.interv-ic { width: 42px; height: 42px; border-radius: 50%; background: #EAF1FB; border: 0.5px solid #CFE0F3; display: grid; place-items: center; color: #185FA5; }
.interv-ic i { font-size: 19px; }
.interv-btn:hover .interv-ic { background: #DCEAFA; }
.interv-list { display: flex; flex-direction: column; gap: 2px; }
.interv .who { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.interv .who > i { font-size: 14px; color: var(--ink-soft); }
.interv-tag { border-radius: 20px; padding: 1px 8px; font-size: 10.5px; font-weight: 500; }
.interv-tag.t-correo  { background: #EAF1FB; color: #185FA5; }
.interv-tag.t-reunion { background: var(--accent-soft); color: #085041; }
.interv-tag.t-tarea   { background: #FAEEDA; color: #854F0B; }
.interv-tag.t-llamada { background: #EEEDFE; color: #3C3489; }
.interv-tag.t-nota    { background: #EFEDE6; color: #444441; }

/* Selección de documentos a adjuntar en el correo */
.doc-attach { display: flex; flex-direction: column; gap: 4px; max-height: 130px; overflow-y: auto; border: 0.5px solid var(--line); border-radius: 8px; padding: 8px; }
.doc-attach-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; cursor: pointer; }
.doc-attach-item input { margin: 0; }

/* ============== Mi cuenta de correo ============== */
.form-card { background: #fff; border: 0.5px solid var(--line); border-radius: 12px; padding: 20px 22px; }
.form-hint { font-size: 12.5px; color: var(--ink-soft); margin: 0 0 18px; line-height: 1.6; }
.field-help { font-size: 11px; color: var(--ink-faint); margin-top: 5px; }
.field-help .ti { vertical-align: -2px; color: #0F6E56; }
.firma-row { display: flex; gap: 12px; align-items: center; }
.firma-preview { flex: 1; min-height: 64px; border: 0.5px solid var(--line); border-radius: 10px; background: #FAFAF8; display: flex; align-items: center; justify-content: center; padding: 8px; overflow: hidden; }
.firma-preview img { max-width: 100%; max-height: 120px; height: auto; display: block; }
.firma-empty { font-size: 12px; color: var(--ink-faint); }
.firma-pick { white-space: nowrap; cursor: pointer; }

/* Subtítulo de sección dentro de un modal */
.modal-section { font-size: 12px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; margin: 18px 0 10px; padding-top: 14px; border-top: 0.5px solid var(--line); }

/* Modal más ancho (usuarios) + pestañas */
.modal.modal-wide { width: 607px; }
.modal-tabs { display: flex; gap: 4px; background: var(--surface-1, #F1EFE8); border-radius: 10px; padding: 4px; margin-bottom: 18px; }
.modal-tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; background: transparent; cursor: pointer; font-family: inherit; font-size: 13px; color: var(--ink-soft); padding: 8px; border-radius: 7px; }
.modal-tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); font-weight: 500; }
.modal-tab .ti { font-size: 16px; }

/* Usuario inactivo */
.row-inactivo td { opacity: 0.55; }
.badge-inactivo { display: inline-block; font-size: 10.5px; font-weight: 500; background: #F1EFE8; color: #5F5E5A; border-radius: 20px; padding: 1px 8px; margin-left: 6px; vertical-align: middle; }

/* Modal de confirmación / aviso */
.modal.modal-confirm { width: 420px; }
.modal-confirm .confirm-msg { font-size: 13.5px; color: var(--ink-soft); line-height: 1.6; margin: 6px 0 20px; }
.btn.btn-danger { background: #A32D2D; color: #fff; border: none; }
.btn.btn-danger:hover { background: #791F1F; }

/* Etapas del pipeline (config) */
.prob-badge { background: var(--accent-soft); color: #0F6E56; border-radius: 20px; padding: 2px 10px; font-weight: 500; font-size: 12px; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); margin: 6px 0 4px; cursor: pointer; }
.check-row input { margin: 0; }

/* Modal de intervención al mover de etapa */
.mov-chip { display: inline-flex; align-items: center; gap: 8px; background: #F3F1EB; border-radius: 20px; padding: 5px 12px; font-size: 12px; color: #444441; margin: 2px 0 6px; }
.mov-chip i { font-size: 14px; color: var(--accent); }
.mov-chip strong { color: #085041; }
.area-badge { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: #085041; border-radius: 8px; padding: 6px 10px; font-size: 12.5px; font-weight: 500; }
.area-badge i { font-size: 15px; }
.hint-row { display: flex; align-items: center; gap: 6px; color: #7A8190; font-size: 11.5px; margin-top: 4px; }
.hint-row i { font-size: 14px; }

/* Selector con botón de creación rápida (Nueva oportunidad) */
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn select, .input-with-btn input { flex: 1; min-width: 0; }
.inline-add { flex: 0 0 auto; display: grid; place-items: center; width: 38px; border: 1px solid var(--accent); color: var(--accent); background: #fff; border-radius: 8px; cursor: pointer; }
.inline-add:hover { background: var(--accent-soft); }
.inline-add i { font-size: 17px; }
.inline-add:disabled { opacity: .5; cursor: not-allowed; border-color: var(--line); color: var(--ink-faint); }

/* Tareas */
.tareas-badge { background: #FBE9E7; color: #A32D2D; border-radius: 20px; padding: 1px 9px; font-size: 11px; font-weight: 500; margin-left: 6px; vertical-align: 2px; }
.tarea-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: #FAF9F5; border: 1px solid #ECEAE3; border-radius: 10px; padding: 10px; margin-bottom: 12px; }
.tarea-add input[data-tt-titulo] { flex: 2; min-width: 150px; }
.tarea-add select, .tarea-add input[type="date"] { flex: 1; min-width: 120px; }
.tarea-list { display: flex; flex-direction: column; }
.tarea-item { display: flex; align-items: flex-start; gap: 10px; padding: 13px 15px; margin-bottom: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgba(27,34,48,.05); }
.tarea-item:last-child { margin-bottom: 0; }
.tarea-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
.tarea-grid .tarea-item { margin-bottom: 0; }
@media (max-width: 720px) { .tarea-grid { grid-template-columns: 1fr; } }
.tarea-item.done { opacity: .62; }
.tt-check { width: 18px; height: 18px; border: 1.5px solid #C9C5BA; border-radius: 5px; flex: 0 0 auto; margin-top: 1px; display: grid; place-items: center; cursor: pointer; }
.tt-check.done { background: var(--accent); border-color: var(--accent); }
.tt-check.done i { color: #fff; font-size: 12px; }
.tt-check.locked { cursor: not-allowed; opacity: .6; }
.tarea-main { flex: 1; min-width: 0; }
.tarea-titulo { font-size: 13px; color: var(--ink); font-weight: 500; }
.tarea-item.done .tarea-titulo { text-decoration: line-through; }
.tarea-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.asignado-chip { display: inline-flex; align-items: center; gap: 5px; background: #EEF1F6; color: #46506A; border-radius: 20px; padding: 2px 9px; font-size: 11px; }
.asignado-chip i { font-size: 13px; }
.tarea-fecha { color: var(--ink-soft); font-size: 11.5px; display: inline-flex; align-items: center; }
.tarea-fecha.vencida { color: #A32D2D; font-weight: 500; }
.tarea-fecha.vencida i { font-size: 14px; }
.tarea-del { color: #B6BAC2; font-size: 16px; cursor: pointer; margin-top: 2px; }
.tarea-del:hover { color: #A32D2D; }

/* Página Mis tareas */
.tareas-filtros { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.tareas-filtros select { min-width: 150px; }
.tarea-op { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }

/* Responsabilidad del contacto */
label .req { color: #A32D2D; }
.resp-tag { display: inline-block; border-radius: 20px; padding: 2px 9px; font-size: 11px; font-weight: 500; }
.resp-estrategico { background: #E1F0FB; color: #1D6FA5; }
.resp-operativo { background: #E6F0E8; color: #2E6B4F; }
.resp-administrativo { background: #F3EEDD; color: #8A6D1E; }

/* Chip de tipo de actividad */
.tipo-act { display: inline-flex; align-items: center; gap: 4px; border-radius: 20px; padding: 1px 8px; font-size: 10.5px; font-weight: 600; margin-right: 7px; vertical-align: 1px; }
.tipo-act i { font-size: 12px; }

/* Calendario */
.cal-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.cal-nav { display: flex; align-items: center; gap: 10px; }
.cal-mes { font-size: 16px; font-weight: 600; color: var(--ink); min-width: 130px; text-align: center; }
.cal-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cal-legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--ink-soft); flex-wrap: wrap; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend .dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid #ECEAE3; border-radius: 12px; overflow: hidden; background: #fff; }
.cal-dow { background: #FAF9F5; color: #9AA0AC; font-size: 11px; font-weight: 600; padding: 9px 10px; border-bottom: 1px solid #ECEAE3; }
.cal-cell { min-height: 92px; padding: 6px 7px; border-top: 1px solid #F0EEE8; border-left: 1px solid #F0EEE8; }
.cal-cell:nth-child(7n+1) { border-left: none; }
.cal-cell.empty { background: #FCFBF8; }
.cal-num { font-size: 12px; color: var(--ink-soft); margin-bottom: 4px; }
.cal-num.hoy { background: var(--accent); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; }
.cal-chip { font-size: 10.5px; border-radius: 5px; padding: 2px 6px; margin-bottom: 3px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip:hover { filter: brightness(0.96); }
.cal-chip i { font-size: 11px; }
@media (max-width: 720px) {
  .cal-cell { min-height: 64px; }
  .cal-chip { font-size: 9.5px; }
}

/* Requisitos de cierre */
.req-count { font-size: 12px; color: var(--ink-faint); font-weight: 400; }
.req-banner { display: flex; align-items: center; gap: 8px; border-radius: 9px; padding: 9px 12px; font-size: 12.5px; margin: 6px 0 12px; background: #F7EEDB; border: 1px solid #E9D9B0; color: #8A6D1E; }
.req-banner i { font-size: 16px; }
.req-banner.ok { background: #E6F0E8; border-color: #CDE6D5; color: #2E6B4F; }
.req-list { display: flex; flex-direction: column; }
.req-item { display: flex; align-items: flex-start; gap: 11px; padding: 11px 2px; border-top: 0.5px solid #F0EEE8; }
.req-box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid #C9C5BA; flex: 0 0 auto; margin-top: 1px; display: grid; place-items: center; }
.req-box.pend { border-style: dashed; }
.req-box.done { background: var(--accent); border-color: var(--accent); }
.req-box.done i { color: #fff; font-size: 13px; }
.req-box[data-req-toggle] { cursor: pointer; }
.req-box[data-req-toggle]:hover { border-color: var(--accent); }
.req-main { flex: 1; min-width: 0; }
.req-nombre { font-size: 13px; font-weight: 500; color: var(--ink); }
.req-sub { font-size: 11.5px; color: var(--ink-soft); margin-top: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.req-sub.falta { color: #B6361F; }

.area-pill { display: inline-block; background: #EEF1F6; color: #46506A; border-radius: 20px; padding: 1px 9px; font-size: 10.5px; font-weight: 500; }

.tarea-detalle { font-weight: 400; color: var(--ink-soft); }
.tarea-item.done .tarea-detalle { text-decoration: line-through; }

/* Editor de líneas de crédito en oportunidad */
.lineas-head { font-size: 13px; font-weight: 500; color: var(--ink); margin: 4px 0 8px; }
.lineas-rows { display: flex; flex-direction: column; gap: 8px; }
.linea-row { display: grid; grid-template-columns: 1.3fr 1fr auto; gap: 8px; align-items: center; }
.linea-row select, .linea-row input { width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--ink); outline: none; font: inherit; }
.linea-row select:focus, .linea-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.linea-row .ti-trash { color: #B6BAC2; font-size: 17px; cursor: pointer; }
.linea-row .ti-trash:hover { color: #A32D2D; }
.btn-linea-add { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 0.5px dashed var(--line-strong); color: var(--ink-soft); border-radius: 8px; padding: 7px 12px; font-size: 12.5px; margin-top: 8px; cursor: pointer; }
.btn-linea-add:hover { background: #F3F1EB; }
.btn-linea-add i { font-size: 14px; }
.lineas-total { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 0.5px solid var(--line); }
.lineas-total span:first-child { font-size: 13px; color: var(--ink-soft); }
.lineas-total span:last-child { font-size: 16px; font-weight: 600; color: var(--accent); }
.lineas-detalle { margin: -2px 0 4px; padding: 6px 0 2px; border-top: 0.5px dashed var(--line); }
.linea-det-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-soft); padding: 2px 0; }

/* Invitados a reunión */
.invitados-box { display: flex; flex-direction: column; gap: 8px; }
.invitados-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.invitados-chips:empty { display: none; }
.inv-chip { display: inline-flex; align-items: center; gap: 5px; background: #E1ECF6; color: #0C447C; font-size: 12px; padding: 3px 9px; border-radius: 20px; }
.inv-chip .ti-x { cursor: pointer; font-size: 12px; opacity: .7; }
.inv-chip .ti-x:hover { opacity: 1; }
/* Acciones por tarea */
.tarea-acciones { display: flex; gap: 10px; align-items: center; }
.tarea-edit { color: #B6BAC2; cursor: pointer; font-size: 16px; }
.tarea-edit:hover { color: var(--accent); }

/* Selector de tipo en "Nueva actividad" */
.tipo-actividad-btns { display: flex; gap: 8px; }
.tipo-actividad-btns .btn { flex: 1; justify-content: center; gap: 6px; }

/* Calendario: selector de vista */
.cal-vistas { display: inline-flex; border: 0.5px solid var(--line-strong); border-radius: 9px; overflow: hidden; }
.cal-vistas button { padding: 6px 14px; font-size: 13px; background: transparent; border: none; border-left: 0.5px solid var(--line); color: var(--ink-soft); cursor: pointer; }
.cal-vistas button:first-child { border-left: none; }
.cal-vistas button.active { background: var(--accent); color: #fff; font-weight: 500; }

/* Calendario: vista Semana (fila única tipo mes, celdas más altas) */
.cal-grid--semana .cal-cell--sem { min-height: 132px; }

/* Calendario: vista Día (barra de días arriba + lista debajo) */
.cal-dow.activo { background: var(--accent); color: #fff; }
.cal-dia-body { grid-column: 1 / -1; padding: 14px; }
.cal-dia-fecha { font-size: 13px; font-weight: 500; color: var(--ink); margin-bottom: 10px; }
.cal-dia-list { display: flex; flex-direction: column; gap: 8px; }
.cal-dia-row { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid #ECEAE3; border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.cal-dia-row:hover { background: #FAF9F5; }
.cal-dia-hora { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); width: 46px; flex: none; }
.cal-dia-row.venc .cal-dia-hora { color: #A32D2D; }
.cal-dia-tit { font-size: 13px; color: var(--ink); flex: 1; }
.cal-dia-vacio { color: var(--ink-faint); padding: 4px; }

/* Trazabilidad de actividad */
.traza-titulo { font-size: 13px; font-weight: 500; color: var(--ink); margin: 16px 0 10px; }
.traza { position: relative; padding-left: 22px; }
.traza::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.traza-row { position: relative; margin-bottom: 14px; }
.traza-row:last-child { margin-bottom: 0; }
.traza-dot { position: absolute; left: -22px; top: 2px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--surface); }
.traza-h { font-size: 12.5px; color: var(--ink); }
.traza-meta { font-size: 11.5px; color: var(--ink-faint); }
.traza-com { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

.tarea-ver { cursor: pointer; }
.tarea-ver:hover { text-decoration: underline; text-underline-offset: 2px; }

/* Cierre por líneas */
.cierre-lineas { display: flex; flex-direction: column; gap: 8px; margin: 4px 0; }
.cierre-linea { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 11px 13px; cursor: pointer; }
.cierre-linea:has(input:checked) { border-color: var(--accent); background: #F2FAF7; }
.cierre-linea-nom { flex: 1; font-size: 13.5px; color: var(--ink); }
.cierre-linea-val { font-size: 13.5px; font-weight: 600; color: var(--ink); }

/* Verificación en dos pasos (login) */
.twofa-hint { font-size: 12.5px; color: var(--ink-soft); margin: 0 0 10px; }
.twofa-qr { display: flex; justify-content: center; margin: 6px 0 10px; }
.twofa-qr img { width: 168px; height: 168px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 6px; }
.twofa-key { font-size: 11.5px; color: var(--ink-faint); text-align: center; margin: 0 0 12px; }
.twofa-key code { font-family: monospace; letter-spacing: 1px; color: var(--ink); background: var(--surface-1); border: 0.5px solid var(--line); padding: 2px 6px; border-radius: 5px; }
#twofaSetup input, #twofaVerify input { letter-spacing: 4px; text-align: center; font-size: 18px; }
