/* AppCRM design system — estilos centralizados */
:root {
  --brand: #0b3d5c;
  --brand-accent: #1a7a9c;
  --surface: #f4f7fa;
  --ink: #1c2b36;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --border: #e6ebf0;
  --border-strong: #d0d7de;
  --row-border: #eef2f5;
  --card-radius: 14px;
  --control-radius: 8px;
  --pill-radius: 999px;
  --shadow-card: 0 1px 2px rgba(28, 43, 54, 0.04), 0 8px 24px rgba(28, 43, 54, 0.04);
  --chip-general: #4a5563;
  --chip-history: #5b4b8a;
  --chip-tasks: #9a5b1a;
  --chip-ix: #1f6b4a;
  --modal-primary: #1a5f9e;
  --modal-primary-hover: #154d80;
  --modal-accent: #2a7a6e;
  --modal-link: #1a6bb5;
  --modal-radius: 16px;
  --modal-control-radius: 8px;
  --row-zebra: #f1f4f7;
  --row-hover: #d5dde6;
}

body {
  background: linear-gradient(160deg, #e8f1f6 0%, var(--surface) 45%, #ffffff 100%);
  color: var(--ink);
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* Embebido en BOLPortal: barra compacta solo con menú del módulo */
html.embed-mode body,
body.embed-mode {
  background: #fff;
  min-height: 0;
}
html.embed-mode #app-nav,
body.embed-mode #app-nav {
  display: block !important;
  position: sticky;
  top: 0;
  z-index: 20;
}
html.embed-mode .navbar-embed,
body.embed-mode .navbar-embed {
  display: flex !important;
  min-height: 0;
  padding: 0.25rem 0;
  margin-bottom: 0.5rem !important;
  border-radius: 0;
  background: #fff !important;
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}
html.embed-mode .navbar-embed .nav-link,
body.embed-mode .navbar-embed .nav-link {
  color: var(--brand) !important;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.55rem !important;
  border-radius: 0.4rem;
  white-space: nowrap;
}
html.embed-mode .navbar-embed .nav-link.active,
body.embed-mode .navbar-embed .nav-link.active {
  background: rgba(11, 61, 92, 0.08);
  text-decoration: none;
}
html.embed-mode .navbar-embed .nav-link:hover,
body.embed-mode .navbar-embed .nav-link:hover {
  background: rgba(11, 61, 92, 0.06);
}
html.embed-mode .container,
body.embed-mode .container {
  max-width: 100%;
  padding-top: 0.5rem;
}

/* —— Nav —— */
.navbar-appcrm {
  background: linear-gradient(90deg, var(--brand), var(--brand-accent));
}
.navbar-appcrm .navbar-brand,
.navbar-appcrm .nav-link,
.navbar-appcrm .navbar-text {
  color: #fff !important;
}
.navbar-user-btn {
  color: #fff !important;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border: none;
  box-shadow: none;
}
.navbar-user-btn:hover,
.navbar-user-btn:focus {
  color: #ffe566 !important;
}
.navbar-appcrm .dropdown-menu {
  border: none;
  box-shadow: 0 8px 24px rgba(11, 61, 92, 0.18);
  border-radius: 10px;
}
.navbar-appcrm .nav-link.active {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.navbar-tenant {
  display: inline-block;
  background: #ffe566;
  color: #0a2a3d !important;
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.2;
  letter-spacing: 0.01em;
  padding: 0.4rem 0.85rem;
  border-radius: 0.5rem;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.navbar-tenant-btn {
  cursor: pointer;
  appearance: none;
  max-width: 280px;
}
.navbar-tenant-btn::after {
  margin-left: 0.4rem;
  vertical-align: middle;
  border-top-color: #0a2a3d;
}
.lang-select {
  width: auto;
  min-width: 4.2rem;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.8);
  color: #0b3d5c;
  font-weight: 700;
}

/* —— Layout / títulos —— */
.page-title,
main > .d-flex > h1.h3,
main > h1.h3 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.25;
}
.page-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}
.page-toolbar .page-title {
  margin-bottom: 0;
  flex: 1 1 auto;
  min-width: 0;
}
.page-back {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--brand-accent);
  text-decoration: none;
  white-space: nowrap;
  align-self: center;
}
.page-back:hover {
  color: var(--brand);
  text-decoration: underline;
}
.page-note {
  color: var(--muted);
  font-size: 0.875rem;
}

/* —— Cards —— */
.card-soft,
.ds-card {
  background: #fff;
  border: 1px solid var(--border) !important;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-card);
}
.card-soft:has(.filters-bar) {
  overflow: visible;
}
.ds-card {
  padding: 1.15rem 1.25rem 1.25rem;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.ds-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.ds-stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-card);
  padding: 1.1rem 1.2rem;
  height: 100%;
}
.ds-stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.ds-stat-value {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.2;
}

/* —— Chips de sección —— */
.ds-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.45rem 0.75rem;
  border-radius: var(--pill-radius);
  border: 1px solid;
  background: #fff;
  margin-bottom: 1rem;
}
.ds-chip svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.ds-chip-general { color: var(--chip-general); border-color: var(--border-strong); }
.ds-chip-history { color: var(--chip-history); border-color: #d5cce8; background: #faf8ff; }
.ds-chip-tasks { color: var(--chip-tasks); border-color: #efd2a8; background: #fffaf3; }
.ds-chip-ix { color: var(--chip-ix); border-color: #b7e0cb; background: #f4fbf7; }
.ds-card-head .ds-chip { margin-bottom: 0; }

/* —— Campos etiqueta/valor —— */
.ds-field-row {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 0.5rem 1rem;
  align-items: start;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--row-border);
}
.ds-field-row:last-of-type { border-bottom: none; }
.ds-field-row > label {
  margin: 0;
  padding-top: 0.45rem;
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
}
.ds-contact-block { padding-top: 0.15rem; }
.ds-contact-block a {
  font-weight: 600;
  color: var(--brand-accent);
  text-decoration: none;
}
.ds-contact-block a:hover { text-decoration: underline; }
.ds-stage-footer {
  margin-top: auto;
  padding-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}
@media (max-width: 575.98px) {
  .ds-field-row { grid-template-columns: 1fr; gap: 0.25rem; }
  .ds-field-row > label { padding-top: 0; }
}

/* —— Controles —— */
.card-soft .form-control,
.card-soft .form-select,
.ds-card .form-control,
.ds-card .form-select,
.modal-content .form-control,
.modal-content .form-select {
  border-color: #e2e8f0;
  border-radius: var(--control-radius);
  font-size: 0.925rem;
}
.card-soft .form-control:focus,
.card-soft .form-select:focus,
.ds-card .form-control:focus,
.ds-card .form-select:focus,
.modal-content .form-control:focus,
.modal-content .form-select:focus {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 0.2rem rgba(26, 122, 156, 0.15);
}
.form-label.small.text-muted {
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* —— Botones —— */
.btn {
  border-radius: var(--pill-radius);
  font-weight: 600;
}
.btn-primary {
  background: var(--brand-accent);
  border-color: var(--brand-accent);
}
.btn-primary:hover,
.btn-primary:focus {
  background: var(--brand);
  border-color: var(--brand);
}
.btn-outline-primary {
  color: var(--brand-accent);
  border-color: rgba(26, 122, 156, 0.45);
}
.btn-outline-primary:hover {
  background: rgba(26, 122, 156, 0.08);
  color: var(--brand);
  border-color: var(--brand-accent);
}
.ds-save-btn,
.btn-save {
  background: var(--modal-primary) !important;
  border-color: var(--modal-primary) !important;
  color: #fff !important;
  border-radius: var(--modal-control-radius);
  padding: 0.5rem 1.25rem;
  font-weight: 600;
}
.ds-save-btn:hover,
.btn-save:hover {
  background: var(--modal-primary-hover) !important;
  border-color: var(--modal-primary-hover) !important;
  color: #fff !important;
}
.ds-ghost-btn,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--ink);
  border-radius: var(--pill-radius);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  text-decoration: none;
  line-height: 1.2;
}
.ds-ghost-btn:hover,
.btn-ghost:hover {
  background: #f8fafc;
  color: var(--ink);
  border-color: #b8c2cc;
}

/* —— Tablas / listados —— */
.card-soft .table,
.ds-table,
.table {
  margin-bottom: 0;
  font-size: 0.9rem;
}
.card-soft .table thead th,
.ds-table th,
.table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-2);
  font-weight: 600;
  border-bottom-color: var(--row-border);
  background: #fff;
  padding-top: 0.85rem;
  padding-bottom: 0.65rem;
}
.card-soft .table tbody td,
.ds-table td,
.table tbody td {
  border-bottom-color: var(--row-border);
  vertical-align: middle;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}
.card-soft .table tbody tr:last-child td,
.ds-table tbody tr:last-child td,
.table tbody tr:last-child td {
  border-bottom: none;
}

/* Zebra: filas impares en gris claro (todos los listados) */
.table > tbody > tr:nth-child(odd) > *,
.ds-table > tbody > tr:nth-child(odd) > * {
  --bs-table-bg-type: var(--row-zebra);
  background-color: var(--row-zebra);
}
.table > tbody > tr:nth-child(even) > *,
.ds-table > tbody > tr:nth-child(even) > * {
  --bs-table-bg-type: #fff;
  background-color: #fff;
}

/* Anular hover genérico de Bootstrap: solo filas interactivas */
.table-hover > tbody > tr:hover > * {
  --bs-table-color-state: inherit;
  --bs-table-bg-state: transparent;
  color: inherit;
  background-color: inherit;
}

/* Filas / ítems clicables */
.ds-row-click,
.task-row,
.ix-row,
.task-rel-row,
.ix-rel-row,
.ds-row-link {
  cursor: pointer;
}
.ds-row-click:hover > *,
.task-row:hover > *,
.ix-row:hover > *,
.task-rel-row:hover > *,
.ds-row-link:hover > *,
tr.ds-row-click:hover > td,
tr.task-row:hover > td,
tr.ix-row:hover > td,
tr.task-rel-row:hover > td,
tr.ds-row-link:hover > td {
  --bs-table-bg-state: var(--row-hover);
  background-color: var(--row-hover) !important;
}

.ds-empty,
.opp-empty {
  color: var(--muted-2);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

/* Listas (timeline / relacionadas) */
.ds-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ds-list > li {
  padding: 0.75rem 0.65rem;
  border-bottom: 1px solid var(--row-border);
  border-radius: 6px;
  margin-bottom: 2px;
}
.ds-list > li:last-child { border-bottom: none; }
.ds-list > li:nth-child(odd) {
  background-color: var(--row-zebra);
}
.ds-list > li:nth-child(even) {
  background-color: #fff;
}
.ds-list > li.ds-row-click,
.ds-list > li.ix-rel-row,
.ds-list > li[data-href] {
  cursor: pointer;
}
.ds-list > li.ds-row-click:hover,
.ds-list > li.ix-rel-row:hover,
.ds-list > li[data-href]:hover {
  background-color: var(--row-hover);
}
.ds-list-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
  margin-bottom: 0.2rem;
}
.ds-list-meta {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

/* Suggest lists (también listados interactivos) */
.person-suggest-list .person-suggest-item:nth-child(odd) {
  background-color: var(--row-zebra);
}
.person-suggest-list .person-suggest-item:hover {
  background-color: var(--row-hover) !important;
}
.ds-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.22rem 0.55rem;
  border-radius: var(--pill-radius);
  line-height: 1.2;
}
.ds-badge-done { background: #dcfce7; color: #166534; }
.ds-badge-open { background: #e0f2fe; color: #075985; }
.ds-badge-other { background: #f1f5f9; color: #475569; }
.ds-badge-warn { background: #fef3c7; color: #92400e; }

/* —— Timeline / listas —— */
.ds-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ds-timeline li {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--row-border);
}
.ds-timeline li:last-child { border-bottom: none; }
.ds-timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.ds-timeline-stage {
  font-weight: 700;
  color: var(--ink);
}
.ds-timeline-notes {
  font-size: 0.9rem;
  color: #334155;
  line-height: 1.45;
}
.ds-timeline li:nth-child(odd) {
  background-color: var(--row-zebra);
  border-radius: 6px;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
}

/* —— Filtros —— */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
  overflow: visible;
}
.filters-bar > .filter-field {
  flex: 1 1 0;
  min-width: 7.25rem;
}
.filters-bar > .filter-field-status {
  flex: 1.15 1 0;
  min-width: 8.5rem;
  position: relative;
  z-index: 5;
  overflow: visible;
}
.status-multi-toggle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
/* Flecha de combo nativa del form-select */
.status-multi-menu {
  --bs-dropdown-min-width: 12rem;
  z-index: 1080;
  padding: 0.35rem;
  max-height: min(18rem, 70vh);
  overflow-y: auto;
}
.status-multi-menu .form-check {
  padding: 0.4rem 0.65rem 0.4rem 2rem;
  margin: 0;
  border-radius: 0.35rem;
}
.status-multi-menu .form-check:hover {
  background: rgba(0, 0, 0, 0.04);
}
.status-multi-menu .form-check-label {
  cursor: pointer;
  width: 100%;
}
.filters-bar > .filter-field-person {
  flex: 1.5 1 0;
  min-width: 10rem;
}
.filters-bar > .filter-field-btn {
  flex: 0 0 auto;
  min-width: 5.5rem;
}

/* —— Autocomplete persona —— */
.person-suggest-wrap { position: relative; }
.person-suggest-list {
  position: absolute;
  z-index: 1060;
  left: 0;
  right: 0;
  top: 100%;
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid rgba(11, 61, 92, 0.2);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(11, 61, 92, 0.12);
  margin-top: 2px;
  padding: 0.25rem 0;
  display: none;
}
.person-suggest-list.show { display: block; }
.person-suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
}
.person-suggest-item:hover,
.person-suggest-item:focus {
  background: var(--row-hover);
  outline: none;
}
.person-suggest-item .meta {
  display: block;
  font-size: 0.75rem;
  color: #6c757d;
}
.person-suggest-empty {
  padding: 0.5rem 0.75rem;
  color: #6c757d;
  font-size: 0.85rem;
}

/* —— Filas clicables —— */
tr.task-row,
tr.ix-row,
.task-rel-row,
.ix-rel-row {
  cursor: pointer;
}
tr.task-row:hover,
tr.ix-row:hover {
  background: rgba(26, 122, 156, 0.06);
}

/* —— Modales de edición —— */
.modal-content {
  border: none;
  border-radius: var(--modal-radius);
  box-shadow: 0 18px 50px rgba(28, 43, 54, 0.18);
  overflow: hidden;
  background: #fff;
}
.modal-header {
  border-bottom: none;
  padding: 1.2rem 1.35rem 0.35rem;
  align-items: flex-start;
}
.modal-header .btn-close {
  margin: 0.15rem 0 0 auto;
  padding: 0.35rem;
  opacity: 0.45;
  box-shadow: none;
}
.modal-header .btn-close:hover { opacity: 0.75; }

/* Título tipo chip (diseño de edición) */
.modal-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.45rem 0.85rem;
  border-radius: var(--pill-radius);
  border: 1px solid #efd2a8;
  color: var(--chip-tasks);
  background: #fffaf3;
  letter-spacing: 0;
}
.modal-title::before {
  content: "";
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 1.5A1.5 1.5 0 0 0 2.5 3v10A1.5 1.5 0 0 0 4 14.5h8a1.5 1.5 0 0 0 1.5-1.5V3A1.5 1.5 0 0 0 12 1.5H4zm0 1h8a.5.5 0 0 1 .5.5v10a.5.5 0 0 1-.5.5H4a.5.5 0 0 1-.5-.5V3a.5.5 0 0 1 .5-.5zM5.5 5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1zm0 2.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1zm0 2.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 1.5A1.5 1.5 0 0 0 2.5 3v10A1.5 1.5 0 0 0 4 14.5h8a1.5 1.5 0 0 0 1.5-1.5V3A1.5 1.5 0 0 0 12 1.5H4zm0 1h8a.5.5 0 0 1 .5.5v10a.5.5 0 0 1-.5.5H4a.5.5 0 0 1-.5-.5V3a.5.5 0 0 1 .5-.5zM5.5 5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1zm0 2.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1zm0 2.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Variantes de chip por tipo de modal */
#ixModal .modal-title,
#interactionModal .modal-title {
  color: var(--chip-ix);
  border-color: #b7e0cb;
  background: #f4fbf7;
}
#personModal .modal-title,
#tenantModal .modal-title,
#importModal .modal-title {
  color: var(--chip-general);
  border-color: var(--border-strong);
  background: #fff;
}
#oppModal .modal-title,
#oppBulkModal .modal-title,
#stageNoteModal .modal-title {
  color: var(--brand-accent);
  border-color: #b7d7e4;
  background: #f3f9fc;
}

.modal-body {
  padding: 0.85rem 1.35rem 0.5rem;
}
.modal-body .mb-3 { margin-bottom: 1rem !important; }
.modal-body .form-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  margin-bottom: 0.35rem;
}
.modal-body .form-control,
.modal-body .form-select {
  border: 1px solid #d8dee6;
  border-radius: var(--modal-control-radius);
  padding: 0.55rem 0.75rem;
  font-size: 0.925rem;
  color: var(--ink);
  background: #fff;
  min-height: 2.45rem;
}
.modal-body textarea.form-control {
  min-height: auto;
  padding-top: 0.6rem;
}
.modal-body .form-control:focus,
.modal-body .form-select:focus {
  border-color: var(--modal-primary);
  box-shadow: 0 0 0 0.2rem rgba(26, 95, 158, 0.15);
}
.modal-body .ds-open-link,
.modal-body a.small.text-decoration-none {
  color: var(--modal-link);
  font-weight: 500;
  font-size: 0.85rem;
  text-decoration: none !important;
}
.modal-body .ds-open-link:hover,
.modal-body a.small.text-decoration-none:hover {
  color: var(--modal-primary-hover);
  text-decoration: underline !important;
}

.modal-footer {
  border-top: none;
  padding: 0.75rem 1.35rem 1.25rem;
  gap: 0.55rem;
  justify-content: flex-end;
}
.modal-footer .btn {
  border-radius: var(--modal-control-radius);
  font-weight: 600;
  padding: 0.5rem 1.1rem;
  min-height: 2.4rem;
}
.modal-footer .btn-primary {
  background: var(--modal-primary);
  border-color: var(--modal-primary);
  color: #fff;
}
.modal-footer .btn-primary:hover,
.modal-footer .btn-primary:focus {
  background: var(--modal-primary-hover);
  border-color: var(--modal-primary-hover);
  color: #fff;
}
.modal-footer .btn-outline-secondary {
  color: #64748b;
  border-color: #c9d1d9;
  background: #fff;
}
.modal-footer .btn-outline-secondary:hover {
  color: var(--ink);
  border-color: #a8b3bf;
  background: #f8fafc;
}
.modal-footer .btn-outline-success,
.modal-footer .btn-outline-info {
  color: var(--modal-accent);
  border-color: var(--modal-accent);
  background: #fff;
}
.modal-footer .btn-outline-success:hover,
.modal-footer .btn-outline-info:hover {
  color: #fff;
  background: var(--modal-accent);
  border-color: var(--modal-accent);
}
.modal-footer .btn-outline-danger {
  color: #b42318;
  border-color: #f0b4ae;
  background: #fff;
}
.modal-footer .btn-outline-danger:hover {
  color: #fff;
  background: #b42318;
  border-color: #b42318;
}

/* —— Login (sin cambios de concepto) —— */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(26, 122, 156, 0.25), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(11, 61, 92, 0.2), transparent 35%),
    linear-gradient(160deg, #0b3d5c, #1a7a9c 55%, #e8f1f6);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}
.login-brand {
  font-size: 2rem;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -0.02em;
}
.password-toggle-group .form-control {
  border-right: 0;
}
.password-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #5b6b7a;
  background: #fff;
  border-color: var(--bs-border-color, #dee2e6);
}
.password-toggle-btn:hover,
.password-toggle-btn:focus {
  color: var(--brand);
  background: #fff;
  border-color: var(--bs-border-color, #dee2e6);
}
.badge-role { font-size: 0.75rem; }
.toast-container { z-index: 1080; }

th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th.sortable:hover { color: var(--brand-accent); }
th.sortable::after {
  content: " ↕";
  opacity: 0.35;
  font-size: 0.75em;
}
th.sortable.sort-asc::after {
  content: " ▲";
  opacity: 0.9;
}
th.sortable.sort-desc::after {
  content: " ▼";
  opacity: 0.9;
}

.company-ac-wrap { position: relative; }
.company-ac-list {
  position: absolute;
  z-index: 1050;
  left: 0;
  right: 0;
  top: 100%;
  margin: 0.15rem 0 0;
  padding: 0.25rem 0;
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}
.company-ac-item {
  padding: 0.4rem 0.75rem;
  cursor: pointer;
}
.company-ac-item:hover,
.company-ac-item:focus {
  background: #e8f1f6;
}

.filter-progress {
  height: 4px;
  border-radius: 2px;
  background: rgba(11, 61, 92, 0.12);
  overflow: hidden;
}
.filter-progress-bar {
  height: 100%;
  width: 40%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand), var(--brand-accent));
  animation: filter-progress-slide 1.1s ease-in-out infinite;
}
@keyframes filter-progress-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

/* —— Kanban —— */
.kanban {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  align-items: flex-start;
}
.kanban-col {
  min-width: 260px;
  max-width: 280px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 0.75rem;
  box-shadow: var(--shadow-card);
  transition: min-width 0.2s ease, max-width 0.2s ease, padding 0.2s ease;
}
.kanban-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
}
.kanban-col-head h2 {
  font-size: 0.95rem;
  margin: 0;
  color: var(--brand);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  font-weight: 700;
}
.kanban-col-head h2 .stage-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kanban-collapse-btn {
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 1px solid rgba(11, 61, 92, 0.2);
  border-radius: 6px;
  background: #fff;
  color: var(--brand);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.kanban-collapse-btn:hover {
  background: #e8f1f6;
  border-color: var(--brand-accent);
}
.kanban-cards { min-height: 0.5rem; }
.kanban-card {
  background: #fff;
  border: 1px solid var(--row-border);
  border-radius: 10px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 8px rgba(11, 61, 92, 0.06);
  cursor: grab;
}
.kanban-card.dragging { opacity: 0.5; }
.kanban-col.drag-over { outline: 2px dashed var(--brand-accent); }
.kanban-col.is-collapsed {
  min-width: 52px;
  max-width: 52px;
  padding: 0.5rem 0.35rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.kanban-col.is-collapsed .kanban-col-expanded { display: none; }
.kanban-col:not(.is-collapsed) .kanban-col-collapsed { display: none; }
.kanban-rail {
  width: 40px;
  min-height: 120px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--brand), var(--brand-accent));
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  padding: 0.55rem 0.2rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(11, 61, 92, 0.18);
}
.kanban-rail:hover { filter: brightness(1.08); }
.kanban-rail-initials {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  line-height: 1.1;
}
.kanban-rail .badge { font-size: 0.65rem; }

/* Ficha oportunidad: ancho contenido */
.opp-detail-page { max-width: 1120px; }

/* Campos condicionales por canal (interacciones) */
.channel-field { display: none; }
.channel-field.is-visible { display: block; }
